1
2#ifndef LIBNETLINK_H
3#define LIBNETLINK_H 1
4
5#include <linux/types.h>
6
7
8#include <linux/netlink.h>
9#include <linux/rtnetlink.h>
10
11PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
12
13struct rtnl_handle
14{
15 int fd;
16 struct sockaddr_nl local;
17 struct sockaddr_nl peer;
18 uint32_t seq;
19 uint32_t dump;
20};
21
22extern int xrtnl_open(struct rtnl_handle *rth) FAST_FUNC;
23extern void rtnl_close(struct rtnl_handle *rth) FAST_FUNC;
24extern int xrtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type) FAST_FUNC;
25extern int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req, int len) FAST_FUNC;
26extern int xrtnl_dump_filter(struct rtnl_handle *rth,
27 int (*filter)(const struct sockaddr_nl*, struct nlmsghdr *n, void*),
28 void *arg1) FAST_FUNC;
29
30
31#define rtnl_talk(rtnl, n, peer, groups, answer, junk, jarg) \
32 rtnl_talk(rtnl, n, answer)
33extern int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer,
34 unsigned groups, struct nlmsghdr *answer,
35 int (*junk)(struct sockaddr_nl *,struct nlmsghdr *n, void *),
36 void *jarg) FAST_FUNC;
37
38extern int rtnl_send(struct rtnl_handle *rth, char *buf, int) FAST_FUNC;
39
40
41extern int addattr32(struct nlmsghdr *n, int maxlen, int type, uint32_t data) FAST_FUNC;
42extern int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen) FAST_FUNC;
43extern int rta_addattr32(struct rtattr *rta, int maxlen, int type, uint32_t data) FAST_FUNC;
44extern int rta_addattr_l(struct rtattr *rta, int maxlen, int type, void *data, int alen) FAST_FUNC;
45
46extern int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len) FAST_FUNC;
47
48POP_SAVED_FUNCTION_VISIBILITY
49
50#endif
51