summaryrefslogtreecommitdiffstats
path: root/include/netlink/netfilter/ct.h
blob: ddf13732afee1076fce79791039ea9e2d6d2f81f (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
 * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
 * Copyright (c) 2007 Philip Craig <philipc@snapgear.com>
 * Copyright (c) 2007 Secure Computing Corporation
 */

#ifndef NETLINK_CT_H_
#define NETLINK_CT_H_

#include <netlink/netlink.h>
#include <netlink/addr.h>
#include <netlink/cache.h>
#include <netlink/msg.h>
#include <netlink/attr.h>

#ifdef __cplusplus
extern "C" {
#endif

struct nfnl_ct;

struct nfnl_ct_timestamp {
	uint64_t		start;
	uint64_t		stop;
};

extern struct nl_object_ops ct_obj_ops;

extern struct nfnl_ct *	nfnl_ct_alloc(void);
extern int	nfnl_ct_alloc_cache(struct nl_sock *, struct nl_cache **);

extern int	nfnlmsg_ct_group(struct nlmsghdr *);
extern int	nfnlmsg_ct_parse(struct nlmsghdr *, struct nfnl_ct **);
extern int	nfnlmsg_ct_parse_nested(struct nlattr *, struct nfnl_ct **);

extern void	nfnl_ct_get(struct nfnl_ct *);
extern void	nfnl_ct_put(struct nfnl_ct *);

extern int	nfnl_ct_dump_request(struct nl_sock *);

extern int	nfnl_ct_build_add_request(const struct nfnl_ct *, int,
					  struct nl_msg **);
extern int	nfnl_ct_add(struct nl_sock *, const struct nfnl_ct *, int);

extern int	nfnl_ct_build_delete_request(const struct nfnl_ct *, int,
					     struct nl_msg **);
extern int	nfnl_ct_del(struct nl_sock *, const struct nfnl_ct *, int);

extern int	nfnl_ct_build_query_request(const struct nfnl_ct *, int,
					    struct nl_msg **);
extern int	nfnl_ct_query(struct nl_sock *, const struct nfnl_ct *, int);

extern void	nfnl_ct_set_family(struct nfnl_ct *, uint8_t);
extern uint8_t	nfnl_ct_get_family(const struct nfnl_ct *);

extern void	nfnl_ct_set_proto(struct nfnl_ct *, uint8_t);
extern int	nfnl_ct_test_proto(const struct nfnl_ct *);
extern uint8_t	nfnl_ct_get_proto(const struct nfnl_ct *);

extern void	nfnl_ct_set_tcp_state(struct nfnl_ct *, uint8_t);
extern int	nfnl_ct_test_tcp_state(const struct nfnl_ct *);
extern uint8_t	nfnl_ct_get_tcp_state(const struct nfnl_ct *);
extern char *	nfnl_ct_tcp_state2str(uint8_t, char *, size_t);
extern int	nfnl_ct_str2tcp_state(const char *name);

extern void	nfnl_ct_set_status(struct nfnl_ct *, uint32_t);
extern void	nfnl_ct_unset_status(struct nfnl_ct *, uint32_t);
extern int	nfnl_ct_test_status(const struct nfnl_ct *ct);
extern uint32_t	nfnl_ct_get_status(const struct nfnl_ct *);
extern char *	nfnl_ct_status2str(int, char *, size_t);
extern int	nfnl_ct_str2status(const char *);

extern void	nfnl_ct_set_timeout(struct nfnl_ct *, uint32_t);
extern int	nfnl_ct_test_timeout(const struct nfnl_ct *);
extern uint32_t	nfnl_ct_get_timeout(const struct nfnl_ct *);

extern void	nfnl_ct_set_mark(struct nfnl_ct *, uint32_t);
extern int	nfnl_ct_test_mark(const struct nfnl_ct *);
extern uint32_t	nfnl_ct_get_mark(const struct nfnl_ct *);

extern void	nfnl_ct_set_use(struct nfnl_ct *, uint32_t);
extern int	nfnl_ct_test_use(const struct nfnl_ct *);
extern uint32_t	nfnl_ct_get_use(const struct nfnl_ct *);

extern void	nfnl_ct_set_id(struct nfnl_ct *, uint32_t);
extern int	nfnl_ct_test_id(const struct nfnl_ct *);
extern uint32_t	nfnl_ct_get_id(const struct nfnl_ct *);

extern void	nfnl_ct_set_zone(struct nfnl_ct *, uint16_t);
extern int	nfnl_ct_test_zone(const struct nfnl_ct *);
extern uint16_t	nfnl_ct_get_zone(const struct nfnl_ct *);

extern int	nfnl_ct_set_src(struct nfnl_ct *, int, struct nl_addr *);
extern struct nl_addr *	nfnl_ct_get_src(const struct nfnl_ct *, int);

extern int	nfnl_ct_set_dst(struct nfnl_ct *, int, struct nl_addr *);
extern struct nl_addr *	nfnl_ct_get_dst(const struct nfnl_ct *, int);

extern void	nfnl_ct_set_src_port(struct nfnl_ct *, int, uint16_t);
extern int	nfnl_ct_test_src_port(const struct nfnl_ct *, int);
extern uint16_t	nfnl_ct_get_src_port(const struct nfnl_ct *, int);

extern void	nfnl_ct_set_dst_port(struct nfnl_ct *, int, uint16_t);
extern int	nfnl_ct_test_dst_port(const struct nfnl_ct *, int);
extern uint16_t	nfnl_ct_get_dst_port(const struct nfnl_ct *, int);

extern void	nfnl_ct_set_icmp_id(struct nfnl_ct *, int, uint16_t);
extern int	nfnl_ct_test_icmp_id(const struct nfnl_ct *, int);
extern uint16_t	nfnl_ct_get_icmp_id(const struct nfnl_ct *, int);

extern void	nfnl_ct_set_icmp_type(struct nfnl_ct *, int, uint8_t);
extern int	nfnl_ct_test_icmp_type(const struct nfnl_ct *, int);
extern uint8_t	nfnl_ct_get_icmp_type(const struct nfnl_ct *, int);

extern void	nfnl_ct_set_icmp_code(struct nfnl_ct *, int, uint8_t);
extern int	nfnl_ct_test_icmp_code(const struct nfnl_ct *, int);
extern uint8_t	nfnl_ct_get_icmp_code(const struct nfnl_ct *, int);

extern void	nfnl_ct_set_packets(struct nfnl_ct *, int, uint64_t);
extern int	nfnl_ct_test_packets(const struct nfnl_ct *, int);
extern uint64_t	nfnl_ct_get_packets(const struct nfnl_ct *,int);

extern void	nfnl_ct_set_bytes(struct nfnl_ct *, int, uint64_t);
extern int	nfnl_ct_test_bytes(const struct nfnl_ct *, int);
extern uint64_t	nfnl_ct_get_bytes(const struct nfnl_ct *, int);

extern void nfnl_ct_set_timestamp(struct nfnl_ct *, uint64_t, uint64_t);
extern int nfnl_ct_test_timestamp(const struct nfnl_ct *);
extern const struct nfnl_ct_timestamp *nfnl_ct_get_timestamp(const struct nfnl_ct *);

#ifdef __cplusplus
}
#endif

#endif