trafgen: parser: do not enforce whitesapce
[netsniff-ng.git] / ring_tx.h
blob797004559a74a8768ef181b01e867f886fd0d471
1 /*
2 * netsniff-ng - the packet sniffing beast
3 * Copyright 2009, 2010 Daniel Borkmann.
4 * Subject to the GPL, version 2.
5 */
7 #ifndef TX_RING_H
8 #define TX_RING_H
10 #include "ring.h"
11 #include "built_in.h"
13 /* Give userland 10 us time to push packets to the ring */
14 #define TX_KERNEL_PULL_INT 10
16 extern void destroy_tx_ring(int sock, struct ring *ring);
17 extern void create_tx_ring(int sock, struct ring *ring, int verbose);
18 extern void mmap_tx_ring(int sock, struct ring *ring);
19 extern void alloc_tx_ring_frames(struct ring *ring);
20 extern void bind_tx_ring(int sock, struct ring *ring, int ifindex);
21 extern void setup_tx_ring_layout(int sock, struct ring *ring,
22 unsigned int size, int jumbo_support);
23 extern void set_packet_loss_discard(int sock);
25 static inline int user_may_pull_from_tx(struct tpacket2_hdr *hdr)
27 return ((hdr->tp_status & TP_STATUS_AVAILABLE) == TP_STATUS_AVAILABLE);
30 static inline void kernel_may_pull_from_tx(struct tpacket2_hdr *hdr)
32 hdr->tp_status = TP_STATUS_SEND_REQUEST;
35 static inline int pull_and_flush_tx_ring(int sock)
37 return sendto(sock, NULL, 0, MSG_DONTWAIT, NULL, 0);
40 #endif /* TX_RING_H */