24#include <netlink-private/netlink.h>
25#include <netlink/netlink.h>
26#include <netlink/utils.h>
27#include <linux/socket.h>
48 data = calloc(1,
sizeof(*data));
52 data->d_data = calloc(1, size);
61 memcpy(data->d_data, buf, size);
108 char *d_data = realloc(data->d_data, data->d_size + size);
113 memcpy(d_data + data->d_size, buf, size);
115 memset(d_data + data->d_size, 0, size);
117 data->d_data = d_data;
118 data->d_size += size;
150 if (data->d_size > 0)
151 return (
void*)data->d_data;
void * nla_data(const struct nlattr *nla)
Return pointer to the payload section.
int nla_len(const struct nlattr *nla)
Return length of the payload .
struct nl_data * nl_data_clone(const struct nl_data *src)
Clone an abstract data object.
void nl_data_free(struct nl_data *data)
Free an abstract data object.
int nl_data_append(struct nl_data *data, const void *buf, size_t size)
Append data to an abstract data object.
struct nl_data * nl_data_alloc(const void *buf, size_t size)
Allocate a new abstract data object.
size_t nl_data_get_size(const struct nl_data *data)
Get size of data buffer of abstract data object.
struct nl_data * nl_data_alloc_attr(const struct nlattr *nla)
Allocate abstract data object based on netlink attribute.
void * nl_data_get(const struct nl_data *data)
Get data buffer of abstract data object.
int nl_data_cmp(const struct nl_data *a, const struct nl_data *b)
Compare two abstract data objects.