1/****************************************************************************
2 ****************************************************************************
3 ***
4 ***   This header was automatically generated from a Linux kernel header
5 ***   of the same name, to make information necessary for userspace to
6 ***   call into the kernel available to libc.  It contains only constants,
7 ***   structures, and macros generated from the original header, and thus,
8 ***   contains no copyrightable information.
9 ***
10 ****************************************************************************
11 ****************************************************************************/
12#ifndef __LINUX_IF_PACKET_H
13#define __LINUX_IF_PACKET_H
14
15struct sockaddr_pkt
16{
17 unsigned short spkt_family;
18 unsigned char spkt_device[14];
19 unsigned short spkt_protocol;
20};
21
22struct sockaddr_ll
23{
24 unsigned short sll_family;
25 unsigned short sll_protocol;
26 int sll_ifindex;
27 unsigned short sll_hatype;
28 unsigned char sll_pkttype;
29 unsigned char sll_halen;
30 unsigned char sll_addr[8];
31};
32
33#define PACKET_HOST 0
34#define PACKET_BROADCAST 1
35#define PACKET_MULTICAST 2
36#define PACKET_OTHERHOST 3
37#define PACKET_OUTGOING 4
38
39#define PACKET_LOOPBACK 5
40#define PACKET_FASTROUTE 6
41
42#define PACKET_ADD_MEMBERSHIP 1
43#define PACKET_DROP_MEMBERSHIP 2
44#define PACKET_RECV_OUTPUT 3
45
46#define PACKET_RX_RING 5
47#define PACKET_STATISTICS 6
48#define PACKET_COPY_THRESH 7
49
50struct tpacket_stats
51{
52 unsigned int tp_packets;
53 unsigned int tp_drops;
54};
55
56struct tpacket_hdr
57{
58 unsigned long tp_status;
59#define TP_STATUS_KERNEL 0
60#define TP_STATUS_USER 1
61#define TP_STATUS_COPY 2
62#define TP_STATUS_LOSING 4
63#define TP_STATUS_CSUMNOTREADY 8
64 unsigned int tp_len;
65 unsigned int tp_snaplen;
66 unsigned short tp_mac;
67 unsigned short tp_net;
68 unsigned int tp_sec;
69 unsigned int tp_usec;
70};
71
72#define TPACKET_ALIGNMENT 16
73#define TPACKET_ALIGN(x) (((x)+TPACKET_ALIGNMENT-1)&~(TPACKET_ALIGNMENT-1))
74#define TPACKET_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll))
75
76struct tpacket_req
77{
78 unsigned int tp_block_size;
79 unsigned int tp_block_nr;
80 unsigned int tp_frame_size;
81 unsigned int tp_frame_nr;
82};
83
84struct packet_mreq
85{
86 int mr_ifindex;
87 unsigned short mr_type;
88 unsigned short mr_alen;
89 unsigned char mr_address[8];
90};
91
92#define PACKET_MR_MULTICAST 0
93#define PACKET_MR_PROMISC 1
94#define PACKET_MR_ALLMULTI 2
95
96#endif
97