aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-07-18 18:47:52 -0400
committerDavid S. Miller <davem@davemloft.net>2007-07-18 18:47:52 -0400
commit2dbba6f773d1e1e4c78f03b0dbf19790d9017693 (patch)
tree19535af46e79a0af756275f751d7b0080b72001d /include
parent84659eb529b33572bb3f8c94e0978bd5d084bc7e (diff)
[GENETLINK]: Dynamic multicast groups.
Introduce API to dynamically register and unregister multicast groups. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Acked-by: Patrick McHardy <kaber@trash.net> Acked-by: Jamal Hadi Salim <hadi@cyberus.ca> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/genetlink.h13
-rw-r--r--include/net/genetlink.h22
2 files changed, 35 insertions, 0 deletions
diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h
index f7a93770e1be..7da02c93002b 100644
--- a/include/linux/genetlink.h
+++ b/include/linux/genetlink.h
@@ -39,6 +39,9 @@ enum {
39 CTRL_CMD_NEWOPS, 39 CTRL_CMD_NEWOPS,
40 CTRL_CMD_DELOPS, 40 CTRL_CMD_DELOPS,
41 CTRL_CMD_GETOPS, 41 CTRL_CMD_GETOPS,
42 CTRL_CMD_NEWMCAST_GRP,
43 CTRL_CMD_DELMCAST_GRP,
44 CTRL_CMD_GETMCAST_GRP, /* unused */
42 __CTRL_CMD_MAX, 45 __CTRL_CMD_MAX,
43}; 46};
44 47
@@ -52,6 +55,7 @@ enum {
52 CTRL_ATTR_HDRSIZE, 55 CTRL_ATTR_HDRSIZE,
53 CTRL_ATTR_MAXATTR, 56 CTRL_ATTR_MAXATTR,
54 CTRL_ATTR_OPS, 57 CTRL_ATTR_OPS,
58 CTRL_ATTR_MCAST_GROUPS,
55 __CTRL_ATTR_MAX, 59 __CTRL_ATTR_MAX,
56}; 60};
57 61
@@ -66,4 +70,13 @@ enum {
66 70
67#define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1) 71#define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1)
68 72
73enum {
74 CTRL_ATTR_MCAST_GRP_UNSPEC,
75 CTRL_ATTR_MCAST_GRP_NAME,
76 CTRL_ATTR_MCAST_GRP_ID,
77 __CTRL_ATTR_MCAST_GRP_MAX,
78};
79
80#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1)
81
69#endif /* __LINUX_GENERIC_NETLINK_H */ 82#endif /* __LINUX_GENERIC_NETLINK_H */
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index b6eaca122db8..decdda546829 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -5,6 +5,22 @@
5#include <net/netlink.h> 5#include <net/netlink.h>
6 6
7/** 7/**
8 * struct genl_multicast_group - generic netlink multicast group
9 * @name: name of the multicast group, names are per-family
10 * @id: multicast group ID, assigned by the core, to use with
11 * genlmsg_multicast().
12 * @list: list entry for linking
13 * @family: pointer to family, need not be set before registering
14 */
15struct genl_multicast_group
16{
17 struct genl_family *family; /* private */
18 struct list_head list; /* private */
19 char name[GENL_NAMSIZ];
20 u32 id;
21};
22
23/**
8 * struct genl_family - generic netlink family 24 * struct genl_family - generic netlink family
9 * @id: protocol family idenfitier 25 * @id: protocol family idenfitier
10 * @hdrsize: length of user specific header in bytes 26 * @hdrsize: length of user specific header in bytes
@@ -14,6 +30,7 @@
14 * @attrbuf: buffer to store parsed attributes 30 * @attrbuf: buffer to store parsed attributes
15 * @ops_list: list of all assigned operations 31 * @ops_list: list of all assigned operations
16 * @family_list: family list 32 * @family_list: family list
33 * @mcast_groups: multicast groups list
17 */ 34 */
18struct genl_family 35struct genl_family
19{ 36{
@@ -25,6 +42,7 @@ struct genl_family
25 struct nlattr ** attrbuf; /* private */ 42 struct nlattr ** attrbuf; /* private */
26 struct list_head ops_list; /* private */ 43 struct list_head ops_list; /* private */
27 struct list_head family_list; /* private */ 44 struct list_head family_list; /* private */
45 struct list_head mcast_groups; /* private */
28}; 46};
29 47
30/** 48/**
@@ -73,6 +91,10 @@ extern int genl_register_family(struct genl_family *family);
73extern int genl_unregister_family(struct genl_family *family); 91extern int genl_unregister_family(struct genl_family *family);
74extern int genl_register_ops(struct genl_family *, struct genl_ops *ops); 92extern int genl_register_ops(struct genl_family *, struct genl_ops *ops);
75extern int genl_unregister_ops(struct genl_family *, struct genl_ops *ops); 93extern int genl_unregister_ops(struct genl_family *, struct genl_ops *ops);
94extern int genl_register_mc_group(struct genl_family *family,
95 struct genl_multicast_group *grp);
96extern void genl_unregister_mc_group(struct genl_family *family,
97 struct genl_multicast_group *grp);
76 98
77extern struct sock *genl_sock; 99extern struct sock *genl_sock;
78 100