1/*
2 * Copyright (C) 1999 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_INTERFACE_H
23#define OSPF6_INTERFACE_H
24
25#include "ospf6_message.h"
26
27/* This file defines interface data structure. */
28
29struct ospf6_interface
30{
31  /* IF info from zebra */
32  struct interface *interface;
33
34  /* back pointer */
35  struct ospf6_area *area;
36
37  /* list of ospf6 neighbor */
38  list neighbor_list;
39
40  /* linklocal address of this I/F */
41  struct in6_addr *lladdr;
42
43  /* Interface ID; same as ifindex */
44  u_int32_t if_id;
45
46  /* ospf6 instance id */
47  u_char instance_id;
48
49  /* I/F transmission delay */
50  u_int32_t transdelay;
51
52  /* Router Priority */
53  u_char priority;
54
55  /* Timers */
56  u_int16_t hello_interval;
57  u_int16_t dead_interval;
58  u_int32_t rxmt_interval;
59
60  /* Cost */
61  u_int32_t cost;
62
63  /* I/F MTU */
64  u_int32_t ifmtu;
65
66  /* Interface State */
67  u_char state;
68
69  /* OSPF6 Interface flag */
70  char flag;
71
72  /* Decision of DR Election */
73  u_int32_t dr;
74  u_int32_t bdr;
75  u_int32_t prevdr;
76  u_int32_t prevbdr;
77
78  /* Ongoing Tasks */
79  struct thread *thread_send_hello;
80  struct thread *thread_send_lsack_delayed;
81
82  /* LSAs to Delayed Acknowledge */
83  struct ospf6_lsdb *ack_list;
84
85  /* Linklocal LSA Database: includes Link-LSA */
86  struct ospf6_lsdb *lsdb;
87
88  /* statistics */
89  u_int ospf6_stat_dr_election;
90  u_int ospf6_stat_delayed_lsack;
91
92  struct ospf6_message_stat message_stat[OSPF6_MESSAGE_TYPE_MAX];
93
94  void (*foreach_nei) (struct ospf6_interface *, void *, int,
95                       void (*func) (void *, int, void *));
96
97  struct thread *maxage_remover;
98
99  /* route-map to filter connected prefix */
100  char *plist_name;
101};
102
103extern char *ospf6_interface_state_string[];
104
105#define OSPF6_INTERFACE_FLAG_PASSIVE      0x01
106#define OSPF6_INTERFACE_FLAG_FORCE_PREFIX 0x02
107
108
109/* Function Prototypes */
110
111void
112ospf6_interface_schedule_maxage_remover (void *arg, int val, void *obj);
113
114struct ospf6_interface *
115ospf6_interface_create (struct interface *);
116void
117ospf6_interface_delete (struct ospf6_interface *);
118
119struct ospf6_interface *
120ospf6_interface_lookup_by_index (int);
121struct ospf6_interface *
122ospf6_interface_lookup_by_name (char *);
123
124void ospf6_interface_if_add (struct interface *);
125void ospf6_interface_if_del (struct interface *);
126void ospf6_interface_state_update (struct interface *);
127void ospf6_interface_address_update (struct interface *);
128
129void ospf6_interface_init ();
130
131#if 0
132int
133ospf6_interface_count_neighbor_in_state (u_char state,
134                                         struct ospf6_interface *o6i);
135int
136ospf6_interface_count_full_neighbor (struct ospf6_interface *);
137#endif
138
139int ospf6_interface_is_enabled (u_int32_t ifindex);
140
141void
142ospf6_interface_delayed_ack_add (struct ospf6_lsa *lsa,
143                                 struct ospf6_interface *o6i);
144void
145ospf6_interface_delayed_ack_remove (struct ospf6_lsa *lsa,
146                                    struct ospf6_interface *o6i);
147
148void
149ospf6_interface_statistics_show (struct vty *vty,
150                                 struct ospf6_interface *o6i);
151
152#endif /* OSPF6_INTERFACE_H */
153
154