Abstract data allocation based on netlink attribute

This commit is contained in:
Thomas Graf 2008-01-30 13:14:38 +01:00
parent 2e6ded94f4
commit 3607dbfa54
2 changed files with 16 additions and 0 deletions

View file

@ -22,6 +22,7 @@ struct nl_data;
/* General */
extern struct nl_data * nl_data_alloc(void *, size_t);
extern struct nl_data * nl_data_alloc_from_attr(struct nlattr *);
extern struct nl_data * nl_data_clone(struct nl_data *);
extern int nl_data_append(struct nl_data *, void *, size_t);
extern void nl_data_free(struct nl_data *);

View file

@ -60,6 +60,21 @@ errout:
return NULL;
}
/**
* Allocate abstract data object based on netlink attribute.
* @arg nla Netlink attribute of unspecific type.
*
* Allocates a new abstract data and copies the payload of the
* attribute to the abstract data object.
*
* @see nla_data_alloc
* @return Newly allocated data handle or NULL
*/
struct nl_data *nl_data_alloc_from_attr(struct nlattr *nla)
{
return nl_data_alloc(nla_data(nla), nla_len(nla));
}
/**
* Clone an abstract data object.
* @arg src Abstract data object