libnl 1.1
include/netlink/netfilter/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-2006 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 /* General */
00031 extern struct nfnl_ct * nfnl_ct_alloc(void);
00032 extern struct nl_cache *nfnl_ct_alloc_cache(struct nl_handle *);
00033 
00034 extern int              nfnlmsg_ct_group(struct nlmsghdr *);
00035 extern struct nfnl_ct * nfnlmsg_ct_parse(struct nlmsghdr *);
00036 
00037 extern void             nfnl_ct_get(struct nfnl_ct *);
00038 extern void             nfnl_ct_put(struct nfnl_ct *);
00039 
00040 extern int              nfnl_ct_dump_request(struct nl_handle *);
00041 
00042 extern void             nfnl_ct_set_family(struct nfnl_ct *, uint8_t);
00043 extern uint8_t          nfnl_ct_get_family(const struct nfnl_ct *);
00044 
00045 extern void             nfnl_ct_set_proto(struct nfnl_ct *, uint8_t);
00046 extern int              nfnl_ct_test_proto(const struct nfnl_ct *);
00047 extern uint8_t          nfnl_ct_get_proto(const struct nfnl_ct *);
00048 
00049 extern void             nfnl_ct_set_tcp_state(struct nfnl_ct *, uint8_t);
00050 extern int              nfnl_ct_test_tcp_state(const struct nfnl_ct *);
00051 extern uint8_t          nfnl_ct_get_tcp_state(const struct nfnl_ct *);
00052 extern char *           nfnl_ct_tcp_state2str(uint8_t, char *, size_t);
00053 extern int              nfnl_ct_str2tcp_state(const char *name);
00054 
00055 extern void             nfnl_ct_set_status(struct nfnl_ct *, uint32_t);
00056 extern void             nfnl_ct_unset_status(struct nfnl_ct *, uint32_t);
00057 extern uint32_t         nfnl_ct_get_status(const struct nfnl_ct *);
00058 
00059 extern void             nfnl_ct_set_timeout(struct nfnl_ct *, uint32_t);
00060 extern int              nfnl_ct_test_timeout(const struct nfnl_ct *);
00061 extern uint32_t         nfnl_ct_get_timeout(const struct nfnl_ct *);
00062 
00063 extern void             nfnl_ct_set_mark(struct nfnl_ct *, uint32_t);
00064 extern int              nfnl_ct_test_mark(const struct nfnl_ct *);
00065 extern uint32_t         nfnl_ct_get_mark(const struct nfnl_ct *);
00066 
00067 extern void             nfnl_ct_set_use(struct nfnl_ct *, uint32_t);
00068 extern int              nfnl_ct_test_use(const struct nfnl_ct *);
00069 extern uint32_t         nfnl_ct_get_use(const struct nfnl_ct *);
00070 
00071 extern void             nfnl_ct_set_id(struct nfnl_ct *, uint32_t);
00072 extern int              nfnl_ct_test_id(const struct nfnl_ct *);
00073 extern uint32_t         nfnl_ct_get_id(const struct nfnl_ct *);
00074 
00075 extern int              nfnl_ct_set_src(struct nfnl_ct *, int,
00076                                         struct nl_addr *);
00077 extern struct nl_addr * nfnl_ct_get_src(const struct nfnl_ct *, int);
00078 
00079 extern int              nfnl_ct_set_dst(struct nfnl_ct *, int,
00080                                         struct nl_addr *);
00081 extern struct nl_addr * nfnl_ct_get_dst(const struct nfnl_ct *, int);
00082 
00083 extern void             nfnl_ct_set_src_port(struct nfnl_ct *, int, uint16_t);
00084 extern int              nfnl_ct_test_src_port(const struct nfnl_ct *, int);
00085 extern uint16_t         nfnl_ct_get_src_port(const struct nfnl_ct *, int);
00086 
00087 extern void             nfnl_ct_set_dst_port(struct nfnl_ct *, int, uint16_t);
00088 extern int              nfnl_ct_test_dst_port(const struct nfnl_ct *, int);
00089 extern uint16_t         nfnl_ct_get_dst_port(const struct nfnl_ct *, int);
00090 
00091 extern void             nfnl_ct_set_icmp_id(struct nfnl_ct *, int, uint16_t);
00092 extern int              nfnl_ct_test_icmp_id(const struct nfnl_ct *, int);
00093 extern uint16_t         nfnl_ct_get_icmp_id(const struct nfnl_ct *, int);
00094 
00095 extern void             nfnl_ct_set_icmp_type(struct nfnl_ct *, int, uint8_t);
00096 extern int              nfnl_ct_test_icmp_type(const struct nfnl_ct *, int);
00097 extern uint8_t          nfnl_ct_get_icmp_type(const struct nfnl_ct *, int);
00098 
00099 extern void             nfnl_ct_set_icmp_code(struct nfnl_ct *, int, uint8_t);
00100 extern int              nfnl_ct_test_icmp_code(const struct nfnl_ct *, int);
00101 extern uint8_t          nfnl_ct_get_icmp_code(const struct nfnl_ct *, int);
00102 
00103 extern void             nfnl_ct_set_packets(struct nfnl_ct *, int, uint64_t);
00104 extern int              nfnl_ct_test_packets(const struct nfnl_ct *, int);
00105 extern uint64_t         nfnl_ct_get_packets(const struct nfnl_ct *,int);
00106 
00107 extern void             nfnl_ct_set_bytes(struct nfnl_ct *, int, uint64_t);
00108 extern int              nfnl_ct_test_bytes(const struct nfnl_ct *, int);
00109 extern uint64_t         nfnl_ct_get_bytes(const struct nfnl_ct *, int);
00110 
00111 #ifdef __cplusplus
00112 }
00113 #endif
00114 
00115 #endif