mirror of
https://gitee.com/openharmony/third_party_libnl
synced 2024-11-30 21:50:54 +00:00
Abstract address allocation based on netlink attribute
This commit is contained in:
parent
3607dbfa54
commit
0fa6756cca
@ -22,6 +22,7 @@ struct nl_addr;
|
||||
|
||||
/* Creation */
|
||||
extern struct nl_addr * nl_addr_alloc(size_t);
|
||||
extern struct nl_addr * nl_addr_alloc_from_attr(struct nlattr *, int);
|
||||
extern struct nl_addr * nl_addr_build(int, void *, size_t);
|
||||
extern struct nl_addr * nl_addr_parse(const char *, int);
|
||||
extern struct nl_addr * nl_addr_clone(struct nl_addr *);
|
||||
|
15
lib/addr.c
15
lib/addr.c
@ -202,6 +202,21 @@ struct nl_addr *nl_addr_build(int family, void *buf, size_t size)
|
||||
return addr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate abstract address based on netlink attribute.
|
||||
* @arg nla Netlink attribute of unspecific type.
|
||||
* @arg family Address family.
|
||||
*
|
||||
* Considers the netlink attribute payload a address of the specified
|
||||
* family and allocates a new abstract address based on it.
|
||||
*
|
||||
* @return Newly allocated address handle or NULL.
|
||||
*/
|
||||
struct nl_addr *nl_addr_alloc_from_attr(struct nlattr *nla, int family)
|
||||
{
|
||||
return nl_addr_build(family, nla_data(nla), nla_len(nla));
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate abstract address object based on a character string
|
||||
* @arg addrstr Address represented as character string.
|
||||
|
Loading…
Reference in New Issue
Block a user