blob: 48b56fc0256f3b6a2152701895cca4a331a787c1 [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001/*
hasso508e53e2004-05-18 18:57:06 +00002 * Copyright (C) 2003 Yasuhiro Ohara
paul718e3742002-12-13 20:15:29 +00003 *
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_INTERFACE_H
23#define OSPF6_INTERFACE_H
24
hasso508e53e2004-05-18 18:57:06 +000025#include "if.h"
paul718e3742002-12-13 20:15:29 +000026
hasso508e53e2004-05-18 18:57:06 +000027/* Debug option */
28extern unsigned char conf_debug_ospf6_interface;
29#define OSPF6_DEBUG_INTERFACE_ON() \
30 (conf_debug_ospf6_interface = 1)
31#define OSPF6_DEBUG_INTERFACE_OFF() \
32 (conf_debug_ospf6_interface = 0)
33#define IS_OSPF6_DEBUG_INTERFACE \
34 (conf_debug_ospf6_interface)
paul718e3742002-12-13 20:15:29 +000035
hasso508e53e2004-05-18 18:57:06 +000036/* Interface structure */
paul718e3742002-12-13 20:15:29 +000037struct ospf6_interface
38{
39 /* IF info from zebra */
40 struct interface *interface;
41
42 /* back pointer */
43 struct ospf6_area *area;
44
45 /* list of ospf6 neighbor */
46 list neighbor_list;
47
48 /* linklocal address of this I/F */
hasso508e53e2004-05-18 18:57:06 +000049 struct in6_addr *linklocal_addr;
paul718e3742002-12-13 20:15:29 +000050
hasso508e53e2004-05-18 18:57:06 +000051 /* Interface ID; use interface->ifindex */
paul718e3742002-12-13 20:15:29 +000052
53 /* ospf6 instance id */
54 u_char instance_id;
55
56 /* I/F transmission delay */
57 u_int32_t transdelay;
58
59 /* Router Priority */
60 u_char priority;
61
hasso508e53e2004-05-18 18:57:06 +000062 /* Time Interval */
paul718e3742002-12-13 20:15:29 +000063 u_int16_t hello_interval;
64 u_int16_t dead_interval;
65 u_int32_t rxmt_interval;
66
67 /* Cost */
68 u_int32_t cost;
69
70 /* I/F MTU */
71 u_int32_t ifmtu;
72
73 /* Interface State */
74 u_char state;
75
76 /* OSPF6 Interface flag */
77 char flag;
78
79 /* Decision of DR Election */
hasso508e53e2004-05-18 18:57:06 +000080 u_int32_t drouter;
81 u_int32_t bdrouter;
82 u_int32_t prev_drouter;
83 u_int32_t prev_bdrouter;
paul718e3742002-12-13 20:15:29 +000084
85 /* Linklocal LSA Database: includes Link-LSA */
86 struct ospf6_lsdb *lsdb;
87
hasso508e53e2004-05-18 18:57:06 +000088 struct ospf6_lsdb *lsupdate_list;
89 struct ospf6_lsdb *lsack_list;
paul718e3742002-12-13 20:15:29 +000090
hasso508e53e2004-05-18 18:57:06 +000091 /* Ongoing Tasks */
92 struct thread *thread_send_hello;
93 struct thread *thread_send_lsupdate;
94 struct thread *thread_send_lsack;
paul718e3742002-12-13 20:15:29 +000095
hasso508e53e2004-05-18 18:57:06 +000096 struct thread *thread_network_lsa;
97 struct thread *thread_link_lsa;
98 struct thread *thread_intra_prefix_lsa;
paul718e3742002-12-13 20:15:29 +000099
hasso508e53e2004-05-18 18:57:06 +0000100 struct ospf6_route_table *route_connected;
paul718e3742002-12-13 20:15:29 +0000101
hasso508e53e2004-05-18 18:57:06 +0000102 /* prefix-list name to filter connected prefix */
paul718e3742002-12-13 20:15:29 +0000103 char *plist_name;
104};
105
hasso508e53e2004-05-18 18:57:06 +0000106/* interface state */
107#define OSPF6_INTERFACE_NONE 0
108#define OSPF6_INTERFACE_DOWN 1
109#define OSPF6_INTERFACE_LOOPBACK 2
110#define OSPF6_INTERFACE_WAITING 3
111#define OSPF6_INTERFACE_POINTTOPOINT 4
112#define OSPF6_INTERFACE_DROTHER 5
113#define OSPF6_INTERFACE_BDR 6
114#define OSPF6_INTERFACE_DR 7
115#define OSPF6_INTERFACE_MAX 8
paul718e3742002-12-13 20:15:29 +0000116
hasso508e53e2004-05-18 18:57:06 +0000117extern char *ospf6_interface_state_str[];
118
119/* flags */
120#define OSPF6_INTERFACE_DISABLE 0x01
121#define OSPF6_INTERFACE_PASSIVE 0x02
paul718e3742002-12-13 20:15:29 +0000122
123
124/* Function Prototypes */
125
hasso508e53e2004-05-18 18:57:06 +0000126struct ospf6_interface *ospf6_interface_lookup_by_ifindex (int);
127struct ospf6_interface *ospf6_interface_lookup_by_name (char *);
128struct ospf6_interface *ospf6_interface_create (struct interface *);
129void ospf6_interface_delete (struct ospf6_interface *);
paul718e3742002-12-13 20:15:29 +0000130
hasso508e53e2004-05-18 18:57:06 +0000131void ospf6_interface_enable (struct ospf6_interface *);
132void ospf6_interface_disable (struct ospf6_interface *);
paul718e3742002-12-13 20:15:29 +0000133
134void ospf6_interface_if_add (struct interface *);
135void ospf6_interface_if_del (struct interface *);
136void ospf6_interface_state_update (struct interface *);
hasso508e53e2004-05-18 18:57:06 +0000137void ospf6_interface_connected_route_update (struct interface *);
138
139/* interface event */
140int interface_up (struct thread *);
141int interface_down (struct thread *);
142int wait_timer (struct thread *);
143int backup_seen (struct thread *);
144int neighbor_change (struct thread *);
paul718e3742002-12-13 20:15:29 +0000145
146void ospf6_interface_init ();
147
hasso508e53e2004-05-18 18:57:06 +0000148int config_write_ospf6_debug_interface (struct vty *vty);
149void install_element_ospf6_debug_interface ();
paul718e3742002-12-13 20:15:29 +0000150
151#endif /* OSPF6_INTERFACE_H */
152