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