libnl: genl_cmd Struct Reference

libnl 3.12.0

genl_cmd Struct Reference
Generic Netlink Library (libnl-genl) » Family and Command Registration

Definition of a Generic Netlink command. More...

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

## Data Fields
int | c_id
| Numeric command identifier (required)
char * | c_name
| Human readable name (required)
int | c_maxattr
| Maximum attribute identifier that the command is prepared to handle.
int(* | c_msg_parser )(struct nl_cache_ops *, struct genl_cmd *, struct genl_info *, void *)
| Called whenever a message for this command is received.
struct nla_policy * | c_attr_policy
| Attribute validation policy, enforced before the callback is called.

## Detailed Description

Definition of a Generic Netlink command.

This structure is used to define the list of available commands on the receiving side.

Example:
  static struct genl_cmd foo_cmds[] = {
  {
  .c_id = FOO_CMD_NEW,
  .c_name = "NEWFOO" ,
  .c_maxattr = FOO_ATTR_MAX,
  .c_attr_policy = foo_policy,
  .c_msg_parser = foo_msg_parser,
  },
  {
  .c_id = FOO_CMD_DEL,
  .c_name = "DELFOO" ,
  },
  };
  static struct genl_ops my_genl_ops = {
  [...]
  .o_cmds = foo_cmds,
  .o_ncmds = ARRAY_SIZE(foo_cmds),
  };
  genl_cmd
  Definition of a Generic Netlink command.
  Definition mngt.h:82

Definition at line 81 of file mngt.h.

## Field Documentation

## ◆ c_id

int genl_cmd::c_id

Numeric command identifier (required)

Definition at line 84 of file mngt.h.

## ◆ c_name

char* genl_cmd::c_name

Human readable name (required)

Definition at line 87 of file mngt.h.

## ◆ c_maxattr

int genl_cmd::c_maxattr

Maximum attribute identifier that the command is prepared to handle.

Definition at line 90 of file mngt.h.

## ◆ c_msg_parser

int(* genl_cmd::c_msg_parser) (struct nl_cache_ops *, struct genl_cmd *, struct genl_info *, void *)

Called whenever a message for this command is received.

Definition at line 93 of file mngt.h.

## ◆ c_attr_policy

struct nla_policy* genl_cmd::c_attr_policy

Attribute validation policy, enforced before the callback is called.

Definition at line 98 of file mngt.h.