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_NEIGHBOR_H
23#define OSPF6_NEIGHBOR_H
24
25/* Neighbor structure */
26struct ospf6_neighbor
27{
28  /* Neighbor Router ID String */
29  char str[32];
30
31  /* OSPFv3 Interface this neighbor belongs to */
32  struct ospf6_interface *ospf6_interface;
33
34  /* Neighbor state */
35  u_char state;
36  struct timeval last_changed;
37
38  /* Neighbor Router ID */
39  u_int32_t router_id;
40
41  /* Router Priority of this neighbor */
42  u_char priority;
43
44  u_int32_t ifid;
45  u_int32_t dr;
46  u_int32_t bdr;
47  u_int32_t prevdr;
48  u_int32_t prevbdr;
49
50  /* Link-LSA's options field */
51  char options[3];
52
53  /* IPaddr of I/F on our side link */
54  struct in6_addr hisaddr;
55
56  /* new */
57  struct ospf6_lsdb *summary_list;
58  struct ospf6_lsdb *request_list;
59  struct ospf6_lsdb *retrans_list;
60
61  /* For Database Exchange */
62  u_char               dbdesc_bits;
63  u_int32_t            dbdesc_seqnum;
64  struct ospf6_dbdesc *dbdesc_previous;
65
66  /* last received DD , including OSPF capability of this neighbor */
67  struct ospf6_dbdesc last_dd;
68
69  /* LSAs to retransmit to this neighbor */
70  list dbdesc_lsa;
71
72  /* placeholder for DbDesc */
73  struct iovec dbdesc_last_send[1024];
74
75  struct thread *inactivity_timer;
76
77  /* DbDesc */
78  struct thread *thread_send_dbdesc;
79  struct thread *thread_rxmt_dbdesc;
80  list dbdesclist;
81  struct ospf6_lsdb *dbdesc_list;
82
83  /* LSReq */
84  struct thread *thread_send_lsreq;
85  struct thread *thread_rxmt_lsreq;
86
87  /* LSUpdate */
88  struct thread *send_update;
89  struct thread *thread_send_update;
90  struct thread *thread_rxmt_update;
91
92  /* statistics */
93  u_int message_send[OSPF6_MESSAGE_TYPE_MAX];
94  u_int message_receive[OSPF6_MESSAGE_TYPE_MAX];
95  u_int lsa_send[OSPF6_MESSAGE_TYPE_MAX];
96  u_int lsa_receive[OSPF6_MESSAGE_TYPE_MAX];
97
98  u_int ospf6_stat_state_changed;
99  u_int ospf6_stat_seqnum_mismatch;
100  u_int ospf6_stat_bad_lsreq;
101  u_int ospf6_stat_oneway_received;
102  u_int ospf6_stat_inactivity_timer;
103  u_int ospf6_stat_dr_election;
104  u_int ospf6_stat_retrans_dbdesc;
105  u_int ospf6_stat_retrans_lsreq;
106  u_int ospf6_stat_retrans_lsupdate;
107  u_int ospf6_stat_received_lsa;
108  u_int ospf6_stat_received_lsupdate;
109
110  struct timeval tv_last_hello_received;
111};
112
113extern char *ospf6_neighbor_state_string[];
114
115
116/* Function Prototypes */
117int
118ospf6_neighbor_last_dbdesc_release (struct thread *);
119
120void
121ospf6_neighbor_lslist_clear (struct ospf6_neighbor *);
122
123void
124ospf6_neighbor_summary_add (struct ospf6_lsa *, struct ospf6_neighbor *);
125void
126ospf6_neighbor_summary_remove (struct ospf6_lsa *, struct ospf6_neighbor *);
127
128void
129ospf6_neighbor_request_add (struct ospf6_lsa *, struct ospf6_neighbor *);
130void
131ospf6_neighbor_request_remove (struct ospf6_lsa *, struct ospf6_neighbor *);
132
133void
134ospf6_neighbor_retrans_add (struct ospf6_lsa *, struct ospf6_neighbor *);
135void
136ospf6_neighbor_retrans_remove (struct ospf6_lsa *, struct ospf6_neighbor *);
137
138void
139ospf6_neighbor_dbdesc_add (struct ospf6_lsa *lsa,
140                           struct ospf6_neighbor *nei);
141void
142ospf6_neighbor_dbdesc_remove (struct ospf6_lsa *lsa,
143                              struct ospf6_neighbor *nei);
144
145void
146ospf6_neighbor_dbex_init (struct ospf6_neighbor *nei);
147
148void
149ospf6_neighbor_thread_cancel_all (struct ospf6_neighbor *);
150
151struct ospf6_neighbor *
152ospf6_neighbor_create (u_int32_t, struct ospf6_interface *);
153void
154ospf6_neighbor_delete (struct ospf6_neighbor *);
155struct ospf6_neighbor *
156ospf6_neighbor_lookup (u_int32_t, struct ospf6_interface *);
157
158void ospf6_neighbor_init ();
159
160#endif /* OSPF6_NEIGHBOR_H */
161
162