libnl  1.1.4
mngt.h
1 /*
2  * netlink/genl/mngt.h Generic Netlink Management
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation version 2.1
7  * of the License.
8  *
9  * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
10  */
11 
12 #ifndef NETLINK_GENL_MNGT_H_
13 #define NETLINK_GENL_MNGT_H_
14 
15 #include <netlink/netlink.h>
16 #include <netlink/attr.h>
17 #include <netlink/list.h>
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 struct nl_cache_ops;
24 
25 /**
26  * @ingroup genl_mngt
27  * Generic Netlink Command
28  */
29 struct genl_cmd
30 {
31  /** Unique command identifier */
32  int c_id;
33 
34  /** Name/description of command */
35  char * c_name;
36 
37  /**
38  * Maximum attribute identifier, must be provided if
39  * a message parser is available.
40  */
41  int c_maxattr;
42 
43  int (*c_msg_parser)(struct nl_cache_ops *,
44  struct genl_cmd *,
45  struct genl_info *, void *);
46 
47  /**
48  * Attribute validation policy (optional)
49  */
51 };
52 
53 /**
54  * @ingroup genl_mngt
55  * Generic Netlink Operations
56  */
57 struct genl_ops
58 {
59  int o_family;
60  int o_id;
61  char * o_name;
62  struct nl_cache_ops * o_cache_ops;
63  struct genl_cmd * o_cmds;
64  int o_ncmds;
65 
66  /* linked list of all genl cache operations */
67  struct nl_list_head o_list;
68 };
69 
70 
71 extern int genl_register(struct nl_cache_ops *);
72 extern void genl_unregister(struct nl_cache_ops *);
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif
struct nla_policy * c_attr_policy
Attribute validation policy (optional)
Definition: mngt.h:50
int genl_register(struct nl_cache_ops *ops)
Register generic netlink operations.
Definition: mngt.c:172
Generic Netlink Command.
Definition: mngt.h:29
attribute validation policy
Definition: attr.h:73
char * c_name
Name/description of command.
Definition: mngt.h:35
int c_id
Unique command identifier.
Definition: mngt.h:32
void genl_unregister(struct nl_cache_ops *ops)
Unregister generic netlink operations.
Definition: mngt.c:214
Cache Operations.
Definition: cache-api.h:163
Generic Netlink Operations.
Definition: mngt.h:57
int c_maxattr
Maximum attribute identifier, must be provided if a message parser is available.
Definition: mngt.h:41