libnl  3.2.21
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/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 #include <netlink/object.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 struct ucred;
41 struct nl_cache_ops;
42 struct nl_parser_param;
43 
44 extern int nl_debug;
45 extern struct nl_dump_params nl_debug_dp;
46 
47 /* Connection Management */
48 extern int nl_connect(struct nl_sock *, int);
49 extern void nl_close(struct nl_sock *);
50 
51 /* Send */
52 extern int nl_sendto(struct nl_sock *, void *, size_t);
53 extern int nl_sendmsg(struct nl_sock *, struct nl_msg *,
54  struct msghdr *);
55 extern int nl_send(struct nl_sock *, struct nl_msg *);
56 extern int nl_send_iovec(struct nl_sock *, struct nl_msg *,
57  struct iovec *, unsigned);
58 extern void nl_complete_msg(struct nl_sock *,
59  struct nl_msg *);
60 extern void nl_auto_complete(struct nl_sock *,
61  struct nl_msg *);
62 extern int nl_send_auto(struct nl_sock *, struct nl_msg *);
63 extern int nl_send_auto_complete(struct nl_sock *,
64  struct nl_msg *);
65 extern int nl_send_sync(struct nl_sock *, struct nl_msg *);
66 extern int nl_send_simple(struct nl_sock *, int, int,
67  void *, size_t);
68 
69 /* Receive */
70 extern int nl_recv(struct nl_sock *,
71  struct sockaddr_nl *, unsigned char **,
72  struct ucred **);
73 
74 extern int nl_recvmsgs(struct nl_sock *, struct nl_cb *);
75 extern int nl_recvmsgs_report(struct nl_sock *, struct nl_cb *);
76 
77 extern int nl_recvmsgs_default(struct nl_sock *);
78 
79 extern int nl_wait_for_ack(struct nl_sock *);
80 
81 extern int nl_pickup(struct nl_sock *,
82  int (*parser)(struct nl_cache_ops *,
83  struct sockaddr_nl *,
84  struct nlmsghdr *,
85  struct nl_parser_param *),
86  struct nl_object **);
87 /* Netlink Family Translations */
88 extern char * nl_nlfamily2str(int, char *, size_t);
89 extern int nl_str2nlfamily(const char *);
90 
91 #ifdef __cplusplus
92 }
93 #endif
94 
95 #endif