blob: c2ef984c40715b4f68eaa7842302a65a49eec63a [file] [log] [blame]
"Robert P. J. Day"63fc1a92006-07-02 19:47:05 +00001/* vi: set sw=4 ts=4: */
Glenn L McGrath9a2d2722002-11-10 01:33:55 +00002#ifndef __LIBNETLINK_H__
3#define __LIBNETLINK_H__ 1
4
5#include <asm/types.h>
6#include <linux/netlink.h>
7#include <linux/rtnetlink.h>
8
9struct rtnl_handle
10{
11 int fd;
12 struct sockaddr_nl local;
13 struct sockaddr_nl peer;
14 __u32 seq;
15 __u32 dump;
16};
17
18extern int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions);
19extern void rtnl_close(struct rtnl_handle *rth);
20extern int rtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type);
21extern int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req, int len);
22extern int rtnl_dump_filter(struct rtnl_handle *rth,
23 int (*filter)(struct sockaddr_nl *, struct nlmsghdr *n, void *),
24 void *arg1,
25 int (*junk)(struct sockaddr_nl *,struct nlmsghdr *n, void *),
26 void *arg2);
27extern int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer,
28 unsigned groups, struct nlmsghdr *answer,
29 int (*junk)(struct sockaddr_nl *,struct nlmsghdr *n, void *),
30 void *jarg);
31extern int rtnl_send(struct rtnl_handle *rth, char *buf, int);
32
33
34extern int addattr32(struct nlmsghdr *n, int maxlen, int type, __u32 data);
35extern int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen);
36extern int rta_addattr32(struct rtattr *rta, int maxlen, int type, __u32 data);
37extern int rta_addattr_l(struct rtattr *rta, int maxlen, int type, void *data, int alen);
38
39extern int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len);
40
Glenn L McGrath9a2d2722002-11-10 01:33:55 +000041
42#endif /* __LIBNETLINK_H__ */
43