move library packages to package/libs/
[openwrt/svn-archive/archive.git] / package / libs / libnl-tiny / src / include / netlink / netlink.h
1 /*
2 * netlink/netlink.h Netlink Interface
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_NETLINK_H_
13 #define NETLINK_NETLINK_H_
14
15 #include <stdio.h>
16 #include <stdint.h>
17 #include <string.h>
18 #include <stdlib.h>
19 #include <sys/poll.h>
20 #include <sys/socket.h>
21 #include <sys/types.h>
22 #include <sys/time.h>
23 #include <netdb.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>
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 extern int nl_debug;
38 extern struct nl_dump_params nl_debug_dp;
39
40 /* Connection Management */
41 extern int nl_connect(struct nl_sock *, int);
42 extern void nl_close(struct nl_sock *);
43
44 /* Send */
45 extern int nl_sendto(struct nl_sock *, void *, size_t);
46 extern int nl_sendmsg(struct nl_sock *, struct nl_msg *,
47 struct msghdr *);
48 extern int nl_send(struct nl_sock *, struct nl_msg *);
49 extern int nl_send_auto_complete(struct nl_sock *,
50 struct nl_msg *);
51 extern int nl_send_simple(struct nl_sock *, int, int,
52 void *, size_t);
53
54 /* Receive */
55 extern int nl_recv(struct nl_sock *,
56 struct sockaddr_nl *, unsigned char **,
57 struct ucred **);
58 extern int nl_recvmsgs(struct nl_sock *sk, struct nl_cb *cb);
59
60 extern int nl_wait_for_ack(struct nl_sock *);
61
62 /* Netlink Family Translations */
63 extern char * nl_nlfamily2str(int, char *, size_t);
64 extern int nl_str2nlfamily(const char *);
65
66 /**
67 * Receive a set of message from a netlink socket using handlers in nl_sock.
68 * @arg sk Netlink socket.
69 *
70 * Calls nl_recvmsgs() with the handlers configured in the netlink socket.
71 */
72 static inline int nl_recvmsgs_default(struct nl_sock *sk)
73 {
74 return nl_recvmsgs(sk, sk->s_cb);
75 }
76
77
78 #ifdef __cplusplus
79 }
80 #endif
81
82 #endif