libnl  1.1.4
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 <netlink/netlink-compat.h>
24 #include <linux/netlink.h>
25 #include <linux/rtnetlink.h>
26 #include <linux/genetlink.h>
27 #include <linux/netfilter/nfnetlink.h>
28 #include <netlink/types.h>
29 #include <netlink/handlers.h>
30 #include <netlink/socket.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 extern int nl_debug;
37 extern struct nl_dump_params nl_debug_dp;
38 
39 /* Connection Management */
40 extern int nl_connect(struct nl_handle *, int);
41 extern void nl_close(struct nl_handle *);
42 
43 /* Send */
44 extern int nl_sendto(struct nl_handle *, void *, size_t);
45 extern int nl_sendmsg(struct nl_handle *, struct nl_msg *,
46  struct msghdr *);
47 extern int nl_send(struct nl_handle *, struct nl_msg *);
48 extern int nl_send_auto_complete(struct nl_handle *,
49  struct nl_msg *);
50 extern int nl_send_simple(struct nl_handle *, int, int,
51  void *, size_t);
52 
53 /* Receive */
54 extern int nl_recv(struct nl_handle *,
55  struct sockaddr_nl *, unsigned char **,
56  struct ucred **);
57 
58 extern int nl_recvmsgs(struct nl_handle *, struct nl_cb *);
59 
60 #define nl_recvmsgs_def(handle) nl_recvmsgs_default(handle)
61 extern int nl_recvmsgs_default(struct nl_handle *);
62 
63 extern int nl_wait_for_ack(struct nl_handle *);
64 
65 /* Netlink Family Translations */
66 extern char * nl_nlfamily2str(int, char *, size_t);
67 extern int nl_str2nlfamily(const char *);
68 
69 #ifdef __cplusplus
70 }
71 #endif
72 
73 #endif