netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ct_obj.c File Reference
#include <sys/types.h>
#include <linux/netfilter/nfnetlink_conntrack.h>
#include <linux/netfilter/nf_conntrack_common.h>
#include <linux/netfilter/nf_conntrack_tcp.h>
#include <netlink-local.h>
#include <netlink/netfilter/nfnl.h>
#include <netlink/netfilter/ct.h>
Include dependency graph for ct_obj.c:

Macros

#define PRINT_FLAG(str)   { nl_dump(p, "%s%s", fp++ ? "," : "", (str)); }
 
#define CT_DIFF(ATTR, EXPR)   ATTR_DIFF(attrs, CT_ATTR_##ATTR, a, b, EXPR)
 
#define CT_DIFF_VAL(ATTR, FIELD)   CT_DIFF(ATTR, a->FIELD != b->FIELD)
 
#define CT_DIFF_ADDR(ATTR, FIELD)
 

Functions

Allocation/Freeing
struct nfnl_ctnfnl_ct_alloc (void)
 
void nfnl_ct_get (struct nfnl_ct *ct)
 
void nfnl_ct_put (struct nfnl_ct *ct)
 

Variables

struct nl_object_ops ct_obj_ops
 

Attributes

void nfnl_ct_set_family (struct nfnl_ct *ct, uint8_t family)
 
uint8_t nfnl_ct_get_family (const struct nfnl_ct *ct)
 
void nfnl_ct_set_proto (struct nfnl_ct *ct, uint8_t proto)
 
int nfnl_ct_test_proto (const struct nfnl_ct *ct)
 
uint8_t nfnl_ct_get_proto (const struct nfnl_ct *ct)
 
void nfnl_ct_set_tcp_state (struct nfnl_ct *ct, uint8_t state)
 
int nfnl_ct_test_tcp_state (const struct nfnl_ct *ct)
 
uint8_t nfnl_ct_get_tcp_state (const struct nfnl_ct *ct)
 
char * nfnl_ct_tcp_state2str (uint8_t state, char *buf, size_t len)
 
int nfnl_ct_str2tcp_state (const char *name)
 
void nfnl_ct_set_status (struct nfnl_ct *ct, uint32_t status)
 
void nfnl_ct_unset_status (struct nfnl_ct *ct, uint32_t status)
 
uint32_t nfnl_ct_get_status (const struct nfnl_ct *ct)
 
char * nfnl_ct_status2str (int flags, char *buf, size_t len)
 
int nfnl_ct_str2status (const char *name)
 
void nfnl_ct_set_timeout (struct nfnl_ct *ct, uint32_t timeout)
 
int nfnl_ct_test_timeout (const struct nfnl_ct *ct)
 
uint32_t nfnl_ct_get_timeout (const struct nfnl_ct *ct)
 
void nfnl_ct_set_mark (struct nfnl_ct *ct, uint32_t mark)
 
int nfnl_ct_test_mark (const struct nfnl_ct *ct)
 
uint32_t nfnl_ct_get_mark (const struct nfnl_ct *ct)
 
void nfnl_ct_set_use (struct nfnl_ct *ct, uint32_t use)
 
int nfnl_ct_test_use (const struct nfnl_ct *ct)
 
uint32_t nfnl_ct_get_use (const struct nfnl_ct *ct)
 
void nfnl_ct_set_id (struct nfnl_ct *ct, uint32_t id)
 
int nfnl_ct_test_id (const struct nfnl_ct *ct)
 
uint32_t nfnl_ct_get_id (const struct nfnl_ct *ct)
 
int nfnl_ct_set_src (struct nfnl_ct *ct, int repl, struct nl_addr *addr)
 
int nfnl_ct_set_dst (struct nfnl_ct *ct, int repl, struct nl_addr *addr)
 
struct nl_addrnfnl_ct_get_src (const struct nfnl_ct *ct, int repl)
 
struct nl_addrnfnl_ct_get_dst (const struct nfnl_ct *ct, int repl)
 
void nfnl_ct_set_src_port (struct nfnl_ct *ct, int repl, uint16_t port)
 
int nfnl_ct_test_src_port (const struct nfnl_ct *ct, int repl)
 
uint16_t nfnl_ct_get_src_port (const struct nfnl_ct *ct, int repl)
 
