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
;
42 /* list of ospf6 neighbor */
43 struct list
*neighbor_list
;
45 /* linklocal address of this I/F */
46 struct in6_addr
*linklocal_addr
;
48 /* Interface ID; use interface->ifindex */
50 /* ospf6 instance id */
53 /* I/F transmission delay */
64 uint16_t hello_interval
;
65 uint16_t dead_interval
;
66 uint32_t rxmt_interval
;
68 uint32_t state_change
;
82 /* Interface socket setting trial counter, resets on success */
84 struct thread
*thread_sso
;
86 /* OSPF6 Interface flag */
89 /* MTU mismatch check */
92 /* Decision of DR Election */
95 in_addr_t prev_drouter
;
96 in_addr_t prev_bdrouter
;
98 /* Linklocal LSA Database: includes Link-LSA */
99 struct ospf6_lsdb
*lsdb
;
100 struct ospf6_lsdb
*lsdb_self
;
102 struct ospf6_lsdb
*lsupdate_list
;
103 struct ospf6_lsdb
*lsack_list
;
106 struct thread
*thread_send_hello
;
107 struct thread
*thread_send_lsupdate
;
108 struct thread
*thread_send_lsack
;
110 struct thread
*thread_network_lsa
;
111 struct thread
*thread_link_lsa
;
112 struct thread
*thread_intra_prefix_lsa
;
113 struct thread
*thread_as_extern_lsa
;
114 struct thread
*thread_wait_timer
;
116 struct ospf6_route_table
*route_connected
;
118 /* prefix-list name to filter connected prefix */
121 /* BFD information */
124 /* Statistics Fields */
128 uint32_t db_desc_out
;
139 DECLARE_QOBJ_TYPE(ospf6_interface
);
141 /* interface state */
142 #define OSPF6_INTERFACE_NONE 0
143 #define OSPF6_INTERFACE_DOWN 1
144 #define OSPF6_INTERFACE_LOOPBACK 2
145 #define OSPF6_INTERFACE_WAITING 3
146 #define OSPF6_INTERFACE_POINTTOPOINT 4
147 #define OSPF6_INTERFACE_DROTHER 5
148 #define OSPF6_INTERFACE_BDR 6
149 #define OSPF6_INTERFACE_DR 7
150 #define OSPF6_INTERFACE_MAX 8
152 extern const char *const ospf6_interface_state_str
[];
155 #define OSPF6_INTERFACE_DISABLE 0x01
156 #define OSPF6_INTERFACE_PASSIVE 0x02
157 #define OSPF6_INTERFACE_NOAUTOCOST 0x04
160 #define OSPF6_INTERFACE_HELLO_INTERVAL 10
161 #define OSPF6_INTERFACE_DEAD_INTERVAL 40
162 #define OSPF6_INTERFACE_RXMT_INTERVAL 5
163 #define OSPF6_INTERFACE_COST 1
164 #define OSPF6_INTERFACE_PRIORITY 1
165 #define OSPF6_INTERFACE_TRANSDELAY 1
166 #define OSPF6_INTERFACE_INSTANCE_ID 0
167 #define OSPF6_INTERFACE_BANDWIDTH 10000 /* Mbps */
168 #define OSPF6_REFERENCE_BANDWIDTH 100000 /* Mbps */
169 #define OSPF6_INTERFACE_SSO_RETRY_INT 1
170 #define OSPF6_INTERFACE_SSO_RETRY_MAX 5
172 /* Function Prototypes */
174 extern struct ospf6_interface
*
175 ospf6_interface_lookup_by_ifindex(ifindex_t
, vrf_id_t vrf_id
);
176 extern struct ospf6_interface
*ospf6_interface_create(struct interface
*);
177 extern void ospf6_interface_delete(struct ospf6_interface
*);
179 extern void ospf6_interface_enable(struct ospf6_interface
*);
180 extern void ospf6_interface_disable(struct ospf6_interface
*);
182 extern void ospf6_interface_if_add(struct interface
*);
183 extern void ospf6_interface_state_update(struct interface
*);
184 extern void ospf6_interface_connected_route_update(struct interface
*);
186 /* interface event */
187 extern int interface_up(struct thread
*);
188 extern int interface_down(struct thread
*);
189 extern int wait_timer(struct thread
*);
190 extern int backup_seen(struct thread
*);
191 extern int neighbor_change(struct thread
*);
193 extern void ospf6_interface_init(void);
195 extern void install_element_ospf6_clear_interface(void);
197 extern int config_write_ospf6_debug_interface(struct vty
*vty
);
198 extern void install_element_ospf6_debug_interface(void);
200 DECLARE_HOOK(ospf6_interface_change
,
201 (struct ospf6_interface
* oi
, int state
, int old_state
),
202 (oi
, state
, old_state
));
204 #endif /* OSPF6_INTERFACE_H */