summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHolger Eitzenberger <heitzenberger@astaro.com>2008-12-01 13:38:06 (GMT)
committerThomas Graf <tgr@plip.localdomain>2008-12-03 18:54:21 (GMT)
commit72aa861c48b6876e94d07470025155a6924a6983 (patch)
tree452e2614c83b91fb3791e08bf78e22388e584828 /include
parent37f9855f4c02960b483d4d992771837c5906405e (diff)
downloadlibnl-72aa861c48b6876e94d07470025155a6924a6983.zip
libnl-72aa861c48b6876e94d07470025155a6924a6983.tar.gz
libnl-72aa861c48b6876e94d07470025155a6924a6983.tar.bz2
Allow to pass multiple group values to membership functions
Instead of calling the membership functions several times it is helpfull to extend the API and make the single group functions a special case. The value 0 (NFNLGRP_NONE) terminates this list. Example use: nl_socket_add_memberships(sock, group_1, group_2, 0); nl_socket_drop_memberships(sock, group_1, group_2, 0); Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Diffstat (limited to 'include')
-rw-r--r--include/netlink/socket.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/include/netlink/socket.h b/include/netlink/socket.h
index c10bc2a..5eefa08 100644
--- a/include/netlink/socket.h
+++ b/include/netlink/socket.h
@@ -30,12 +30,20 @@ extern uint32_t nl_socket_get_local_port(struct nl_sock *);
extern void nl_socket_set_local_port(struct nl_sock *,
uint32_t);
-extern int nl_socket_add_membership(struct nl_sock *,
- int);
-extern int nl_socket_drop_membership(struct nl_sock *,
- int);
+extern int nl_socket_add_memberships(struct nl_sock *,
+ int, ...);
+extern int nl_socket_drop_memberships(struct nl_sock *,
+ int, ...);
extern void nl_join_groups(struct nl_sock *, int);
+static inline int nl_socket_add_membership(struct nl_sock *sk, int group) {
+ return nl_socket_add_memberships(sk, group, 0);
+}
+
+static inline int nl_socket_drop_membership(struct nl_sock *sk, int group) {
+ return nl_socket_drop_memberships(sk, group, 0);
+}
+
extern uint32_t nl_socket_get_peer_port(struct nl_sock *);
extern void nl_socket_set_peer_port(struct nl_sock *,
uint32_t);