Harald Welte | 7af4cc3 | 2005-08-09 19:44:15 -0700 | [diff] [blame] | 1 | #ifndef _NFNETLINK_QUEUE_H |
| 2 | #define _NFNETLINK_QUEUE_H |
| 3 | |
Harald Welte | 0ba2c6e | 2005-08-13 13:55:44 -0700 | [diff] [blame] | 4 | #include <linux/types.h> |
Harald Welte | 7af4cc3 | 2005-08-09 19:44:15 -0700 | [diff] [blame] | 5 | #include <linux/netfilter/nfnetlink.h> |
| 6 | |
| 7 | enum nfqnl_msg_types { |
| 8 | NFQNL_MSG_PACKET, /* packet from kernel to userspace */ |
| 9 | NFQNL_MSG_VERDICT, /* verdict from userspace to kernel */ |
| 10 | NFQNL_MSG_CONFIG, /* connect to a particular queue */ |
Florian Westphal | 97d32cf | 2011-07-19 11:46:33 +0200 | [diff] [blame] | 11 | NFQNL_MSG_VERDICT_BATCH, /* batchv from userspace to kernel */ |
Harald Welte | 7af4cc3 | 2005-08-09 19:44:15 -0700 | [diff] [blame] | 12 | |
| 13 | NFQNL_MSG_MAX |
| 14 | }; |
| 15 | |
| 16 | struct nfqnl_msg_packet_hdr { |
Al Viro | 98a4a86 | 2006-11-08 00:26:51 -0800 | [diff] [blame] | 17 | __be32 packet_id; /* unique ID of packet in queue */ |
| 18 | __be16 hw_protocol; /* hw protocol (network order) */ |
Arnd Bergmann | 60c195c | 2009-02-26 00:51:43 +0100 | [diff] [blame] | 19 | __u8 hook; /* netfilter hook */ |
Harald Welte | 7af4cc3 | 2005-08-09 19:44:15 -0700 | [diff] [blame] | 20 | } __attribute__ ((packed)); |
| 21 | |
| 22 | struct nfqnl_msg_packet_hw { |
Al Viro | 98a4a86 | 2006-11-08 00:26:51 -0800 | [diff] [blame] | 23 | __be16 hw_addrlen; |
Arnd Bergmann | 60c195c | 2009-02-26 00:51:43 +0100 | [diff] [blame] | 24 | __u16 _pad; |
| 25 | __u8 hw_addr[8]; |
Patrick McHardy | 53e2665 | 2006-08-22 00:43:20 -0700 | [diff] [blame] | 26 | }; |
Harald Welte | 7af4cc3 | 2005-08-09 19:44:15 -0700 | [diff] [blame] | 27 | |
| 28 | struct nfqnl_msg_packet_timestamp { |
Mike Frysinger | b51bdad | 2011-03-18 08:50:37 +0000 | [diff] [blame] | 29 | __aligned_be64 sec; |
| 30 | __aligned_be64 usec; |
Patrick McHardy | 53e2665 | 2006-08-22 00:43:20 -0700 | [diff] [blame] | 31 | }; |
Harald Welte | 7af4cc3 | 2005-08-09 19:44:15 -0700 | [diff] [blame] | 32 | |
| 33 | enum nfqnl_attr_type { |
| 34 | NFQA_UNSPEC, |
| 35 | NFQA_PACKET_HDR, |
| 36 | NFQA_VERDICT_HDR, /* nfqnl_msg_verdict_hrd */ |
Arnd Bergmann | 60c195c | 2009-02-26 00:51:43 +0100 | [diff] [blame] | 37 | NFQA_MARK, /* __u32 nfmark */ |
Harald Welte | 7af4cc3 | 2005-08-09 19:44:15 -0700 | [diff] [blame] | 38 | NFQA_TIMESTAMP, /* nfqnl_msg_packet_timestamp */ |
Arnd Bergmann | 60c195c | 2009-02-26 00:51:43 +0100 | [diff] [blame] | 39 | NFQA_IFINDEX_INDEV, /* __u32 ifindex */ |
| 40 | NFQA_IFINDEX_OUTDEV, /* __u32 ifindex */ |
| 41 | NFQA_IFINDEX_PHYSINDEV, /* __u32 ifindex */ |
| 42 | NFQA_IFINDEX_PHYSOUTDEV, /* __u32 ifindex */ |
Harald Welte | 7af4cc3 | 2005-08-09 19:44:15 -0700 | [diff] [blame] | 43 | NFQA_HWADDR, /* nfqnl_msg_packet_hw */ |
| 44 | NFQA_PAYLOAD, /* opaque data payload */ |
| 45 | |
| 46 | __NFQA_MAX |
| 47 | }; |
| 48 | #define NFQA_MAX (__NFQA_MAX - 1) |
| 49 | |
| 50 | struct nfqnl_msg_verdict_hdr { |
Al Viro | 98a4a86 | 2006-11-08 00:26:51 -0800 | [diff] [blame] | 51 | __be32 verdict; |
| 52 | __be32 id; |
Patrick McHardy | 53e2665 | 2006-08-22 00:43:20 -0700 | [diff] [blame] | 53 | }; |
Harald Welte | 7af4cc3 | 2005-08-09 19:44:15 -0700 | [diff] [blame] | 54 | |
| 55 | |
| 56 | enum nfqnl_msg_config_cmds { |
| 57 | NFQNL_CFG_CMD_NONE, |
| 58 | NFQNL_CFG_CMD_BIND, |
| 59 | NFQNL_CFG_CMD_UNBIND, |
| 60 | NFQNL_CFG_CMD_PF_BIND, |
| 61 | NFQNL_CFG_CMD_PF_UNBIND, |
| 62 | }; |
| 63 | |
| 64 | struct nfqnl_msg_config_cmd { |
Arnd Bergmann | 60c195c | 2009-02-26 00:51:43 +0100 | [diff] [blame] | 65 | __u8 command; /* nfqnl_msg_config_cmds */ |
| 66 | __u8 _pad; |
Al Viro | 98a4a86 | 2006-11-08 00:26:51 -0800 | [diff] [blame] | 67 | __be16 pf; /* AF_xxx for PF_[UN]BIND */ |
Patrick McHardy | 53e2665 | 2006-08-22 00:43:20 -0700 | [diff] [blame] | 68 | }; |
Harald Welte | 7af4cc3 | 2005-08-09 19:44:15 -0700 | [diff] [blame] | 69 | |
| 70 | enum nfqnl_config_mode { |
| 71 | NFQNL_COPY_NONE, |
| 72 | NFQNL_COPY_META, |
| 73 | NFQNL_COPY_PACKET, |
| 74 | }; |
| 75 | |
| 76 | struct nfqnl_msg_config_params { |
Al Viro | 98a4a86 | 2006-11-08 00:26:51 -0800 | [diff] [blame] | 77 | __be32 copy_range; |
Arnd Bergmann | 60c195c | 2009-02-26 00:51:43 +0100 | [diff] [blame] | 78 | __u8 copy_mode; /* enum nfqnl_config_mode */ |
Harald Welte | 7af4cc3 | 2005-08-09 19:44:15 -0700 | [diff] [blame] | 79 | } __attribute__ ((packed)); |
| 80 | |
| 81 | |
| 82 | enum nfqnl_attr_config { |
| 83 | NFQA_CFG_UNSPEC, |
| 84 | NFQA_CFG_CMD, /* nfqnl_msg_config_cmd */ |
| 85 | NFQA_CFG_PARAMS, /* nfqnl_msg_config_params */ |
Arnd Bergmann | 60c195c | 2009-02-26 00:51:43 +0100 | [diff] [blame] | 86 | NFQA_CFG_QUEUE_MAXLEN, /* __u32 */ |
Harald Welte | 7af4cc3 | 2005-08-09 19:44:15 -0700 | [diff] [blame] | 87 | __NFQA_CFG_MAX |
| 88 | }; |
Harald Welte | 838ab63 | 2005-08-09 19:50:45 -0700 | [diff] [blame] | 89 | #define NFQA_CFG_MAX (__NFQA_CFG_MAX-1) |
Harald Welte | 7af4cc3 | 2005-08-09 19:44:15 -0700 | [diff] [blame] | 90 | |
| 91 | #endif /* _NFNETLINK_QUEUE_H */ |