netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
table.c File Reference
#include "internal.h"
#include <time.h>
#include <endian.h>
#include <stdint.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <netinet/in.h>
#include <errno.h>
#include <libmnl/libmnl.h>
#include <linux/netfilter/nfnetlink.h>
#include <linux/netfilter/nf_tables.h>
#include <libnftnl/table.h>
#include <buffer.h>
Include dependency graph for table.c:

Data Structures

struct  nft_table
 
struct  nft_table_list
 
struct  nft_table_list_iter
 

Functions

struct nft_tablenft_table_alloc (void)
 
 EXPORT_SYMBOL (nft_table_alloc)
 
void nft_table_free (struct nft_table *t)
 
 EXPORT_SYMBOL (nft_table_free)
 
bool nft_table_attr_is_set (const struct nft_table *t, uint16_t attr)
 
 EXPORT_SYMBOL (nft_table_attr_is_set)
 
void nft_table_attr_unset (struct nft_table *t, uint16_t attr)
 
 EXPORT_SYMBOL (nft_table_attr_unset)
 
void nft_table_attr_set_data (struct nft_table *t, uint16_t attr, const void *data, uint32_t data_len)
 
 EXPORT_SYMBOL (nft_table_attr_set_data)
 
void nft_table_attr_set (struct nft_table *t, uint16_t attr, const void *data)
 
 EXPORT_SYMBOL (nft_table_attr_set)
 
void nft_table_attr_set_u32 (struct nft_table *t, uint16_t attr, uint32_t val)
 
 EXPORT_SYMBOL (nft_table_attr_set_u32)
 
void nft_table_attr_set_u8 (struct nft_table *t, uint16_t attr, uint8_t val)
 
 EXPORT_SYMBOL (nft_table_attr_set_u8)
 
void nft_table_attr_set_str (struct nft_table *t, uint16_t attr, const char *str)
 
 EXPORT_SYMBOL (nft_table_attr_set_str)
 
const void * nft_table_attr_get_data (struct nft_table *t, uint16_t attr, uint32_t *data_len)
 
 EXPORT_SYMBOL (nft_table_attr_get_data)
 
const void * nft_table_attr_get (struct nft_table *t, uint16_t attr)
 
 EXPORT_SYMBOL (nft_table_attr_get)
 
uint32_t nft_table_attr_get_u32 (struct nft_table *t, uint16_t attr)
 
 EXPORT_SYMBOL (nft_table_attr_get_u32)
 
uint8_t nft_table_attr_get_u8 (struct nft_table *t, uint16_t attr)
 
 EXPORT_SYMBOL (nft_table_attr_get_u8)
 
const char * nft_table_attr_get_str (struct nft_table *t, uint16_t attr)
 
 EXPORT_SYMBOL (nft_table_attr_get_str)
 
void nft_table_nlmsg_build_payload (struct nlmsghdr *nlh, const struct nft_table *t)
 
 EXPORT_SYMBOL (nft_table_nlmsg_build_payload)
 
int nft_table_nlmsg_parse (const struct nlmsghdr *nlh, struct nft_table *t)
 
 EXPORT_SYMBOL (nft_table_nlmsg_parse)
 
int nft_table_parse (struct nft_table *t, enum nft_parse_type type, const char *data, struct nft_parse_err *err)
 
 EXPORT_SYMBOL (nft_table_parse)
 
int nft_table_parse_file (struct nft_table *t, enum nft_parse_type type, FILE *fp, struct nft_parse_err *err)
 
 EXPORT_SYMBOL (nft_table_parse_file)
 
int nft_table_snprintf (char *buf, size_t size, struct nft_table *t, uint32_t type, uint32_t flags)
 
 EXPORT_SYMBOL (nft_table_snprintf)
 
int nft_table_fprintf (FILE *fp, struct nft_table *t, uint32_t type, uint32_t flags)
 
 EXPORT_SYMBOL (nft_table_fprintf)
 
struct nft_table_listnft_table_list_alloc (void)
 
 EXPORT_SYMBOL (nft_table_list_alloc)
 
void nft_table_list_free (struct nft_table_list *list)
 
 EXPORT_SYMBOL (nft_table_list_free)
 
int nft_table_list_is_empty (struct nft_table_list *list)
 
 EXPORT_SYMBOL (nft_table_list_is_empty)
 
