Annotation of embedaddon/quagga/ospf6d/ospf6_intra.h, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2003 Yasuhiro Ohara
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:
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:
71: /* Router-LSA */
72: #define OSPF6_ROUTER_LSA_MIN_SIZE 4U
73: struct ospf6_router_lsa
74: {
75: u_char bits;
76: u_char options[3];
77: /* followed by ospf6_router_lsdesc(s) */
78: };
79:
80: /* Link State Description in Router-LSA */
81: #define OSPF6_ROUTER_LSDESC_FIX_SIZE 16U
82: struct ospf6_router_lsdesc
83: {
84: u_char type;
85: u_char reserved;
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;
90: };
91:
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
96:
97: #define ROUTER_LSDESC_IS_TYPE(t,x) \
98: ((((struct ospf6_router_lsdesc *)(x))->type == \
99: OSPF6_ROUTER_LSDESC_ ## t) ? 1 : 0)
100: #define ROUTER_LSDESC_GET_METRIC(x) \
101: (ntohs (((struct ospf6_router_lsdesc *)(x))->metric))
102: #define ROUTER_LSDESC_GET_IFID(x) \
103: (ntohl (((struct ospf6_router_lsdesc *)(x))->interface_id))
104: #define ROUTER_LSDESC_GET_NBR_IFID(x) \
105: (ntohl (((struct ospf6_router_lsdesc *)(x))->neighbor_interface_id))
106: #define ROUTER_LSDESC_GET_NBR_ROUTERID(x) \
107: (((struct ospf6_router_lsdesc *)(x))->neighbor_router_id)
108:
109: /* Network-LSA */
110: #define OSPF6_NETWORK_LSA_MIN_SIZE 4U
111: struct ospf6_network_lsa
112: {
113: u_char reserved;
114: u_char options[3];
115: /* followed by ospf6_netowrk_lsd(s) */
116: };
117:
118: /* Link State Description in Router-LSA */
119: #define OSPF6_NETWORK_LSDESC_FIX_SIZE 4U
120: struct ospf6_network_lsdesc
121: {
122: u_int32_t router_id;
123: };
124: #define NETWORK_LSDESC_GET_NBR_ROUTERID(x) \
125: (((struct ospf6_network_lsdesc *)(x))->router_id)
126:
127: /* Link-LSA */
128: #define OSPF6_LINK_LSA_MIN_SIZE 24U /* w/o 1st IPv6 prefix */
129: struct ospf6_link_lsa
130: {
131: u_char priority;
132: u_char options[3];
133: struct in6_addr linklocal_addr;
134: u_int32_t prefix_num;
135: /* followed by ospf6 prefix(es) */
136: };
137:
138: /* Intra-Area-Prefix-LSA */
139: #define OSPF6_INTRA_PREFIX_LSA_MIN_SIZE 12U /* w/o 1st IPv6 prefix */
140: struct ospf6_intra_prefix_lsa
141: {
142: u_int16_t prefix_num;
143: u_int16_t ref_type;
144: u_int32_t ref_id;
145: u_int32_t ref_adv_router;
146: /* followed by ospf6 prefix(es) */
147: };
148:
149:
150: #define OSPF6_ROUTER_LSA_SCHEDULE(oa) \
151: do { \
152: if (! (oa)->thread_router_lsa) \
153: (oa)->thread_router_lsa = \
154: thread_add_event (master, ospf6_router_lsa_originate, oa, 0); \
155: } while (0)
156: #define OSPF6_NETWORK_LSA_SCHEDULE(oi) \
157: do { \
158: if (! (oi)->thread_network_lsa) \
159: (oi)->thread_network_lsa = \
160: thread_add_event (master, ospf6_network_lsa_originate, oi, 0); \
161: } while (0)
162: #define OSPF6_LINK_LSA_SCHEDULE(oi) \
163: do { \
164: if (! (oi)->thread_link_lsa) \
165: (oi)->thread_link_lsa = \
166: thread_add_event (master, ospf6_link_lsa_originate, oi, 0); \
167: } while (0)
168: #define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB(oa) \
169: do { \
170: if (! (oa)->thread_intra_prefix_lsa) \
171: (oa)->thread_intra_prefix_lsa = \
172: thread_add_event (master, ospf6_intra_prefix_lsa_originate_stub, \
173: oa, 0); \
174: } while (0)
175: #define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT(oi) \
176: do { \
177: if (! (oi)->thread_intra_prefix_lsa) \
178: (oi)->thread_intra_prefix_lsa = \
179: thread_add_event (master, ospf6_intra_prefix_lsa_originate_transit, \
180: oi, 0); \
181: } while (0)
182:
183: #define OSPF6_NETWORK_LSA_EXECUTE(oi) \
184: do { \
185: THREAD_OFF ((oi)->thread_network_lsa); \
186: thread_execute (master, ospf6_network_lsa_originate, oi, 0); \
187: } while (0)
188: #define OSPF6_INTRA_PREFIX_LSA_EXECUTE_TRANSIT(oi) \
189: do { \
190: THREAD_OFF ((oi)->thread_intra_prefix_lsa); \
191: thread_execute (master, ospf6_intra_prefix_lsa_originate_transit, oi, 0); \
192: } while (0)
193:
194:
195: /* Function Prototypes */
196: extern char *ospf6_router_lsdesc_lookup (u_char type, u_int32_t interface_id,
197: u_int32_t neighbor_interface_id,
198: u_int32_t neighbor_router_id,
199: struct ospf6_lsa *lsa);
200: extern char *ospf6_network_lsdesc_lookup (u_int32_t router_id,
201: struct ospf6_lsa *lsa);
202:
203: extern int ospf6_router_lsa_originate (struct thread *);
204: extern int ospf6_network_lsa_originate (struct thread *);
205: extern int ospf6_link_lsa_originate (struct thread *);
206: extern int ospf6_intra_prefix_lsa_originate_transit (struct thread *);
207: extern int ospf6_intra_prefix_lsa_originate_stub (struct thread *);
208: extern void ospf6_intra_prefix_lsa_add (struct ospf6_lsa *lsa);
209: extern void ospf6_intra_prefix_lsa_remove (struct ospf6_lsa *lsa);
210:
211: extern void ospf6_intra_route_calculation (struct ospf6_area *oa);
212: extern void ospf6_intra_brouter_calculation (struct ospf6_area *oa);
213:
214: extern void ospf6_intra_init (void);
215:
216: extern int config_write_ospf6_debug_brouter (struct vty *vty);
217: extern void install_element_ospf6_debug_brouter (void);
218:
219: #endif /* OSPF6_LSA_H */
220:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>