1#ifndef _NETLINK_H_ 2#define _NETLINK_H_ 3 4#include <libnetfilter_conntrack/libnetfilter_conntrack.h> 5 6struct nf_conntrack; 7struct nfct_handle; 8 9struct nfct_handle *nl_init_event_handler(void); 10struct nlif_handle *nl_init_interface_handler(void); 11 12int nl_send_resync(struct nfct_handle *h); 13void nl_resize_socket_buffer(struct nfct_handle *h); 14int nl_dump_conntrack_table(struct nfct_handle *h); 15int nl_flush_conntrack_table_selective(void); 16int nl_get_conntrack(struct nfct_handle *h, const struct nf_conntrack *ct); 17int nl_create_conntrack(struct nfct_handle *h, const struct nf_conntrack *ct, int timeout); 18int nl_update_conntrack(struct nfct_handle *h, const struct nf_conntrack *ct, int timeout); 19int nl_destroy_conntrack(struct nfct_handle *h, const struct nf_conntrack *ct); 20 21static inline int ct_is_related(const struct nf_conntrack *ct) 22{ 23 return (nfct_attr_is_set(ct, ATTR_MASTER_L3PROTO) && 24 nfct_attr_is_set(ct, ATTR_MASTER_L4PROTO) && 25 ((nfct_attr_is_set(ct, ATTR_MASTER_IPV4_SRC) && 26 nfct_attr_is_set(ct, ATTR_MASTER_IPV4_DST)) || 27 (nfct_attr_is_set(ct, ATTR_MASTER_IPV6_SRC) && 28 nfct_attr_is_set(ct, ATTR_MASTER_IPV6_DST))) && 29 nfct_attr_is_set(ct, ATTR_MASTER_PORT_SRC) && 30 nfct_attr_is_set(ct, ATTR_MASTER_PORT_DST)); 31} 32 33int nl_create_expect(struct nfct_handle *h, const struct nf_expect *orig, int timeout); 34int nl_destroy_expect(struct nfct_handle *h, const struct nf_expect *exp); 35int nl_get_expect(struct nfct_handle *h, const struct nf_expect *exp); 36int nl_dump_expect_table(struct nfct_handle *h); 37int nl_flush_expect_table(struct nfct_handle *h); 38int nl_send_expect_resync(struct nfct_handle *h); 39 40#endif 41