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 along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef OSPF6_INTERFACE_H
22 #define OSPF6_INTERFACE_H
29 extern unsigned char conf_debug_ospf6_interface
;
30 #define OSPF6_DEBUG_INTERFACE_ON() (conf_debug_ospf6_interface = 1)
31 #define OSPF6_DEBUG_INTERFACE_OFF() (conf_debug_ospf6_interface = 0)
32 #define IS_OSPF6_DEBUG_INTERFACE (conf_debug_ospf6_interface)
34 /* Interface structure */
35 struct ospf6_interface
{
36 /* IF info from zebra */
37 struct interface
*interface
;
40 struct ospf6_area
*area
;
45 /* list of ospf6 neighbor */
46 struct list
*neighbor_list
;
48 /* linklocal address of this I/F */
49 struct in6_addr
*linklocal_addr
;
51 /* Interface ID; use interface->ifindex */
53 /* ospf6 instance id */
56 /* I/F transmission delay */
67 uint16_t hello_interval
;
68 uint16_t dead_interval
;
69 uint32_t rxmt_interval
;
71 uint32_t state_change
;
85 /* Interface socket setting trial counter, resets on success */
87 struct thread
*thread_sso
;
89 /* OSPF6 Interface flag */
92 /* MTU mismatch check */
95 /* Decision of DR Election */
98 in_addr_t prev_drouter
;
99 in_addr_t prev_bdrouter
;
101 /* Linklocal LSA Database: includes Link-LSA */
102 struct ospf6_lsdb
*lsdb
;
103 struct ospf6_lsdb
*lsdb_self
;
105 struct ospf6_lsdb
*lsupdate_list
;
106 struct ospf6_lsdb
*lsack_list
;
109 struct thread
*thread_send_hello
;
110 struct thread
*thread_send_lsupdate
;
111 struct thread
*thread_send_lsack
;
113 struct thread
*thread_network_lsa
;
114 struct thread
*thread_link_lsa
;
115 struct thread
*thread_intra_prefix_lsa
;
116 struct thread
*thread_as_extern_lsa
;
117 struct thread
*thread_wait_timer
;
119 struct ospf6_route_table
*route_connected
;
121 /* prefix-list name to filter connected prefix */
124 /* BFD information */
127 uint8_t detection_multiplier
;
133 /* Statistics Fields */
137 uint32_t db_desc_out
;
148 DECLARE_QOBJ_TYPE(ospf6_interface
);
150 /* interface state */
151 #define OSPF6_INTERFACE_NONE 0
152 #define OSPF6_INTERFACE_DOWN 1
153 #define OSPF6_INTERFACE_LOOPBACK 2
154 #define OSPF6_INTERFACE_WAITING 3
155 #define OSPF6_INTERFACE_POINTTOPOINT 4
156 #define OSPF6_INTERFACE_DROTHER 5
157 #define OSPF6_INTERFACE_BDR 6
158 #define OSPF6_INTERFACE_DR 7
159 #define OSPF6_INTERFACE_MAX 8
161 extern const char *const ospf6_interface_state_str
[];
164 #define OSPF6_INTERFACE_DISABLE 0x01
165 #define OSPF6_INTERFACE_PASSIVE 0x02
166 #define OSPF6_INTERFACE_NOAUTOCOST 0x04
169 #define OSPF6_INTERFACE_HELLO_INTERVAL 10
170 #define OSPF6_INTERFACE_DEAD_INTERVAL 40
171 #define OSPF6_INTERFACE_RXMT_INTERVAL 5
172 #define OSPF6_INTERFACE_COST 1
173 #define OSPF6_INTERFACE_PRIORITY 1
174 #define OSPF6_INTERFACE_TRANSDELAY 1
175 #define OSPF6_INTERFACE_INSTANCE_ID 0
176 #define OSPF6_INTERFACE_BANDWIDTH 10000 /* Mbps */
177 #define OSPF6_REFERENCE_BANDWIDTH 100000 /* Mbps */
178 #define OSPF6_INTERFACE_SSO_RETRY_INT 1
179 #define OSPF6_INTERFACE_SSO_RETRY_MAX 5
181 /* Function Prototypes */
183 extern void ospf6_interface_start(struct ospf6_interface
*oi
);
184 extern void ospf6_interface_stop(struct ospf6_interface
*oi
);
186 extern struct ospf6_interface
*
187 ospf6_interface_lookup_by_ifindex(ifindex_t
, vrf_id_t vrf_id
);
188 extern struct ospf6_interface
*ospf6_interface_create(struct interface
*);
189 extern void ospf6_interface_delete(struct ospf6_interface
*);
191 extern void ospf6_interface_enable(struct ospf6_interface
*);
192 extern void ospf6_interface_disable(struct ospf6_interface
*);
194 extern void ospf6_interface_state_update(struct interface
*);
195 extern void ospf6_interface_connected_route_update(struct interface
*);
196 extern void ospf6_interface_connected_route_add(struct connected
*);
197 extern struct in6_addr
*
198 ospf6_interface_get_global_address(struct interface
*ifp
);
200 /* interface event */
201 extern int interface_up(struct thread
*);
202 extern int interface_down(struct thread
*);
203 extern int wait_timer(struct thread
*);
204 extern int backup_seen(struct thread
*);
205 extern int neighbor_change(struct thread
*);
207 extern void ospf6_interface_init(void);
209 extern void install_element_ospf6_clear_interface(void);
211 extern int config_write_ospf6_debug_interface(struct vty
*vty
);
212 extern void install_element_ospf6_debug_interface(void);
214 DECLARE_HOOK(ospf6_interface_change
,
215 (struct ospf6_interface
* oi
, int state
, int old_state
),
216 (oi
, state
, old_state
));
218 #endif /* OSPF6_INTERFACE_H */