void nft_table_list_add (struct nft_table *r, struct nft_table_list *list)
 
 EXPORT_SYMBOL (nft_table_list_add)
 
void nft_table_list_add_tail (struct nft_table *r, struct nft_table_list *list)
 
 EXPORT_SYMBOL (nft_table_list_add_tail)
 
void nft_table_list_del (struct nft_table *t)
 
 EXPORT_SYMBOL (nft_table_list_del)
 
int nft_table_list_foreach (struct nft_table_list *table_list, int(*cb)(struct nft_table *t, void *data), void *data)
 
 EXPORT_SYMBOL (nft_table_list_foreach)
 
struct nft_table_list_iternft_table_list_iter_create (struct nft_table_list *l)
 
 EXPORT_SYMBOL (nft_table_list_iter_create)
 
struct nft_tablenft_table_list_iter_next (struct nft_table_list_iter *iter)
 
 EXPORT_SYMBOL (nft_table_list_iter_next)
 
void nft_table_list_iter_destroy (struct nft_table_list_iter *iter)
 
 EXPORT_SYMBOL (nft_table_list_iter_destroy)
 

Function Documentation

EXPORT_SYMBOL ( nft_table_alloc  )
EXPORT_SYMBOL ( nft_table_free  )
EXPORT_SYMBOL ( nft_table_attr_is_set  )
EXPORT_SYMBOL ( nft_table_attr_unset  )
EXPORT_SYMBOL ( nft_table_attr_set_data  )
EXPORT_SYMBOL ( nft_table_attr_set  )
EXPORT_SYMBOL ( nft_table_attr_set_u32  )
EXPORT_SYMBOL ( nft_table_attr_set_u8  )
EXPORT_SYMBOL ( nft_table_attr_set_str  )
EXPORT_SYMBOL ( nft_table_attr_get_data  )
EXPORT_SYMBOL ( nft_table_attr_get  )
EXPORT_SYMBOL ( nft_table_attr_get_u32  )
EXPORT_SYMBOL ( nft_table_attr_get_u8  )
EXPORT_SYMBOL ( nft_table_attr_get_str  )
EXPORT_SYMBOL ( nft_table_nlmsg_build_payload  )
EXPORT_SYMBOL ( nft_table_nlmsg_parse  )
EXPORT_SYMBOL ( nft_table_parse  )
EXPORT_SYMBOL ( nft_table_parse_file  )
EXPORT_SYMBOL ( nft_table_snprintf  )
EXPORT_SYMBOL ( nft_table_fprintf  )
EXPORT_SYMBOL ( nft_table_list_alloc  )
EXPORT_SYMBOL ( nft_table_list_free  )
EXPORT_SYMBOL ( nft_table_list_is_empty  )
EXPORT_SYMBOL ( nft_table_list_add  )
EXPORT_SYMBOL ( nft_table_list_add_tail  )
EXPORT_SYMBOL ( nft_table_list_del  )
EXPORT_SYMBOL ( nft_table_list_foreach  )
EXPORT_SYMBOL ( nft_table_list_iter_create  )
EXPORT_SYMBOL ( nft_table_list_iter_next  )
EXPORT_SYMBOL ( nft_table_list_iter_destroy  )
struct nft_table* nft_table_alloc ( void  )

Referenced by alloc_nft_table().

Here is the caller graph for this function:

const void* nft_table_attr_get ( struct nft_table t,
uint16_t  attr 
)

References nft_table_attr_get_data().

Referenced by nft_for_each_table(), nft_table_attr_get_str(), nft_table_attr_get_u32(), nft_table_attr_get_u8(), nft_table_find(), and nft_xtables_config_load().

Here is the call graph for this function:

Here is the caller graph for this function:

const void* nft_table_attr_get_data ( struct nft_table t,
uint16_t  attr,
uint32_t *  data_len 
)
const char* nft_table_attr_get_str ( struct nft_table t,
uint16_t  attr 
)

References nft_table_attr_get().

Referenced by mnl_ruleset_dump().

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t nft_table_attr_get_u32 ( struct nft_table t,
uint16_t  attr 
)

References nft_table_attr_get(), and NULL.

