1/*
2 * netlink/route/nexthop.h	Routing Nexthop
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-2008 Thomas Graf <tgraf@suug.ch>
10 */
11
12#ifndef NETLINK_ROUTE_NEXTHOP_H_
13#define NETLINK_ROUTE_NEXTHOP_H_
14
15#include <netlink/netlink.h>
16#include <netlink/addr.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22struct rtnl_nexthop;
23
24enum {
25	NH_DUMP_FROM_ONELINE = -2,
26	NH_DUMP_FROM_DETAILS = -1,
27	NH_DUMP_FROM_ENV = 0,
28	/* > 0 reserved for nexthop index */
29};
30
31extern struct rtnl_nexthop * rtnl_route_nh_alloc(void);
32extern struct rtnl_nexthop * rtnl_route_nh_clone(struct rtnl_nexthop *);
33extern void		rtnl_route_nh_free(struct rtnl_nexthop *);
34
35extern int		rtnl_route_nh_compare(struct rtnl_nexthop *,
36					      struct rtnl_nexthop *,
37					      uint32_t, int);
38
39extern void		rtnl_route_nh_dump(struct rtnl_nexthop *,
40					   struct nl_dump_params *);
41
42extern void		rtnl_route_nh_set_weight(struct rtnl_nexthop *, uint8_t);
43extern uint8_t		rtnl_route_nh_get_weight(struct rtnl_nexthop *);
44extern void		rtnl_route_nh_set_ifindex(struct rtnl_nexthop *, int);
45extern int		rtnl_route_nh_get_ifindex(struct rtnl_nexthop *);
46extern void		rtnl_route_nh_set_gateway(struct rtnl_nexthop *,
47						  struct nl_addr *);
48extern struct nl_addr *	rtnl_route_nh_get_gateway(struct rtnl_nexthop *);
49extern void		rtnl_route_nh_set_flags(struct rtnl_nexthop *,
50						unsigned int);
51extern void		rtnl_route_nh_unset_flags(struct rtnl_nexthop *,
52						  unsigned int);
53extern unsigned int	rtnl_route_nh_get_flags(struct rtnl_nexthop *);
54extern void		rtnl_route_nh_set_realms(struct rtnl_nexthop *,
55						 uint32_t);
56extern uint32_t		rtnl_route_nh_get_realms(struct rtnl_nexthop *);
57
58extern char *		rtnl_route_nh_flags2str(int, char *, size_t);
59extern int		rtnl_route_nh_str2flags(const char *);
60
61#ifdef __cplusplus
62}
63#endif
64
65#endif
66