]> git.proxmox.com Git - mirror_frr.git/blame - ospf6d/ospf6_area.h
Merge pull request #13141 from mjstapp/fix_ospf_json_keys
[mirror_frr.git] / ospf6d / ospf6_area.h
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
718e3744 2/*
508e53e2 3 * Copyright (C) 2003 Yasuhiro Ohara
718e3744 4 */
5
6#ifndef OSPF_AREA_H
7#define OSPF_AREA_H
8
718e3744 9#include "ospf6_top.h"
35a45dea 10#include "lib/json.h"
718e3744 11
d62a17ae 12struct ospf6_area {
13 /* Reference to Top data structure */
14 struct ospf6 *ospf6;
718e3744 15
d62a17ae 16 /* Area-ID */
858f9c08 17 in_addr_t area_id;
718e3744 18
42cabc55 19#define OSPF6_AREA_FMT_UNSET 0
79c3f4f4
QY
20#define OSPF6_AREA_FMT_DOTTEDQUAD 1
21#define OSPF6_AREA_FMT_DECIMAL 2
d62a17ae 22 /* Area-ID string */
23 char name[16];
718e3744 24
d62a17ae 25 /* flag */
d7c0a89a 26 uint8_t flag;
718e3744 27
d62a17ae 28 /* OSPF Option */
d7c0a89a 29 uint8_t options[3];
718e3744 30
d62a17ae 31 /* Summary routes to be originated (includes Configured Address Ranges)
32 */
33 struct ospf6_route_table *range_table;
3c77bc80 34 struct ospf6_route_table *nssa_range_table;
d62a17ae 35 struct ospf6_route_table *summary_prefix;
36 struct ospf6_route_table *summary_router;
049207c3 37
d62a17ae 38 /* Area type */
39 int no_summary;
ca1f4309 40
6735622c
RW
41 /* NSSA default-information-originate */
42 struct {
43 bool enabled;
44 int metric_type;
45 int metric_value;
46 } nssa_default_originate;
47
a2d0055a 48 /* Brouter traversal protection */
cbcf3335 49 bool intra_brouter_calc;
a2d0055a 50
d62a17ae 51 /* OSPF interface list */
52 struct list *if_list;
718e3744 53
d62a17ae 54 struct ospf6_lsdb *lsdb;
55 struct ospf6_lsdb *lsdb_self;
da086a3b 56 struct ospf6_lsdb *temp_router_lsa_lsdb;
6452df09 57
d62a17ae 58 struct ospf6_route_table *spf_table;
59 struct ospf6_route_table *route_table;
718e3744 60
d7c0a89a 61 uint32_t spf_calculation; /* SPF calculation count */
718e3744 62
e6685141
DS
63 struct event *thread_router_lsa;
64 struct event *thread_intra_prefix_lsa;
d7c0a89a 65 uint32_t router_lsa_size_limit;
34956b31 66
d62a17ae 67 /* Area announce list */
68 struct {
69 char *name;
70 struct access_list *list;
71 } _export;
dea04441
PJ
72#define EXPORT_NAME(A) (A)->_export.name
73#define EXPORT_LIST(A) (A)->_export.list
34956b31 74
d62a17ae 75 /* Area acceptance list */
76 struct {
77 char *name;
78 struct access_list *list;
79 } import;
34956b31 80#define IMPORT_NAME(A) (A)->import.name
81#define IMPORT_LIST(A) (A)->import.list
82
d62a17ae 83 /* Type 3 LSA Area prefix-list */
84 struct {
85 char *name;
86 struct prefix_list *list;
87 } plist_in;
34956b31 88#define PREFIX_NAME_IN(A) (A)->plist_in.name
89#define PREFIX_LIST_IN(A) (A)->plist_in.list
90
d62a17ae 91 struct {
92 char *name;
93 struct prefix_list *list;
94 } plist_out;
34956b31 95#define PREFIX_NAME_OUT(A) (A)->plist_out.name
96#define PREFIX_LIST_OUT(A) (A)->plist_out.list
97
d62a17ae 98 /* Time stamps. */
99 struct timeval ts_spf; /* SPF calculation time stamp. */
d6927cf3
CS
100
101 uint32_t full_nbrs; /* Fully adjacent neighbors. */
690df177 102 uint8_t intra_prefix_originate; /* Force intra_prefix lsa originate */
ad500b22
K
103 uint8_t NSSATranslatorRole; /* NSSA configured role */
104#define OSPF6_NSSA_ROLE_NEVER 0
105#define OSPF6_NSSA_ROLE_CANDIDATE 1
106#define OSPF6_NSSA_ROLE_ALWAYS 2
107 uint8_t NSSATranslatorState; /* NSSA operational role */
108#define OSPF6_NSSA_TRANSLATE_DISABLED 0
109#define OSPF6_NSSA_TRANSLATE_ENABLED 1
718e3744 110};
111
6452df09 112#define OSPF6_AREA_ENABLE 0x01
113#define OSPF6_AREA_ACTIVE 0x02
114#define OSPF6_AREA_TRANSIT 0x04 /* TransitCapability */
115#define OSPF6_AREA_STUB 0x08
ad500b22 116#define OSPF6_AREA_NSSA 0x10
6452df09 117
6452df09 118#define IS_AREA_ENABLED(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_ENABLE))
119#define IS_AREA_ACTIVE(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_ACTIVE))
120#define IS_AREA_TRANSIT(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_TRANSIT))
121#define IS_AREA_STUB(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_STUB))
ad500b22 122#define IS_AREA_NSSA(oa) (CHECK_FLAG((oa)->flag, OSPF6_AREA_NSSA))
718e3744 123
beadc736 124#define OSPF6_CMD_AREA_GET(str, oa, ospf6) \
de842255 125 { \
42cabc55
IR
126 uint32_t area_id; \
127 int format, ret; \
128 ret = str2area_id(str, &area_id, &format); \
129 if (ret) { \
de842255 130 vty_out(vty, "Malformed Area-ID: %s\n", str); \
42cabc55 131 return CMD_WARNING; \
de842255 132 } \
de842255
PR
133 oa = ospf6_area_lookup(area_id, ospf6); \
134 if (oa == NULL) \
135 oa = ospf6_area_create(area_id, ospf6, format); \
136 }
137
718e3744 138/* prototypes */
42cabc55
IR
139extern int str2area_id(const char *str, uint32_t *area_id, int *area_id_fmt);
140extern void area_id2str(char *buf, int len, uint32_t area_id, int area_id_fmt);
141
d62a17ae 142extern int ospf6_area_cmp(void *va, void *vb);
6452df09 143
7932dd93
DS
144extern struct ospf6_area *ospf6_area_create(uint32_t area_id,
145 struct ospf6 *ospf6, int df);
146extern void ospf6_area_delete(struct ospf6_area *oa);
147extern struct ospf6_area *ospf6_area_lookup(uint32_t area_id,
148 struct ospf6 *ospf6);
beadc736 149extern struct ospf6_area *ospf6_area_lookup_by_area_id(uint32_t area_id);
508e53e2 150
0c293b92 151extern void ospf6_area_stub_unset(struct ospf6 *ospf6, struct ospf6_area *area);
7932dd93
DS
152extern void ospf6_area_enable(struct ospf6_area *oa);
153extern void ospf6_area_disable(struct ospf6_area *oa);
718e3744 154
7932dd93 155extern void ospf6_area_show(struct vty *vty, struct ospf6_area *oa,
35a45dea 156 json_object *json_areas, bool use_json);
6452df09 157
f4f0098c 158extern void ospf6_plist_update(struct prefix_list *plist);
f6c5f2e0 159extern void ospf6_filter_update(struct access_list *access);
beadc736 160extern void ospf6_area_config_write(struct vty *vty, struct ospf6 *ospf6);
d62a17ae 161extern void ospf6_area_init(void);
22b982df
PG
162struct ospf6_interface;
163extern void ospf6_area_interface_delete(struct ospf6_interface *oi);
718e3744 164
165#endif /* OSPF_AREA_H */