struct nl_cache *<object name>_alloc_cache(struct nl_handle *handle)
These functions allocate a new cache for the own object type, initializes it properly and updates it to represent the current state of their master, e.g. a link cache would include all links currently configured in the kernel.
Some of the allocation functions may take additional arguments to further specify what will be part of the cache.
All such functions return a newly allocated cache or NULL in case of an error.
int <object name>_set_addr(struct nl_object *, struct nl_addr *)
All attribute functions avaiable for assigning addresses to objects take a struct nl_addr argument. The provided address object is validated against the address family of the object if known already. The assignment fails if the address families mismatch. In case the address family has not been specified yet, the address family of the new address is elected to be the new requirement.
The function will acquire a new reference on the address object before assignment, the caller is NOT responsible for this.
All functions return 0 on success or a negative error code.
char *<object name>_flags2str(int flags, char *buf, size_t len)
flags | Flags. | |
buf | Destination buffer. | |
len | Buffer length. |
int <object name>_str2flags(const char *name)
name | Name of flag. |
char *<object name>_<type>2str(int type, char *buf, size_t len)
type | Type as numeric value | |
buf | Destination buffer. | |
len | Buffer length. |
int <object name>_str2<type>(const char *name)
name | Name of identifier (type). |