void nfnl_ct_set_dst_port (struct nfnl_ct *ct, int repl, uint16_t port)
 
int nfnl_ct_test_dst_port (const struct nfnl_ct *ct, int repl)
 
uint16_t nfnl_ct_get_dst_port (const struct nfnl_ct *ct, int repl)
 
void nfnl_ct_set_icmp_id (struct nfnl_ct *ct, int repl, uint16_t id)
 
int nfnl_ct_test_icmp_id (const struct nfnl_ct *ct, int repl)
 
uint16_t nfnl_ct_get_icmp_id (const struct nfnl_ct *ct, int repl)
 
void nfnl_ct_set_icmp_type (struct nfnl_ct *ct, int repl, uint8_t type)
 
int nfnl_ct_test_icmp_type (const struct nfnl_ct *ct, int repl)
 
uint8_t nfnl_ct_get_icmp_type (const struct nfnl_ct *ct, int repl)
 
void nfnl_ct_set_icmp_code (struct nfnl_ct *ct, int repl, uint8_t code)
 
int nfnl_ct_test_icmp_code (const struct nfnl_ct *ct, int repl)
 
uint8_t nfnl_ct_get_icmp_code (const struct nfnl_ct *ct, int repl)
 
void nfnl_ct_set_packets (struct nfnl_ct *ct, int repl, uint64_t packets)
 
int nfnl_ct_test_packets (const struct nfnl_ct *ct, int repl)
 
uint64_t nfnl_ct_get_packets (const struct nfnl_ct *ct, int repl)
 
void nfnl_ct_set_bytes (struct nfnl_ct *ct, int repl, uint64_t bytes)
 
int nfnl_ct_test_bytes (const struct nfnl_ct *ct, int repl)
 
uint64_t nfnl_ct_get_bytes (const struct nfnl_ct *ct, int repl)
 

Macro Definition Documentation

#define CT_DIFF (   ATTR,
  EXPR 
)    ATTR_DIFF(attrs, CT_ATTR_##ATTR, a, b, EXPR)
#define CT_DIFF_ADDR (   ATTR,
  FIELD 
)
Value:
? CT_DIFF(ATTR, nl_addr_cmp_prefix(a->FIELD, b->FIELD)) \
: CT_DIFF(ATTR, nl_addr_cmp(a->FIELD, b->FIELD)))
int nl_addr_cmp_prefix(struct nl_addr *, struct nl_addr *)
Compares the prefix of two abstract address objects.
Definition: addr.c:525
#define CT_DIFF(ATTR, EXPR)
static int struct nlattr enum ipset_adt adt u32 u32 flags
Definition: ip_set_hash_gen.h:1157
int nl_addr_cmp(struct nl_addr *, struct nl_addr *)
Compares two abstract address objects.
Definition: addr.c:503
#define CT_DIFF_VAL (   ATTR,
  FIELD 
)    CT_DIFF(ATTR, a->FIELD != b->FIELD)
#define PRINT_FLAG (   str)    { nl_dump(p, "%s%s", fp++ ? "," : "", (str)); }

Function Documentation

struct nfnl_ct* nfnl_ct_alloc ( void  )

References ct_obj_ops, and nl_object_alloc().

Referenced by nfnlmsg_ct_parse(), and nl_cli_ct_alloc().

Here is the call graph for this function:

Here is the caller graph for this function:

void nfnl_ct_get ( struct nfnl_ct ct)

References nl_object_get().

Here is the call graph for this function:

uint64_t nfnl_ct_get_bytes ( const struct nfnl_ct ct,
int  repl 
)
struct nl_addr* nfnl_ct_get_dst ( const struct nfnl_ct ct,
int  repl 
)
uint16_t nfnl_ct_get_dst_port ( const struct nfnl_ct ct,
int  repl 
)
uint8_t nfnl_ct_get_family ( const struct nfnl_ct ct)

References nfnl_ct::ct_family.

Referenced by nl_cli_ct_parse_dst(), and nl_cli_ct_parse_src().

Here is the caller graph for this function:

uint8_t nfnl_ct_get_icmp_code ( const struct nfnl_ct ct,
int  repl 
)
uint16_t nfnl_ct_get_icmp_id ( const struct nfnl_ct ct,
int  repl 
)
uint8_t nfnl_ct_get_icmp_type ( const struct nfnl_ct ct,
int  repl 
)
uint32_t nfnl_ct_get_id ( const struct nfnl_ct ct)

