rtnetlink.h 836 B

1234567891011121314151617181920212223242526
  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. extern int rtnl_dump_all(struct sk_buff *skb, struct netlink_callback *cb);
  14. static inline int rtnl_msg_family(struct nlmsghdr *nlh)
  15. {
  16. if (nlmsg_len(nlh) >= sizeof(struct rtgenmsg))
  17. return ((struct rtgenmsg *) nlmsg_data(nlh))->rtgen_family;
  18. else
  19. return AF_UNSPEC;
  20. }
  21. #endif