ct.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * netlink/netfilter/ct.h Conntrack
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation version 2.1
  7. * of the License.
  8. *
  9. * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
  10. * Copyright (c) 2007 Philip Craig <philipc@snapgear.com>
  11. * Copyright (c) 2007 Secure Computing Corporation
  12. */
  13. #ifndef NETLINK_CT_H_
  14. #define NETLINK_CT_H_
  15. #include <netlink/netlink.h>
  16. #include <netlink/addr.h>
  17. #include <netlink/cache.h>
  18. #include <netlink/msg.h>
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. struct nfnl_ct;
  23. extern struct nl_object_ops ct_obj_ops;
  24. extern struct nfnl_ct * nfnl_ct_alloc(void);
  25. extern int nfnl_ct_alloc_cache(struct nl_sock *, struct nl_cache **);
  26. extern int nfnlmsg_ct_group(struct nlmsghdr *);
  27. extern int nfnlmsg_ct_parse(struct nlmsghdr *, struct nfnl_ct **);
  28. extern void nfnl_ct_get(struct nfnl_ct *);
  29. extern void nfnl_ct_put(struct nfnl_ct *);
  30. extern int nfnl_ct_dump_request(struct nl_sock *);
  31. extern int nfnl_ct_build_add_request(const struct nfnl_ct *, int,
  32. struct nl_msg **);
  33. extern int nfnl_ct_add(struct nl_sock *, const struct nfnl_ct *, int);
  34. extern int nfnl_ct_build_delete_request(const struct nfnl_ct *, int,
  35. struct nl_msg **);
  36. extern int nfnl_ct_del(struct nl_sock *, const struct nfnl_ct *, int);
  37. extern int nfnl_ct_build_query_request(const struct nfnl_ct *, int,
  38. struct nl_msg **);
  39. extern int nfnl_ct_query(struct nl_sock *, const struct nfnl_ct *, int);
  40. extern void nfnl_ct_set_family(struct nfnl_ct *, uint8_t);
  41. extern uint8_t nfnl_ct_get_family(const struct nfnl_ct *);
  42. extern void nfnl_ct_set_proto(struct nfnl_ct *, uint8_t);
  43. extern int nfnl_ct_test_proto(const struct nfnl_ct *);
  44. extern uint8_t nfnl_ct_get_proto(const struct nfnl_ct *);
  45. extern void nfnl_ct_set_tcp_state(struct nfnl_ct *, uint8_t);
  46. extern int nfnl_ct_test_tcp_state(const struct nfnl_ct *);
  47. extern uint8_t nfnl_ct_get_tcp_state(const struct nfnl_ct *);
  48. extern char * nfnl_ct_tcp_state2str(uint8_t, char *, size_t);
  49. extern int nfnl_ct_str2tcp_state(const char *name);
  50. extern void nfnl_ct_set_status(struct nfnl_ct *, uint32_t);
  51. extern void nfnl_ct_unset_status(struct nfnl_ct *, uint32_t);
  52. extern uint32_t nfnl_ct_get_status(const struct nfnl_ct *);
  53. extern char * nfnl_ct_status2str(int, char *, size_t);
  54. extern int nfnl_ct_str2status(const char *);
  55. extern void nfnl_ct_set_timeout(struct nfnl_ct *, uint32_t);
  56. extern int nfnl_ct_test_timeout(const struct nfnl_ct *);
  57. extern uint32_t nfnl_ct_get_timeout(const struct nfnl_ct *);
  58. extern void nfnl_ct_set_mark(struct nfnl_ct *, uint32_t);
  59. extern int nfnl_ct_test_mark(const struct nfnl_ct *);
  60. extern uint32_t nfnl_ct_get_mark(const struct nfnl_ct *);
  61. extern void nfnl_ct_set_use(struct nfnl_ct *, uint32_t);
  62. extern int nfnl_ct_test_use(const struct nfnl_ct *);
  63. extern uint32_t nfnl_ct_get_use(const struct nfnl_ct *);
  64. extern void nfnl_ct_set_id(struct nfnl_ct *, uint32_t);
  65. extern int nfnl_ct_test_id(const struct nfnl_ct *);
  66. extern uint32_t nfnl_ct_get_id(const struct nfnl_ct *);
  67. extern int nfnl_ct_set_src(struct nfnl_ct *, int, struct nl_addr *);
  68. extern struct nl_addr * nfnl_ct_get_src(const struct nfnl_ct *, int);
  69. extern int nfnl_ct_set_dst(struct nfnl_ct *, int, struct nl_addr *);
  70. extern struct nl_addr * nfnl_ct_get_dst(const struct nfnl_ct *, int);
  71. extern void nfnl_ct_set_src_port(struct nfnl_ct *, int, uint16_t);
  72. extern int nfnl_ct_test_src_port(const struct nfnl_ct *, int);
  73. extern uint16_t nfnl_ct_get_src_port(const struct nfnl_ct *, int);
  74. extern void nfnl_ct_set_dst_port(struct nfnl_ct *, int, uint16_t);
  75. extern int nfnl_ct_test_dst_port(const struct nfnl_ct *, int);
  76. extern uint16_t nfnl_ct_get_dst_port(const struct nfnl_ct *, int);
  77. extern void nfnl_ct_set_icmp_id(struct nfnl_ct *, int, uint16_t);
  78. extern int nfnl_ct_test_icmp_id(const struct nfnl_ct *, int);
  79. extern uint16_t nfnl_ct_get_icmp_id(const struct nfnl_ct *, int);
  80. extern void nfnl_ct_set_icmp_type(struct nfnl_ct *, int, uint8_t);
  81. extern int nfnl_ct_test_icmp_type(const struct nfnl_ct *, int);
  82. extern uint8_t nfnl_ct_get_icmp_type(const struct nfnl_ct *, int);
  83. extern void nfnl_ct_set_icmp_code(struct nfnl_ct *, int, uint8_t);
  84. extern int nfnl_ct_test_icmp_code(const struct nfnl_ct *, int);
  85. extern uint8_t nfnl_ct_get_icmp_code(const struct nfnl_ct *, int);
  86. extern void nfnl_ct_set_packets(struct nfnl_ct *, int, uint64_t);
  87. extern int nfnl_ct_test_packets(const struct nfnl_ct *, int);
  88. extern uint64_t nfnl_ct_get_packets(const struct nfnl_ct *,int);
  89. extern void nfnl_ct_set_bytes(struct nfnl_ct *, int, uint64_t);
  90. extern int nfnl_ct_test_bytes(const struct nfnl_ct *, int);
  91. extern uint64_t nfnl_ct_get_bytes(const struct nfnl_ct *, int);
  92. #ifdef __cplusplus
  93. }
  94. #endif
  95. #endif