/usr/include/libnl3/netlink/genl/mngt.h is in libnl-3-dev 3.2.29-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | /*
* netlink/genl/mngt.h Generic Netlink Management
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* Copyright (c) 2003-2012 Thomas Graf <tgraf@suug.ch>
*/
#ifndef NETLINK_GENL_MNGT_H_
#define NETLINK_GENL_MNGT_H_
#include <netlink/netlink.h>
#include <netlink/attr.h>
#include <netlink/list.h>
#ifdef __cplusplus
extern "C" {
#endif
struct nl_cache_ops;
/**
* @ingroup genl_mngt
* @struct genl_info netlink/genl/mngt.h
*
* Informative structure passed on to message parser callbacks
*
* This structure is passed on to all message parser callbacks and contains
* information about the sender of the message as well as pointers to all
* relevant sections of the parsed message.
*
* @see genl_cmd::c_msg_parser
*/
struct genl_info
{
/** Socket address of sender */
struct sockaddr_nl * who;
/** Pointer to Netlink message header */
struct nlmsghdr * nlh;
/** Pointer to Generic Netlink message header */
struct genlmsghdr * genlhdr;
/** Pointer to user header */
void * userhdr;
/** Pointer to array of parsed attributes */
struct nlattr ** attrs;
};
/**
* @ingroup genl_mngt
* @struct genl_cmd netlink/genl/mngt.h
*
* Definition of a Generic Netlink command.
*
* This structure is used to define the list of available commands on the
* receiving side.
*
* @par Example:
* @code
* 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),
* };
* @endcode
*/
struct genl_cmd
{
/** Numeric command identifier (required) */
int c_id;
/** Human readable name (required) */
char * c_name;
/** Maximum attribute identifier that the command is prepared to handle. */
int c_maxattr;
/** Called whenever a message for this command is received */
int (*c_msg_parser)(struct nl_cache_ops *,
struct genl_cmd *,
struct genl_info *, void *);
/** Attribute validation policy, enforced before the callback is called */
struct nla_policy * c_attr_policy;
};
/**
* @ingroup genl_mngt
* @struct genl_ops netlink/genl/mngt.h
*
* Definition of a Generic Netlink family
*
* @par Example:
* @code
* 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
* @endcode
*
* @see genl_cmd
*/
struct genl_ops
{
/** Length of user header */
unsigned int o_hdrsize;
/** Numeric identifier, automatically filled in by genl_ops_resolve() */
int o_id;
/** Human readable name, used by genl_ops_resolve() to resolve numeric id */
char * o_name;
/**
* If registered via genl_register(), will point to the related
* cache operations.
*/
struct nl_cache_ops * o_cache_ops;
/** Optional array defining the available Generic Netlink commands */
struct genl_cmd * o_cmds;
/** Number of elements in \c o_cmds array */
int o_ncmds;
/**
* @private
* Used internally to link together all registered operations.
*/
struct nl_list_head o_list;
};
extern int genl_register_family(struct genl_ops *);
extern int genl_unregister_family(struct genl_ops *);
extern int genl_handle_msg(struct nl_msg *, void *);
extern int genl_register(struct nl_cache_ops *);
extern void genl_unregister(struct nl_cache_ops *);
extern int genl_ops_resolve(struct nl_sock *, struct genl_ops *);
extern int genl_mngt_resolve(struct nl_sock *);
#ifdef __cplusplus
}
#endif
#endif
|