]> git.proxmox.com Git - mirror_frr.git/blob - zebra/zebra_vrf.h
release: FRR 3.0-rc1
[mirror_frr.git] / zebra / zebra_vrf.h
1 /*
2 * Zebra Vrf Header
3 * Copyright (C) 2016 Cumulus Networks
4 * Donald Sahrp
5 *
6 * This file is part of Quagga.
7 *
8 * Quagga is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
11 * later version.
12 *
13 * Quagga is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with GNU Zebra; see the file COPYING. If not, write to the Free
20 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 * 02111-1307, USA.
22 */
23 #if !defined(__ZEBRA_RIB_H__)
24 #define __ZEBRA_RIB_H__
25
26 #include <zebra/zebra_ns.h>
27 #include <zebra/zebra_pw.h>
28
29 /* Routing table instance. */
30 struct zebra_vrf {
31 /* Back pointer */
32 struct vrf *vrf;
33
34 /* Description. */
35 char *desc;
36
37 /* FIB identifier. */
38 u_char fib_id;
39
40 /* Flags. */
41 u_int16_t flags;
42 #define ZEBRA_VRF_RIB_SCHEDULED (1 << 0)
43 #define ZEBRA_VRF_RETAIN (2 << 0)
44
45 u_int32_t table_id;
46
47 /* Routing table. */
48 struct route_table *table[AFI_MAX][SAFI_MAX];
49
50 /* Static route configuration. */
51 struct route_table *stable[AFI_MAX][SAFI_MAX];
52
53 /* Recursive Nexthop table */
54 struct route_table *rnh_table[AFI_MAX];
55
56 /* Import check table (used mostly by BGP */
57 struct route_table *import_check_table[AFI_MAX];
58
59 /* Routing tables off of main table for redistribute table */
60 struct route_table *other_table[AFI_MAX][ZEBRA_KERNEL_TABLE_MAX];
61
62 /* 2nd pointer type used primarily to quell a warning on
63 * ALL_LIST_ELEMENTS_RO
64 */
65 struct list _rid_all_sorted_list;
66 struct list _rid_lo_sorted_list;
67 struct list *rid_all_sorted_list;
68 struct list *rid_lo_sorted_list;
69 struct prefix rid_user_assigned;
70
71 /*
72 * Back pointer to the owning namespace.
73 */
74 struct zebra_ns *zns;
75
76 /* MPLS static LSP config table */
77 struct hash *slsp_table;
78
79 /* MPLS label forwarding table */
80 struct hash *lsp_table;
81
82 /* Pseudowires. */
83 struct zebra_pw_head pseudowires;
84 struct zebra_static_pw_head static_pseudowires;
85
86 /* MPLS processing flags */
87 u_int16_t mpls_flags;
88 #define MPLS_FLAG_SCHEDULE_LSPS (1 << 0)
89 };
90
91 static inline vrf_id_t zvrf_id(struct zebra_vrf *zvrf)
92 {
93 return zvrf->vrf->vrf_id;
94 }
95
96 static inline const char *zvrf_name(struct zebra_vrf *zvrf)
97 {
98 return zvrf->vrf->name;
99 }
100
101 struct route_table *zebra_vrf_table_with_table_id(afi_t afi, safi_t safi,
102 vrf_id_t vrf_id,
103 u_int32_t table_id);
104
105 extern void zebra_vrf_update_all(struct zserv *client);
106 extern struct zebra_vrf *zebra_vrf_lookup_by_id(vrf_id_t vrf_id);
107 extern struct zebra_vrf *zebra_vrf_lookup_by_name(const char *);
108 extern struct zebra_vrf *zebra_vrf_alloc(void);
109 extern struct route_table *zebra_vrf_table(afi_t, safi_t, vrf_id_t);
110 extern struct route_table *zebra_vrf_static_table(afi_t, safi_t,
111 struct zebra_vrf *zvrf);
112 extern struct route_table *
113 zebra_vrf_other_route_table(afi_t afi, u_int32_t table_id, vrf_id_t vrf_id);
114 extern void zebra_vrf_init(void);
115 #endif