libnl 3.7.0
nexthop.h
1/* SPDX-License-Identifier: LGPL-2.1-only */
2/*
3 * Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
4 */
5
6#ifndef NETLINK_ROUTE_NEXTHOP_H_
7#define NETLINK_ROUTE_NEXTHOP_H_
8
9#include <netlink/netlink.h>
10#include <netlink/addr.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16struct rtnl_nexthop;
17
18enum {
19 NH_DUMP_FROM_ONELINE = -2,
20 NH_DUMP_FROM_DETAILS = -1,
21 NH_DUMP_FROM_ENV = 0,
22 /* > 0 reserved for nexthop index */
23};
24
25extern struct rtnl_nexthop * rtnl_route_nh_alloc(void);
26extern struct rtnl_nexthop * rtnl_route_nh_clone(struct rtnl_nexthop *);
27extern void rtnl_route_nh_free(struct rtnl_nexthop *);
28
29extern int rtnl_route_nh_compare(struct rtnl_nexthop *,
30 struct rtnl_nexthop *,
31 uint32_t, int);
32
33extern void rtnl_route_nh_dump(struct rtnl_nexthop *,
34 struct nl_dump_params *);
35
36extern void rtnl_route_nh_set_weight(struct rtnl_nexthop *, uint8_t);
37extern uint8_t rtnl_route_nh_get_weight(struct rtnl_nexthop *);
38extern void rtnl_route_nh_set_ifindex(struct rtnl_nexthop *, int);
39extern int rtnl_route_nh_get_ifindex(struct rtnl_nexthop *);
40extern void rtnl_route_nh_set_gateway(struct rtnl_nexthop *,
41 struct nl_addr *);
42extern struct nl_addr * rtnl_route_nh_get_gateway(struct rtnl_nexthop *);
43extern void rtnl_route_nh_set_flags(struct rtnl_nexthop *,
44 unsigned int);
45extern void rtnl_route_nh_unset_flags(struct rtnl_nexthop *,
46 unsigned int);
47extern unsigned int rtnl_route_nh_get_flags(struct rtnl_nexthop *);
48extern void rtnl_route_nh_set_realms(struct rtnl_nexthop *,
49 uint32_t);
50extern uint32_t rtnl_route_nh_get_realms(struct rtnl_nexthop *);
51
52extern int rtnl_route_nh_set_newdst(struct rtnl_nexthop *,
53 struct nl_addr *);
54extern struct nl_addr * rtnl_route_nh_get_newdst(struct rtnl_nexthop *);
55extern int rtnl_route_nh_set_via(struct rtnl_nexthop *,
56 struct nl_addr *);
57extern struct nl_addr * rtnl_route_nh_get_via(struct rtnl_nexthop *);
58extern char * rtnl_route_nh_flags2str(int, char *, size_t);
59extern int rtnl_route_nh_str2flags(const char *);
60
61/*
62 * nexthop encapsulations
63 */
64extern int rtnl_route_nh_encap_mpls(struct rtnl_nexthop *nh,
65 struct nl_addr *addr,
66 uint8_t ttl);
67extern struct nl_addr * rtnl_route_nh_get_encap_mpls_dst(struct rtnl_nexthop *);
68extern uint8_t rtnl_route_nh_get_encap_mpls_ttl(struct rtnl_nexthop *);
69#ifdef __cplusplus
70}
71#endif
72
73#endif
Dumping parameters.
Definition: types.h:28