libnl: genl_ops Struct Reference

libnl 3.12.0

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 *)
  Register Generic Netlink family and associated commands.
  Definition mngt.c:165
  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_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.

## Field Documentation

## ◆ o_hdrsize

unsigned int genl_ops::o_hdrsize

Length of user header.

Definition at line 129 of file mngt.h.

## ◆ o_id

int genl_ops::o_id

Numeric identifier, automatically filled in by genl_ops_resolve()

Definition at line 132 of file mngt.h.

Referenced by genl_register_family().

## ◆ o_name

char* genl_ops::o_name

Human readable name, used by genl_ops_resolve() to resolve numeric id.

Definition at line 135 of file mngt.h.

Referenced by genl_register_family().

## ◆ o_cache_ops

struct nl_cache_ops* genl_ops::o_cache_ops

If registered via genl_register(), will point to the related cache operations.

Definition at line 141 of file mngt.h.

## ◆ o_cmds

struct genl_cmd* genl_ops::o_cmds

Optional array defining the available Generic Netlink commands.

Definition at line 144 of file mngt.h.

Referenced by genl_register_family().

## ◆ o_ncmds

int genl_ops::o_ncmds

Number of elements in `o_cmds` array.

Definition at line 147 of file mngt.h.

Referenced by genl_register_family().

## ◆ o_list

struct nl_list_head genl_ops::o_list
| private

Used internally to link together all registered operations.

Definition at line 153 of file mngt.h.

Referenced by genl_mngt_resolve(), genl_register_family(), and genl_unregister_family().