References nfnl_ct::ct_id.

uint32_t nfnl_ct_get_mark ( const struct nfnl_ct ct)

References nfnl_ct::ct_mark.

uint64_t nfnl_ct_get_packets ( const struct nfnl_ct ct,
int  repl 
)
uint8_t nfnl_ct_get_proto ( const struct nfnl_ct ct)

References nfnl_ct::ct_proto.

struct nl_addr* nfnl_ct_get_src ( const struct nfnl_ct ct,
int  repl 
)
uint16_t nfnl_ct_get_src_port ( const struct nfnl_ct ct,
int  repl 
)
uint32_t nfnl_ct_get_status ( const struct nfnl_ct ct)

References nfnl_ct::ct_status.

uint8_t nfnl_ct_get_tcp_state ( const struct nfnl_ct ct)
uint32_t nfnl_ct_get_timeout ( const struct nfnl_ct ct)

References nfnl_ct::ct_timeout.

uint32_t nfnl_ct_get_use ( const struct nfnl_ct ct)

References nfnl_ct::ct_use.

void nfnl_ct_put ( struct nfnl_ct ct)

References nl_object_put().

Referenced by nfnlmsg_ct_parse().

Here is the call graph for this function:

Here is the caller graph for this function:

void nfnl_ct_set_bytes ( struct nfnl_ct ct,
int  repl,
uint64_t  bytes 
)
int nfnl_ct_set_dst ( struct nfnl_ct ct,
int  repl,
struct nl_addr addr 
)

References nfnl_ct::ct_orig, nfnl_ct::ct_repl, and nfnl_ct_dir::dst.

Referenced by nl_cli_ct_parse_dst().

Here is the caller graph for this function:

void nfnl_ct_set_dst_port ( struct nfnl_ct ct,
int  repl,
uint16_t  port 
)

References nfnl_ct::ct_orig, nfnl_ct::ct_repl, nfnl_ct_proto::dst, nfnl_ct_proto::port, and nfnl_ct_dir::proto.

Referenced by nl_cli_ct_parse_dst_port().

Here is the caller graph for this function:

void nfnl_ct_set_family ( struct nfnl_ct ct,
uint8_t  family 
)

References nfnl_ct::ct_family.

Referenced by main(), nfnlmsg_ct_parse(), and nl_cli_ct_parse_family().

Here is the caller graph for this function:

void nfnl_ct_set_icmp_code ( struct nfnl_ct ct,
int  repl,
uint8_t  code 
)
void nfnl_ct_set_icmp_id ( struct nfnl_ct ct,
int  repl,
uint16_t  id 
)
void nfnl_ct_set_icmp_type ( struct nfnl_ct ct,
int  repl,
uint8_t  type 
)
void nfnl_ct_set_id ( struct nfnl_ct ct,
uint32_t  id 
)

References nfnl_ct::ct_id, and id.

Referenced by nfnlmsg_ct_parse(), and nl_cli_ct_parse_id().

Here is the caller graph for this function:

void nfnl_ct_set_mark ( struct nfnl_ct ct,
uint32_t  mark 
)

References nfnl_ct::ct_mark, and mark.

Referenced by nfnlmsg_ct_parse(), and nl_cli_ct_parse_mark().

Here is the caller graph for this function:

void nfnl_ct_set_packets ( struct nfnl_ct ct,
int  repl,
uint64_t  packets 
)
void nfnl_ct_set_proto ( struct nfnl_ct ct,
uint8_t  proto 
)

References nfnl_ct::ct_proto.

Referenced by nl_cli_ct_parse_protocol().

Here is the caller graph for this function:

int nfnl_ct_set_src ( struct nfnl_ct ct,
int  repl,
struct nl_addr addr 
)

References nfnl_ct::ct_orig, nfnl_ct::ct_repl, and nfnl_ct_dir::src.

Referenced by nl_cli_ct_parse_src().

Here is the caller graph for this function:

void nfnl_ct_set_src_port ( struct nfnl_ct ct,
int  repl,
uint16_t  port 
)

