libnetfilter_cttimeout
1.0.0
|
00001 #ifndef _LIBNETFILTER_CTTIMEOUT_H_ 00002 #define _LIBNETFILTER_CTTIMEOUT_H_ 00003 00004 #include <stdint.h> 00005 #include <sys/types.h> 00006 #include <linux/netfilter/nfnetlink_conntrack.h> 00007 00008 #ifdef __cplusplus 00009 extern "C" { 00010 #endif 00011 00012 struct nfct_timeout; 00013 00014 struct nfct_timeout *nfct_timeout_alloc(void); 00015 void nfct_timeout_free(struct nfct_timeout *); 00016 00017 enum nfct_timeout_attr { 00018 NFCT_TIMEOUT_ATTR_NAME= 0, 00019 NFCT_TIMEOUT_ATTR_L3PROTO, 00020 NFCT_TIMEOUT_ATTR_L4PROTO, 00021 NFCT_TIMEOUT_ATTR_POLICY, 00022 NFCT_TIMEOUT_ATTR_MAX 00023 }; 00024 00025 enum nfct_timeout_tcp_attr { 00026 NFCT_TIMEOUT_ATTR_TCP_SYN_SENT = 0, 00027 NFCT_TIMEOUT_ATTR_TCP_SYN_RECV, 00028 NFCT_TIMEOUT_ATTR_TCP_ESTABLISHED, 00029 NFCT_TIMEOUT_ATTR_TCP_FIN_WAIT, 00030 NFCT_TIMEOUT_ATTR_TCP_CLOSE_WAIT, 00031 NFCT_TIMEOUT_ATTR_TCP_LAST_ACK, 00032 NFCT_TIMEOUT_ATTR_TCP_TIME_WAIT, 00033 NFCT_TIMEOUT_ATTR_TCP_CLOSE, 00034 NFCT_TIMEOUT_ATTR_TCP_SYN_SENT2, 00035 NFCT_TIMEOUT_ATTR_TCP_RETRANS, 00036 NFCT_TIMEOUT_ATTR_TCP_UNACK, 00037 NFCT_TIMEOUT_ATTR_TCP_MAX 00038 }; 00039 00040 enum nfct_timeout_udp_attr { 00041 NFCT_TIMEOUT_ATTR_UDP_UNREPLIED = 0, 00042 NFCT_TIMEOUT_ATTR_UDP_REPLIED, 00043 NFCT_TIMEOUT_ATTR_UDP_MAX 00044 }; 00045 00046 enum nfct_timeout_udplite_attr { 00047 NFCT_TIMEOUT_ATTR_UDPLITE_UNREPLIED = 0, 00048 NFCT_TIMEOUT_ATTR_UDPLITE_REPLIED, 00049 NFCT_TIMEOUT_ATTR_UDPLITE_MAX 00050 }; 00051 00052 enum nfct_timeout_dccp_attr { 00053 NFCT_TIMEOUT_ATTR_DCCP_REQUEST, 00054 NFCT_TIMEOUT_ATTR_DCCP_RESPOND, 00055 NFCT_TIMEOUT_ATTR_DCCP_PARTOPEN, 00056 NFCT_TIMEOUT_ATTR_DCCP_OPEN, 00057 NFCT_TIMEOUT_ATTR_DCCP_CLOSEREQ, 00058 NFCT_TIMEOUT_ATTR_DCCP_CLOSING, 00059 NFCT_TIMEOUT_ATTR_DCCP_TIMEWAIT, 00060 NFCT_TIMEOUT_ATTR_DCCP_MAX 00061 }; 00062 00063 enum nfct_timeout_sctp_attr { 00064 NFCT_TIMEOUT_ATTR_SCTP_CLOSED = 0, 00065 NFCT_TIMEOUT_ATTR_SCTP_COOKIE_WAIT, 00066 NFCT_TIMEOUT_ATTR_SCTP_COOKIE_ECHOED, 00067 NFCT_TIMEOUT_ATTR_SCTP_ESTABLISHED, 00068 NFCT_TIMEOUT_ATTR_SCTP_SHUTDOWN_SENT, 00069 NFCT_TIMEOUT_ATTR_SCTP_SHUTDOWN_RECD, 00070 NFCT_TIMEOUT_ATTR_SCTP_SHUTDOWN_ACK_SENT, 00071 NFCT_TIMEOUT_ATTR_SCTP_MAX 00072 }; 00073 00074 enum nfct_timeout_icmp_attr { 00075 NFCT_TIMEOUT_ATTR_ICMP = 0, 00076 NFCT_TIMEOUT_ATTR_ICMP_MAX 00077 }; 00078 00079 enum nfct_timeout_icmpv6_attr { 00080 NFCT_TIMEOUT_ATTR_ICMPV6 = 0, 00081 NFCT_TIMEOUT_ATTR_ICMPV6_MAX 00082 }; 00083 00084 enum nfct_timeout_gre_attr { 00085 NFCT_TIMEOUT_ATTR_GRE_UNREPLIED = 0, 00086 NFCT_TIMEOUT_ATTR_GRE_REPLIED, 00087 NFCT_TIMEOUT_ATTR_GRE_MAX 00088 }; 00089 00090 enum nfct_timeout_generic_attr { 00091 NFCT_TIMEOUT_ATTR_GENERIC = 0, 00092 NFCT_TIMEOUT_ATTR_GENERIC_MAX 00093 }; 00094 00095 int nfct_timeout_attr_set(struct nfct_timeout *t, uint32_t type, const void *data); 00096 int nfct_timeout_attr_set_u8(struct nfct_timeout *t, uint32_t type, uint8_t data); 00097 int nfct_timeout_attr_set_u16(struct nfct_timeout *t, uint32_t type, uint16_t data); 00098 void nfct_timeout_attr_unset(struct nfct_timeout *t, uint32_t type); 00099 const char *nfct_timeout_policy_attr_to_name(uint8_t l4proto, uint32_t state); 00100 00101 int nfct_timeout_policy_attr_set_u32(struct nfct_timeout *, uint32_t type, uint32_t data); 00102 void nfct_timeout_policy_attr_unset(struct nfct_timeout *t, uint32_t type); 00103 00104 struct nlmsghdr; 00105 00106 struct nlmsghdr *nfct_timeout_nlmsg_build_hdr(char *buf, uint8_t cmd, uint16_t flags, uint32_t seq); 00107 void nfct_timeout_nlmsg_build_payload(struct nlmsghdr *, const struct nfct_timeout *); 00108 int nfct_timeout_nlmsg_parse_payload(const struct nlmsghdr *nlh, struct nfct_timeout *); 00109 00110 enum { 00111 NFCT_TIMEOUT_O_DEFAULT, 00112 }; 00113 00114 int nfct_timeout_snprintf(char *buf, size_t size, const struct nfct_timeout *, unsigned int type, unsigned int flags); 00115 00116 #ifdef __cplusplus 00117 } /* extern "C" */ 00118 #endif 00119 00120 #endif /* _LIBNETFILTER_CTTIMEOUT_H_ */