libnl 3.10.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 int rtnl_route_nh_identical(struct rtnl_nexthop *,
34 struct rtnl_nexthop *);
35
36extern void rtnl_route_nh_dump(struct rtnl_nexthop *,
37 struct nl_dump_params *);
38
39extern void rtnl_route_nh_set_weight(struct rtnl_nexthop *, uint8_t);
40extern uint8_t rtnl_route_nh_get_weight(struct rtnl_nexthop *);
41extern void rtnl_route_nh_set_ifindex(struct rtnl_nexthop *, int);
42extern int rtnl_route_nh_get_ifindex(struct rtnl_nexthop *);
43extern void rtnl_route_nh_set_gateway(struct rtnl_nexthop *,
44 struct nl_addr *);
45extern struct nl_addr * rtnl_route_nh_get_gateway(struct rtnl_nexthop *);
46extern void rtnl_route_nh_set_flags(struct rtnl_nexthop *,
47 unsigned int);
48extern void rtnl_route_nh_unset_flags(struct rtnl_nexthop *,
49 unsigned int);
50extern unsigned int rtnl_route_nh_get_flags(struct rtnl_nexthop *);
51extern void rtnl_route_nh_set_realms(struct rtnl_nexthop *,
52 uint32_t);
53extern uint32_t rtnl_route_nh_get_realms(struct rtnl_nexthop *);
54
55extern int rtnl_route_nh_set_newdst(struct rtnl_nexthop *,
56 struct nl_addr *);
57extern struct nl_addr * rtnl_route_nh_get_newdst(struct rtnl_nexthop *);
58extern int rtnl_route_nh_set_via(struct rtnl_nexthop *,
59 struct nl_addr *);
60extern struct nl_addr * rtnl_route_nh_get_via(struct rtnl_nexthop *);
61extern char * rtnl_route_nh_flags2str(int, char *, size_t);
62extern int rtnl_route_nh_str2flags(const char *);
63
64/*
65 * nexthop encapsulations
66 */
67extern int rtnl_route_nh_encap_mpls(struct rtnl_nexthop *nh,
68 struct nl_addr *addr,
69 uint8_t ttl);
70extern struct nl_addr * rtnl_route_nh_get_encap_mpls_dst(struct rtnl_nexthop *);
71extern uint8_t rtnl_route_nh_get_encap_mpls_ttl(struct rtnl_nexthop *);
72#ifdef __cplusplus
73}
74#endif
75
76#endif
int rtnl_route_nh_identical(struct rtnl_nexthop *, struct rtnl_nexthop *)
Check if the fixed attributes of two nexthops are identical, and may only differ in flags or weight.
Definition nexthop.c:148
Dumping parameters.
Definition types.h:32