]> git.proxmox.com Git - mirror_frr.git/blob - ospf6d/ospf6_area.h
doc: Add `show ipv6 rpf X:X::X:X` command to docs
[mirror_frr.git] / ospf6d / ospf6_area.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 OSPF_AREA_H
22 #define OSPF_AREA_H
23
24 #include "ospf6_top.h"
25 #include "lib/json.h"
26
27 struct ospf6_area {
28 /* Reference to Top data structure */
29 struct ospf6 *ospf6;
30
31 /* Area-ID */
32 in_addr_t area_id;
33
34 #define OSPF6_AREA_FMT_UNSET 0
35 #define OSPF6_AREA_FMT_DOTTEDQUAD 1
36 #define OSPF6_AREA_FMT_DECIMAL 2
37 /* Area-ID string */
38 char name[16];
39
40 /* flag */
41 uint8_t flag;
42
43 /* OSPF Option */
44 uint8_t options[3];
45
46 /* Summary routes to be originated (includes Configured Address Ranges)
47 */
48 struct ospf6_route_table *range_table;
49 struct ospf6_route_table *nssa_range_table;
50 struct ospf6_route_table *summary_prefix;
51 struct ospf6_route_table *summary_router;
52
53 /* Area type */
54 int no_summary;
55
56 /* NSSA default-information-originate */
57 struct {
58 bool enabled;
59 int metric_type;
60 int metric_value;
61 } nssa_default_originate;
62
63 /* Brouter traversal protection */
64 bool intra_brouter_calc;
65
66 /* OSPF interface list */
67 struct list *if_list;
68
69 struct ospf6_lsdb *lsdb;
70 struct ospf6_lsdb *lsdb_self;
71 struct ospf6_lsdb *temp_router_lsa_lsdb;
72
73 struct ospf6_route_table *spf_table;
74 struct ospf6_route_table *route_table;
75
76 uint32_t spf_calculation; /* SPF calculation count */
77
78 struct thread *thread_router_lsa;
79 struct thread *thread_intra_prefix_lsa;
80 uint32_t router_lsa_size_limit;
81
82 /* Area announce list */
83 struct {
84 char *name;
85 struct access_list *list;
86 } _export;
87 #define EXPORT_NAME(A) (A)->_export.name
88 #define EXPORT_LIST(A) (A)->_export.list
89
90 /* Area acceptance list */
91 struct {
92 char *name;
93 struct access_list *list;
94 } import;
95 #define IMPORT_NAME(A) (A)->import.name
96 #define IMPORT_LIST(A) (A)->import.list
97
98 /* Type 3 LSA Area prefix-list */
99 struct {
100 char *name;
101 struct prefix_list *list;
102 } plist_in;
103 #define PREFIX_NAME_IN(A) (A)->plist_in.name
104 #define PREFIX_LIST_IN(A) (A)->plist_in.list
105
106 struct {
107 char *name;
108 struct prefix_list *list;
109 } plist_out;
110 #define PREFIX_NAME_OUT(A) (A)->plist_out.name
111 #define PREFIX_LIST_OUT(A) (A)->plist_out.list
112
113 /* Time stamps. */
114 struct timeval ts_spf; /* SPF calculation time stamp. */
115
116 uint32_t full_nbrs; /* Fully adjacent neighbors. */
117 uint8_t intra_prefix_originate; /* Force intra_prefix lsa originate */
118 uint8_t NSSATranslatorRole; /* NSSA configured role */
119 #define OSPF6_NSSA_ROLE_NEVER 0
120 #define OSPF6_NSSA_ROLE_CANDIDATE 1
121 #define OSPF6_NSSA_ROLE_ALWAYS 2
122 uint8_t NSSATranslatorState; /* NSSA operational role */
123 #define OSPF6_NSSA_TRANSLATE_DISABLED 0
124 #define OSPF6_NSSA_TRANSLATE_ENABLED 1
125 };
126
127 #define OSPF6_AREA_ENABLE 0x01
128 #define OSPF6_AREA_ACTIVE 0x02
129 #define OSPF6_AREA_TRANSIT 0x04 /* TransitCapability */
130 #define OSPF6_AREA_STUB 0x08
131 #define OSPF6_AREA_NSSA 0x10
132
133 #define IS_AREA_ENABLED(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_ENABLE))
134 #define IS_AREA_ACTIVE(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_ACTIVE))
135 #define IS_AREA_TRANSIT(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_TRANSIT))
136 #define IS_AREA_STUB(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_STUB))
137 #define IS_AREA_NSSA(oa) (CHECK_FLAG((oa)->flag, OSPF6_AREA_NSSA))
138
139 #define OSPF6_CMD_AREA_GET(str, oa, ospf6) \
140 { \
141 uint32_t area_id; \
142 int format, ret; \
143 ret = str2area_id(str, &area_id, &format); \
144 if (ret) { \
145 vty_out(vty, "Malformed Area-ID: %s\n", str); \
146 return CMD_WARNING; \
147 } \
148 oa = ospf6_area_lookup(area_id, ospf6); \
149 if (oa == NULL) \
150 oa = ospf6_area_create(area_id, ospf6, format); \
151 }
152
153 /* prototypes */
154 extern int str2area_id(const char *str, uint32_t *area_id, int *area_id_fmt);
155 extern void area_id2str(char *buf, int len, uint32_t area_id, int area_id_fmt);
156
157 extern int ospf6_area_cmp(void *va, void *vb);
158
159 extern struct ospf6_area *ospf6_area_create(uint32_t area_id,
160 struct ospf6 *ospf6, int df);
161 extern void ospf6_area_delete(struct ospf6_area *oa);
162 extern struct ospf6_area *ospf6_area_lookup(uint32_t area_id,
163 struct ospf6 *ospf6);
164 extern struct ospf6_area *ospf6_area_lookup_by_area_id(uint32_t area_id);
165
166 extern void ospf6_area_stub_unset(struct ospf6 *ospf6, struct ospf6_area *area);
167 extern void ospf6_area_enable(struct ospf6_area *oa);
168 extern void ospf6_area_disable(struct ospf6_area *oa);
169
170 extern void ospf6_area_show(struct vty *vty, struct ospf6_area *oa,
171 json_object *json_areas, bool use_json);
172
173 extern void ospf6_plist_update(struct prefix_list *plist);
174 extern void ospf6_filter_update(struct access_list *access);
175 extern void ospf6_area_config_write(struct vty *vty, struct ospf6 *ospf6);
176 extern void ospf6_area_init(void);
177 struct ospf6_interface;
178 extern void ospf6_area_interface_delete(struct ospf6_interface *oi);
179
180 #endif /* OSPF_AREA_H */