1#ifndef __LIBNETLINK_H__ 2#define __LIBNETLINK_H__ 1 3 4#include <asm/types.h> 5#include <linux/netlink.h> 6#include <linux/rtnetlink.h> 7 8struct rtnl_handle 9{ 10 int fd; 11 struct sockaddr_nl local; 12 struct sockaddr_nl peer; 13 __u32 seq; 14 __u32 dump; 15}; 16 17extern int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions); 18extern void rtnl_close(struct rtnl_handle *rth); 19extern int rtnl_request(struct rtnl_handle *rth, int fam, int type); 20 21typedef int (*rtnl_filter_t)(const struct sockaddr_nl *, struct nlmsghdr *n, void *); 22 23extern int rtnl_filter(struct rtnl_handle *rth, rtnl_filter_t filter, 24 void *arg1); 25extern int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, 26 unsigned groups, struct nlmsghdr * answer); 27extern int rtnl_send(struct rtnl_handle *rth, const char *buf, int); 28 29 30extern int addattr32(struct nlmsghdr *n, int maxlen, int type, unsigned int data); 31extern int addattr_l(struct nlmsghdr *n, int maxlen, int type, const void *data, int alen); 32 33extern int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len); 34 35#define NLMSG_TAIL(nmsg) \ 36 ((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len))) 37 38#endif /* __LIBNETLINK_H__ */ 39 40