netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Abstract Data
Collaboration diagram for Abstract Data:

General

struct nl_datanl_data_alloc (const void *buf, size_t size)
 Allocate a new abstract data object. More...
 
struct nl_datanl_data_alloc_attr (const struct nlattr *nla)
 Allocate abstract data object based on netlink attribute. More...
 
struct nl_datanl_data_clone (const struct nl_data *src)
 Clone an abstract data object. More...
 
int nl_data_append (struct nl_data *data, void *buf, size_t size)
 Append data to an abstract data object. More...
 
void nl_data_free (struct nl_data *data)
 Free an abstract data object. More...
 

Attribute Access

void * nl_data_get (const struct nl_data *data)
 Get data buffer of abstract data object. More...
 
size_t nl_data_get_size (const struct nl_data *data)
 Get size of data buffer of abstract data object. More...
 

Misc

int nl_data_cmp (const struct nl_data *a, const struct nl_data *b)
 Compare two abstract data objects. More...
 

Detailed Description

Function Documentation

struct nl_data* nl_data_alloc ( const void *  buf,
size_t  size 
)

Allocate a new abstract data object.

  • buf Data buffer containing the actual data.
  • size Size of data buffer.

Allocates a new abstract data and copies the specified data buffer into the new handle.

Returns
Newly allocated data handle or NULL

References nl_data::d_data, nl_data::d_size, data, NULL, and size.

Referenced by nfnl_nft_chain_set_name(), nfnl_nft_chain_set_table(), nfnl_nft_rule_set_chain(), nfnl_nft_rule_set_table(), nfnl_nft_set_set_name(), nfnl_nft_set_set_table(), nfnl_nft_table_set_name(), nl_data_alloc_attr(), nl_data_clone(), and rtnl_cls_data().

Here is the caller graph for this function:

struct nl_data* nl_data_alloc_attr ( const struct nlattr nla)

Allocate abstract data object based on netlink attribute.

  • nla Netlink attribute of unspecific type.

Allocates a new abstract data and copies the payload of the attribute to the abstract data object.

See also
nla_data_alloc
Returns
Newly allocated data handle or NULL

References nl_data_alloc(), nla_data(), and nla_len().

Here is the call graph for this function:

int nl_data_append ( struct nl_data data,
void *  buf,
size_t  size 
)

Append data to an abstract data object.

  • data Abstract data object.
  • buf Data buffer containing the data to be appended.
  • size Size of data to be apppended.

Reallocates an abstract data and copies the specified data buffer into the new handle.

Returns
0 on success or a negative error code

References BUG, nl_data::d_data, nl_data::d_size, NLE_NOMEM, and size.

Referenced by rtnl_u32_add_key().

Here is the caller graph for this function:

struct nl_data* nl_data_clone ( const struct nl_data src)

Clone an abstract data object.

  • src Abstract data object
Returns
Cloned object or NULL

References nl_data::d_data, nl_data::d_size, and nl_data_alloc().

Here is the call graph for this function:

int nl_data_cmp ( const struct nl_data a,
const struct nl_data b 
)

Compare two abstract data objects.

  • a Abstract data object.
  • b Another abstract data object.
    Returns
    An integer less than, equal to, or greater than zero if a is found, respectively, to be less than, to match, or be greater than b.

References nl_data_get(), and nl_data_get_size().

Here is the call graph for this function:

void nl_data_free ( struct nl_data data)

Free an abstract data object.

  • data Abstract data object.

References nl_data::d_data.

Referenced by nfnl_nft_chain_set_name(), nfnl_nft_chain_set_table(), nfnl_nft_rule_set_chain(), nfnl_nft_rule_set_table(), nfnl_nft_set_set_name(), nfnl_nft_set_set_table(), and nfnl_nft_table_set_name().

Here is the caller graph for this function:

void* nl_data_get ( const struct nl_data data)

Get data buffer of abstract data object.

  • data Abstract data object.
    Returns
    Data buffer or NULL if empty.

References nl_data::d_data, nl_data::d_size, and NULL.

Referenced by nfnl_nft_chain_get_name(), nfnl_nft_chain_get_table(), nfnl_nft_rule_get_chain(), nfnl_nft_rule_get_table(), nfnl_nft_set_get_name(), nfnl_nft_set_get_table(), nfnl_nft_table_get_name(), nl_data_cmp(), nla_put_data(), and rtnl_cls_data().

Here is the caller graph for this function:

size_t nl_data_get_size ( const struct nl_data data)

Get size of data buffer of abstract data object.

  • data Abstract data object.
    Returns
    Size of data buffer.

References nl_data::d_size.

Referenced by nl_data_cmp(), and nla_put_data().

Here is the caller graph for this function: