rtnetlink.h 760 B

12345678910111213141516171819202122232425
  1. #ifndef __NET_RTNETLINK_H
  2. #define __NET_RTNETLINK_H
  3. #include <linux/rtnetlink.h>
  4. #include <net/netlink.h>
  5. typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *);
  6. typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);
  7. extern int __rtnl_register(int protocol, int msgtype,
  8. rtnl_doit_func, rtnl_dumpit_func);
  9. extern void rtnl_register(int protocol, int msgtype,
  10. rtnl_doit_func, rtnl_dumpit_func);
  11. extern int rtnl_unregister(int protocol, int msgtype);
  12. extern void rtnl_unregister_all(int protocol);
  13. static inline int rtnl_msg_family(struct nlmsghdr *nlh)
  14. {
  15. if (nlmsg_len(nlh) >= sizeof(struct rtgenmsg))
  16. return ((struct rtgenmsg *) nlmsg_data(nlh))->rtgen_family;
  17. else
  18. return AF_UNSPEC;
  19. }
  20. #endif