libnl  3.2.11
Family and Command Registration

Registering Generic Netlink Families and Commands. More...


Detailed Description

Registering Generic Netlink Families and Commands.

Data Structures

struct  genl_info
 Informative structure passed on to message parser callbacks. More...
struct  genl_cmd
 Definition of a Generic Netlink command. More...
struct  genl_ops
 Definition of a Generic Netlink family. More...

Registration

int genl_register_family (struct genl_ops *ops)
 Register Generic Netlink family and associated commands.
int genl_unregister_family (struct genl_ops *ops)
 Unregister Generic Netlink family.
int genl_handle_msg (struct nl_msg *msg, void *arg)
 Run a received message through the demultiplexer.

Registration of Cache Operations

int genl_register (struct nl_cache_ops *ops)
 Register Generic Netlink family backed cache.
void genl_unregister (struct nl_cache_ops *ops)
 Unregister cache based Generic Netlink family.

Resolving the name of registered families

int genl_ops_resolve (struct nl_sock *sk, struct genl_ops *ops)
 Resolve a single Generic Netlink family.
int genl_mngt_resolve (struct nl_sock *sk)
 Resolve all registered Generic Netlink families.

Function Documentation

int genl_register_family ( struct genl_ops ops)

Register Generic Netlink family and associated commands.

Parameters:
opsGeneric Netlink family definition

Registers the specified Generic Netlink family definition together with all associated commands. After registration, received Generic Netlink messages can be passed to genl_handle_msg() which will validate the messages, look for a matching command and call the respective callback function automatically.

Note:
Consider using genl_register() if the family is used to implement a cacheable type.
See also:
genl_unregister_family();
genl_register();
Returns:
0 on success or a negative error code.

Definition at line 164 of file mngt.c.

References genl_ops::o_cmds, genl_ops::o_id, genl_ops::o_list, genl_ops::o_name, and genl_ops::o_ncmds.

Referenced by genl_register().

+ Here is the caller graph for this function:

int genl_unregister_family ( struct genl_ops ops)

Unregister Generic Netlink family.

Parameters:
opsGeneric Netlink family definition

Unregisters a family and all associated commands that were previously registered using genl_register_family().

See also:
genl_register_family()
Returns:
0 on success or a negative error code.

Definition at line 194 of file mngt.c.

References genl_ops::o_list.

Referenced by genl_unregister().

+ Here is the caller graph for this function:

int genl_handle_msg ( struct nl_msg *  msg,
void *  arg 
)

Run a received message through the demultiplexer.

Parameters:
msgGeneric Netlink message
argArgument passed on to the message handler callback
Returns:
0 on success or a negative error code.

Definition at line 208 of file mngt.c.

References genlmsg_valid_hdr(), and nlmsg_hdr().

+ Here is the call graph for this function:

int genl_register ( struct nl_cache_ops ops)

Register Generic Netlink family backed cache.

Parameters:
opsCache operations definition

Same as genl_register_family() but additionally registers the specified cache operations using nl_cache_mngt_register() and associates it with the Generic Netlink family.

See also:
genl_register_family()
Returns:
0 on success or a negative error code.

Definition at line 241 of file mngt.c.

References nl_cache_ops::co_hdrsize, nl_cache_ops::co_msg_parser, nl_cache_ops::co_protocol, genl_register_family(), nl_msgtype::mt_id, nl_msgtype::mt_name, nl_cache_mngt_register(), genl_ops::o_cache_ops, genl_ops::o_hdrsize, genl_ops::o_id, and genl_ops::o_name.

+ Here is the call graph for this function:

void genl_unregister ( struct nl_cache_ops ops)

Unregister cache based Generic Netlink family.

Parameters:
opsCache operations definition

Definition at line 278 of file mngt.c.

References genl_unregister_family(), and nl_cache_mngt_unregister().

+ Here is the call graph for this function:

int genl_ops_resolve ( struct nl_sock *  sk,
struct genl_ops ops 
)

Resolve a single Generic Netlink family.

Parameters:
skGeneric Netlink socket
opsGeneric Netlink family definition

Resolves the family name to its numeric identifier.

Returns:
0 on success or a negative error code.

Definition at line 321 of file mngt.c.

References genl_ctrl_alloc_cache(), and nl_cache_free().

+ Here is the call graph for this function:

int genl_mngt_resolve ( struct nl_sock *  sk)

Resolve all registered Generic Netlink families.

Parameters:
skGeneric Netlink socket

Walks through all local Generic Netlink families that have been registered using genl_register() and resolves the name of each family to the corresponding numeric identifier.

See also:
genl_register()
genl_ops_resolve()
Returns:
0 on success or a negative error code.

Definition at line 349 of file mngt.c.

References genl_ctrl_alloc_cache(), nl_cache_free(), and genl_ops::o_list.

+ Here is the call graph for this function: