libnl: genl_ops Struct Reference

libnl 3.7.0

Data Fields | Private Attributes
genl_ops Struct Reference
Generic Netlink Library (libnl-genl) » Family and Command Registration

Definition of a Generic Netlink family. More...

`#include <netlink/genl/mngt.h>`

## Data Fields
unsigned int | o_hdrsize
| Length of user header.
int | o_id
| Numeric identifier, automatically filled in by genl_ops_resolve()
char * | o_name
| Human readable name, used by genl_ops_resolve() to resolve numeric id.
struct nl_cache_ops * | o_cache_ops
| If registered via genl_register(), will point to the related cache operations.
struct genl_cmd * | o_cmds
| Optional array defining the available Generic Netlink commands.
int | o_ncmds
| Number of elements in `o_cmds` array.

## Private Attributes
struct nl_list_head | o_list
| Used internally to link together all registered operations.

## Detailed Description

Definition of a Generic Netlink family.

Example:
  static struct genl_cmd foo_cmds[] = {
  [...]
  };
  static struct genl_ops my_genl_ops = {
  .o_name = "foo",
  .o_hdrsize = sizeof(struct my_hdr),
  .o_cmds = foo_cmds,
  .o_ncmds = ARRAY_SIZE(foo_cmds),
  };
  if ((err = genl_register_family(&my_genl_ops)) < 0)
  // ERROR
  genl_register_family
  int genl_register_family(struct genl_ops *ops)
  Register Generic Netlink family and associated commands.
  Definition: mngt.c:164
  genl_cmd
  Definition of a Generic Netlink command.
  Definition: mngt.h:82
  genl_ops
  Definition of a Generic Netlink family.
  Definition: mngt.h:127
  genl_ops::o_name
  char * o_name
  Human readable name, used by genl_ops_resolve() to resolve numeric id.
  Definition: mngt.h:135
  genl_ops::o_cmds
  struct genl_cmd * o_cmds
  Optional array defining the available Generic Netlink commands.
  Definition: mngt.h:144

See also
  genl_cmd

Definition at line 126 of file mngt.h.