OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 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 | struct genl_info |
||
26 | { |
||
27 | struct sockaddr_nl * who; |
||
28 | struct nlmsghdr * nlh; |
||
29 | struct genlmsghdr * genlhdr; |
||
30 | void * userhdr; |
||
31 | struct nlattr ** attrs; |
||
32 | }; |
||
33 | |||
34 | /** |
||
35 | * @ingroup genl_mngt |
||
36 | * Generic Netlink Command |
||
37 | */ |
||
38 | struct genl_cmd |
||
39 | { |
||
40 | /** Unique command identifier */ |
||
41 | int c_id; |
||
42 | |||
43 | /** Name/description of command */ |
||
44 | char * c_name; |
||
45 | |||
46 | /** |
||
47 | * Maximum attribute identifier, must be provided if |
||
48 | * a message parser is available. |
||
49 | */ |
||
50 | int c_maxattr; |
||
51 | |||
52 | int (*c_msg_parser)(struct nl_cache_ops *, |
||
53 | struct genl_cmd *, |
||
54 | struct genl_info *, void *); |
||
55 | |||
56 | /** |
||
57 | * Attribute validation policy (optional) |
||
58 | */ |
||
59 | struct nla_policy * c_attr_policy; |
||
60 | }; |
||
61 | |||
62 | /** |
||
63 | * @ingroup genl_mngt |
||
64 | * Generic Netlink Operations |
||
65 | */ |
||
66 | struct genl_ops |
||
67 | { |
||
68 | int o_family; |
||
69 | int o_id; |
||
70 | char * o_name; |
||
71 | struct nl_cache_ops * o_cache_ops; |
||
72 | struct genl_cmd * o_cmds; |
||
73 | int o_ncmds; |
||
74 | |||
75 | /* linked list of all genl cache operations */ |
||
76 | struct nl_list_head o_list; |
||
77 | }; |
||
78 | |||
79 | |||
80 | extern int genl_register(struct nl_cache_ops *); |
||
81 | extern void genl_unregister(struct nl_cache_ops *); |
||
82 | |||
83 | #ifdef __cplusplus |
||
84 | } |
||
85 | #endif |
||
86 | |||
87 | #endif |