]> git.proxmox.com Git - mirror_frr.git/blame - zebra/zebra_rnh.h
add cplusplus guards to all zebra headers
[mirror_frr.git] / zebra / zebra_rnh.h
CommitLineData
fb018d25
DS
1/*
2 * Zebra next hop tracking header
3 * Copyright (C) 2013 Cumulus Networks, Inc.
4 *
5 * This file is part of GNU Zebra.
6 *
7 * GNU Zebra is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
10 * later version.
11 *
12 * GNU Zebra is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
896014f4
DL
17 * You should have received a copy of the GNU General Public License along
18 * with this program; see the file COPYING; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
fb018d25
DS
20 */
21
22#ifndef _ZEBRA_RNH_H
23#define _ZEBRA_RNH_H
24
25#include "prefix.h"
26#include "vty.h"
27
51e94aa7
EDP
28#ifdef __cplusplus
29extern "C" {
30#endif
31
fb018d25 32/* Nexthop structure. */
d62a17ae 33struct rnh {
d7c0a89a 34 uint8_t flags;
078430f6 35
fc9a856f 36#define ZEBRA_NHT_CONNECTED 0x1
70c0f184 37#define ZEBRA_NHT_DELETED 0x2
078430f6
DS
38#define ZEBRA_NHT_EXACT_MATCH 0x4
39
d62a17ae 40 /* VRF identifier. */
41 vrf_id_t vrf_id;
d82ae0de 42
d62a17ae 43 struct route_entry *state;
44 struct prefix resolved_route;
45 struct list *client_list;
7e24fdf3
DS
46
47 /* pseudowires dependent on this nh */
48 struct list *zebra_pseudowire_list;
49
d62a17ae 50 struct route_node *node;
7e24fdf3
DS
51
52 /*
53 * if this has been filtered for the client
54 */
55 int filtered[ZEBRA_ROUTE_MAX];
fb018d25
DS
56};
57
d62a17ae 58typedef enum { RNH_NEXTHOP_TYPE, RNH_IMPORT_CHECK_TYPE } rnh_type_t;
078430f6 59
a50b580a
DS
60extern int zebra_rnh_ip_default_route;
61extern int zebra_rnh_ipv6_default_route;
62
453844ab
QY
63extern void zebra_rnh_init(void);
64
44bdf159
DS
65static inline int rnh_resolve_via_default(int family)
66{
67 if (((family == AF_INET) && zebra_rnh_ip_default_route)
68 || ((family == AF_INET6) && zebra_rnh_ipv6_default_route))
69 return 1;
70 else
71 return 0;
72}
73
b72ede27 74extern struct rnh *zebra_add_rnh(struct prefix *p, vrf_id_t vrfid,
1d30d1f4 75 rnh_type_t type, bool *exists);
b72ede27 76extern struct rnh *zebra_lookup_rnh(struct prefix *p, vrf_id_t vrfid,
078430f6 77 rnh_type_t type);
d62a17ae 78extern void zebra_free_rnh(struct rnh *rnh);
d62a17ae 79extern void zebra_add_rnh_client(struct rnh *rnh, struct zserv *client,
80 rnh_type_t type, vrf_id_t vrfid);
731a75fe
RW
81extern void zebra_register_rnh_pseudowire(vrf_id_t, struct zebra_pw *);
82extern void zebra_deregister_rnh_pseudowire(vrf_id_t, struct zebra_pw *);
078430f6
DS
83extern void zebra_remove_rnh_client(struct rnh *rnh, struct zserv *client,
84 rnh_type_t type);
73bf60a0 85extern void zebra_evaluate_rnh(struct zebra_vrf *zvrf, afi_t afi, int force,
d62a17ae 86 rnh_type_t type, struct prefix *p);
73bf60a0 87extern void zebra_print_rnh_table(vrf_id_t vrfid, afi_t afi, struct vty *vty,
d62a17ae 88 rnh_type_t);
fb018d25 89extern char *rnh_str(struct rnh *rnh, char *buf, int size);
51e94aa7
EDP
90
91#ifdef __cplusplus
92}
93#endif
94
fb018d25 95#endif /*_ZEBRA_RNH_H */