summaryrefslogtreecommitdiffstats
path: root/include/libnetfilter_cttimeout/libnetfilter_cttimeout.h
blob: be376365276157ffcf070fe5459f89b2cf178879 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#ifndef _LIBNETFILTER_CTTIMEOUT_H_
#define _LIBNETFILTER_CTTIMEOUT_H_

#include <sys/types.h>
#include <linux/netfilter/nfnetlink_conntrack.h>

struct nfct_timeout;

struct nfct_timeout *nfct_timeout_alloc(void);
void nfct_timeout_free(struct nfct_timeout *);

enum nfct_timeout_attr {
	NFCT_TIMEOUT_ATTR_NAME= 0,
	NFCT_TIMEOUT_ATTR_L3PROTO,
	NFCT_TIMEOUT_ATTR_L4PROTO,
	NFCT_TIMEOUT_ATTR_POLICY,
	NFCT_TIMEOUT_ATTR_MAX
};

enum nfct_timeout_tcp_attr {
	NFCT_TIMEOUT_ATTR_TCP_SYN_SENT = 0,
	NFCT_TIMEOUT_ATTR_TCP_SYN_RECV,
	NFCT_TIMEOUT_ATTR_TCP_ESTABLISHED,
	NFCT_TIMEOUT_ATTR_TCP_FIN_WAIT,
	NFCT_TIMEOUT_ATTR_TCP_CLOSE_WAIT,
	NFCT_TIMEOUT_ATTR_TCP_LAST_ACK,
	NFCT_TIMEOUT_ATTR_TCP_TIME_WAIT,
	NFCT_TIMEOUT_ATTR_TCP_CLOSE,
	NFCT_TIMEOUT_ATTR_TCP_SYN_SENT2,
	NFCT_TIMEOUT_ATTR_TCP_RETRANS,
	NFCT_TIMEOUT_ATTR_TCP_UNACK,
	NFCT_TIMEOUT_ATTR_TCP_MAX
};

enum nfct_timeout_udp_attr {
	NFCT_TIMEOUT_ATTR_UDP_UNREPLIED = 0,
	NFCT_TIMEOUT_ATTR_UDP_REPLIED,
	NFCT_TIMEOUT_ATTR_UDP_MAX
};

enum nfct_timeout_udplite_attr {
	NFCT_TIMEOUT_ATTR_UDPLITE_UNREPLIED = 0,
	NFCT_TIMEOUT_ATTR_UDPLITE_REPLIED,
	NFCT_TIMEOUT_ATTR_UDPLITE_MAX
};

enum nfct_timeout_dccp_attr {
	NFCT_TIMEOUT_ATTR_DCCP_REQUEST,
	NFCT_TIMEOUT_ATTR_DCCP_RESPOND,
	NFCT_TIMEOUT_ATTR_DCCP_PARTOPEN,
	NFCT_TIMEOUT_ATTR_DCCP_OPEN,
	NFCT_TIMEOUT_ATTR_DCCP_CLOSEREQ,
	NFCT_TIMEOUT_ATTR_DCCP_CLOSING,
	NFCT_TIMEOUT_ATTR_DCCP_TIMEWAIT,
	NFCT_TIMEOUT_ATTR_DCCP_MAX
};

enum nfct_timeout_sctp_attr {
	NFCT_TIMEOUT_ATTR_SCTP_CLOSED = 0,
	NFCT_TIMEOUT_ATTR_SCTP_COOKIE_WAIT,
	NFCT_TIMEOUT_ATTR_SCTP_COOKIE_ECHOED,
	NFCT_TIMEOUT_ATTR_SCTP_ESTABLISHED,
	NFCT_TIMEOUT_ATTR_SCTP_SHUTDOWN_SENT,
	NFCT_TIMEOUT_ATTR_SCTP_SHUTDOWN_RECD,
	NFCT_TIMEOUT_ATTR_SCTP_SHUTDOWN_ACK_SENT,
	NFCT_TIMEOUT_ATTR_SCTP_MAX
};

enum nfct_timeout_icmp_attr {
	NFCT_TIMEOUT_ATTR_ICMP = 0,
	NFCT_TIMEOUT_ATTR_ICMP_MAX
};

enum nfct_timeout_icmpv6_attr {
	NFCT_TIMEOUT_ATTR_ICMPV6 = 0,
	NFCT_TIMEOUT_ATTR_ICMPV6_MAX
};

enum nfct_timeout_gre_attr {
	NFCT_TIMEOUT_ATTR_GRE_UNREPLIED = 0,
	NFCT_TIMEOUT_ATTR_GRE_REPLIED,
	NFCT_TIMEOUT_ATTR_GRE_MAX
};

enum nfct_timeout_generic_attr {
	NFCT_TIMEOUT_ATTR_GENERIC = 0,
	NFCT_TIMEOUT_ATTR_GENERIC_MAX
};

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);
int nfct_timeout_attr_set_u16(struct nfct_timeout *t, uint32_t type, uint16_t data);
void nfct_timeout_attr_unset(struct nfct_timeout *t, uint32_t type);

int nfct_timeout_policy_attr_set_u32(struct nfct_timeout *, uint32_t type, uint32_t data);
void nfct_timeout_policy_attr_unset(struct nfct_timeout *t, uint32_t type);

struct nlmsghdr;

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 *, struct nfct_timeout *);
int nfct_timeout_nlmsg_parse_payload(const struct nlmsghdr *nlh, struct nfct_timeout *);

int nfct_timeout_snprintf(char *buf, size_t size, struct nfct_timeout *, unsigned int flags);

#endif