netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
set.h File Reference
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <sys/types.h>
#include <libnftnl/common.h>
Include dependency graph for set.h:
This graph shows which files directly or indirectly include this file:

Macros

#define NFT_SET_ATTR_MAX   (__NFT_SET_ATTR_MAX - 1)
 
#define nft_set_nlmsg_build_hdr   nft_nlmsg_build_hdr
 
#define nft_set_elem_nlmsg_build_hdr   nft_nlmsg_build_hdr
 

Enumerations

enum  {
  NFT_SET_ATTR_TABLE,
  NFT_SET_ATTR_NAME,
  NFT_SET_ATTR_FLAGS,
  NFT_SET_ATTR_KEY_TYPE,
  NFT_SET_ATTR_KEY_LEN,
  NFT_SET_ATTR_DATA_TYPE,
  NFT_SET_ATTR_DATA_LEN,
  NFT_SET_ATTR_FAMILY,
  NFT_SET_ATTR_ID,
  NFT_SET_ATTR_POLICY,
  NFT_SET_ATTR_DESC_SIZE,
  __NFT_SET_ATTR_MAX
}
 
enum  {
  NFT_SET_ELEM_ATTR_FLAGS,
  NFT_SET_ELEM_ATTR_KEY,
  NFT_SET_ELEM_ATTR_VERDICT,
  NFT_SET_ELEM_ATTR_CHAIN,
  NFT_SET_ELEM_ATTR_DATA
}
 

Functions

struct nft_setnft_set_alloc (void)
 
void nft_set_free (struct nft_set *s)
 
bool nft_set_attr_is_set (const struct nft_set *s, uint16_t attr)
 
void nft_set_attr_unset (struct nft_set *s, uint16_t attr)
 
void nft_set_attr_set (struct nft_set *s, uint16_t attr, const void *data)
 
void nft_set_attr_set_data (struct nft_set *s, uint16_t attr, const void *data, uint32_t data_len)
 
void nft_set_attr_set_u32 (struct nft_set *s, uint16_t attr, uint32_t val)
 
void nft_set_attr_set_str (struct nft_set *s, uint16_t attr, const char *str)
 
const void * nft_set_attr_get (struct nft_set *s, uint16_t attr)
 
const void * nft_set_attr_get_data (struct nft_set *s, uint16_t attr, uint32_t *data_len)
 
const char * nft_set_attr_get_str (struct nft_set *s, uint16_t attr)
 
uint32_t nft_set_attr_get_u32 (struct nft_set *s, uint16_t attr)
 
void nft_set_nlmsg_build_payload (struct nlmsghdr *nlh, struct nft_set *s)
 
int nft_set_nlmsg_parse (const struct nlmsghdr *nlh, struct nft_set *s)
 
int nft_set_elems_nlmsg_parse (const struct nlmsghdr *nlh, struct nft_set *s)
 
int nft_set_snprintf (char *buf, size_t size, struct nft_set *s, uint32_t type, uint32_t flags)
 
int nft_set_fprintf (FILE *fp, struct nft_set *s, uint32_t type, uint32_t flags)
 
struct nft_set_listnft_set_list_alloc (void)
 
void nft_set_list_free (struct nft_set_list *list)
 
int nft_set_list_is_empty (struct nft_set_list *list)
 
void nft_set_list_add (struct nft_set *s, struct nft_set_list *list)
 
void nft_set_list_add_tail (struct nft_set *s, struct nft_set_list *list)
 
void nft_set_list_del (struct nft_set *s)
 
int nft_set_list_foreach (struct nft_set_list *set_list, int(*cb)(struct nft_set *t, void *data), void *data)
 
struct nft_set_list_iternft_set_list_iter_create (struct nft_set_list *l)
 
struct nft_setnft_set_list_iter_cur (struct nft_set_list_iter *iter)
 
struct nft_setnft_set_list_iter_next (struct nft_set_list_iter *iter)
 
void nft_set_list_iter_destroy (struct nft_set_list_iter *iter)
 
int nft_set_parse (struct nft_set *s, enum nft_parse_type type, const char *data, struct nft_parse_err *err)
 
int nft_set_parse_file (struct nft_set *s, enum nft_parse_type type, FILE *fp, struct nft_parse_err *err)
 
