ct.h

00001 /*
00002  * netlink/netfilter/ct.h       Conntrack
00003  *
00004  *      This library is free software; you can redistribute it and/or
00005  *      modify it under the terms of the GNU Lesser General Public
00006  *      License as published by the Free Software Foundation version 2.1
00007  *      of the License.
00008  *
00009  * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
00010  * Copyright (c) 2007 Philip Craig <philipc@snapgear.com>
00011  * Copyright (c) 2007 Secure Computing Corporation
00012  */
00013 
00014 #ifndef NETLINK_CT_H_
00015 #define NETLINK_CT_H_
00016 
00017 #include <netlink/netlink.h>
00018 #include <netlink/addr.h>
00019 #include <netlink/cache.h>
00020 #include <netlink/msg.h>
00021 
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025 
00026 struct nfnl_ct;
00027 
00028 extern struct nl_object_ops ct_obj_ops;
00029 
00030 extern struct nfnl_ct * nfnl_ct_alloc(void);
00031 extern int      nfnl_ct_alloc_cache(struct nl_sock *, struct nl_cache **);
00032 
00033 extern int      nfnlmsg_ct_group(struct nlmsghdr *);
00034 extern int      nfnlmsg_ct_parse(struct nlmsghdr *, struct nfnl_ct **);
00035 
00036 extern void     nfnl_ct_get(struct nfnl_ct *);
00037 extern void     nfnl_ct_put(struct nfnl_ct *);
00038 
00039 extern int      nfnl_ct_dump_request(struct nl_sock *);
00040 
00041 extern int      nfnl_ct_build_add_request(const struct nfnl_ct *, int,
00042                                           struct nl_msg **);
00043 extern int      nfnl_ct_add(struct nl_sock *, const struct nfnl_ct *, int);
00044 
00045 extern int      nfnl_ct_build_delete_request(const struct nfnl_ct *, int,
00046                                              struct nl_msg **);
00047 extern int      nfnl_ct_del(struct nl_sock *, const struct nfnl_ct *, int);
00048 
00049 extern int      nfnl_ct_build_query_request(const struct nfnl_ct *, int,
00050                                             struct nl_msg **);
00051 extern int      nfnl_ct_query(struct nl_sock *, const struct nfnl_ct *, int);
00052 
00053 extern void     nfnl_ct_set_family(struct nfnl_ct *, uint8_t);
00054 extern uint8_t  nfnl_ct_get_family(const struct nfnl_ct *);
00055 
00056 extern void     nfnl_ct_set_proto(struct nfnl_ct *, uint8_t);
00057 extern int      nfnl_ct_test_proto(const struct nfnl_ct *);
00058 extern uint8_t  nfnl_ct_get_proto(const struct nfnl_ct *);
00059 
00060 extern void     nfnl_ct_set_tcp_state(struct nfnl_ct *, uint8_t);
00061 extern int      nfnl_ct_test_tcp_state(const struct nfnl_ct *);
00062 extern uint8_t  nfnl_ct_get_tcp_state(const struct nfnl_ct *);
00063 extern char *   nfnl_ct_tcp_state2str(uint8_t, char *, size_t);
00064 extern int      nfnl_ct_str2tcp_state(const char *name);
00065 
00066 extern void     nfnl_ct_set_status(struct nfnl_ct *, uint32_t);
00067 extern void     nfnl_ct_unset_status(struct nfnl_ct *, uint32_t);
00068 extern uint32_t nfnl_ct_get_status(const struct nfnl_ct *);
00069 extern char *   nfnl_ct_status2str(int, char *, size_t);
00070 extern int      nfnl_ct_str2status(const char *);
00071 
00072 extern void     nfnl_ct_set_timeout(struct nfnl_ct *, uint32_t);
00073 extern int      nfnl_ct_test_timeout(const struct nfnl_ct *);
00074 extern uint32_t nfnl_ct_get_timeout(const struct nfnl_ct *);
00075 
00076 extern void     nfnl_ct_set_mark(struct nfnl_ct *, uint32_t);
00077 extern int      nfnl_ct_test_mark(const struct nfnl_ct *);
00078 extern uint32_t nfnl_ct_get_mark(const struct nfnl_ct *);
00079 
00080 extern void     nfnl_ct_set_use(struct nfnl_ct *, uint32_t);
00081 extern int      nfnl_ct_test_use(const struct nfnl_ct *);
00082 extern uint32_t nfnl_ct_get_use(const struct nfnl_ct *);
00083 
00084 extern void     nfnl_ct_set_id(struct nfnl_ct *, uint32_t);
00085 extern int      nfnl_ct_test_id(const struct nfnl_ct *);
00086 extern uint32_t nfnl_ct_get_id(const struct nfnl_ct *);
00087 
00088 extern int      nfnl_ct_set_src(struct nfnl_ct *, int, struct nl_addr *);
00089 extern struct nl_addr * nfnl_ct_get_src(const struct nfnl_ct *, int);
00090 
00091 extern int      nfnl_ct_set_dst(struct nfnl_ct *, int, struct nl_addr *);
00092 extern struct nl_addr * nfnl_ct_get_dst(const struct nfnl_ct *, int);
00093 
00094 extern void     nfnl_ct_set_src_port(struct nfnl_ct *, int, uint16_t);
00095 extern int      nfnl_ct_test_src_port(const struct nfnl_ct *, int);
00096 extern uint16_t nfnl_ct_get_src_port(const struct nfnl_ct *, int);
00097 
00098 extern void     nfnl_ct_set_dst_port(struct nfnl_ct *, int, uint16_t);
00099 extern int      nfnl_ct_test_dst_port(const struct nfnl_ct *, int);
00100 extern uint16_t nfnl_ct_get_dst_port(const struct nfnl_ct *, int);
00101 
00102 extern void     nfnl_ct_set_icmp_id(struct nfnl_ct *, int, uint16_t);
00103 extern int      nfnl_ct_test_icmp_id(const struct nfnl_ct *, int);
00104 extern uint16_t nfnl_ct_get_icmp_id(const struct nfnl_ct *, int);
00105 
00106 extern void     nfnl_ct_set_icmp_type(struct nfnl_ct *, int, uint8_t);
00107 extern int      nfnl_ct_test_icmp_type(const struct nfnl_ct *, int);
00108 extern uint8_t  nfnl_ct_get_icmp_type(const struct nfnl_ct *, int);
00109 
00110 extern void     nfnl_ct_set_icmp_code(struct nfnl_ct *, int, uint8_t);
00111 extern int      nfnl_ct_test_icmp_code(const struct nfnl_ct *, int);
00112 extern uint8_t  nfnl_ct_get_icmp_code(const struct nfnl_ct *, int);
00113 
00114 extern void     nfnl_ct_set_packets(struct nfnl_ct *, int, uint64_t);
00115 extern int      nfnl_ct_test_packets(const struct nfnl_ct *, int);
00116 extern uint64_t nfnl_ct_get_packets(const struct nfnl_ct *,int);
00117 
00118 extern void     nfnl_ct_set_bytes(struct nfnl_ct *, int, uint64_t);
00119 extern int      nfnl_ct_test_bytes(const struct nfnl_ct *, int);
00120 extern uint64_t nfnl_ct_get_bytes(const struct nfnl_ct *, int);
00121 
00122 #ifdef __cplusplus
00123 }
00124 #endif
00125 
00126 #endif