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