struct nft_set_elemnft_set_elem_alloc (void)
 
void nft_set_elem_free (struct nft_set_elem *s)
 
void nft_set_elem_add (struct nft_set *s, struct nft_set_elem *elem)
 
void nft_set_elem_attr_unset (struct nft_set_elem *s, uint16_t attr)
 
void nft_set_elem_attr_set (struct nft_set_elem *s, uint16_t attr, const void *data, uint32_t data_len)
 
void nft_set_elem_attr_set_u32 (struct nft_set_elem *s, uint16_t attr, uint32_t val)
 
void nft_set_elem_attr_set_str (struct nft_set_elem *s, uint16_t attr, const char *str)
 
const void * nft_set_elem_attr_get (struct nft_set_elem *s, uint16_t attr, uint32_t *data_len)
 
const char * nft_set_elem_attr_get_str (struct nft_set_elem *s, uint16_t attr)
 
uint32_t nft_set_elem_attr_get_u32 (struct nft_set_elem *s, uint16_t attr)
 
bool nft_set_elem_attr_is_set (const struct nft_set_elem *s, uint16_t attr)
 
void nft_set_elems_nlmsg_build_payload (struct nlmsghdr *nlh, struct nft_set *s)
 
void nft_set_elem_nlmsg_build_payload (struct nlmsghdr *nlh, struct nft_set_elem *e)
 
int nft_set_elem_parse (struct nft_set_elem *e, enum nft_parse_type type, const char *data, struct nft_parse_err *err)
 
int nft_set_elem_parse_file (struct nft_set_elem *e, enum nft_parse_type type, FILE *fp, struct nft_parse_err *err)
 
int nft_set_elem_snprintf (char *buf, size_t size, struct nft_set_elem *s, uint32_t type, uint32_t flags)
 
int nft_set_elem_fprintf (FILE *fp, struct nft_set_elem *se, uint32_t type, uint32_t flags)
 
int nft_set_elem_foreach (struct nft_set *s, int(*cb)(struct nft_set_elem *e, void *data), void *data)
 
struct nft_set_elems_iternft_set_elems_iter_create (struct nft_set *s)
 
struct nft_set_elemnft_set_elems_iter_cur (struct nft_set_elems_iter *iter)
 
struct nft_set_elemnft_set_elems_iter_next (struct nft_set_elems_iter *iter)
 
void nft_set_elems_iter_destroy (struct nft_set_elems_iter *iter)
 
int nft_set_elems_nlmsg_build_payload_iter (struct nlmsghdr *nlh, struct nft_set_elems_iter *iter)
 

Macro Definition Documentation

#define NFT_SET_ATTR_MAX   (__NFT_SET_ATTR_MAX - 1)

Referenced by nft_set_attr_set_data().

Enumeration Type Documentation

anonymous enum
Enumerator
NFT_SET_ATTR_TABLE 
NFT_SET_ATTR_NAME 
NFT_SET_ATTR_FLAGS 
NFT_SET_ATTR_KEY_TYPE 
NFT_SET_ATTR_KEY_LEN 
NFT_SET_ATTR_DATA_TYPE 
NFT_SET_ATTR_DATA_LEN 
NFT_SET_ATTR_FAMILY 
NFT_SET_ATTR_ID 
NFT_SET_ATTR_POLICY 
NFT_SET_ATTR_DESC_SIZE 
__NFT_SET_ATTR_MAX 
anonymous enum
Enumerator
NFT_SET_ELEM_ATTR_FLAGS 
NFT_SET_ELEM_ATTR_KEY 
NFT_SET_ELEM_ATTR_VERDICT 
NFT_SET_ELEM_ATTR_CHAIN 
NFT_SET_ELEM_ATTR_DATA 

Function Documentation

struct nft_set* nft_set_alloc ( void  )

References nft_set::element_list, INIT_LIST_HEAD, NULL, and s.

Referenced by alloc_nft_set(), mnl_nft_set_dump(), and mnl_set_dump().

Here is the caller graph for this function:

const void* nft_set_attr_get ( struct nft_set s,
uint16_t  attr 
)

References nft_set_attr_get_data().

Referenced by nft_set_attr_get_str().

Here is the call graph for this function:

Here is the caller graph for this function:

