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