]> git.proxmox.com Git - mirror_frr.git/blob - ospf6d/ospf6_top.h
Merge pull request #9028 from mobash-rasool/ospfv3-asbr-summarisation
[mirror_frr.git] / ospf6d / ospf6_top.h
1 /*
2 * Copyright (C) 2003 Yasuhiro Ohara
3 *
4 * This file is part of GNU Zebra.
5 *
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
9 * later version.
10 *
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * 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 #ifndef OSPF6_TOP_H
22 #define OSPF6_TOP_H
23
24 #include "qobj.h"
25 #include "routemap.h"
26 struct ospf6_master {
27
28 /* OSPFv3 instance. */
29 struct list *ospf6;
30 /* OSPFv3 thread master. */
31 struct thread_master *master;
32 };
33
34 /* ospf6->config_flags */
35 enum {
36 OSPF6_LOG_ADJACENCY_CHANGES = (1 << 0),
37 OSPF6_LOG_ADJACENCY_DETAIL = (1 << 1),
38 };
39
40 /* For processing route-map change update in the callback */
41 #define OSPF6_IS_RMAP_CHANGED 0x01
42 struct ospf6_redist {
43 uint8_t instance;
44
45 uint8_t flag;
46 /* Redistribute metric info. */
47 struct {
48 int type; /* External metric type (E1 or E2). */
49 int value; /* Value for static metric (24-bit).
50 * -1 means metric value is not set.
51 */
52 } dmetric;
53
54 /* For redistribute route map. */
55 struct {
56 char *name;
57 struct route_map *map;
58 } route_map;
59 #define ROUTEMAP_NAME(R) (R->route_map.name)
60 #define ROUTEMAP(R) (R->route_map.map)
61 };
62
63 /* OSPFv3 top level data structure */
64 struct ospf6 {
65 /* The relevant vrf_id */
66 vrf_id_t vrf_id;
67
68 char *name; /* VRF name */
69
70 /* my router id */
71 in_addr_t router_id;
72
73 /* static router id */
74 in_addr_t router_id_static;
75
76 in_addr_t router_id_zebra;
77
78 /* start time */
79 struct timeval starttime;
80
81 /* list of areas */
82 struct list *area_list;
83 struct ospf6_area *backbone;
84
85 /* AS scope link state database */
86 struct ospf6_lsdb *lsdb;
87 struct ospf6_lsdb *lsdb_self;
88
89 struct ospf6_route_table *route_table;
90 struct ospf6_route_table *brouter_table;
91
92 struct ospf6_route_table *external_table;
93 struct route_table *external_id_table;
94 #define OSPF6_EXT_INIT_LS_ID 1
95 uint32_t external_id;
96
97 /* OSPF6 redistribute configuration */
98 struct list *redist[ZEBRA_ROUTE_MAX + 1];
99
100 uint8_t flag;
101 #define OSPF6_FLAG_ABR 0x04
102 #define OSPF6_FLAG_ASBR 0x08
103
104 int redistribute; /* Num of redistributed protocols. */
105
106 /* Configuration bitmask, refer to enum above */
107 uint8_t config_flags;
108 int default_originate; /* Default information originate. */
109 #define DEFAULT_ORIGINATE_NONE 0
110 #define DEFAULT_ORIGINATE_ZEBRA 1
111 #define DEFAULT_ORIGINATE_ALWAYS 2
112 /* LSA timer parameters */
113 unsigned int lsa_minarrival; /* LSA minimum arrival in milliseconds. */
114
115 /* SPF parameters */
116 unsigned int spf_delay; /* SPF delay time. */
117 unsigned int spf_holdtime; /* SPF hold time. */
118 unsigned int spf_max_holdtime; /* SPF maximum-holdtime */
119 unsigned int
120 spf_hold_multiplier; /* Adaptive multiplier for hold time */
121 unsigned int spf_reason; /* reason bits while scheduling SPF */
122
123 struct timeval ts_spf; /* SPF calculation time stamp. */
124 struct timeval ts_spf_duration; /* Execution time of last SPF */
125 unsigned int last_spf_reason; /* Last SPF reason */
126
127 int fd;
128 /* Threads */
129 struct thread *t_spf_calc; /* SPF calculation timer. */
130 struct thread *t_ase_calc; /* ASE calculation timer. */
131 struct thread *maxage_remover;
132 struct thread *t_distribute_update; /* Distirbute update timer. */
133 struct thread *t_ospf6_receive; /* OSPF6 receive timer */
134 struct thread *t_external_aggr; /* OSPF6 aggregation timer */
135 #define OSPF6_WRITE_INTERFACE_COUNT_DEFAULT 20
136 struct thread *t_write;
137
138 int write_oi_count; /* Num of packets sent per thread invocation */
139 uint32_t ref_bandwidth;
140
141 /* Distance parameters */
142 uint8_t distance_all;
143 uint8_t distance_intra;
144 uint8_t distance_inter;
145 uint8_t distance_external;
146
147 struct route_table *distance_table;
148
149 /* Used during ospf instance going down send LSDB
150 * update to neighbors immediatly */
151 uint8_t inst_shutdown;
152
153 /* Max number of multiple paths
154 * to support ECMP.
155 */
156 uint16_t max_multipath;
157 /* Count of NSSA areas */
158 uint8_t anyNSSA;
159 struct thread *t_abr_task; /* ABR task timer. */
160 struct list *oi_write_q;
161
162 uint32_t redist_count;
163
164 /* Action for aggregation of external LSAs */
165 int aggr_action;
166
167 #define OSPF6_EXTL_AGGR_DEFAULT_DELAY 5
168 /* For ASBR summary delay timer */
169 int aggr_delay_interval;
170 /* Table of configured Aggregate addresses */
171 struct route_table *rt_aggr_tbl;
172
173 QOBJ_FIELDS;
174 };
175 DECLARE_QOBJ_TYPE(ospf6);
176
177 #define OSPF6_DISABLED 0x01
178 #define OSPF6_STUB_ROUTER 0x02
179
180 /* global pointer for OSPF top data structure */
181 extern struct ospf6 *ospf6;
182 extern struct ospf6_master *om6;
183
184 /* prototypes */
185 extern void ospf6_master_init(struct thread_master *master);
186 extern void install_element_ospf6_clear_process(void);
187 extern void ospf6_top_init(void);
188 extern void ospf6_delete(struct ospf6 *o);
189 extern void ospf6_router_id_update(struct ospf6 *ospf6);
190
191 extern void ospf6_maxage_remove(struct ospf6 *o);
192 extern struct ospf6 *ospf6_instance_create(const char *name);
193 void ospf6_vrf_link(struct ospf6 *ospf6, struct vrf *vrf);
194 void ospf6_vrf_unlink(struct ospf6 *ospf6, struct vrf *vrf);
195 struct ospf6 *ospf6_lookup_by_vrf_id(vrf_id_t vrf_id);
196 struct ospf6 *ospf6_lookup_by_vrf_name(const char *name);
197 const char *ospf6_vrf_id_to_name(vrf_id_t vrf_id);
198 void ospf6_vrf_init(void);
199 bool ospf6_is_valid_summary_addr(struct vty *vty, struct prefix *p);
200 #endif /* OSPF6_TOP_H */