libnl  3.6.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
13 extern "C" {
14 #endif
15 
16 struct rtnl_nexthop;
17 
18 enum {
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 
25 extern struct rtnl_nexthop * rtnl_route_nh_alloc(void);
26 extern struct rtnl_nexthop * rtnl_route_nh_clone(struct rtnl_nexthop *);
27 extern void rtnl_route_nh_free(struct rtnl_nexthop *);
28 
29 extern int rtnl_route_nh_compare(struct rtnl_nexthop *,
30  struct rtnl_nexthop *,
31  uint32_t, int);
32 
33 extern void rtnl_route_nh_dump(struct rtnl_nexthop *,
34  struct nl_dump_params *);
35 
36 extern void rtnl_route_nh_set_weight(struct rtnl_nexthop *, uint8_t);
37 extern uint8_t rtnl_route_nh_get_weight(struct rtnl_nexthop *);
38 extern void rtnl_route_nh_set_ifindex(struct rtnl_nexthop *, int);
39 extern int rtnl_route_nh_get_ifindex(struct rtnl_nexthop *);
40 extern void rtnl_route_nh_set_gateway(struct rtnl_nexthop *,
41  struct nl_addr *);
42 extern struct nl_addr * rtnl_route_nh_get_gateway(struct rtnl_nexthop *);
43 extern void rtnl_route_nh_set_flags(struct rtnl_nexthop *,
44  unsigned int);
45 extern void rtnl_route_nh_unset_flags(struct rtnl_nexthop *,
46  unsigned int);
47 extern unsigned int rtnl_route_nh_get_flags(struct rtnl_nexthop *);
48 extern void rtnl_route_nh_set_realms(struct rtnl_nexthop *,
49  uint32_t);
50 extern uint32_t rtnl_route_nh_get_realms(struct rtnl_nexthop *);
51 
52 extern int rtnl_route_nh_set_newdst(struct rtnl_nexthop *,
53  struct nl_addr *);
54 extern struct nl_addr * rtnl_route_nh_get_newdst(struct rtnl_nexthop *);
55 extern int rtnl_route_nh_set_via(struct rtnl_nexthop *,
56  struct nl_addr *);
57 extern struct nl_addr * rtnl_route_nh_get_via(struct rtnl_nexthop *);
58 extern char * rtnl_route_nh_flags2str(int, char *, size_t);
59 extern int rtnl_route_nh_str2flags(const char *);
60 
61 /*
62  * nexthop encapsulations
63  */
64 extern int rtnl_route_nh_encap_mpls(struct rtnl_nexthop *nh,
65  struct nl_addr *addr,
66  uint8_t ttl);
67 extern struct nl_addr * rtnl_route_nh_get_encap_mpls_dst(struct rtnl_nexthop *);
68 extern 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