2 * netsniff-ng - the packet sniffing beast
3 * Copyright 2009, 2010 Daniel Borkmann.
4 * Subject to the GPL, version 2.
14 extern void ring_rx_setup(struct ring
*ring
, int sock
, size_t size
, int ifindex
,
15 struct pollfd
*poll
, bool v3
, bool jumbo_support
,
16 bool verbose
, uint32_t fanout_group
, uint32_t fanout_type
);
17 extern void destroy_rx_ring(int sock
, struct ring
*ring
);
18 extern int get_rx_net_stats(int sock
, uint64_t *packets
, uint64_t *drops
, bool v3
);
20 static inline int user_may_pull_from_rx(struct tpacket2_hdr
*hdr
)
22 return ((hdr
->tp_status
& TP_STATUS_USER
) == TP_STATUS_USER
);
25 static inline void kernel_may_pull_from_rx(struct tpacket2_hdr
*hdr
)
27 hdr
->tp_status
= TP_STATUS_KERNEL
;
31 static inline int user_may_pull_from_rx_block(struct block_desc
*pbd
)
33 return ((pbd
->h1
.block_status
& TP_STATUS_USER
) == TP_STATUS_USER
);
36 static inline void kernel_may_pull_from_rx_block(struct block_desc
*pbd
)
38 pbd
->h1
.block_status
= TP_STATUS_KERNEL
;
40 #endif /* HAVE_TPACKET3 */
44 #ifndef PACKET_FANOUT_HASH
45 # define PACKET_FANOUT_HASH 0
48 #ifndef PACKET_FANOUT_LB
49 # define PACKET_FANOUT_LB 1
52 #ifndef PACKET_FANOUT_CPU
53 # define PACKET_FANOUT_CPU 2
56 #ifndef PACKET_FANOUT_ROLLOVER
57 # define PACKET_FANOUT_ROLLOVER 3
60 #ifndef PACKET_FANOUT_RND
61 # define PACKET_FANOUT_RND 4
64 #ifndef PACKET_FANOUT_QM
65 # define PACKET_FANOUT_QM 5
68 #ifndef PACKET_FANOUT_FLAG_ROLLOVER
69 # define PACKET_FANOUT_FLAG_ROLLOVER 0x1000
72 #ifndef PACKET_FANOUT_FLAG_DEFRAG
73 # define PACKET_FANOUT_FLAG_DEFRAG 0x8000
76 #endif /* RX_RING_H */