2 * netlink/netlink.h Netlink Interface
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
9 * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
12 #ifndef NETLINK_NETLINK_H_
13 #define NETLINK_NETLINK_H_
20 #include <sys/socket.h>
21 #include <sys/types.h>
24 #include <netlink/netlink-compat.h>
25 #include <linux/netlink.h>
26 #include <linux/genetlink.h>
27 #include <netlink/version.h>
28 #include <netlink/errno.h>
29 #include <netlink/types.h>
30 #include <netlink/handlers.h>
31 #include <netlink/socket.h>
38 extern struct nl_dump_params nl_debug_dp
;
40 /* Connection Management */
41 extern int nl_connect(struct nl_sock
*, int);
42 extern void nl_close(struct nl_sock
*);
45 extern int nl_sendto(struct nl_sock
*, void *, size_t);
46 extern int nl_sendmsg(struct nl_sock
*, struct nl_msg
*,
48 extern int nl_send(struct nl_sock
*, struct nl_msg
*);
49 extern int nl_send_auto_complete(struct nl_sock
*,
51 extern int nl_send_simple(struct nl_sock
*, int, int,
55 extern int nl_recv(struct nl_sock
*,
56 struct sockaddr_nl
*, unsigned char **,
58 extern int nl_recvmsgs(struct nl_sock
*sk
, struct nl_cb
*cb
);
60 extern int nl_wait_for_ack(struct nl_sock
*);
62 /* Netlink Family Translations */
63 extern char * nl_nlfamily2str(int, char *, size_t);
64 extern int nl_str2nlfamily(const char *);
67 * Receive a set of message from a netlink socket using handlers in nl_sock.
68 * @arg sk Netlink socket.
70 * Calls nl_recvmsgs() with the handlers configured in the netlink socket.
72 static inline int nl_recvmsgs_default(struct nl_sock
*sk
)
74 return nl_recvmsgs(sk
, sk
->s_cb
);