libnl  3.2.24-rc1

Resolves Generic Netlink family names to numeric identifiers. More...

Modules

 Generic Netlink Family Object
 Object representing a kernel side registered Generic Netlink family.
 

Controller Cache

The controller cache allows to keep a local copy of the list of all kernel side registered Generic Netlink families to quickly resolve multiple Generic Netlink family names without requiring to communicate with the kernel for each resolving iteration.

int genl_ctrl_alloc_cache (struct nl_sock *sk, struct nl_cache **result)
 Allocate a new controller cache. More...
 
struct genl_family * genl_ctrl_search (struct nl_cache *cache, int id)
 Search controller cache for a numeric address match. More...
 
struct genl_family * genl_ctrl_search_by_name (struct nl_cache *cache, const char *name)
 Search controller cache for a family name match. More...
 

Direct Resolvers

These functions communicate directly with the kernel and do not require a cache to be kept up to date.

int genl_ctrl_resolve (struct nl_sock *sk, const char *name)
 Resolve Generic Netlink family name to numeric identifier. More...
 
int genl_ctrl_resolve_grp (struct nl_sock *sk, const char *family_name, const char *grp_name)
 Resolve Generic Netlink family group name. More...
 

Detailed Description

Resolves Generic Netlink family names to numeric identifiers.

The controller is a component in the kernel that resolves Generic Netlink family names to their numeric identifiers. This module provides functions to query the controller to access the resolving functionality.

Function Documentation

int genl_ctrl_alloc_cache ( struct nl_sock *  sk,
struct nl_cache **  result 
)

Allocate a new controller cache.

Parameters
skGeneric Netlink socket
resultPointer to store resulting cache

Allocates a new cache mirroring the state of the controller and stores it in *result. The allocated cache will contain a list of all currently registered kernel side Generic Netlink families. The cache is meant to be used to resolve family names locally.

Returns
0 on success or a negative error code.

Definition at line 333 of file ctrl.c.

References nl_cache_alloc_and_fill().

Referenced by genl_mngt_resolve(), and genl_ops_resolve().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

struct genl_family* genl_ctrl_search ( struct nl_cache *  cache,
int  id 
)
read

Search controller cache for a numeric address match.

Parameters
cacheController cache
idNumeric family identifier.

Searches a previously allocated controller cache and looks for an entry that matches the specified numeric family identifier id. If a match is found successfully, the reference count of the matching object is increased by one before the objet is returned.

See Also
genl_ctrl_alloc_cache()
genl_ctrl_search_by_name()
genl_family_put()
Returns
Generic Netlink family object or NULL if no match was found.

Definition at line 354 of file ctrl.c.

References nl_object_get().

+ Here is the call graph for this function:

struct genl_family* genl_ctrl_search_by_name ( struct nl_cache *  cache,
const char *  name 
)
read

Search controller cache for a family name match.

Parameters
cacheController cache
nameName of Generic Netlink family

Searches a previously allocated controller cache and looks for an entry that matches the specified family name. If a match is found successfully, the reference count of the matching object is increased by one before the objet is returned.

See Also
genl_ctrl_alloc_cache()
genl_ctrl_search()
genl_family_put()
Returns
Generic Netlink family object or NULL if no match was found.

Definition at line 387 of file ctrl.c.

References nl_object_get().

+ Here is the call graph for this function:

int genl_ctrl_resolve ( struct nl_sock *  sk,
const char *  name 
)

Resolve Generic Netlink family name to numeric identifier.

Parameters
skGeneric Netlink socket.
nameName of Generic Netlink family

Resolves the Generic Netlink family name to the corresponding numeric family identifier. This function queries the kernel directly, use genl_ctrl_search_by_name() if you need to resolve multiple names.

See Also
genl_ctrl_search_by_name()
Returns
The numeric family identifier or a negative error code.

Definition at line 429 of file ctrl.c.

References genl_family_get_id(), and genl_family_put().

+ Here is the call graph for this function:

int genl_ctrl_resolve_grp ( struct nl_sock *  sk,
const char *  family_name,
const char *  grp_name 
)

Resolve Generic Netlink family group name.

Parameters
skGeneric Netlink socket
family_nameName of Generic Netlink family
grp_nameName of group to resolve

Looks up the family object and resolves the group name to the numeric group identifier.

Returns
Numeric group identifier or a negative error code.

Definition at line 471 of file ctrl.c.

References genl_family_put().

+ Here is the call graph for this function: