]> git.proxmox.com Git - mirror_frr.git/blob - bgpd/rfapi/rfapi_rib.h
bgpd: Rename various variable names to something more appropriate
[mirror_frr.git] / bgpd / rfapi / rfapi_rib.h
1 /*
2 *
3 * Copyright 2009-2016, LabN Consulting, L.L.C.
4 *
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 /*
22 * File: rfapi_rib.h
23 * Purpose: per-nve rib
24 */
25
26 #ifndef QUAGGA_HGP_RFAPI_RIB_H
27 #define QUAGGA_HGP_RFAPI_RIB_H
28
29 /*
30 * Key for indexing RIB and Pending RIB skiplists. For L3 RIBs,
31 * the VN address is sufficient because it represents the actual next hop.
32 *
33 * For L2 RIBs, it is possible to have multiple routes to a given L2
34 * prefix via a given VN address, but each route having a unique aux_prefix.
35 */
36 struct rfapi_rib_key {
37 struct prefix vn;
38 struct prefix_rd rd;
39
40 /*
41 * for L2 routes: optional IP addr
42 * .family == 0 means "none"
43 */
44 struct prefix aux_prefix;
45 };
46 #include "rfapi.h"
47
48 /*
49 * RFAPI Advertisement Data Block
50 *
51 * Holds NVE prefix advertisement information
52 */
53 struct rfapi_adb {
54 union {
55 struct {
56 struct prefix prefix_ip;
57 struct prefix_rd prd;
58 struct prefix prefix_eth;
59 } s; /* mainly for legacy use */
60 struct rfapi_rib_key key;
61 } u;
62 uint32_t lifetime;
63 uint8_t cost;
64 struct rfapi_l2address_option l2o;
65 };
66
67 struct rfapi_info {
68 struct rfapi_rib_key rk; /* NVE VN addr + aux addr */
69 struct prefix un;
70 uint8_t cost;
71 uint32_t lifetime;
72 time_t last_sent_time;
73 uint32_t rsp_counter; /* dedup initial responses */
74 struct bgp_tea_options *tea_options;
75 struct rfapi_un_option *un_options;
76 struct rfapi_vn_option *vn_options;
77 struct thread *timer;
78 };
79
80 /*
81 * Work item for updated responses queue
82 */
83 struct rfapi_updated_responses_queue {
84 struct rfapi_descriptor *rfd;
85 afi_t afi;
86 };
87
88
89 extern void rfapiRibClear(struct rfapi_descriptor *rfd);
90
91 extern void rfapiRibFree(struct rfapi_descriptor *rfd);
92
93 extern void rfapiRibUpdatePendingNode(struct bgp *bgp,
94 struct rfapi_descriptor *rfd,
95 struct rfapi_import_table *it,
96 struct agg_node *it_node,
97 uint32_t lifetime);
98
99 extern void rfapiRibUpdatePendingNodeSubtree(struct bgp *bgp,
100 struct rfapi_descriptor *rfd,
101 struct rfapi_import_table *it,
102 struct agg_node *it_node,
103 struct agg_node *omit_subtree,
104 uint32_t lifetime);
105
106 extern int rfapiRibPreloadBi(struct agg_node *rfd_rib_node,
107 struct prefix *pfx_vn, struct prefix *pfx_un,
108 uint32_t lifetime, struct bgp_path_info *bpi);
109
110 extern struct rfapi_next_hop_entry *
111 rfapiRibPreload(struct bgp *bgp, struct rfapi_descriptor *rfd,
112 struct rfapi_next_hop_entry *response, int use_eth_resolution);
113
114 extern void rfapiRibPendingDeleteRoute(struct bgp *bgp,
115 struct rfapi_import_table *it, afi_t afi,
116 struct agg_node *it_node);
117
118 extern void rfapiRibShowResponsesSummary(void *stream);
119
120 extern void rfapiRibShowResponsesSummaryClear(void);
121
122 extern void rfapiRibShowResponses(void *stream, struct prefix *pfx_match,
123 int show_removed);
124
125 extern int rfapiRibFTDFilterRecentPrefix(
126 struct rfapi_descriptor *rfd,
127 struct agg_node *it_rn, /* import table node */
128 struct prefix *pfx_target_original); /* query target */
129
130 extern void rfapiFreeRfapiUnOptionChain(struct rfapi_un_option *p);
131
132 extern void rfapiFreeRfapiVnOptionChain(struct rfapi_vn_option *p);
133
134 extern void
135 rfapiRibCheckCounts(int checkstats, /* validate rfd & global counts */
136 unsigned int offset); /* number of ri's held separately */
137
138 /* enable for debugging; disable for performance */
139 #if 0
140 #define RFAPI_RIB_CHECK_COUNTS(checkstats, offset) rfapiRibCheckCounts(checkstats, offset)
141 #else
142 #define RFAPI_RIB_CHECK_COUNTS(checkstats, offset)
143 #endif
144
145 extern void rfapi_rib_key_init(struct prefix *prefix, /* may be NULL */
146 struct prefix_rd *rd, /* may be NULL */
147 struct prefix *aux, /* may be NULL */
148 struct rfapi_rib_key *rk);
149
150 extern int rfapi_rib_key_cmp(void *k1, void *k2);
151
152 extern void rfapiAdbFree(struct rfapi_adb *adb);
153
154 #endif /* QUAGGA_HGP_RFAPI_RIB_H */