1 #ifndef _NFNETLINK_QUEUE_H 2 #define _NFNETLINK_QUEUE_H 3 4 #include <linux/types.h> 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 */ 11 12 NFQNL_MSG_MAX 13 }; 14 15 struct nfqnl_msg_packet_hdr { 16 __be32 packet_id; /* unique ID of packet in queue */ 17 __be16 hw_protocol; /* hw protocol (network order) */ 18 __u8 hook; /* netfilter hook */ 19 } __attribute__ ((packed)); 20 21 struct nfqnl_msg_packet_hw { 22 __be16 hw_addrlen; 23 __u16 _pad; 24 __u8 hw_addr[8]; 25 }; 26 27 struct nfqnl_msg_packet_timestamp { 28 __aligned_be64 sec; 29 __aligned_be64 usec; 30 }; 31 32 enum nfqnl_attr_type { 33 NFQA_UNSPEC, 34 NFQA_PACKET_HDR, 35 NFQA_VERDICT_HDR, /* nfqnl_msg_verdict_hrd */ 36 NFQA_MARK, /* __u32 nfmark */ 37 NFQA_TIMESTAMP, /* nfqnl_msg_packet_timestamp */ 38 NFQA_IFINDEX_INDEV, /* __u32 ifindex */ 39 NFQA_IFINDEX_OUTDEV, /* __u32 ifindex */ 40 NFQA_IFINDEX_PHYSINDEV, /* __u32 ifindex */ 41 NFQA_IFINDEX_PHYSOUTDEV, /* __u32 ifindex */ 42 NFQA_HWADDR, /* nfqnl_msg_packet_hw */ 43 NFQA_PAYLOAD, /* opaque data payload */ 44 45 __NFQA_MAX 46 }; 47 #define NFQA_MAX (__NFQA_MAX - 1) 48 49 struct nfqnl_msg_verdict_hdr { 50 __be32 verdict; 51 __be32 id; 52 }; 53 54 55 enum nfqnl_msg_config_cmds { 56 NFQNL_CFG_CMD_NONE, 57 NFQNL_CFG_CMD_BIND, 58 NFQNL_CFG_CMD_UNBIND, 59 NFQNL_CFG_CMD_PF_BIND, 60 NFQNL_CFG_CMD_PF_UNBIND, 61 }; 62 63 struct nfqnl_msg_config_cmd { 64 __u8 command; /* nfqnl_msg_config_cmds */ 65 __u8 _pad; 66 __be16 pf; /* AF_xxx for PF_[UN]BIND */ 67 }; 68 69 enum nfqnl_config_mode { 70 NFQNL_COPY_NONE, 71 NFQNL_COPY_META, 72 NFQNL_COPY_PACKET, 73 }; 74 75 struct nfqnl_msg_config_params { 76 __be32 copy_range; 77 __u8 copy_mode; /* enum nfqnl_config_mode */ 78 } __attribute__ ((packed)); 79 80 81 enum nfqnl_attr_config { 82 NFQA_CFG_UNSPEC, 83 NFQA_CFG_CMD, /* nfqnl_msg_config_cmd */ 84 NFQA_CFG_PARAMS, /* nfqnl_msg_config_params */ 85 NFQA_CFG_QUEUE_MAXLEN, /* __u32 */ 86 __NFQA_CFG_MAX 87 }; 88 #define NFQA_CFG_MAX (__NFQA_CFG_MAX-1) 89 90 #endif /* _NFNETLINK_QUEUE_H */ 91