6#ifndef NETLINK_ROUTE_H_
7#define NETLINK_ROUTE_H_
9#include <netlink/netlink.h>
10#include <netlink/cache.h>
11#include <netlink/addr.h>
12#include <netlink/data.h>
13#include <netlink/route/nexthop.h>
14#include <netlink/route/rtnl.h>
15#include <linux/in_route.h>
27#define ROUTE_CACHE_CONTENT 1
33 uint32_t rtci_clntref;
34 uint32_t rtci_last_use;
35 uint32_t rtci_expires;
43extern struct nl_object_ops route_obj_ops;
45extern struct rtnl_route * rtnl_route_alloc(
void);
46extern void rtnl_route_put(
struct rtnl_route *);
50extern void rtnl_route_get(
struct rtnl_route *);
52extern int rtnl_route_parse(
struct nlmsghdr *,
struct rtnl_route **);
53extern int rtnl_route_build_msg(
struct nl_msg *,
struct rtnl_route *);
55extern int rtnl_route_lookup(
struct nl_sock *sk,
struct nl_addr *dst,
56 struct rtnl_route **result);
58extern int rtnl_route_build_add_request(
struct rtnl_route *,
int,
60extern int rtnl_route_add(
struct nl_sock *,
struct rtnl_route *,
int);
61extern int rtnl_route_build_del_request(
struct rtnl_route *,
int,
63extern int rtnl_route_delete(
struct nl_sock *,
struct rtnl_route *,
int);
65extern void rtnl_route_set_table(
struct rtnl_route *, uint32_t);
66extern uint32_t rtnl_route_get_table(
struct rtnl_route *);
67extern void rtnl_route_set_scope(
struct rtnl_route *, uint8_t);
68extern uint8_t rtnl_route_get_scope(
struct rtnl_route *);
69extern void rtnl_route_set_tos(
struct rtnl_route *, uint8_t);
70extern uint8_t rtnl_route_get_tos(
struct rtnl_route *);
71extern void rtnl_route_set_protocol(
struct rtnl_route *, uint8_t);
72extern uint8_t rtnl_route_get_protocol(
struct rtnl_route *);
73extern void rtnl_route_set_priority(
struct rtnl_route *, uint32_t);
74extern uint32_t rtnl_route_get_priority(
struct rtnl_route *);
75extern int rtnl_route_set_family(
struct rtnl_route *, uint8_t);
76extern uint8_t rtnl_route_get_family(
struct rtnl_route *);
77extern int rtnl_route_set_type(
struct rtnl_route *, uint8_t);
78extern uint8_t rtnl_route_get_type(
struct rtnl_route *);
79extern void rtnl_route_set_flags(
struct rtnl_route *, uint32_t);
80extern void rtnl_route_unset_flags(
struct rtnl_route *, uint32_t);
81extern uint32_t rtnl_route_get_flags(
struct rtnl_route *);
82extern int rtnl_route_set_metric(
struct rtnl_route *,
int,
unsigned int);
83extern int rtnl_route_unset_metric(
struct rtnl_route *,
int);
84extern int rtnl_route_get_metric(
struct rtnl_route *,
int, uint32_t *);
85extern int rtnl_route_set_dst(
struct rtnl_route *,
struct nl_addr *);
86extern struct nl_addr *rtnl_route_get_dst(
struct rtnl_route *);
87extern int rtnl_route_set_src(
struct rtnl_route *,
struct nl_addr *);
88extern struct nl_addr *rtnl_route_get_src(
struct rtnl_route *);
89extern int rtnl_route_set_pref_src(
struct rtnl_route *,
struct nl_addr *);
90extern struct nl_addr *rtnl_route_get_pref_src(
struct rtnl_route *);
91extern void rtnl_route_set_iif(
struct rtnl_route *,
int);
92extern int rtnl_route_get_iif(
struct rtnl_route *);
93extern int rtnl_route_get_src_len(
struct rtnl_route *);
94extern void rtnl_route_set_ttl_propagate(
struct rtnl_route *route,
96extern int rtnl_route_get_ttl_propagate(
struct rtnl_route *route);
98extern void rtnl_route_add_nexthop(
struct rtnl_route *,
99 struct rtnl_nexthop *);
100extern void rtnl_route_remove_nexthop(
struct rtnl_route *,
101 struct rtnl_nexthop *);
102extern struct nl_list_head *rtnl_route_get_nexthops(
struct rtnl_route *);
103extern int rtnl_route_get_nnexthops(
struct rtnl_route *);
105extern void rtnl_route_foreach_nexthop(
struct rtnl_route *r,
106 void (*cb)(
struct rtnl_nexthop *,
void *),
109extern struct rtnl_nexthop * rtnl_route_nexthop_n(
struct rtnl_route *r,
int n);
113extern char * rtnl_route_table2str(
int,
char *,
size_t);
114extern int rtnl_route_str2table(
const char *);
115extern int rtnl_route_read_table_names(
const char *);
117extern char * rtnl_route_proto2str(
int,
char *,
size_t);
118extern int rtnl_route_str2proto(
const char *);
119extern int rtnl_route_read_protocol_names(
const char *);
121extern char * rtnl_route_metric2str(
int,
char *,
size_t);
122extern int rtnl_route_str2metric(
const char *);
int rtnl_route_guess_scope(struct rtnl_route *)
Guess scope of a route object.
int rtnl_route_alloc_cache(struct nl_sock *, int, int, struct nl_cache **)
Build a route cache holding all routes currently configured in the kernel.