This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
stellar-stellar/infra/packet_io/packet_io.h

54 lines
1.3 KiB
C
Raw Normal View History

#pragma once
2024-04-21 11:30:41 +08:00
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdint.h>
#include "stellar/packet.h"
struct packet_io_stat
{
2024-04-10 17:50:51 +08:00
// device packet
2024-08-16 17:44:23 +08:00
uint64_t pkts_rx;
uint64_t bytes_rx;
2024-08-16 17:44:23 +08:00
uint64_t pkts_tx;
uint64_t bytes_tx;
2024-04-10 17:50:51 +08:00
// keep-alive packet
uint64_t keep_alive_pkts;
uint64_t keep_alive_bytes;
// drop packet
2024-08-16 17:44:23 +08:00
uint64_t pkts_dropped;
uint64_t bytes_dropped;
// inject packet
2024-08-16 17:44:23 +08:00
uint64_t pkts_injected;
uint64_t bytes_injected;
// user freed
uint64_t pkts_user_freed;
uint64_t bytes_user_freed;
} __attribute__((aligned(64)));
struct packet_io;
2024-09-20 18:41:07 +08:00
struct packet_io *packet_io_new(const char *toml_file);
void packet_io_free(struct packet_io *pkt_io);
int packet_io_isbreak(struct packet_io *pkt_io);
int packet_io_init(struct packet_io *pkt_io, uint16_t thr_idx);
int packet_io_recv(struct packet_io *pkt_io, uint16_t thr_idx, struct packet *pkts[], int nr_pkts);
void packet_io_send(struct packet_io *pkt_io, uint16_t thr_idx, struct packet *pkts[], int nr_pkts);
void packet_io_drop(struct packet_io *pkt_io, uint16_t thr_idx, struct packet *pkts[], int nr_pkts);
void packet_io_yield(struct packet_io *pkt_io, uint16_t thr_idx);
void packet_io_polling(struct packet_io *pkt_io, uint16_t thr_idx);
struct packet_io_stat *packet_io_stat(struct packet_io *pkt_io, uint16_t thr_idx);
2024-04-21 11:30:41 +08:00
#ifdef __cplusplus
}
#endif