]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* |
508e53e2 | 2 | * Copyright (C) 2003 Yasuhiro Ohara |
718e3744 | 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 | * | |
896014f4 DL |
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 | |
718e3744 | 19 | */ |
20 | ||
21 | #ifndef OSPF_AREA_H | |
22 | #define OSPF_AREA_H | |
23 | ||
718e3744 | 24 | #include "ospf6_top.h" |
35a45dea | 25 | #include "lib/json.h" |
718e3744 | 26 | |
d62a17ae | 27 | struct ospf6_area { |
28 | /* Reference to Top data structure */ | |
29 | struct ospf6 *ospf6; | |
718e3744 | 30 | |
d62a17ae | 31 | /* Area-ID */ |
858f9c08 | 32 | in_addr_t area_id; |
718e3744 | 33 | |
79c3f4f4 QY |
34 | #define OSPF6_AREA_FMT_DOTTEDQUAD 1 |
35 | #define OSPF6_AREA_FMT_DECIMAL 2 | |
d62a17ae | 36 | /* Area-ID string */ |
37 | char name[16]; | |
718e3744 | 38 | |
d62a17ae | 39 | /* flag */ |
d7c0a89a | 40 | uint8_t flag; |
718e3744 | 41 | |
d62a17ae | 42 | /* OSPF Option */ |
d7c0a89a | 43 | uint8_t options[3]; |
718e3744 | 44 | |
d62a17ae | 45 | /* Summary routes to be originated (includes Configured Address Ranges) |
46 | */ | |
47 | struct ospf6_route_table *range_table; | |
48 | struct ospf6_route_table *summary_prefix; | |
49 | struct ospf6_route_table *summary_router; | |
049207c3 | 50 | |
d62a17ae | 51 | /* Area type */ |
52 | int no_summary; | |
ca1f4309 | 53 | |
a2d0055a CS |
54 | /* Brouter traversal protection */ |
55 | int intra_brouter_calc; | |
56 | ||
d62a17ae | 57 | /* OSPF interface list */ |
58 | struct list *if_list; | |
718e3744 | 59 | |
d62a17ae | 60 | struct ospf6_lsdb *lsdb; |
61 | struct ospf6_lsdb *lsdb_self; | |
da086a3b | 62 | struct ospf6_lsdb *temp_router_lsa_lsdb; |
6452df09 | 63 | |
d62a17ae | 64 | struct ospf6_route_table *spf_table; |
65 | struct ospf6_route_table *route_table; | |
718e3744 | 66 | |
d7c0a89a | 67 | uint32_t spf_calculation; /* SPF calculation count */ |
718e3744 | 68 | |
d62a17ae | 69 | struct thread *thread_router_lsa; |
70 | struct thread *thread_intra_prefix_lsa; | |
d7c0a89a | 71 | uint32_t router_lsa_size_limit; |
34956b31 | 72 | |
d62a17ae | 73 | /* Area announce list */ |
74 | struct { | |
75 | char *name; | |
76 | struct access_list *list; | |
77 | } _export; | |
dea04441 PJ |
78 | #define EXPORT_NAME(A) (A)->_export.name |
79 | #define EXPORT_LIST(A) (A)->_export.list | |
34956b31 | 80 | |
d62a17ae | 81 | /* Area acceptance list */ |
82 | struct { | |
83 | char *name; | |
84 | struct access_list *list; | |
85 | } import; | |
34956b31 | 86 | #define IMPORT_NAME(A) (A)->import.name |
87 | #define IMPORT_LIST(A) (A)->import.list | |
88 | ||
d62a17ae | 89 | /* Type 3 LSA Area prefix-list */ |
90 | struct { | |
91 | char *name; | |
92 | struct prefix_list *list; | |
93 | } plist_in; | |
34956b31 | 94 | #define PREFIX_NAME_IN(A) (A)->plist_in.name |
95 | #define PREFIX_LIST_IN(A) (A)->plist_in.list | |
96 | ||
d62a17ae | 97 | struct { |
98 | char *name; | |
99 | struct prefix_list *list; | |
100 | } plist_out; | |
34956b31 | 101 | #define PREFIX_NAME_OUT(A) (A)->plist_out.name |
102 | #define PREFIX_LIST_OUT(A) (A)->plist_out.list | |
103 | ||
d62a17ae | 104 | /* Time stamps. */ |
105 | struct timeval ts_spf; /* SPF calculation time stamp. */ | |
d6927cf3 CS |
106 | |
107 | uint32_t full_nbrs; /* Fully adjacent neighbors. */ | |
690df177 | 108 | uint8_t intra_prefix_originate; /* Force intra_prefix lsa originate */ |
718e3744 | 109 | }; |
110 | ||
6452df09 | 111 | #define OSPF6_AREA_ENABLE 0x01 |
112 | #define OSPF6_AREA_ACTIVE 0x02 | |
113 | #define OSPF6_AREA_TRANSIT 0x04 /* TransitCapability */ | |
114 | #define OSPF6_AREA_STUB 0x08 | |
115 | ||
6452df09 | 116 | #define IS_AREA_ENABLED(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_ENABLE)) |
117 | #define IS_AREA_ACTIVE(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_ACTIVE)) | |
118 | #define IS_AREA_TRANSIT(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_TRANSIT)) | |
119 | #define IS_AREA_STUB(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_STUB)) | |
718e3744 | 120 | |
beadc736 | 121 | #define OSPF6_CMD_AREA_GET(str, oa, ospf6) \ |
de842255 PR |
122 | { \ |
123 | char *ep; \ | |
124 | uint32_t area_id = htonl(strtoul(str, &ep, 10)); \ | |
125 | if (*ep && inet_pton(AF_INET, str, &area_id) != 1) { \ | |
126 | vty_out(vty, "Malformed Area-ID: %s\n", str); \ | |
127 | return CMD_SUCCESS; \ | |
128 | } \ | |
129 | int format = !*ep ? OSPF6_AREA_FMT_DECIMAL \ | |
130 | : OSPF6_AREA_FMT_DOTTEDQUAD; \ | |
131 | oa = ospf6_area_lookup(area_id, ospf6); \ | |
132 | if (oa == NULL) \ | |
133 | oa = ospf6_area_create(area_id, ospf6, format); \ | |
134 | } | |
135 | ||
718e3744 | 136 | /* prototypes */ |
d62a17ae | 137 | extern int ospf6_area_cmp(void *va, void *vb); |
6452df09 | 138 | |
d7c0a89a | 139 | extern struct ospf6_area *ospf6_area_create(uint32_t, struct ospf6 *, int); |
d62a17ae | 140 | extern void ospf6_area_delete(struct ospf6_area *); |
d7c0a89a | 141 | extern struct ospf6_area *ospf6_area_lookup(uint32_t, struct ospf6 *); |
beadc736 | 142 | extern struct ospf6_area *ospf6_area_lookup_by_area_id(uint32_t area_id); |
508e53e2 | 143 | |
d62a17ae | 144 | extern void ospf6_area_enable(struct ospf6_area *); |
145 | extern void ospf6_area_disable(struct ospf6_area *); | |
718e3744 | 146 | |
35a45dea | 147 | extern void ospf6_area_show(struct vty *, struct ospf6_area *, |
148 | json_object *json_areas, bool use_json); | |
6452df09 | 149 | |
427f8e61 | 150 | extern void ospf6_area_plist_update(struct prefix_list *plist, int add); |
beadc736 | 151 | extern void ospf6_area_config_write(struct vty *vty, struct ospf6 *ospf6); |
d62a17ae | 152 | extern void ospf6_area_init(void); |
22b982df PG |
153 | struct ospf6_interface; |
154 | extern void ospf6_area_interface_delete(struct ospf6_interface *oi); | |
718e3744 | 155 | |
156 | #endif /* OSPF_AREA_H */ |