2 * netlink/netfilter/ct.h Conntrack
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation version 2.1
9 * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
10 * Copyright (c) 2007 Philip Craig <philipc@snapgear.com>
11 * Copyright (c) 2007 Secure Computing Corporation
17 #include <netlink/netlink.h>
18 #include <netlink/addr.h>
19 #include <netlink/cache.h>
20 #include <netlink/msg.h>
28 extern struct nl_object_ops ct_obj_ops;
30 extern struct nfnl_ct * nfnl_ct_alloc(void);
31 extern int nfnl_ct_alloc_cache(struct nl_sock *, struct nl_cache **);
33 extern int nfnlmsg_ct_group(struct nlmsghdr *);
34 extern int nfnlmsg_ct_parse(struct nlmsghdr *, struct nfnl_ct **);
36 extern void nfnl_ct_get(struct nfnl_ct *);
37 extern void nfnl_ct_put(struct nfnl_ct *);
39 extern int nfnl_ct_dump_request(struct nl_sock *);
41 extern int nfnl_ct_build_add_request(const struct nfnl_ct *, int,
43 extern int nfnl_ct_add(struct nl_sock *, const struct nfnl_ct *, int);
45 extern int nfnl_ct_build_delete_request(const struct nfnl_ct *, int,
47 extern int nfnl_ct_delete(struct nl_sock *, const struct nfnl_ct *, int);
49 extern int nfnl_ct_build_query_request(const struct nfnl_ct *, int,
51 extern int nfnl_ct_query(struct nl_sock *, const struct nfnl_ct *, int);
53 extern void nfnl_ct_set_family(struct nfnl_ct *, uint8_t);
54 extern uint8_t nfnl_ct_get_family(const struct nfnl_ct *);
56 extern void nfnl_ct_set_proto(struct nfnl_ct *, uint8_t);
57 extern int nfnl_ct_test_proto(const struct nfnl_ct *);
58 extern uint8_t nfnl_ct_get_proto(const struct nfnl_ct *);
60 extern void nfnl_ct_set_tcp_state(struct nfnl_ct *, uint8_t);
61 extern int nfnl_ct_test_tcp_state(const struct nfnl_ct *);
62 extern uint8_t nfnl_ct_get_tcp_state(const struct nfnl_ct *);
63 extern char * nfnl_ct_tcp_state2str(uint8_t, char *, size_t);
64 extern int nfnl_ct_str2tcp_state(const char *name);
66 extern void nfnl_ct_set_status(struct nfnl_ct *, uint32_t);
67 extern void nfnl_ct_unset_status(struct nfnl_ct *, uint32_t);
68 extern uint32_t nfnl_ct_get_status(const struct nfnl_ct *);
69 extern char * nfnl_ct_status2str(int, char *, size_t);
70 extern int nfnl_ct_str2status(const char *);
72 extern void nfnl_ct_set_timeout(struct nfnl_ct *, uint32_t);
73 extern int nfnl_ct_test_timeout(const struct nfnl_ct *);
74 extern uint32_t nfnl_ct_get_timeout(const struct nfnl_ct *);
76 extern void nfnl_ct_set_mark(struct nfnl_ct *, uint32_t);
77 extern int nfnl_ct_test_mark(const struct nfnl_ct *);
78 extern uint32_t nfnl_ct_get_mark(const struct nfnl_ct *);
80 extern void nfnl_ct_set_use(struct nfnl_ct *, uint32_t);
81 extern int nfnl_ct_test_use(const struct nfnl_ct *);
82 extern uint32_t nfnl_ct_get_use(const struct nfnl_ct *);
84 extern void nfnl_ct_set_id(struct nfnl_ct *, uint32_t);
85 extern int nfnl_ct_test_id(const struct nfnl_ct *);
86 extern uint32_t nfnl_ct_get_id(const struct nfnl_ct *);
88 extern int nfnl_ct_set_src(struct nfnl_ct *, int, struct nl_addr *);
89 extern struct nl_addr * nfnl_ct_get_src(const struct nfnl_ct *, int);
91 extern int nfnl_ct_set_dst(struct nfnl_ct *, int, struct nl_addr *);
92 extern struct nl_addr * nfnl_ct_get_dst(const struct nfnl_ct *, int);
94 extern void nfnl_ct_set_src_port(struct nfnl_ct *, int, uint16_t);
95 extern int nfnl_ct_test_src_port(const struct nfnl_ct *, int);
96 extern uint16_t nfnl_ct_get_src_port(const struct nfnl_ct *, int);
98 extern void nfnl_ct_set_dst_port(struct nfnl_ct *, int, uint16_t);
99 extern int nfnl_ct_test_dst_port(const struct nfnl_ct *, int);
100 extern uint16_t nfnl_ct_get_dst_port(const struct nfnl_ct *, int);
102 extern void nfnl_ct_set_icmp_id(struct nfnl_ct *, int, uint16_t);
103 extern int nfnl_ct_test_icmp_id(const struct nfnl_ct *, int);
104 extern uint16_t nfnl_ct_get_icmp_id(const struct nfnl_ct *, int);
106 extern void nfnl_ct_set_icmp_type(struct nfnl_ct *, int, uint8_t);
107 extern int nfnl_ct_test_icmp_type(const struct nfnl_ct *, int);
108 extern uint8_t nfnl_ct_get_icmp_type(const struct nfnl_ct *, int);
110 extern void nfnl_ct_set_icmp_code(struct nfnl_ct *, int, uint8_t);
111 extern int nfnl_ct_test_icmp_code(const struct nfnl_ct *, int);
112 extern uint8_t nfnl_ct_get_icmp_code(const struct nfnl_ct *, int);
114 extern void nfnl_ct_set_packets(struct nfnl_ct *, int, uint64_t);
115 extern int nfnl_ct_test_packets(const struct nfnl_ct *, int);
116 extern uint64_t nfnl_ct_get_packets(const struct nfnl_ct *,int);
118 extern void nfnl_ct_set_bytes(struct nfnl_ct *, int, uint64_t);
119 extern int nfnl_ct_test_bytes(const struct nfnl_ct *, int);
120 extern uint64_t nfnl_ct_get_bytes(const struct nfnl_ct *, int);