libnl  3.2.24-rc1
Abstract Data

Abstract data type representing a binary data blob. More...

General

struct nl_data * nl_data_alloc (void *buf, size_t size)
 Allocate a new abstract data object. More...
 
struct nl_data * nl_data_alloc_attr (struct nlattr *nla)
 Allocate abstract data object based on netlink attribute. More...
 
struct nl_data * nl_data_clone (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 (struct nl_data *data)
 Get data buffer of abstract data object. More...
 
size_t nl_data_get_size (struct nl_data *data)
 Get size of data buffer of abstract data object. More...
 

Misc

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

Detailed Description

Abstract data type representing a binary data blob.

Related sections in the development guide:

Header

#include <netlink/data.h>

Function Documentation

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

Allocate a new abstract data object.

Parameters
bufData buffer containing the actual data.
sizeSize 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

Definition at line 50 of file data.c.

Referenced by nl_data_alloc_attr(), nl_data_clone(), and rtnl_tc_data().

+ Here is the caller graph for this function:

struct nl_data* nl_data_alloc_attr ( struct nlattr *  nla)
read

Allocate abstract data object based on netlink attribute.

Parameters
nlaNetlink 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

Definition at line 84 of file data.c.

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

+ Here is the call graph for this function:

struct nl_data* nl_data_clone ( struct nl_data *  src)
read

Clone an abstract data object.

Parameters
srcAbstract data object
Returns
Cloned object or NULL

Definition at line 95 of file data.c.

References nl_data_alloc().

+ 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.

Parameters
dataAbstract data object.
bufData buffer containing the data to be appended.
sizeSize 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

Definition at line 111 of file data.c.

Referenced by rtnl_u32_add_key().

+ Here is the caller graph for this function:

void nl_data_free ( struct nl_data *  data)

Free an abstract data object.

Parameters
dataAbstract data object.

Definition at line 133 of file data.c.

void* nl_data_get ( struct nl_data *  data)

Get data buffer of abstract data object.

Parameters
dataAbstract data object.
Returns
Data buffer or NULL if empty.

Definition at line 153 of file data.c.

Referenced by nl_data_cmp(), nla_put_data(), and rtnl_tc_data().

+ Here is the caller graph for this function:

size_t nl_data_get_size ( struct nl_data *  data)

Get size of data buffer of abstract data object.

Parameters
dataAbstract data object.
Returns
Size of data buffer.

Definition at line 163 of file data.c.

Referenced by nl_data_cmp(), and nla_put_data().

+ Here is the caller graph for this function:

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

Compare two abstract data objects.

Parameters
aAbstract data object.
bAnother 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.

Definition at line 183 of file data.c.

References nl_data_get(), and nl_data_get_size().

+ Here is the call graph for this function: