libnl 1.1.4
route.h
1/*
2 * netlink/route/route.h Routes
3 *
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
7 * of the License.
8 *
9 * Copyright (c) 2003-2006 Thomas Graf <tgraf@suug.ch>
10 */
11
12#ifndef NETLINK_ROUTE_H_
13#define NETLINK_ROUTE_H_
14
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>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25struct rtnl_route;
26
28{
29 uint32_t rtci_clntref;
30 uint32_t rtci_last_use;
31 uint32_t rtci_expires;
32 int32_t rtci_error;
33 uint32_t rtci_used;
34 uint32_t rtci_id;
35 uint32_t rtci_ts;
36 uint32_t rtci_tsage;
37};
38
39extern struct nl_object_ops route_obj_ops;
40
41/* General */
42extern struct rtnl_route * rtnl_route_alloc(void);
43extern void rtnl_route_put(struct rtnl_route *);
44extern struct nl_cache * rtnl_route_alloc_cache(struct nl_handle *);
45
46extern void rtnl_route_get(struct rtnl_route *);
47extern void rtnl_route_put(struct rtnl_route *);
48
49extern struct nl_msg *rtnl_route_build_add_request(struct rtnl_route *, int);
50extern int rtnl_route_add(struct nl_handle *, struct rtnl_route *, int);
51extern struct nl_msg *rtnl_route_build_del_request(struct rtnl_route *, int);
52extern int rtnl_route_del(struct nl_handle *, struct rtnl_route *, int);
53
54extern void rtnl_route_set_table(struct rtnl_route *, int);
55extern int rtnl_route_get_table(struct rtnl_route *);
56extern void rtnl_route_set_scope(struct rtnl_route *, int);
57extern int rtnl_route_get_scope(struct rtnl_route *);
58extern void rtnl_route_set_tos(struct rtnl_route *, int);
59extern int rtnl_route_get_tos(struct rtnl_route *);
60extern void rtnl_route_set_realms(struct rtnl_route *, realm_t);
61extern realm_t rtnl_route_get_realms(struct rtnl_route *);
62extern void rtnl_route_set_protocol(struct rtnl_route *, int);
63extern int rtnl_route_get_protocol(struct rtnl_route *);
64extern void rtnl_route_set_prio(struct rtnl_route *, int);
65extern int rtnl_route_get_prio(struct rtnl_route *);
66extern void rtnl_route_set_family(struct rtnl_route *, int);
67extern int rtnl_route_get_family(struct rtnl_route *);
68extern void rtnl_route_set_type(struct rtnl_route *, int);
69extern int rtnl_route_get_type(struct rtnl_route *);
70extern void rtnl_route_set_flags(struct rtnl_route *,
71 unsigned int);
72extern void rtnl_route_unset_flags(struct rtnl_route *,
73 unsigned int);
74extern unsigned int rtnl_route_get_flags(struct rtnl_route *);
75extern int rtnl_route_set_metric(struct rtnl_route *, int,
76 unsigned int);
77extern int rtnl_route_unset_metric(struct rtnl_route *, int);
78extern unsigned int rtnl_route_get_metric(struct rtnl_route *, int);
79extern int rtnl_route_set_dst(struct rtnl_route *,
80 struct nl_addr *);
81extern struct nl_addr * rtnl_route_get_dst(struct rtnl_route *);
82extern int rtnl_route_set_src(struct rtnl_route *,
83 struct nl_addr *);
84extern struct nl_addr * rtnl_route_get_src(struct rtnl_route *);
85extern int rtnl_route_set_gateway(struct rtnl_route *,
86 struct nl_addr *);
87extern struct nl_addr * rtnl_route_get_gateway(struct rtnl_route *);
88extern int rtnl_route_set_pref_src(struct rtnl_route *,
89 struct nl_addr *);
90extern struct nl_addr * rtnl_route_get_pref_src(struct rtnl_route *);
91extern void rtnl_route_set_oif(struct rtnl_route *, int);
92extern int rtnl_route_get_oif(struct rtnl_route *);
93extern void rtnl_route_set_iif(struct rtnl_route *, const char *);
94extern char * rtnl_route_get_iif(struct rtnl_route *);
95extern int rtnl_route_get_dst_len(struct rtnl_route *);
96extern int rtnl_route_get_src_len(struct rtnl_route *);
97
98extern void rtnl_route_add_nexthop(struct rtnl_route *,
99 struct rtnl_nexthop *);
100extern void rtnl_route_remove_nexthop(struct rtnl_nexthop *);
101extern struct nl_list_head * rtnl_route_get_nexthops(struct rtnl_route *);
102extern void rtnl_route_set_cacheinfo(struct rtnl_route *,
103 struct rtnl_rtcacheinfo *);
104extern uint32_t rtnl_route_get_mp_algo(struct rtnl_route *);
105extern void rtnl_route_set_mp_algo(struct rtnl_route *, uint32_t);
106
107extern char * rtnl_route_table2str(int, char *, size_t);
108extern int rtnl_route_str2table(const char *);
109extern int rtnl_route_read_table_names(const char *);
110
111extern char * rtnl_route_proto2str(int, char *, size_t);
112extern int rtnl_route_str2proto(const char *);
113extern int rtnl_route_read_protocol_names(const char *);
114
115extern char * rtnl_route_metric2str(int, char *, size_t);
116extern int rtnl_route_str2metric(const char *);
117
118extern char * rtnl_route_nh_flags2str(int, char *, size_t);
119extern int rtnl_route_nh_str2flags(const char *);
120
121#ifdef __cplusplus
122}
123#endif
124
125#endif
struct nl_cache * rtnl_route_alloc_cache(struct nl_handle *)
Build a route cache holding all routes currently configured in the kernel.
Definition: route.c:241
Object Operations.
Definition: object-api.h:255