]> git.proxmox.com Git - mirror_frr.git/blob - ospf6d/ospf6_top.h
*: Rename `struct thread` to `struct event`
[mirror_frr.git] / ospf6d / ospf6_top.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Copyright (C) 2003 Yasuhiro Ohara
4 */
5
6 #ifndef OSPF6_TOP_H
7 #define OSPF6_TOP_H
8
9 #include "qobj.h"
10 #include "routemap.h"
11 struct ospf6_master {
12
13 /* OSPFv3 instance. */
14 struct list *ospf6;
15 /* OSPFv3 thread master. */
16 struct thread_master *master;
17 };
18
19 /* ospf6->config_flags */
20 enum { OSPF6_LOG_ADJACENCY_CHANGES = (1 << 0),
21 OSPF6_LOG_ADJACENCY_DETAIL = (1 << 1),
22 OSPF6_SEND_EXTRA_DATA_TO_ZEBRA = (1 << 2),
23 };
24
25 /* For processing route-map change update in the callback */
26 #define OSPF6_IS_RMAP_CHANGED 0x01
27 struct ospf6_redist {
28 uint8_t instance;
29
30 uint8_t flag;
31 /* Redistribute metric info. */
32 struct {
33 int type; /* External metric type (E1 or E2). */
34 int value; /* Value for static metric (24-bit).
35 * -1 means metric value is not set.
36 */
37 } dmetric;
38
39 /* For redistribute route map. */
40 struct {
41 char *name;
42 struct route_map *map;
43 } route_map;
44 #define ROUTEMAP_NAME(R) (R->route_map.name)
45 #define ROUTEMAP(R) (R->route_map.map)
46 };
47
48 struct ospf6_gr_info {
49 bool restart_support;
50 bool restart_in_progress;
51 bool prepare_in_progress;
52 bool finishing_restart;
53 uint32_t grace_period;
54 struct event *t_grace_period;
55 };
56
57 struct ospf6_gr_helper {
58 /* Graceful restart Helper supported configs*/
59 /* Supported grace interval*/
60 uint32_t supported_grace_time;
61
62 /* Helper support
63 * Supported : True
64 * Not Supported : False.
65 */
66 bool is_helper_supported;
67
68 /* Support for strict LSA check.
69 * if it is set,Helper aborted
70 * upon a TOPO change.
71 */
72 bool strict_lsa_check;
73
74 /* Support as HELPER only for
75 * planned restarts.
76 */
77 bool only_planned_restart;
78
79 /* This list contains the advertisement
80 * routerids for which Helper support is
81 * enabled.
82 */
83 struct hash *enable_rtr_list;
84
85 /* HELPER for number of active
86 * RESTARTERs.
87 */
88 int active_restarter_cnt;
89
90 /* last HELPER exit reason */
91 uint32_t last_exit_reason;
92 };
93
94 /* OSPFv3 top level data structure */
95 struct ospf6 {
96 /* The relevant vrf_id */
97 vrf_id_t vrf_id;
98
99 char *name; /* VRF name */
100
101 /* my router id */
102 in_addr_t router_id;
103
104 /* static router id */
105 in_addr_t router_id_static;
106
107 in_addr_t router_id_zebra;
108
109 /* start time */
110 struct timeval starttime;
111
112 /* list of areas */
113 struct list *area_list;
114 struct ospf6_area *backbone;
115
116 /* AS scope link state database */
117 struct ospf6_lsdb *lsdb;
118 struct ospf6_lsdb *lsdb_self;
119
120 struct ospf6_route_table *route_table;
121 struct ospf6_route_table *brouter_table;
122
123 struct ospf6_route_table *external_table;
124 #define OSPF6_EXT_INIT_LS_ID 1
125 uint32_t external_id;
126
127 /* OSPF6 redistribute configuration */
128 struct list *redist[ZEBRA_ROUTE_MAX + 1];
129
130 /* NSSA default-information-originate */
131 struct {
132 /* # of NSSA areas requesting default information */
133 uint16_t refcnt;
134
135 /*
136 * Whether a default route known through non-OSPF protocol is
137 * present in the RIB.
138 */
139 bool status;
140 } nssa_default_import_check;
141
142 uint8_t flag;
143 #define OSPF6_FLAG_ABR 0x04
144 #define OSPF6_FLAG_ASBR 0x08
145
146 int redistribute; /* Num of redistributed protocols. */
147
148 /* Configuration bitmask, refer to enum above */
149 uint8_t config_flags;
150 int default_originate; /* Default information originate. */
151 #define DEFAULT_ORIGINATE_NONE 0
152 #define DEFAULT_ORIGINATE_ZEBRA 1
153 #define DEFAULT_ORIGINATE_ALWAYS 2
154 /* LSA timer parameters */
155 unsigned int lsa_minarrival; /* LSA minimum arrival in milliseconds. */
156
157 /* SPF parameters */
158 unsigned int spf_delay; /* SPF delay time. */
159 unsigned int spf_holdtime; /* SPF hold time. */
160 unsigned int spf_max_holdtime; /* SPF maximum-holdtime */
161 unsigned int
162 spf_hold_multiplier; /* Adaptive multiplier for hold time */
163 unsigned int spf_reason; /* reason bits while scheduling SPF */
164
165 struct timeval ts_spf; /* SPF calculation time stamp. */
166 struct timeval ts_spf_duration; /* Execution time of last SPF */
167 unsigned int last_spf_reason; /* Last SPF reason */
168
169 int fd;
170 /* Threads */
171 struct event *t_spf_calc; /* SPF calculation timer. */
172 struct event *t_ase_calc; /* ASE calculation timer. */
173 struct event *maxage_remover;
174 struct event *t_distribute_update; /* Distirbute update timer. */
175 struct event *t_ospf6_receive; /* OSPF6 receive timer */
176 struct event *t_external_aggr; /* OSPF6 aggregation timer */
177 #define OSPF6_WRITE_INTERFACE_COUNT_DEFAULT 20
178 struct event *t_write;
179
180 int write_oi_count; /* Num of packets sent per thread invocation */
181 uint32_t ref_bandwidth;
182
183 /* Distance parameters */
184 uint8_t distance_all;
185 uint8_t distance_intra;
186 uint8_t distance_inter;
187 uint8_t distance_external;
188
189 struct route_table *distance_table;
190
191 /* Used during ospf instance going down send LSDB
192 * update to neighbors immediatly */
193 uint8_t inst_shutdown;
194
195 /* Max number of multiple paths
196 * to support ECMP.
197 */
198 uint16_t max_multipath;
199
200 /* OSPF Graceful Restart info (restarting mode) */
201 struct ospf6_gr_info gr_info;
202
203 /*ospf6 Graceful restart helper info */
204 struct ospf6_gr_helper ospf6_helper_cfg;
205
206 /* Count of NSSA areas */
207 uint8_t anyNSSA;
208 struct event *t_abr_task; /* ABR task timer. */
209 struct list *oi_write_q;
210
211 uint32_t redist_count;
212
213 /* Action for aggregation of external LSAs */
214 int aggr_action;
215
216 uint32_t seqnum_l; /* lower order Sequence Number */
217 uint32_t seqnum_h; /* higher order Sequence Number */
218 #define OSPF6_EXTL_AGGR_DEFAULT_DELAY 5
219 /* For ASBR summary delay timer */
220 uint16_t aggr_delay_interval;
221 /* Table of configured Aggregate addresses */
222 struct route_table *rt_aggr_tbl;
223
224 QOBJ_FIELDS;
225 };
226 DECLARE_QOBJ_TYPE(ospf6);
227
228 #define OSPF6_DISABLED 0x01
229 #define OSPF6_STUB_ROUTER 0x02
230
231 /* global pointer for OSPF top data structure */
232 extern struct ospf6 *ospf6;
233 extern struct ospf6_master *om6;
234
235 /* prototypes */
236 extern void ospf6_master_init(struct thread_master *master);
237 extern void install_element_ospf6_clear_process(void);
238 extern void ospf6_top_init(void);
239 extern void ospf6_delete(struct ospf6 *o);
240 extern bool ospf6_router_id_update(struct ospf6 *ospf6, bool init);
241 void ospf6_restart_spf(struct ospf6 *ospf6);
242
243 extern void ospf6_maxage_remove(struct ospf6 *o);
244 extern struct ospf6 *ospf6_instance_create(const char *name);
245 void ospf6_vrf_link(struct ospf6 *ospf6, struct vrf *vrf);
246 void ospf6_vrf_unlink(struct ospf6 *ospf6, struct vrf *vrf);
247 struct ospf6 *ospf6_lookup_by_vrf_id(vrf_id_t vrf_id);
248 struct ospf6 *ospf6_lookup_by_vrf_name(const char *name);
249 const char *ospf6_vrf_id_to_name(vrf_id_t vrf_id);
250 void ospf6_vrf_init(void);
251 bool ospf6_is_valid_summary_addr(struct vty *vty, struct prefix *p);
252 #endif /* OSPF6_TOP_H */