const char* nft_set_attr_get_str ( struct nft_set s,
uint16_t  attr 
)

References nft_set_attr_get().

Here is the call graph for this function:

uint32_t nft_set_attr_get_u32 ( struct nft_set s,
uint16_t  attr 
)
bool nft_set_attr_is_set ( const struct nft_set s,
uint16_t  attr 
)

References nft_set::flags.

void nft_set_attr_set ( struct nft_set s,
uint16_t  attr,
const void *  data 
)

References nft_set_attr_set_data().

Referenced by mnl_nft_set_dump(), mnl_set_dump(), nft_set_attr_set_str(), and nft_set_attr_set_u32().

Here is the call graph for this function:

Here is the caller graph for this function:

void nft_set_attr_set_str ( struct nft_set s,
uint16_t  attr,
const char *  str 
)

References nft_set_attr_set().

Referenced by alloc_nft_set().

Here is the call graph for this function:

Here is the caller graph for this function:

void nft_set_attr_set_u32 ( struct nft_set s,
uint16_t  attr,
uint32_t  val 
)

References nft_set_attr_set().

Referenced by alloc_nft_set().

Here is the call graph for this function:

Here is the caller graph for this function:

void nft_set_elem_add ( struct nft_set s,
struct nft_set_elem elem 
)
struct nft_set_elem* nft_set_elem_alloc ( void  )

References NULL, and s.

const char* nft_set_elem_attr_get_str ( struct nft_set_elem s,
uint16_t  attr 
)

References nft_set_elem_attr_get(), and size.

Here is the call graph for this function:

uint32_t nft_set_elem_attr_get_u32 ( struct nft_set_elem s,
uint16_t  attr 
)

References nft_set_elem_attr_get(), and size.

Here is the call graph for this function:

bool nft_set_elem_attr_is_set ( const struct nft_set_elem s,
uint16_t  attr 
)

References nft_set_elem::flags.

void nft_set_elem_attr_set_str ( struct nft_set_elem s,
uint16_t  attr,
const char *  str 
)

References nft_set_elem_attr_set().

Here is the call graph for this function:

void nft_set_elem_attr_set_u32 ( struct nft_set_elem s,
uint16_t  attr,
uint32_t  val 
)

References nft_set_elem_attr_set().

Here is the call graph for this function:

