2 * Copyright (C) 2003 Yasuhiro Ohara
4 * This file is part of GNU Zebra.
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
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.
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.
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)
39 #define OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ON(router_id) \
41 conf_debug_ospf6_brouter_specific_router_id = (router_id); \
42 conf_debug_ospf6_brouter |= OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER; \
44 #define OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_OFF() \
46 conf_debug_ospf6_brouter_specific_router_id = 0; \
47 conf_debug_ospf6_brouter &= ~OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER; \
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))
55 #define OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ON(area_id) \
57 conf_debug_ospf6_brouter_specific_area_id = (area_id); \
58 conf_debug_ospf6_brouter |= OSPF6_DEBUG_BROUTER_SPECIFIC_AREA; \
60 #define OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_OFF() \
62 conf_debug_ospf6_brouter_specific_area_id = 0; \
63 conf_debug_ospf6_brouter &= ~OSPF6_DEBUG_BROUTER_SPECIFIC_AREA; \
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))
72 #define OSPF6_ROUTER_LSA_MIN_SIZE 4U
73 struct ospf6_router_lsa
77 /* followed by ospf6_router_lsdesc(s) */
80 /* Link State Description in Router-LSA */
81 #define OSPF6_ROUTER_LSDESC_FIX_SIZE 16U
82 struct ospf6_router_lsdesc
86 u_int16_t metric; /* output cost */
87 u_int32_t interface_id;
88 u_int32_t neighbor_interface_id;
89 u_int32_t neighbor_router_id;
92 #define OSPF6_ROUTER_LSDESC_POINTTOPOINT 1
93 #define OSPF6_ROUTER_LSDESC_TRANSIT_NETWORK 2
94 #define OSPF6_ROUTER_LSDESC_STUB_NETWORK 3
95 #define OSPF6_ROUTER_LSDESC_VIRTUAL_LINK 4
99 OSPF6_NOT_STUB_ROUTER,
100 OSPF6_IS_STUB_ROUTER,
101 OSPF6_IS_STUB_ROUTER_V6,
104 #define ROUTER_LSDESC_IS_TYPE(t,x) \
105 ((((struct ospf6_router_lsdesc *)(x))->type == \
106 OSPF6_ROUTER_LSDESC_ ## t) ? 1 : 0)
107 #define ROUTER_LSDESC_GET_METRIC(x) \
108 (ntohs (((struct ospf6_router_lsdesc *)(x))->metric))
109 #define ROUTER_LSDESC_GET_IFID(x) \
110 (ntohl (((struct ospf6_router_lsdesc *)(x))->interface_id))
111 #define ROUTER_LSDESC_GET_NBR_IFID(x) \
112 (ntohl (((struct ospf6_router_lsdesc *)(x))->neighbor_interface_id))
113 #define ROUTER_LSDESC_GET_NBR_ROUTERID(x) \
114 (((struct ospf6_router_lsdesc *)(x))->neighbor_router_id)
117 #define OSPF6_NETWORK_LSA_MIN_SIZE 4U
118 struct ospf6_network_lsa
122 /* followed by ospf6_netowrk_lsd(s) */
125 /* Link State Description in Router-LSA */
126 #define OSPF6_NETWORK_LSDESC_FIX_SIZE 4U
127 struct ospf6_network_lsdesc
131 #define NETWORK_LSDESC_GET_NBR_ROUTERID(x) \
132 (((struct ospf6_network_lsdesc *)(x))->router_id)
135 #define OSPF6_LINK_LSA_MIN_SIZE 24U /* w/o 1st IPv6 prefix */
136 struct ospf6_link_lsa
140 struct in6_addr linklocal_addr;
141 u_int32_t prefix_num;
142 /* followed by ospf6 prefix(es) */
145 /* Intra-Area-Prefix-LSA */
146 #define OSPF6_INTRA_PREFIX_LSA_MIN_SIZE 12U /* w/o 1st IPv6 prefix */
147 struct ospf6_intra_prefix_lsa
149 u_int16_t prefix_num;
152 u_int32_t ref_adv_router;
153 /* followed by ospf6 prefix(es) */
157 #define OSPF6_ROUTER_LSA_SCHEDULE(oa) \
159 if (! (oa)->thread_router_lsa \
160 && CHECK_FLAG((oa)->flag, OSPF6_AREA_ENABLE)) \
161 (oa)->thread_router_lsa = \
162 thread_add_event (master, ospf6_router_lsa_originate, oa, 0); \
164 #define OSPF6_NETWORK_LSA_SCHEDULE(oi) \
166 if (! (oi)->thread_network_lsa \
167 && ! CHECK_FLAG((oi)->flag, OSPF6_INTERFACE_DISABLE)) \
168 (oi)->thread_network_lsa = \
169 thread_add_event (master, ospf6_network_lsa_originate, oi, 0); \
171 #define OSPF6_LINK_LSA_SCHEDULE(oi) \
173 if (! (oi)->thread_link_lsa \
174 && ! CHECK_FLAG((oi)->flag, OSPF6_INTERFACE_DISABLE)) \
175 (oi)->thread_link_lsa = \
176 thread_add_event (master, ospf6_link_lsa_originate, oi, 0); \
178 #define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB(oa) \
180 if (! (oa)->thread_intra_prefix_lsa \
181 && CHECK_FLAG((oa)->flag, OSPF6_AREA_ENABLE)) \
182 (oa)->thread_intra_prefix_lsa = \
183 thread_add_event (master, ospf6_intra_prefix_lsa_originate_stub, \
186 #define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT(oi) \
188 if (! (oi)->thread_intra_prefix_lsa \
189 && ! CHECK_FLAG((oi)->flag, OSPF6_INTERFACE_DISABLE)) \
190 (oi)->thread_intra_prefix_lsa = \
191 thread_add_event (master, ospf6_intra_prefix_lsa_originate_transit, \
195 #define OSPF6_NETWORK_LSA_EXECUTE(oi) \
197 THREAD_OFF ((oi)->thread_network_lsa); \
198 thread_execute (master, ospf6_network_lsa_originate, oi, 0); \
200 #define OSPF6_INTRA_PREFIX_LSA_EXECUTE_TRANSIT(oi) \
202 THREAD_OFF ((oi)->thread_intra_prefix_lsa); \
203 thread_execute (master, ospf6_intra_prefix_lsa_originate_transit, oi, 0); \
207 /* Function Prototypes */
208 extern char *ospf6_router_lsdesc_lookup (u_char type, u_int32_t interface_id,
209 u_int32_t neighbor_interface_id,
210 u_int32_t neighbor_router_id,
211 struct ospf6_lsa *lsa);
212 extern char *ospf6_network_lsdesc_lookup (u_int32_t router_id,
213 struct ospf6_lsa *lsa);
215 extern int ospf6_router_is_stub_router (struct ospf6_lsa *lsa);
216 extern int ospf6_router_lsa_originate (struct thread *);
217 extern int ospf6_network_lsa_originate (struct thread *);
218 extern int ospf6_link_lsa_originate (struct thread *);
219 extern int ospf6_intra_prefix_lsa_originate_transit (struct thread *);
220 extern int ospf6_intra_prefix_lsa_originate_stub (struct thread *);
221 extern void ospf6_intra_prefix_lsa_add (struct ospf6_lsa *lsa);
222 extern void ospf6_intra_prefix_lsa_remove (struct ospf6_lsa *lsa);
224 extern void ospf6_intra_route_calculation (struct ospf6_area *oa);
225 extern void ospf6_intra_brouter_calculation (struct ospf6_area *oa);
227 extern void ospf6_intra_init (void);
229 extern int config_write_ospf6_debug_brouter (struct vty *vty);
230 extern void install_element_ospf6_debug_brouter (void);
232 #endif /* OSPF6_LSA_H */