libnl 3.7.0
ct.h
1/* SPDX-License-Identifier: LGPL-2.1-only */
2/*
3 * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
4 * Copyright (c) 2007 Philip Craig <philipc@snapgear.com>
5 * Copyright (c) 2007 Secure Computing Corporation
6 */
7
8#ifndef NETLINK_CT_H_
9#define NETLINK_CT_H_
10
11#include <netlink/netlink.h>
12#include <netlink/addr.h>
13#include <netlink/cache.h>
14#include <netlink/msg.h>
15#include <netlink/attr.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21struct nfnl_ct;
22
24 uint64_t start;
25 uint64_t stop;
26};
27
28extern struct nl_object_ops ct_obj_ops;
29
30extern struct nfnl_ct * nfnl_ct_alloc(void);
31extern int nfnl_ct_alloc_cache(struct nl_sock *, struct nl_cache **);
32
33extern int nfnlmsg_ct_group(struct nlmsghdr *);
34extern int nfnlmsg_ct_parse(struct nlmsghdr *, struct nfnl_ct **);
35extern int nfnlmsg_ct_parse_nested(struct nlattr *, struct nfnl_ct **);
36
37extern void nfnl_ct_get(struct nfnl_ct *);
38extern void nfnl_ct_put(struct nfnl_ct *);
39
40extern int nfnl_ct_dump_request(struct nl_sock *);
41
42extern int nfnl_ct_build_add_request(const struct nfnl_ct *, int,
43 struct nl_msg **);
44extern int nfnl_ct_add(struct nl_sock *, const struct nfnl_ct *, int);
45
46extern int nfnl_ct_build_delete_request(const struct nfnl_ct *, int,
47 struct nl_msg **);
48extern int nfnl_ct_del(struct nl_sock *, const struct nfnl_ct *, int);
49
50extern int nfnl_ct_build_query_request(const struct nfnl_ct *, int,
51 struct nl_msg **);
52extern int nfnl_ct_query(struct nl_sock *, const struct nfnl_ct *, int);
53
54extern void nfnl_ct_set_family(struct nfnl_ct *, uint8_t);
55extern uint8_t nfnl_ct_get_family(const struct nfnl_ct *);
56
57extern void nfnl_ct_set_proto(struct nfnl_ct *, uint8_t);
58extern int nfnl_ct_test_proto(const struct nfnl_ct *);
59extern uint8_t nfnl_ct_get_proto(const struct nfnl_ct *);
60
61extern void nfnl_ct_set_tcp_state(struct nfnl_ct *, uint8_t);
62extern int nfnl_ct_test_tcp_state(const struct nfnl_ct *);
63extern uint8_t nfnl_ct_get_tcp_state(const struct nfnl_ct *);
64extern char * nfnl_ct_tcp_state2str(uint8_t, char *, size_t);
65extern int nfnl_ct_str2tcp_state(const char *name);
66
67extern void nfnl_ct_set_status(struct nfnl_ct *, uint32_t);
68extern void nfnl_ct_unset_status(struct nfnl_ct *, uint32_t);
69extern int nfnl_ct_test_status(const struct nfnl_ct *ct);
70extern uint32_t nfnl_ct_get_status(const struct nfnl_ct *);
71extern char * nfnl_ct_status2str(int, char *, size_t);
72extern int nfnl_ct_str2status(const char *);
73
74extern void nfnl_ct_set_timeout(struct nfnl_ct *, uint32_t);
75extern int nfnl_ct_test_timeout(const struct nfnl_ct *);
76extern uint32_t nfnl_ct_get_timeout(const struct nfnl_ct *);
77
78extern void nfnl_ct_set_mark(struct nfnl_ct *, uint32_t);
79extern int nfnl_ct_test_mark(const struct nfnl_ct *);
80extern uint32_t nfnl_ct_get_mark(const struct nfnl_ct *);
81
82extern void nfnl_ct_set_use(struct nfnl_ct *, uint32_t);
83extern int nfnl_ct_test_use(const struct nfnl_ct *);
84extern uint32_t nfnl_ct_get_use(const struct nfnl_ct *);
85
86extern void nfnl_ct_set_id(struct nfnl_ct *, uint32_t);
87extern int nfnl_ct_test_id(const struct nfnl_ct *);
88extern uint32_t nfnl_ct_get_id(const struct nfnl_ct *);
89
90extern void nfnl_ct_set_zone(struct nfnl_ct *, uint16_t);
91extern int nfnl_ct_test_zone(const struct nfnl_ct *);
92extern uint16_t nfnl_ct_get_zone(const struct nfnl_ct *);
93
94extern int nfnl_ct_set_src(struct nfnl_ct *, int, struct nl_addr *);
95extern struct nl_addr * nfnl_ct_get_src(const struct nfnl_ct *, int);
96
97extern int nfnl_ct_set_dst(struct nfnl_ct *, int, struct nl_addr *);
98extern struct nl_addr * nfnl_ct_get_dst(const struct nfnl_ct *, int);
99
100extern void nfnl_ct_set_src_port(struct nfnl_ct *, int, uint16_t);
101extern int nfnl_ct_test_src_port(const struct nfnl_ct *, int);
102extern uint16_t nfnl_ct_get_src_port(const struct nfnl_ct *, int);
103
104extern void nfnl_ct_set_dst_port(struct nfnl_ct *, int, uint16_t);
105extern int nfnl_ct_test_dst_port(const struct nfnl_ct *, int);
106extern uint16_t nfnl_ct_get_dst_port(const struct nfnl_ct *, int);
107
108extern void nfnl_ct_set_icmp_id(struct nfnl_ct *, int, uint16_t);
109extern int nfnl_ct_test_icmp_id(const struct nfnl_ct *, int);
110extern uint16_t nfnl_ct_get_icmp_id(const struct nfnl_ct *, int);
111
112extern void nfnl_ct_set_icmp_type(struct nfnl_ct *, int, uint8_t);
113extern int nfnl_ct_test_icmp_type(const struct nfnl_ct *, int);
114extern uint8_t nfnl_ct_get_icmp_type(const struct nfnl_ct *, int);
115
116extern void nfnl_ct_set_icmp_code(struct nfnl_ct *, int, uint8_t);
117extern int nfnl_ct_test_icmp_code(const struct nfnl_ct *, int);
118extern uint8_t nfnl_ct_get_icmp_code(const struct nfnl_ct *, int);
119
120extern void nfnl_ct_set_packets(struct nfnl_ct *, int, uint64_t);
121extern int nfnl_ct_test_packets(const struct nfnl_ct *, int);
122extern uint64_t nfnl_ct_get_packets(const struct nfnl_ct *,int);
123
124extern void nfnl_ct_set_bytes(struct nfnl_ct *, int, uint64_t);
125extern int nfnl_ct_test_bytes(const struct nfnl_ct *, int);
126extern uint64_t nfnl_ct_get_bytes(const struct nfnl_ct *, int);
127
128extern void nfnl_ct_set_timestamp(struct nfnl_ct *, uint64_t, uint64_t);
129extern int nfnl_ct_test_timestamp(const struct nfnl_ct *);
130extern const struct nfnl_ct_timestamp *nfnl_ct_get_timestamp(const struct nfnl_ct *);
131
132#ifdef __cplusplus
133}
134#endif
135
136#endif
int nfnl_ct_alloc_cache(struct nl_sock *, struct nl_cache **)
Build a conntrack cache holding all conntrack currently in the kernel.
Definition: ct.c:669
int nfnl_ct_dump_request(struct nl_sock *)
Send nfnl ct dump request.
Definition: ct.c:448