nfnetlink_queue.h
上传用户:szlgq88
上传日期:2009-04-28
资源大小:48287k
文件大小:2k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

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