References nfnl_ct::ct_orig, nfnl_ct::ct_repl, nfnl_ct_proto::port, nfnl_ct_dir::proto, and nfnl_ct_proto::src.

Referenced by nl_cli_ct_parse_src_port().

Here is the caller graph for this function:

void nfnl_ct_set_status ( struct nfnl_ct ct,
uint32_t  status 
)

References nfnl_ct::ct_status, and nfnl_ct::ct_status_mask.

Referenced by nfnlmsg_ct_parse(), and nl_cli_ct_parse_status().

Here is the caller graph for this function:

void nfnl_ct_set_tcp_state ( struct nfnl_ct ct,
uint8_t  state 
)

References nfnl_ct::ct_protoinfo, state, nfnl_ct_protoinfo::state, and nfnl_ct_protoinfo::tcp.

Referenced by nl_cli_ct_parse_tcp_state().

Here is the caller graph for this function:

void nfnl_ct_set_timeout ( struct nfnl_ct ct,
uint32_t  timeout 
)

References nfnl_ct::ct_timeout, and timeout.

Referenced by nfnlmsg_ct_parse(), and nl_cli_ct_parse_timeout().

Here is the caller graph for this function:

void nfnl_ct_set_use ( struct nfnl_ct ct,
uint32_t  use 
)

References nfnl_ct::ct_use.

Referenced by nfnlmsg_ct_parse(), and nl_cli_ct_parse_use().

Here is the caller graph for this function:

char* nfnl_ct_status2str ( int  flags,
char *  buf,
size_t  len 
)

References __flags2str(), and ARRAY_SIZE.

Here is the call graph for this function:

int nfnl_ct_str2status ( const char *  name)

References __str2flags(), and ARRAY_SIZE.

Referenced by nl_cli_ct_parse_status().

Here is the call graph for this function:

Here is the caller graph for this function:

int nfnl_ct_str2tcp_state ( const char *  name)

References __str2type(), and ARRAY_SIZE.

Referenced by nl_cli_ct_parse_tcp_state().

Here is the call graph for this function:

Here is the caller graph for this function:

char* nfnl_ct_tcp_state2str ( uint8_t  state,
char *  buf,
size_t  len 
)

References __type2str(), and ARRAY_SIZE.

Here is the call graph for this function:

int nfnl_ct_test_bytes ( const struct nfnl_ct ct,
int  repl 
)
int nfnl_ct_test_dst_port ( const struct nfnl_ct ct,
int  repl 
)
int nfnl_ct_test_icmp_code ( const struct nfnl_ct ct,
int  repl 
)
int nfnl_ct_test_icmp_id ( const struct nfnl_ct ct,
int  repl 
)
int nfnl_ct_test_icmp_type ( const struct nfnl_ct ct,
int  repl 
)
int nfnl_ct_test_id ( const struct nfnl_ct ct)
int nfnl_ct_test_mark ( const struct nfnl_ct ct)
int nfnl_ct_test_packets ( const struct nfnl_ct ct,
int  repl 
)
int nfnl_ct_test_proto ( const struct nfnl_ct ct)
int nfnl_ct_test_src_port ( const struct nfnl_ct ct,
int  repl 
)
int nfnl_ct_test_tcp_state ( const struct nfnl_ct ct)
int nfnl_ct_test_timeout ( const struct nfnl_ct ct)
int nfnl_ct_test_use ( const struct nfnl_ct ct)
void nfnl_ct_unset_status ( struct nfnl_ct ct,
uint32_t  status 
)

Variable Documentation

struct nl_object_ops ct_obj_ops
Initial value:
= {
.oo_name = "netfilter/ct",
.oo_size = sizeof(struct nfnl_ct),
.oo_free_data = ct_free_data,
.oo_clone = ct_clone,
.oo_dump = {
[NL_DUMP_LINE] = ct_dump_line,
[NL_DUMP_DETAILS] = ct_dump_details,
[NL_DUMP_STATS] = ct_dump_stats,
},
.oo_compare = ct_compare,
.oo_attrs2str = ct_attrs2str,
}
Dump object briefly on one line.
Definition: types.h:22
Dump all attributes but no statistics.
Definition: types.h:23
Definition: netlink-types.h:745
Dump all attributes including statistics.
Definition: types.h:24

Referenced by nfnl_ct_alloc().