libnl 3.5.0

Data Structures
Family and Command Registration
Generic Netlink Library (libnl-genl)

Registering Generic Netlink Families and Commands. More...

## 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. More...
int | genl_unregister_family (struct genl_ops *ops)
| Unregister Generic Netlink family. More...
int | genl_handle_msg (struct nl_msg *msg, void *arg)
| Run a received message through the demultiplexer. More...

## Registration of Cache Operations
int | genl_register (struct nl_cache_ops *ops)
| Register Generic Netlink family backed cache. More...
void | genl_unregister (struct nl_cache_ops *ops)
| Unregister cache based Generic Netlink family. More...

## Resolving the name of registered families
int | genl_ops_resolve (struct nl_sock *sk, struct genl_ops *ops)
| Resolve a single Generic Netlink family. More...
int | genl_mngt_resolve (struct nl_sock *sk)
| Resolve all registered Generic Netlink families. More...

## Detailed Description

Registering Generic Netlink Families and Commands.

## Function Documentation

## ◆ genl_register_family()

int genl_register_family | ( | struct genl_ops * | ops | ) |

Register Generic Netlink family and associated commands.

Parameters

  ops | Generic 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 171 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:

## ◆ genl_unregister_family()

int genl_unregister_family | ( | struct genl_ops * | ops | ) |

Unregister Generic Netlink family.

Parameters

  ops | Generic 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 201 of file mngt.c.

References genl_ops::o_list.

Referenced by genl_unregister().

Here is the caller graph for this function:

## ◆ genl_handle_msg()

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

Run a received message through the demultiplexer.

Parameters

  msg | Generic Netlink message
  arg | Argument passed on to the message handler callback

Returns
  0 on success or a negative error code.

Definition at line 215 of file mngt.c.

References genlmsg_valid_hdr(), and nlmsg_hdr().

Here is the call graph for this function:

## ◆ genl_register()

int genl_register | ( | struct nl_cache_ops * | ops | ) |

Register Generic Netlink family backed cache.

Parameters

  ops | Cache 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 248 of file mngt.c.

References genl_register_family(), and nl_cache_mngt_register().

Here is the call graph for this function:

## ◆ genl_unregister()

void genl_unregister | ( | struct nl_cache_ops * | ops | ) |

Unregister cache based Generic Netlink family.

Parameters

  ops | Cache operations definition

Definition at line 285 of file mngt.c.

References genl_unregister_family(), and nl_cache_mngt_unregister().

Here is the call graph for this function:

## ◆ genl_ops_resolve()

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

Resolve a single Generic Netlink family.

Parameters

  sk | Generic Netlink socket
  ops | Generic Netlink family definition

Resolves the family name to its numeric identifier.

Returns
  0 on success or a negative error code.

Definition at line 358 of file mngt.c.

References genl_ctrl_alloc_cache(), and nl_cache_free().

Here is the call graph for this function:

## ◆ genl_mngt_resolve()

int genl_mngt_resolve | ( | struct nl_sock * | sk | ) |

Resolve all registered Generic Netlink families.

Parameters

  sk | Generic 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 386 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: