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 struct ospf6_router_lsa
30 /* followed by ospf6_router_lsdesc(s) */
33 /* Link State Description in Router-LSA */
34 struct ospf6_router_lsdesc
38 u_int16_t metric
; /* output cost */
39 u_int32_t interface_id
;
40 u_int32_t neighbor_interface_id
;
41 u_int32_t neighbor_router_id
;
44 #define OSPF6_ROUTER_LSDESC_POINTTOPOINT 1
45 #define OSPF6_ROUTER_LSDESC_TRANSIT_NETWORK 2
46 #define OSPF6_ROUTER_LSDESC_STUB_NETWORK 3
47 #define OSPF6_ROUTER_LSDESC_VIRTUAL_LINK 4
49 #define ROUTER_LSDESC_IS_TYPE(t,x) \
50 ((((struct ospf6_router_lsdesc *)(x))->type == \
51 OSPF6_ROUTER_LSDESC_ ## t) ? 1 : 0)
52 #define ROUTER_LSDESC_GET_METRIC(x) \
53 (ntohs (((struct ospf6_router_lsdesc *)(x))->metric))
54 #define ROUTER_LSDESC_GET_IFID(x) \
55 (ntohl (((struct ospf6_router_lsdesc *)(x))->interface_id))
56 #define ROUTER_LSDESC_GET_NBR_IFID(x) \
57 (ntohl (((struct ospf6_router_lsdesc *)(x))->neighbor_interface_id))
58 #define ROUTER_LSDESC_GET_NBR_ROUTERID(x) \
59 (((struct ospf6_router_lsdesc *)(x))->neighbor_router_id)
62 struct ospf6_network_lsa
66 /* followed by ospf6_netowrk_lsd(s) */
69 /* Link State Description in Router-LSA */
70 struct ospf6_network_lsdesc
74 #define NETWORK_LSDESC_GET_NBR_ROUTERID(x) \
75 (((struct ospf6_network_lsdesc *)(x))->router_id)
82 struct in6_addr linklocal_addr
;
84 /* followed by ospf6 prefix(es) */
87 /* Intra-Area-Prefix-LSA */
88 struct ospf6_intra_prefix_lsa
93 u_int32_t ref_adv_router
;
94 /* followed by ospf6 prefix(es) */
98 #define OSPF6_ROUTER_LSA_SCHEDULE(oa) \
100 if (! (oa)->thread_router_lsa) \
101 (oa)->thread_router_lsa = \
102 thread_add_event (master, ospf6_router_lsa_originate, oa, 0); \
104 #define OSPF6_NETWORK_LSA_SCHEDULE(oi) \
106 if (! (oi)->thread_network_lsa) \
107 (oi)->thread_network_lsa = \
108 thread_add_event (master, ospf6_network_lsa_originate, oi, 0); \
110 #define OSPF6_LINK_LSA_SCHEDULE(oi) \
112 if (! (oi)->thread_link_lsa) \
113 (oi)->thread_link_lsa = \
114 thread_add_event (master, ospf6_link_lsa_originate, oi, 0); \
116 #define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB(oa) \
118 if (! (oa)->thread_intra_prefix_lsa) \
119 (oa)->thread_intra_prefix_lsa = \
120 thread_add_event (master, ospf6_intra_prefix_lsa_originate_stub, \
123 #define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT(oi) \
125 if (! (oi)->thread_intra_prefix_lsa) \
126 (oi)->thread_intra_prefix_lsa = \
127 thread_add_event (master, ospf6_intra_prefix_lsa_originate_transit, \
131 /* Function Prototypes */
132 char *ospf6_router_lsdesc_lookup (u_char type
, u_int32_t interface_id
,
133 u_int32_t neighbor_interface_id
,
134 u_int32_t neighbor_router_id
,
135 struct ospf6_lsa
*lsa
);
136 char *ospf6_network_lsdesc_lookup (u_int32_t router_id
,
137 struct ospf6_lsa
*lsa
);
139 int ospf6_router_lsa_originate (struct thread
*);
140 int ospf6_network_lsa_originate (struct thread
*);
141 int ospf6_link_lsa_originate (struct thread
*);
142 int ospf6_intra_prefix_lsa_originate_transit (struct thread
*);
143 int ospf6_intra_prefix_lsa_originate_stub (struct thread
*);
144 void ospf6_intra_prefix_lsa_add (struct ospf6_lsa
*lsa
);
145 void ospf6_intra_prefix_lsa_remove (struct ospf6_lsa
*lsa
);
147 void ospf6_intra_route_calculation (struct ospf6_area
*oa
);
148 void ospf6_intra_asbr_calculation (struct ospf6_area
*oa
);
150 void ospf6_intra_init ();
152 #endif /* OSPF6_LSA_H */