int nft_set_elem_foreach ( struct nft_set s,
int(*)(struct nft_set_elem *e, void *data cb,
void *  data 
)

References nft_set::element_list, nft_set_elem::head, and list_for_each_entry.

Referenced by netlink_get_setelems().

Here is the caller graph for this function:

int nft_set_elem_fprintf ( FILE *  fp,
struct nft_set_elem se,
uint32_t  type,
uint32_t  flags 
)

References nft_fprintf().

Here is the call graph for this function:

void nft_set_elem_free ( struct nft_set_elem s)

References nft_data_reg::chain, nft_set_elem::data, nft_set_elem::flags, NFT_SET_ELEM_ATTR_CHAIN, NULL, and xfree.

Referenced by nft_set_free().

Here is the caller graph for this function:

int nft_set_elem_parse ( struct nft_set_elem e,
enum nft_parse_type  type,
const char *  data,
struct nft_parse_err err 
)

References NFT_PARSE_BUFFER.

int nft_set_elem_parse_file ( struct nft_set_elem e,
enum nft_parse_type  type,
FILE *  fp,
struct nft_parse_err err 
)

References NFT_PARSE_FILE.

int nft_set_elem_snprintf ( char *  buf,
size_t  size,
struct nft_set_elem s,
uint32_t  type,
uint32_t  flags 
)
struct nft_set_elems_iter* nft_set_elems_iter_create ( struct nft_set s)
struct nft_set_elem* nft_set_elems_iter_cur ( struct nft_set_elems_iter iter)
void nft_set_elems_iter_destroy ( struct nft_set_elems_iter iter)

References xfree.

Referenced by mnl_nft_setelem_add(), and mnl_nft_setelem_batch_add().

Here is the caller graph for this function:

struct nft_set_elem* nft_set_elems_iter_next ( struct nft_set_elems_iter iter)

References nft_set_elems_iter::cur, nft_set_elem::head, nft_set_elems_iter::list, list_entry, list_head::next, NULL, and s.

Referenced by nft_set_elems_nlmsg_build_payload_iter().

Here is the caller graph for this function:

void nft_set_elems_nlmsg_build_payload ( struct nlmsghdr nlh,
struct nft_set s 
)

References nft_set::element_list, list_for_each_entry, mnl_attr_nest_end(), mnl_attr_nest_start(), and NFTA_SET_ELEM_LIST_ELEMENTS.

Referenced by mnl_nft_setelem_batch_del(), and mnl_nft_setelem_delete().

Here is the call graph for this function:

Here is the caller graph for this function:

int nft_set_elems_nlmsg_build_payload_iter ( struct nlmsghdr nlh,
struct nft_set_elems_iter iter 
)
int nft_set_fprintf ( FILE *  fp,
struct nft_set s,
uint32_t  type,
uint32_t  flags 
)

References nft_fprintf().

Here is the call graph for this function:

void nft_set_free ( struct nft_set s)

References nft_set::element_list, nft_set_elem::head, list_for_each_entry_safe, nft_set::name, nft_set_elem_free(), NULL, nft_set::table, and xfree.

Referenced by mnl_nft_set_dump(), mnl_set_dump(), netlink_get_set(), netlink_get_setelems(), and nft_set_list_free().

Here is the call graph for this function:

Here is the caller graph for this function:

void nft_set_list_add ( struct nft_set s,
struct nft_set_list list 
)
void nft_set_list_add_tail ( struct nft_set s,
struct nft_set_list list 
)
struct nft_set_list* nft_set_list_alloc ( void  )

References INIT_LIST_HEAD, nft_set_list::list, and NULL.

Referenced by mnl_nft_set_dump(), mnl_ruleset_dump(), and mnl_set_dump().

Here is the caller graph for this function:

void nft_set_list_del ( struct nft_set s)

References nft_set::head.

int nft_set_list_foreach ( struct nft_set_list set_list,
int(*)(struct nft_set *t, void *data cb,
void *  data 
)

References nft_set::head, nft_set_list::list, and list_for_each_entry_safe.

Referenced by netlink_list_sets().

Here is the caller graph for this function:

void nft_set_list_free ( struct nft_set_list list)

References nft_set::head, nft_set_list::list, list_for_each_entry_safe, nft_set_free(), s, and xfree.

Referenced by mnl_nft_set_dump(), mnl_set_dump(), netlink_list_sets(), nft_ruleset_attr_unset(), and nft_ruleset_free().

Here is the call graph for this function:

Here is the caller graph for this function:

int nft_set_list_is_empty ( struct nft_set_list list)

References nft_set_list::list.

Referenced by nft_ruleset_fprintf().

Here is the caller graph for this function:

struct nft_set_list_iter* nft_set_list_iter_create ( struct nft_set_list l)

References nft_set_list_iter::cur, nft_set_list_iter::list, nft_set_list::list, list_entry, list_head::next, and NULL.

Referenced by mnl_nft_ruleset_dump().

Here is the caller graph for this function:

struct nft_set* nft_set_list_iter_cur ( struct nft_set_list_iter iter)
void nft_set_list_iter_destroy ( struct nft_set_list_iter iter)

References xfree.

Referenced by mnl_nft_ruleset_dump().

Here is the caller graph for this function:

struct nft_set* nft_set_list_iter_next ( struct nft_set_list_iter iter)

References nft_set_list_iter::cur, nft_set::head, nft_set_list_iter::list, nft_set_list::list, list_entry, list_head::next, NULL, and s.

Referenced by mnl_nft_ruleset_dump().

Here is the caller graph for this function:

int nft_set_parse ( struct nft_set s,
enum nft_parse_type  type,
const char *  data,
struct nft_parse_err err 
)

References NFT_PARSE_BUFFER.

int nft_set_parse_file ( struct nft_set s,
enum nft_parse_type  type,
FILE *  fp,
struct nft_parse_err err 
)

References NFT_PARSE_FILE.

int nft_set_snprintf ( char *  buf,
size_t  size,
struct nft_set s,
uint32_t  type,
uint32_t  flags 
)

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

Referenced by netlink_dump_set().

Here is the call graph for this function:

Here is the caller graph for this function: