libnetfilter_cttimeout 1.0.1
libnetfilter_cttimeout.h
1#ifndef _LIBNETFILTER_CTTIMEOUT_H_
2#define _LIBNETFILTER_CTTIMEOUT_H_
3
4#include <stdint.h>
5#include <sys/types.h>
6#include <linux/netfilter/nfnetlink_conntrack.h>
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12struct nfct_timeout;
13
14struct nfct_timeout *nfct_timeout_alloc(void);
15void nfct_timeout_free(struct nfct_timeout *);
16
17enum nfct_timeout_attr {
18 NFCT_TIMEOUT_ATTR_NAME= 0,
19 NFCT_TIMEOUT_ATTR_L3PROTO,
20 NFCT_TIMEOUT_ATTR_L4PROTO,
21 NFCT_TIMEOUT_ATTR_POLICY,
22 NFCT_TIMEOUT_ATTR_MAX
23};
24
25enum nfct_timeout_tcp_attr {
26 NFCT_TIMEOUT_ATTR_TCP_SYN_SENT = 0,
27 NFCT_TIMEOUT_ATTR_TCP_SYN_RECV,
28 NFCT_TIMEOUT_ATTR_TCP_ESTABLISHED,
29 NFCT_TIMEOUT_ATTR_TCP_FIN_WAIT,
30 NFCT_TIMEOUT_ATTR_TCP_CLOSE_WAIT,
31 NFCT_TIMEOUT_ATTR_TCP_LAST_ACK,
32 NFCT_TIMEOUT_ATTR_TCP_TIME_WAIT,
33 NFCT_TIMEOUT_ATTR_TCP_CLOSE,
34 NFCT_TIMEOUT_ATTR_TCP_SYN_SENT2,
35 NFCT_TIMEOUT_ATTR_TCP_RETRANS,
36 NFCT_TIMEOUT_ATTR_TCP_UNACK,
37 NFCT_TIMEOUT_ATTR_TCP_MAX
38};
39
40enum nfct_timeout_udp_attr {
41 NFCT_TIMEOUT_ATTR_UDP_UNREPLIED = 0,
42 NFCT_TIMEOUT_ATTR_UDP_REPLIED,
43 NFCT_TIMEOUT_ATTR_UDP_MAX
44};
45
46enum nfct_timeout_udplite_attr {
47 NFCT_TIMEOUT_ATTR_UDPLITE_UNREPLIED = 0,
48 NFCT_TIMEOUT_ATTR_UDPLITE_REPLIED,
49 NFCT_TIMEOUT_ATTR_UDPLITE_MAX
50};
51
52enum nfct_timeout_dccp_attr {
53 NFCT_TIMEOUT_ATTR_DCCP_REQUEST,
54 NFCT_TIMEOUT_ATTR_DCCP_RESPOND,
55 NFCT_TIMEOUT_ATTR_DCCP_PARTOPEN,
56 NFCT_TIMEOUT_ATTR_DCCP_OPEN,
57 NFCT_TIMEOUT_ATTR_DCCP_CLOSEREQ,
58 NFCT_TIMEOUT_ATTR_DCCP_CLOSING,
59 NFCT_TIMEOUT_ATTR_DCCP_TIMEWAIT,
60 NFCT_TIMEOUT_ATTR_DCCP_MAX
61};
62
63enum nfct_timeout_sctp_attr {
64 NFCT_TIMEOUT_ATTR_SCTP_CLOSED = 0,
65 NFCT_TIMEOUT_ATTR_SCTP_COOKIE_WAIT,
66 NFCT_TIMEOUT_ATTR_SCTP_COOKIE_ECHOED,
67 NFCT_TIMEOUT_ATTR_SCTP_ESTABLISHED,
68 NFCT_TIMEOUT_ATTR_SCTP_SHUTDOWN_SENT,
69 NFCT_TIMEOUT_ATTR_SCTP_SHUTDOWN_RECD,
70 NFCT_TIMEOUT_ATTR_SCTP_SHUTDOWN_ACK_SENT,
71 NFCT_TIMEOUT_ATTR_SCTP_MAX
72};
73
74enum nfct_timeout_icmp_attr {
75 NFCT_TIMEOUT_ATTR_ICMP = 0,
76 NFCT_TIMEOUT_ATTR_ICMP_MAX
77};
78
79enum nfct_timeout_icmpv6_attr {
80 NFCT_TIMEOUT_ATTR_ICMPV6 = 0,
81 NFCT_TIMEOUT_ATTR_ICMPV6_MAX
82};
83
84enum nfct_timeout_gre_attr {
85 NFCT_TIMEOUT_ATTR_GRE_UNREPLIED = 0,
86 NFCT_TIMEOUT_ATTR_GRE_REPLIED,
87 NFCT_TIMEOUT_ATTR_GRE_MAX
88};
89
90enum nfct_timeout_generic_attr {
91 NFCT_TIMEOUT_ATTR_GENERIC = 0,
92 NFCT_TIMEOUT_ATTR_GENERIC_MAX
93};
94
95int nfct_timeout_attr_set(struct nfct_timeout *t, uint32_t type, const void *data);
96int nfct_timeout_attr_set_u8(struct nfct_timeout *t, uint32_t type, uint8_t data);
97int nfct_timeout_attr_set_u16(struct nfct_timeout *t, uint32_t type, uint16_t data);
98void nfct_timeout_attr_unset(struct nfct_timeout *t, uint32_t type);
99const char *nfct_timeout_policy_attr_to_name(uint8_t l4proto, uint32_t state);
100
101int nfct_timeout_policy_attr_set_u32(struct nfct_timeout *, uint32_t type, uint32_t data);
102void nfct_timeout_policy_attr_unset(struct nfct_timeout *t, uint32_t type);
103
104struct nlmsghdr;
105
106struct nlmsghdr *nfct_timeout_nlmsg_build_hdr(char *buf, uint8_t cmd, uint16_t flags, uint32_t seq);
107void nfct_timeout_nlmsg_build_payload(struct nlmsghdr *, const struct nfct_timeout *);
108int nfct_timeout_nlmsg_parse_payload(const struct nlmsghdr *nlh, struct nfct_timeout *);
109
110enum {
111 NFCT_TIMEOUT_O_DEFAULT,
112};
113
114int nfct_timeout_snprintf(char *buf, size_t size, const struct nfct_timeout *, unsigned int type, unsigned int flags);
115
116#ifdef __cplusplus
117} /* extern "C" */
118#endif
119
120#endif /* _LIBNETFILTER_CTTIMEOUT_H_ */
int nfct_timeout_snprintf(char *buf, size_t size, const struct nfct_timeout *, unsigned int type, unsigned int flags)
int nfct_timeout_policy_attr_set_u32(struct nfct_timeout *, uint32_t type, uint32_t data)
const char * nfct_timeout_policy_attr_to_name(uint8_t l4proto, uint32_t state)
void nfct_timeout_policy_attr_unset(struct nfct_timeout *t, uint32_t type)
int nfct_timeout_attr_set_u16(struct nfct_timeout *t, uint32_t type, uint16_t data)
void nfct_timeout_free(struct nfct_timeout *)
struct nfct_timeout * nfct_timeout_alloc(void)
int nfct_timeout_attr_set(struct nfct_timeout *t, uint32_t type, const void *data)
int nfct_timeout_attr_set_u8(struct nfct_timeout *t, uint32_t type, uint8_t data)
void nfct_timeout_attr_unset(struct nfct_timeout *t, uint32_t type)
struct nlmsghdr * nfct_timeout_nlmsg_build_hdr(char *buf, uint8_t cmd, uint16_t flags, uint32_t seq)
void nfct_timeout_nlmsg_build_payload(struct nlmsghdr *, const struct nfct_timeout *)
int nfct_timeout_nlmsg_parse_payload(const struct nlmsghdr *nlh, struct nfct_timeout *)