Home | History | Annotate | Download | only in src
      1 #ifndef _RTNL_H
      2 #define _RTNL_H
      3 
      4 #include <linux/types.h>
      5 #include <linux/rtnetlink.h>
      6 
      7 struct rtnl_handler {
      8 	struct rtnl_handler *next;
      9 
     10 	u_int16_t	nlmsg_type;
     11 	int		(*handlefn)(struct nlmsghdr *h, void *arg);
     12 	void		*arg;
     13 };
     14 
     15 struct rtnl_handle {
     16 	int rtnl_fd;
     17 	int rtnl_seq;
     18 	int rtnl_dump;
     19 	struct sockaddr_nl rtnl_local;
     20 	struct rtnl_handler *handlers;
     21 };
     22 
     23 /* api for handler plugins */
     24 int rtnl_handler_register(struct rtnl_handle *rtnl_handle,
     25 			  struct rtnl_handler *hdlr);
     26 int rtnl_handler_unregister(struct rtnl_handle *rtnl_handle,
     27 			    struct rtnl_handler *hdlr);
     28 int rtnl_parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len);
     29 int rtnl_dump_type(struct rtnl_handle *rtnl_handle, unsigned int type);
     30 
     31 /* api for core program */
     32 struct rtnl_handle *rtnl_open(void);
     33 void rtnl_close(struct rtnl_handle *rtnl_handle);
     34 int rtnl_receive(struct rtnl_handle *rtnl_handle);
     35 int rtnl_receive_multi(struct rtnl_handle *rtnl_handle);
     36 
     37 #endif
     38