blob: 086fa9e89509896423dca8b812c9ff22a72b29c6 [file] [log] [blame]
Thomas Grafe2849862007-03-22 11:48:11 -07001#ifndef __NET_RTNETLINK_H
2#define __NET_RTNETLINK_H
3
4#include <linux/rtnetlink.h>
5#include <net/netlink.h>
6
7typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *);
8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);
9
10extern int __rtnl_register(int protocol, int msgtype,
11 rtnl_doit_func, rtnl_dumpit_func);
12extern void rtnl_register(int protocol, int msgtype,
13 rtnl_doit_func, rtnl_dumpit_func);
14extern int rtnl_unregister(int protocol, int msgtype);
15extern void rtnl_unregister_all(int protocol);
16extern int rtnl_dump_all(struct sk_buff *skb, struct netlink_callback *cb);
17
Thomas Grafc4546732007-03-25 23:24:24 -070018static inline int rtnl_msg_family(struct nlmsghdr *nlh)
19{
20 if (nlmsg_len(nlh) >= sizeof(struct rtgenmsg))
21 return ((struct rtgenmsg *) nlmsg_data(nlh))->rtgen_family;
22 else
23 return AF_UNSPEC;
24}
25
Thomas Grafe2849862007-03-22 11:48:11 -070026#endif