109 typedef signed __int8 int8_t;
110 typedef signed __int16 int16_t;
111 typedef signed __int32 int32_t;
112 typedef signed __int64 int64_t;
113 typedef unsigned __int8 uint8_t;
114 typedef unsigned __int16 uint16_t;
115 typedef unsigned __int32 uint32_t;
116 typedef unsigned __int64 uint64_t;
118 typedef unsigned __int32 uintptr_t;
120 typedef unsigned __int64 uintptr_t;
136 # define SNF_FUNC(type) type
137 # define SNF_VAR(type) type
139 # ifdef SNF_BUILDING_LIB
141 # define SNF_FUNC(type) extern "C" __declspec(dllexport) type __cdecl
142 # define SNF_VAR(type) extern "C" __declspec(dllexport) type
144 # define SNF_FUNC(type) __declspec(dllexport) type __cdecl
145 # define SNF_VAR(type) __declspec(dllexport) type
149 # define SNF_FUNC(type) extern "C" __declspec(dllimport) type __cdecl
150 # define SNF_VAR(type) extern "C" __declspec(dllimport) type
152 # define SNF_FUNC(type) __declspec(dllimport) type __cdecl
153 # define SNF_VAR(type) __declspec(dllimport) type
339 #define SNF_VERSION_API 8
359 SNF_FUNC(
int)
snf_init(uint16_t api_version);
416 #define snf_ifa_boardnum snf_ifa_portnum
512 #define SNF_RSS_IPV4 SNF_RSS_IP
520 struct snf_rss_mode_function {
575 int (*rss_hash_fn)(
struct snf_recv_req *r,
void *context,
633 #define SNF_F_PSHARED 0x1
644 #define SNF_F_AGGREGATE_PORTMASK 0x2
657 #define SNF_F_RX_DUPLICATE 0x300
724 SNF_FUNC(
int)
snf_open(uint32_t portnum,
922 uint32_t length_data;
968 uintptr_t q_borrowed;
1037 struct
snf_recv_req *req_vector,
int nreq_in,
int *nreq_out,
1038 struct snf_ring_qinfo *qinfo);
1099 struct snf_ring_qinfo *qinfo);
1107 uint64_t nic_pkt_recv;
1108 uint64_t nic_pkt_overflow;
1109 uint64_t nic_pkt_bad;
1110 uint64_t ring_pkt_recv;
1111 uint64_t ring_pkt_overflow;
1112 uint64_t nic_bytes_recv;
1116 uint64_t snf_pkt_overflow;
1118 uint64_t nic_pkt_dropped;
1170 SNF_FUNC(
int)
snf_inject_open(
int portnum,
int flags, snf_inject_t *handle);
1229 SNF_FUNC(
int)
snf_inject_send(snf_inject_t inj,
int timeout_ms,
int flags,
1230 const
void *pkt, uint32_t length);
1279 SNF_FUNC(
int)
snf_inject_sched(snf_inject_t inj,
int timeout_ms,
int flags,
1280 const
void *pkt, uint32_t length, uint64_t delay_ns);
1363 uint32_t length_hint);
1443 uint32_t length_hint, uint64_t delay_ns);
1466 uint64_t inj_pkt_send;
1467 uint64_t nic_pkt_send;
1468 uint64_t nic_bytes_send;
1535 SNF_FUNC(
int)
snf_netdev_reflect(snf_netdev_reflect_t ref_dev, const
void *pkt, uint32_t length);
int snf_get_timesource_state(snf_handle_t devhandle, enum snf_timesource_state *state)
void snf_freeifaddrs(struct snf_ifaddrs *ifaddrs)
int snf_inject_send(snf_inject_t inj, int timeout_ms, int flags, const void *pkt, uint32_t length)
Send a packet and optionally block until send resources are available.
const char * snf_ifa_name
Definition: snf.h:414
int snf_getifaddrs(struct snf_ifaddrs **ifaddrs_o)
int snf_ring_return_many(snf_ring_t ring, uint32_t data_qlen, struct snf_ring_qinfo *qinfo)
Return packet space to receive ring.
uint64_t snf_ifa_link_speed
Definition: snf.h:423
int snf_get_injection_speed(snf_inject_t devhandle, uint64_t *speed)
uint8_t snf_ifa_macaddr[6]
Definition: snf.h:418
struct snf_inject_handle * snf_inject_t
Definition: snf.h:1151
int snf_open(uint32_t portnum, int num_rings, const struct snf_rss_params *rss_params, int64_t dataring_sz, int flags, snf_handle_t *devhandle)
Open device for single or multi-ring operation.
uintptr_t data_size
Definition: snf.h:980
enum snf_link_state snf_ifa_link_state
Definition: snf.h:421
int snf_getportmask_linkup(uint32_t *mask_o, int *cnt_o)
int snf_netdev_reflect(snf_netdev_reflect_t ref_dev, const void *pkt, uint32_t length)
Reflect a packet to the network device.
int snf_ring_close(snf_ring_t ringh)
int snf_netdev_reflect_enable(snf_handle_t hsnf, snf_netdev_reflect_t *handle)
Enable a network device for packet reflection.
uint32_t portcnt
Definition: snf.h:977
int snf_ring_portinfo_count(snf_ring_t ring, int *count)
For aggregated rings, return the number of physical subrings. If the ring is not aggregated, the count is set to 1.
int snf_stop(snf_handle_t devhandle)
uint8_t pad[2]
Definition: snf.h:419
snf_timesource_state
Definition: snf.h:400
int snf_close(snf_handle_t devhandle)
Close port.
int snf_ring_getstats(snf_ring_t ringh, struct snf_ring_stats *stats)
Get statistics from a receive ring.
int snf_open_defaults(uint32_t portnum, snf_handle_t *devhandle)
Open device for single or multi-ring operation.
int snf_inject_sched(snf_inject_t inj, int timeout_ms, int flags, const void *pkt, uint32_t length, uint64_t delay_ns)
Send a packet with hardware delay and optionally block until send resources are available.
int snf_ifa_maxrings
Definition: snf.h:417
int snf_get_link_state(snf_handle_t devhandle, enum snf_link_state *state)
uintptr_t data_addr
Definition: snf.h:979
uint32_t snf_ifa_portnum
Definition: snf.h:415
uint32_t portmask
Definition: snf.h:978
int snf_init(uint16_t api_version)
Initialize Sniffer Library with api_version == SNF_VERSION_API.
int snf_inject_open(int portnum, int flags, snf_inject_t *handle)
Open a port for injection and allocate an injection handle.
struct snf_ring * snf_ring_t
opaque snf ring handle
Definition: snf.h:849
int snf_getportmask_valid(uint32_t *mask_o, int *cnt_o)
int snf_inject_close(snf_inject_t inj)
Close injection handle.
struct snf_ifaddrs * snf_ifa_next
Definition: snf.h:413
struct snf_handle * snf_handle_t
opaque snf device handle
Definition: snf.h:345
int snf_get_link_speed(snf_handle_t devhandle, uint64_t *speed)
int snf_inject_send_v(snf_inject_t inj, int timeout_ms, int flags, struct snf_pkt_fragment *frags_vec, int nfrags, uint32_t length_hint)
Send a packet assembled from a vector of fragments and optionally block until send resources are avai...
int snf_start(snf_handle_t devhandle)
snf_ring_t ring
Definition: snf.h:975
snf_link_state
Definition: snf.h:394
int snf_ring_recv(snf_ring_t ringh, int timeout_ms, struct snf_recv_req *recv_req)
Receive next packet from a receive ring.
int snf_ring_recv_qinfo(snf_ring_t ring, struct snf_ring_qinfo *)
Return queue information from ring.
void * snf_netdev_reflect_t
Definition: snf.h:1507
uintptr_t q_size
Definition: snf.h:976
int snf_inject_getstats(snf_inject_t inj, struct snf_inject_stats *stats)
Get statistics from an injection handle.
int snf_ring_open(snf_handle_t devhandle, snf_ring_t *ringh)
int snf_ifa_maxinject
Definition: snf.h:420
int snf_ring_recv_many(snf_ring_t ring, int timeout_ms, struct snf_recv_req *req_vector, int nreq_in, int *nreq_out, struct snf_ring_qinfo *qinfo)
Receive and borrow many packets at once.
int snf_ring_open_id(snf_handle_t devhandle, int ring_id, snf_ring_t *ringh)
Fragment for snf_inject_send_v.
Definition: snf.h:1286
int snf_set_app_id(int32_t id)
Set the application ID.
int snf_inject_sched_v(snf_inject_t inj, int timeout_ms, int flags, struct snf_pkt_fragment *frags_vec, int nfrags, uint32_t length_hint, uint64_t delay_ns)
Send a packet assembled from a vector of fragments at a scheduled point relative to the start of the ...