2 * netlink/route/route.h Routes
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation version 2.1
9 * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
12 #ifndef NETLINK_ROUTE_H_
13 #define NETLINK_ROUTE_H_
15 #include <netlink/netlink.h>
16 #include <netlink/cache.h>
17 #include <netlink/addr.h>
18 #include <netlink/data.h>
19 #include <netlink/route/nexthop.h>
24 extern struct rtnl_route * rtnl_route_alloc(void);
25 extern void rtnl_route_free(struct rtnl_route *);
26 extern struct nl_cache * rtnl_route_alloc_cache(struct nl_handle *);
28 extern void rtnl_route_get(struct rtnl_route *);
29 extern void rtnl_route_put(struct rtnl_route *);
31 /* Access Functions */
32 extern void rtnl_route_set_table(struct rtnl_route *, int);
33 extern int rtnl_route_get_table(struct rtnl_route *);
34 extern void rtnl_route_set_scope(struct rtnl_route *, int);
35 extern int rtnl_route_get_scope(struct rtnl_route *);
36 extern void rtnl_route_set_tos(struct rtnl_route *, int);
37 extern int rtnl_route_get_tos(struct rtnl_route *);
38 extern void rtnl_route_set_realms(struct rtnl_route *, realm_t);
39 extern realm_t rtnl_route_get_realms(struct rtnl_route *);
40 extern void rtnl_route_set_protocol(struct rtnl_route *, int);
41 extern int rtnl_route_get_protocol(struct rtnl_route *);
42 extern void rtnl_route_set_prio(struct rtnl_route *, int);
43 extern int rtnl_route_get_prio(struct rtnl_route *);
44 extern void rtnl_route_set_family(struct rtnl_route *, int);
45 extern int rtnl_route_get_family(struct rtnl_route *);
46 extern void rtnl_route_set_type(struct rtnl_route *, int);
47 extern int rtnl_route_get_type(struct rtnl_route *);
48 extern void rtnl_route_set_flags(struct rtnl_route *,
50 extern void rtnl_route_unset_flags(struct rtnl_route *,
52 extern unsigned int rtnl_route_get_flags(struct rtnl_route *);
53 extern int rtnl_route_set_metric(struct rtnl_route *, int,
55 extern int rtnl_route_unset_metric(struct rtnl_route *, int);
56 extern unsigned int rtnl_route_get_metric(struct rtnl_route *, int);
57 extern int rtnl_route_set_dst(struct rtnl_route *,
59 extern struct nl_addr * rtnl_route_get_dst(struct rtnl_route *);
60 extern int rtnl_route_set_src(struct rtnl_route *,
62 extern struct nl_addr * rtnl_route_get_src(struct rtnl_route *);
63 extern int rtnl_route_set_gateway(struct rtnl_route *,
65 extern struct nl_addr * rtnl_route_get_gateway(struct rtnl_route *);
66 extern int rtnl_route_set_pref_src(struct rtnl_route *,
68 extern struct nl_addr * rtnl_route_get_pref_src(struct rtnl_route *);
69 extern void rtnl_route_set_oif(struct rtnl_route *, int);
70 extern int rtnl_route_get_oif(struct rtnl_route *);
71 extern void rtnl_route_set_iif(struct rtnl_route *, const char *);
72 extern char * rtnl_route_get_iif(struct rtnl_route *);
73 extern void rtnl_route_set_dst_len(struct rtnl_route *, int);
74 extern int rtnl_route_get_dst_len(struct rtnl_route *);
75 extern void rtnl_route_set_src_len(struct rtnl_route *, int);
76 extern int rtnl_route_get_src_len(struct rtnl_route *);
78 extern void rtnl_route_add_nexthop(struct rtnl_route *,
79 struct rtnl_nexthop *);
80 extern void rtnl_route_remove_nexthop(struct rtnl_nexthop *);
81 extern struct nl_list_head * rtnl_route_get_nexthops(struct rtnl_route *);
83 extern char * rtnl_route_table2str(int, char *, size_t);
84 extern int rtnl_route_str2table(const char *);
86 extern char * rtnl_route_proto2str(int, char *, size_t);
87 extern int rtnl_route_str2proto(const char *);
89 extern char * rtnl_route_metric2str(int, char *, size_t);
90 extern int rtnl_route_str2metric(const char *);
92 extern char * rtnl_route_nh_flags2str(int, char *, size_t);
93 extern int rtnl_route_nh_str2flags(const char *);