Referenced by mnl_nft_table_add(), mnl_nft_table_batch_add(), mnl_nft_table_batch_del(), mnl_nft_table_delete(), mnl_nft_table_get(), mnl_ruleset_dump(), and nft_xtables_config_load().

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t nft_table_attr_get_u8 ( struct nft_table t,
uint16_t  attr 
)

References nft_table_attr_get(), and NULL.

Here is the call graph for this function:

bool nft_table_attr_is_set ( const struct nft_table t,
uint16_t  attr 
)

References nft_table::flags.

void nft_table_attr_set ( struct nft_table t,
uint16_t  attr,
const void *  data 
)

References nft_table_attr_set_data().

Referenced by alloc_nft_table().

Here is the call graph for this function:

Here is the caller graph for this function:

void nft_table_attr_set_data ( struct nft_table t,
uint16_t  attr,
const void *  data,
uint32_t  data_len 
)
void nft_table_attr_set_str ( struct nft_table t,
uint16_t  attr,
const char *  str 
)

References nft_table_attr_set_data().

Here is the call graph for this function:

void nft_table_attr_set_u32 ( struct nft_table t,
uint16_t  attr,
uint32_t  val 
)

References nft_table_attr_set_data().

Referenced by alloc_nft_table().

Here is the call graph for this function:

Here is the caller graph for this function:

void nft_table_attr_set_u8 ( struct nft_table t,
uint16_t  attr,
uint8_t  val 
)

References nft_table_attr_set_data().

Here is the call graph for this function:

void nft_table_attr_unset ( struct nft_table t,
uint16_t  attr 
)
int nft_table_fprintf ( FILE *  fp,
struct nft_table t,
uint32_t  type,
uint32_t  flags 
)

References nft_fprintf().

Here is the call graph for this function:

void nft_table_free ( struct nft_table t)

References nft_table::flags, nft_table::name, NFT_TABLE_ATTR_NAME, and xfree.

Referenced by netlink_flush_ruleset(), netlink_get_table(), nft_table_add(), and nft_table_list_free().

Here is the caller graph for this function:

void nft_table_list_add ( struct nft_table r,
struct nft_table_list list 
)
void nft_table_list_add_tail ( struct nft_table r,
struct nft_table_list list 
)
struct nft_table_list* nft_table_list_alloc ( void  )

References INIT_LIST_HEAD, nft_table_list::list, and NULL.

Referenced by mnl_nft_table_dump(), mnl_table_dump(), and nft_xtables_config_load().

Here is the caller graph for this function:

void nft_table_list_del ( struct nft_table t)

References nft_table::head.

int nft_table_list_foreach ( struct nft_table_list table_list,
int(*)(struct nft_table *t, void *data cb,
void *  data 
)

References nft_table::head, nft_table_list::list, and list_for_each_entry_safe.

Referenced by netlink_list_tables().

Here is the caller graph for this function:

void nft_table_list_free ( struct nft_table_list list)
int nft_table_list_is_empty ( struct nft_table_list list)

References nft_table_list::list.

Referenced by nft_ruleset_fprintf().

Here is the caller graph for this function:

void nft_table_list_iter_destroy ( struct nft_table_list_iter iter)

References xfree.

Referenced by mnl_ruleset_dump(), and nft_xtables_config_load().

Here is the caller graph for this function:

void nft_table_nlmsg_build_payload ( struct nlmsghdr nlh,
const struct nft_table t 
)
int nft_table_parse ( struct nft_table t,
enum nft_parse_type  type,
const char *  data,
struct nft_parse_err err 
)

References NFT_PARSE_BUFFER.

int nft_table_parse_file ( struct nft_table t,
enum nft_parse_type  type,
FILE *  fp,
struct nft_parse_err err 
)

References NFT_PARSE_FILE.

int nft_table_snprintf ( char *  buf,
size_t  size,
struct nft_table t,
uint32_t  type,
uint32_t  flags 
)

References len, nft_event_footer_snprintf(), nft_event_header_snprintf(), NFT_OUTPUT_DEFAULT, NFT_OUTPUT_JSON, NFT_OUTPUT_XML, size, and SNPRINTF_BUFFER_SIZE.

Referenced by netlink_dump_table(), and nft_table_add().

Here is the call graph for this function:

Here is the caller graph for this function: