]> git.proxmox.com Git - mirror_frr.git/blame - ospf6d/ospf6_intra.h
debianpkg: Add missing XSBC-Original-Maintainer field (fixes merge error)
[mirror_frr.git] / ospf6d / ospf6_intra.h
CommitLineData
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
ac4d0be5 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.
718e3744 20 */
21
22#ifndef OSPF6_INTRA_H
23#define OSPF6_INTRA_H
24
cb4b8845
PJ
25/* Debug option */
26extern unsigned char conf_debug_ospf6_brouter;
27extern u_int32_t conf_debug_ospf6_brouter_specific_router_id;
28extern 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
ac4d0be5 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 |= \
43 OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER; \
44 } while (0)
45#define OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_OFF() \
46 do { \
47 conf_debug_ospf6_brouter_specific_router_id = 0; \
48 conf_debug_ospf6_brouter &= \
49 ~OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER; \
50 } while (0)
51#define IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER \
52 (conf_debug_ospf6_brouter & OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER)
53#define IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ID(router_id) \
54 (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER \
55 && conf_debug_ospf6_brouter_specific_router_id == (router_id))
56
57#define OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ON(area_id) \
58 do { \
59 conf_debug_ospf6_brouter_specific_area_id = (area_id); \
60 conf_debug_ospf6_brouter |= OSPF6_DEBUG_BROUTER_SPECIFIC_AREA; \
61 } while (0)
62#define OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_OFF() \
63 do { \
64 conf_debug_ospf6_brouter_specific_area_id = 0; \
65 conf_debug_ospf6_brouter &= \
66 ~OSPF6_DEBUG_BROUTER_SPECIFIC_AREA; \
67 } while (0)
68#define IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA \
69 (conf_debug_ospf6_brouter & OSPF6_DEBUG_BROUTER_SPECIFIC_AREA)
70#define IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ID(area_id) \
71 (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA \
72 && conf_debug_ospf6_brouter_specific_area_id == (area_id))
cb4b8845 73
508e53e2 74/* Router-LSA */
abc7ef44 75#define OSPF6_ROUTER_LSA_MIN_SIZE 4U
ac4d0be5 76struct ospf6_router_lsa {
77 u_char bits;
78 u_char options[3];
79 /* followed by ospf6_router_lsdesc(s) */
508e53e2 80};
81
82/* Link State Description in Router-LSA */
abc7ef44 83#define OSPF6_ROUTER_LSDESC_FIX_SIZE 16U
ac4d0be5 84struct ospf6_router_lsdesc {
85 u_char type;
86 u_char reserved;
87 u_int16_t metric; /* output cost */
88 u_int32_t interface_id;
89 u_int32_t neighbor_interface_id;
90 u_int32_t neighbor_router_id;
508e53e2 91};
92
93#define OSPF6_ROUTER_LSDESC_POINTTOPOINT 1
94#define OSPF6_ROUTER_LSDESC_TRANSIT_NETWORK 2
95#define OSPF6_ROUTER_LSDESC_STUB_NETWORK 3
96#define OSPF6_ROUTER_LSDESC_VIRTUAL_LINK 4
97
ac4d0be5 98enum stub_router_mode {
99 OSPF6_NOT_STUB_ROUTER,
100 OSPF6_IS_STUB_ROUTER,
101 OSPF6_IS_STUB_ROUTER_V6,
102};
103
104#define ROUTER_LSDESC_IS_TYPE(t, x) \
105 ((((struct ospf6_router_lsdesc *)(x))->type \
106 == OSPF6_ROUTER_LSDESC_##t) \
107 ? 1 \
108 : 0)
109#define ROUTER_LSDESC_GET_METRIC(x) \
110 (ntohs(((struct ospf6_router_lsdesc *)(x))->metric))
111#define ROUTER_LSDESC_GET_IFID(x) \
112 (ntohl(((struct ospf6_router_lsdesc *)(x))->interface_id))
113#define ROUTER_LSDESC_GET_NBR_IFID(x) \
114 (ntohl(((struct ospf6_router_lsdesc *)(x))->neighbor_interface_id))
115#define ROUTER_LSDESC_GET_NBR_ROUTERID(x) \
116 (((struct ospf6_router_lsdesc *)(x))->neighbor_router_id)
508e53e2 117
118/* Network-LSA */
abc7ef44 119#define OSPF6_NETWORK_LSA_MIN_SIZE 4U
ac4d0be5 120struct ospf6_network_lsa {
121 u_char reserved;
122 u_char options[3];
123 /* followed by ospf6_netowrk_lsd(s) */
508e53e2 124};
125
126/* Link State Description in Router-LSA */
abc7ef44 127#define OSPF6_NETWORK_LSDESC_FIX_SIZE 4U
ac4d0be5 128struct ospf6_network_lsdesc {
129 u_int32_t router_id;
508e53e2 130};
ac4d0be5 131#define NETWORK_LSDESC_GET_NBR_ROUTERID(x) \
132 (((struct ospf6_network_lsdesc *)(x))->router_id)
508e53e2 133
134/* Link-LSA */
abc7ef44 135#define OSPF6_LINK_LSA_MIN_SIZE 24U /* w/o 1st IPv6 prefix */
ac4d0be5 136struct ospf6_link_lsa {
137 u_char priority;
138 u_char options[3];
139 struct in6_addr linklocal_addr;
140 u_int32_t prefix_num;
141 /* followed by ospf6 prefix(es) */
508e53e2 142};
143
144/* Intra-Area-Prefix-LSA */
abc7ef44 145#define OSPF6_INTRA_PREFIX_LSA_MIN_SIZE 12U /* w/o 1st IPv6 prefix */
ac4d0be5 146struct ospf6_intra_prefix_lsa {
147 u_int16_t prefix_num;
148 u_int16_t ref_type;
149 u_int32_t ref_id;
150 u_int32_t ref_adv_router;
151 /* followed by ospf6 prefix(es) */
508e53e2 152};
153
6b0655a2 154
ac4d0be5 155#define OSPF6_ROUTER_LSA_SCHEDULE(oa) \
156 do { \
157 if (!(oa)->thread_router_lsa \
158 && CHECK_FLAG((oa)->flag, OSPF6_AREA_ENABLE)) \
159 (oa)->thread_router_lsa = thread_add_event( \
160 master, ospf6_router_lsa_originate, oa, 0); \
161 } while (0)
162#define OSPF6_NETWORK_LSA_SCHEDULE(oi) \
163 do { \
164 if (!(oi)->thread_network_lsa \
165 && !CHECK_FLAG((oi)->flag, OSPF6_INTERFACE_DISABLE)) \
166 (oi)->thread_network_lsa = thread_add_event( \
167 master, ospf6_network_lsa_originate, oi, 0); \
168 } while (0)
169#define OSPF6_LINK_LSA_SCHEDULE(oi) \
170 do { \
171 if (!(oi)->thread_link_lsa \
172 && !CHECK_FLAG((oi)->flag, OSPF6_INTERFACE_DISABLE)) \
173 (oi)->thread_link_lsa = thread_add_event( \
174 master, ospf6_link_lsa_originate, oi, 0); \
175 } while (0)
176#define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB(oa) \
177 do { \
178 if (!(oa)->thread_intra_prefix_lsa \
179 && CHECK_FLAG((oa)->flag, OSPF6_AREA_ENABLE)) \
180 (oa)->thread_intra_prefix_lsa = thread_add_event( \
181 master, ospf6_intra_prefix_lsa_originate_stub, \
182 oa, 0); \
183 } while (0)
184#define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT(oi) \
185 do { \
186 if (!(oi)->thread_intra_prefix_lsa \
187 && !CHECK_FLAG((oi)->flag, OSPF6_INTERFACE_DISABLE)) \
188 (oi)->thread_intra_prefix_lsa = thread_add_event( \
189 master, \
190 ospf6_intra_prefix_lsa_originate_transit, oi, \
191 0); \
192 } while (0)
193
194#define OSPF6_NETWORK_LSA_EXECUTE(oi) \
195 do { \
196 THREAD_OFF((oi)->thread_network_lsa); \
197 thread_execute(master, ospf6_network_lsa_originate, oi, 0); \
198 } while (0)
199#define OSPF6_INTRA_PREFIX_LSA_EXECUTE_TRANSIT(oi) \
200 do { \
201 THREAD_OFF((oi)->thread_intra_prefix_lsa); \
202 thread_execute(master, \
203 ospf6_intra_prefix_lsa_originate_transit, oi, \
204 0); \
205 } while (0)
6452df09 206
207
508e53e2 208/* Function Prototypes */
ac4d0be5 209extern char *ospf6_router_lsdesc_lookup(u_char type, u_int32_t interface_id,
210 u_int32_t neighbor_interface_id,
211 u_int32_t neighbor_router_id,
212 struct ospf6_lsa *lsa);
213extern char *ospf6_network_lsdesc_lookup(u_int32_t router_id,
214 struct ospf6_lsa *lsa);
215
216extern int ospf6_router_is_stub_router(struct ospf6_lsa *lsa);
217extern int ospf6_router_lsa_originate(struct thread *);
218extern int ospf6_network_lsa_originate(struct thread *);
219extern int ospf6_link_lsa_originate(struct thread *);
220extern int ospf6_intra_prefix_lsa_originate_transit(struct thread *);
221extern int ospf6_intra_prefix_lsa_originate_stub(struct thread *);
222extern void ospf6_intra_prefix_lsa_add(struct ospf6_lsa *lsa);
223extern void ospf6_intra_prefix_lsa_remove(struct ospf6_lsa *lsa);
224
225extern void ospf6_intra_route_calculation(struct ospf6_area *oa);
226extern void ospf6_intra_brouter_calculation(struct ospf6_area *oa);
227
228extern void ospf6_intra_init(void);
229
230extern int config_write_ospf6_debug_brouter(struct vty *vty);
231extern void install_element_ospf6_debug_brouter(void);
cb4b8845 232
508e53e2 233#endif /* OSPF6_LSA_H */