00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef NETLINK_ROUTE_H_
00013 #define NETLINK_ROUTE_H_
00014
00015 #include <netlink/netlink.h>
00016 #include <netlink/cache.h>
00017 #include <netlink/addr.h>
00018 #include <netlink/data.h>
00019 #include <netlink/route/nexthop.h>
00020
00021 struct rtnl_route;
00022
00023
00024 extern struct rtnl_route * rtnl_route_alloc(void);
00025 extern void rtnl_route_free(struct rtnl_route *);
00026 extern struct nl_cache * rtnl_route_alloc_cache(struct nl_handle *);
00027
00028 extern void rtnl_route_get(struct rtnl_route *);
00029 extern void rtnl_route_put(struct rtnl_route *);
00030
00031
00032 extern void rtnl_route_set_table(struct rtnl_route *, int);
00033 extern int rtnl_route_get_table(struct rtnl_route *);
00034 extern void rtnl_route_set_scope(struct rtnl_route *, int);
00035 extern int rtnl_route_get_scope(struct rtnl_route *);
00036 extern void rtnl_route_set_tos(struct rtnl_route *, int);
00037 extern int rtnl_route_get_tos(struct rtnl_route *);
00038 extern void rtnl_route_set_realms(struct rtnl_route *, realm_t);
00039 extern realm_t rtnl_route_get_realms(struct rtnl_route *);
00040 extern void rtnl_route_set_protocol(struct rtnl_route *, int);
00041 extern int rtnl_route_get_protocol(struct rtnl_route *);
00042 extern void rtnl_route_set_prio(struct rtnl_route *, int);
00043 extern int rtnl_route_get_prio(struct rtnl_route *);
00044 extern void rtnl_route_set_family(struct rtnl_route *, int);
00045 extern int rtnl_route_get_family(struct rtnl_route *);
00046 extern void rtnl_route_set_type(struct rtnl_route *, int);
00047 extern int rtnl_route_get_type(struct rtnl_route *);
00048 extern void rtnl_route_set_flags(struct rtnl_route *,
00049 unsigned int);
00050 extern void rtnl_route_unset_flags(struct rtnl_route *,
00051 unsigned int);
00052 extern unsigned int rtnl_route_get_flags(struct rtnl_route *);
00053 extern int rtnl_route_set_metric(struct rtnl_route *, int,
00054 unsigned int);
00055 extern int rtnl_route_unset_metric(struct rtnl_route *, int);
00056 extern unsigned int rtnl_route_get_metric(struct rtnl_route *, int);
00057 extern int rtnl_route_set_dst(struct rtnl_route *,
00058 struct nl_addr *);
00059 extern struct nl_addr * rtnl_route_get_dst(struct rtnl_route *);
00060 extern int rtnl_route_set_src(struct rtnl_route *,
00061 struct nl_addr *);
00062 extern struct nl_addr * rtnl_route_get_src(struct rtnl_route *);
00063 extern int rtnl_route_set_gateway(struct rtnl_route *,
00064 struct nl_addr *);
00065 extern struct nl_addr * rtnl_route_get_gateway(struct rtnl_route *);
00066 extern int rtnl_route_set_pref_src(struct rtnl_route *,
00067 struct nl_addr *);
00068 extern struct nl_addr * rtnl_route_get_pref_src(struct rtnl_route *);
00069 extern void rtnl_route_set_oif(struct rtnl_route *, int);
00070 extern int rtnl_route_get_oif(struct rtnl_route *);
00071 extern void rtnl_route_set_iif(struct rtnl_route *, const char *);
00072 extern char * rtnl_route_get_iif(struct rtnl_route *);
00073 extern void rtnl_route_set_dst_len(struct rtnl_route *, int);
00074 extern int rtnl_route_get_dst_len(struct rtnl_route *);
00075 extern void rtnl_route_set_src_len(struct rtnl_route *, int);
00076 extern int rtnl_route_get_src_len(struct rtnl_route *);
00077
00078 extern void rtnl_route_add_nexthop(struct rtnl_route *,
00079 struct rtnl_nexthop *);
00080 extern void rtnl_route_remove_nexthop(struct rtnl_nexthop *);
00081 extern struct nl_list_head * rtnl_route_get_nexthops(struct rtnl_route *);
00082
00083 extern char * rtnl_route_table2str(int, char *, size_t);
00084 extern int rtnl_route_str2table(const char *);
00085
00086 extern char * rtnl_route_proto2str(int, char *, size_t);
00087 extern int rtnl_route_str2proto(const char *);
00088
00089 extern char * rtnl_route_metric2str(int, char *, size_t);
00090 extern int rtnl_route_str2metric(const char *);
00091
00092 extern char * rtnl_route_nh_flags2str(int, char *, size_t);
00093 extern int rtnl_route_nh_str2flags(const char *);
00094
00095 #endif