nexthop.h

00001 /*
00002  * netlink/route/nexthop.h      Routing Nexthop
00003  *
00004  *      This library is free software; you can redistribute it and/or
00005  *      modify it under the terms of the GNU Lesser General Public
00006  *      License as published by the Free Software Foundation version 2.1
00007  *      of the License.
00008  *
00009  * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
00010  */
00011 
00012 #ifndef NETLINK_ROUTE_NEXTHOP_H_
00013 #define NETLINK_ROUTE_NEXTHOP_H_
00014 
00015 #include <netlink/netlink.h>
00016 #include <netlink/addr.h>
00017 
00018 #ifdef __cplusplus
00019 extern "C" {
00020 #endif
00021 
00022 struct rtnl_nexthop;
00023 
00024 enum {
00025         NH_DUMP_FROM_ONELINE = -2,
00026         NH_DUMP_FROM_DETAILS = -1,
00027         NH_DUMP_FROM_ENV = 0,
00028         /* > 0 reserved for nexthop index */
00029 };
00030 
00031 extern struct rtnl_nexthop * rtnl_route_nh_alloc(void);
00032 extern struct rtnl_nexthop * rtnl_route_nh_clone(struct rtnl_nexthop *);
00033 extern void             rtnl_route_nh_free(struct rtnl_nexthop *);
00034 
00035 extern int              rtnl_route_nh_compare(struct rtnl_nexthop *,
00036                                               struct rtnl_nexthop *,
00037                                               uint32_t, int);
00038 
00039 extern void             rtnl_route_nh_dump(struct rtnl_nexthop *,
00040                                            struct nl_dump_params *);
00041 
00042 extern void             rtnl_route_nh_set_weight(struct rtnl_nexthop *, uint8_t);
00043 extern uint8_t          rtnl_route_nh_get_weight(struct rtnl_nexthop *);
00044 extern void             rtnl_route_nh_set_ifindex(struct rtnl_nexthop *, int);
00045 extern int              rtnl_route_nh_get_ifindex(struct rtnl_nexthop *);
00046 extern void             rtnl_route_nh_set_gateway(struct rtnl_nexthop *,
00047                                                   struct nl_addr *);
00048 extern struct nl_addr * rtnl_route_nh_get_gateway(struct rtnl_nexthop *);
00049 extern void             rtnl_route_nh_set_flags(struct rtnl_nexthop *,
00050                                                 unsigned int);
00051 extern void             rtnl_route_nh_unset_flags(struct rtnl_nexthop *,
00052                                                   unsigned int);
00053 extern unsigned int     rtnl_route_nh_get_flags(struct rtnl_nexthop *);
00054 extern void             rtnl_route_nh_set_realms(struct rtnl_nexthop *,
00055                                                  uint32_t);
00056 extern uint32_t         rtnl_route_nh_get_realms(struct rtnl_nexthop *);
00057 
00058 extern char *           rtnl_route_nh_flags2str(int, char *, size_t);
00059 extern int              rtnl_route_nh_str2flags(const char *);
00060 
00061 #ifdef __cplusplus
00062 }
00063 #endif
00064 
00065 #endif