]>
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 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with GNU Zebra; see the file COPYING. If not, write to the | |
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
19 | * Boston, MA 02111-1307, USA. | |
20 | */ | |
21 | ||
22 | #ifndef OSPF6_INTRA_H | |
23 | #define OSPF6_INTRA_H | |
24 | ||
cb4b8845 PJ |
25 | /* Debug option */ |
26 | extern unsigned char conf_debug_ospf6_brouter; | |
27 | extern u_int32_t conf_debug_ospf6_brouter_specific_router_id; | |
28 | extern u_int32_t conf_debug_ospf6_brouter_specific_area_id; | |
29 | #define OSPF6_DEBUG_BROUTER_SUMMARY 0x01 | |
30 | #define OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER 0x02 | |
31 | #define OSPF6_DEBUG_BROUTER_SPECIFIC_AREA 0x04 | |
32 | #define OSPF6_DEBUG_BROUTER_ON() \ | |
33 | (conf_debug_ospf6_brouter |= OSPF6_DEBUG_BROUTER_SUMMARY) | |
34 | #define OSPF6_DEBUG_BROUTER_OFF() \ | |
35 | (conf_debug_ospf6_brouter &= ~OSPF6_DEBUG_BROUTER_SUMMARY) | |
36 | #define IS_OSPF6_DEBUG_BROUTER \ | |
37 | (conf_debug_ospf6_brouter & OSPF6_DEBUG_BROUTER_SUMMARY) | |
38 | ||
39 | #define OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ON(router_id) \ | |
40 | do { \ | |
41 | conf_debug_ospf6_brouter_specific_router_id = (router_id); \ | |
42 | conf_debug_ospf6_brouter |= OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER; \ | |
43 | } while (0) | |
44 | #define OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_OFF() \ | |
45 | do { \ | |
46 | conf_debug_ospf6_brouter_specific_router_id = 0; \ | |
47 | conf_debug_ospf6_brouter &= ~OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER; \ | |
48 | } while (0) | |
49 | #define IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER \ | |
50 | (conf_debug_ospf6_brouter & OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER) | |
51 | #define IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ID(router_id) \ | |
52 | (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER && \ | |
53 | conf_debug_ospf6_brouter_specific_router_id == (router_id)) | |
54 | ||
55 | #define OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ON(area_id) \ | |
56 | do { \ | |
57 | conf_debug_ospf6_brouter_specific_area_id = (area_id); \ | |
58 | conf_debug_ospf6_brouter |= OSPF6_DEBUG_BROUTER_SPECIFIC_AREA; \ | |
59 | } while (0) | |
60 | #define OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_OFF() \ | |
61 | do { \ | |
62 | conf_debug_ospf6_brouter_specific_area_id = 0; \ | |
63 | conf_debug_ospf6_brouter &= ~OSPF6_DEBUG_BROUTER_SPECIFIC_AREA; \ | |
64 | } while (0) | |
65 | #define IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA \ | |
66 | (conf_debug_ospf6_brouter & OSPF6_DEBUG_BROUTER_SPECIFIC_AREA) | |
67 | #define IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID(area_id) \ | |
68 | (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA && \ | |
69 | conf_debug_ospf6_brouter_specific_area_id == (area_id)) | |
70 | ||
508e53e2 | 71 | /* Router-LSA */ |
72 | struct ospf6_router_lsa | |
73 | { | |
74 | u_char bits; | |
75 | u_char options[3]; | |
76 | /* followed by ospf6_router_lsdesc(s) */ | |
77 | }; | |
78 | ||
79 | /* Link State Description in Router-LSA */ | |
80 | struct ospf6_router_lsdesc | |
81 | { | |
82 | u_char type; | |
83 | u_char reserved; | |
84 | u_int16_t metric; /* output cost */ | |
85 | u_int32_t interface_id; | |
86 | u_int32_t neighbor_interface_id; | |
87 | u_int32_t neighbor_router_id; | |
88 | }; | |
89 | ||
90 | #define OSPF6_ROUTER_LSDESC_POINTTOPOINT 1 | |
91 | #define OSPF6_ROUTER_LSDESC_TRANSIT_NETWORK 2 | |
92 | #define OSPF6_ROUTER_LSDESC_STUB_NETWORK 3 | |
93 | #define OSPF6_ROUTER_LSDESC_VIRTUAL_LINK 4 | |
94 | ||
95 | #define ROUTER_LSDESC_IS_TYPE(t,x) \ | |
96 | ((((struct ospf6_router_lsdesc *)(x))->type == \ | |
97 | OSPF6_ROUTER_LSDESC_ ## t) ? 1 : 0) | |
98 | #define ROUTER_LSDESC_GET_METRIC(x) \ | |
99 | (ntohs (((struct ospf6_router_lsdesc *)(x))->metric)) | |
100 | #define ROUTER_LSDESC_GET_IFID(x) \ | |
101 | (ntohl (((struct ospf6_router_lsdesc *)(x))->interface_id)) | |
102 | #define ROUTER_LSDESC_GET_NBR_IFID(x) \ | |
103 | (ntohl (((struct ospf6_router_lsdesc *)(x))->neighbor_interface_id)) | |
104 | #define ROUTER_LSDESC_GET_NBR_ROUTERID(x) \ | |
105 | (((struct ospf6_router_lsdesc *)(x))->neighbor_router_id) | |
106 | ||
107 | /* Network-LSA */ | |
108 | struct ospf6_network_lsa | |
109 | { | |
110 | u_char reserved; | |
111 | u_char options[3]; | |
112 | /* followed by ospf6_netowrk_lsd(s) */ | |
113 | }; | |
114 | ||
115 | /* Link State Description in Router-LSA */ | |
116 | struct ospf6_network_lsdesc | |
117 | { | |
118 | u_int32_t router_id; | |
119 | }; | |
120 | #define NETWORK_LSDESC_GET_NBR_ROUTERID(x) \ | |
121 | (((struct ospf6_network_lsdesc *)(x))->router_id) | |
122 | ||
123 | /* Link-LSA */ | |
124 | struct ospf6_link_lsa | |
125 | { | |
126 | u_char priority; | |
127 | u_char options[3]; | |
128 | struct in6_addr linklocal_addr; | |
129 | u_int32_t prefix_num; | |
130 | /* followed by ospf6 prefix(es) */ | |
131 | }; | |
132 | ||
133 | /* Intra-Area-Prefix-LSA */ | |
134 | struct ospf6_intra_prefix_lsa | |
135 | { | |
136 | u_int16_t prefix_num; | |
137 | u_int16_t ref_type; | |
138 | u_int32_t ref_id; | |
139 | u_int32_t ref_adv_router; | |
140 | /* followed by ospf6 prefix(es) */ | |
141 | }; | |
142 | ||
143 | \f | |
144 | #define OSPF6_ROUTER_LSA_SCHEDULE(oa) \ | |
145 | do { \ | |
146 | if (! (oa)->thread_router_lsa) \ | |
147 | (oa)->thread_router_lsa = \ | |
148 | thread_add_event (master, ospf6_router_lsa_originate, oa, 0); \ | |
149 | } while (0) | |
150 | #define OSPF6_NETWORK_LSA_SCHEDULE(oi) \ | |
151 | do { \ | |
152 | if (! (oi)->thread_network_lsa) \ | |
153 | (oi)->thread_network_lsa = \ | |
154 | thread_add_event (master, ospf6_network_lsa_originate, oi, 0); \ | |
155 | } while (0) | |
156 | #define OSPF6_LINK_LSA_SCHEDULE(oi) \ | |
157 | do { \ | |
158 | if (! (oi)->thread_link_lsa) \ | |
159 | (oi)->thread_link_lsa = \ | |
160 | thread_add_event (master, ospf6_link_lsa_originate, oi, 0); \ | |
161 | } while (0) | |
162 | #define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB(oa) \ | |
163 | do { \ | |
164 | if (! (oa)->thread_intra_prefix_lsa) \ | |
165 | (oa)->thread_intra_prefix_lsa = \ | |
166 | thread_add_event (master, ospf6_intra_prefix_lsa_originate_stub, \ | |
167 | oa, 0); \ | |
168 | } while (0) | |
169 | #define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT(oi) \ | |
170 | do { \ | |
171 | if (! (oi)->thread_intra_prefix_lsa) \ | |
172 | (oi)->thread_intra_prefix_lsa = \ | |
173 | thread_add_event (master, ospf6_intra_prefix_lsa_originate_transit, \ | |
174 | oi, 0); \ | |
175 | } while (0) | |
176 | ||
6452df09 | 177 | #define OSPF6_NETWORK_LSA_EXECUTE(oi) \ |
178 | do { \ | |
179 | THREAD_OFF ((oi)->thread_network_lsa); \ | |
180 | thread_execute (master, ospf6_network_lsa_originate, oi, 0); \ | |
181 | } while (0) | |
182 | #define OSPF6_INTRA_PREFIX_LSA_EXECUTE_TRANSIT(oi) \ | |
183 | do { \ | |
184 | THREAD_OFF ((oi)->thread_intra_prefix_lsa); \ | |
185 | thread_execute (master, ospf6_intra_prefix_lsa_originate_transit, oi, 0); \ | |
186 | } while (0) | |
187 | ||
188 | ||
508e53e2 | 189 | /* Function Prototypes */ |
6ac29a51 PJ |
190 | extern char *ospf6_router_lsdesc_lookup (u_char type, u_int32_t interface_id, |
191 | u_int32_t neighbor_interface_id, | |
192 | u_int32_t neighbor_router_id, | |
193 | struct ospf6_lsa *lsa); | |
194 | extern char *ospf6_network_lsdesc_lookup (u_int32_t router_id, | |
195 | struct ospf6_lsa *lsa); | |
196 | ||
197 | extern int ospf6_router_lsa_originate (struct thread *); | |
198 | extern int ospf6_network_lsa_originate (struct thread *); | |
199 | extern int ospf6_link_lsa_originate (struct thread *); | |
200 | extern int ospf6_intra_prefix_lsa_originate_transit (struct thread *); | |
201 | extern int ospf6_intra_prefix_lsa_originate_stub (struct thread *); | |
202 | extern void ospf6_intra_prefix_lsa_add (struct ospf6_lsa *lsa); | |
203 | extern void ospf6_intra_prefix_lsa_remove (struct ospf6_lsa *lsa); | |
204 | ||
205 | extern void ospf6_intra_route_calculation (struct ospf6_area *oa); | |
206 | extern void ospf6_intra_brouter_calculation (struct ospf6_area *oa); | |
207 | ||
208 | extern void ospf6_intra_init (void); | |
209 | ||
210 | extern int config_write_ospf6_debug_brouter (struct vty *vty); | |
211 | extern void install_element_ospf6_debug_brouter (void); | |
cb4b8845 | 212 | |
508e53e2 | 213 | #endif /* OSPF6_LSA_H */ |
718e3744 | 214 |