/* 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 *);
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