]> git.proxmox.com Git - mirror_frr.git/blob - ospf6d/ospf6_neighbor.h
debianpkg: Add missing XSBC-Original-Maintainer field (fixes merge error)
[mirror_frr.git] / ospf6d / ospf6_neighbor.h
1 /*
2 * Copyright (C) 2003 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 #include "hook.h"
26
27 /* Debug option */
28 extern unsigned char conf_debug_ospf6_neighbor;
29 #define OSPF6_DEBUG_NEIGHBOR_STATE 0x01
30 #define OSPF6_DEBUG_NEIGHBOR_EVENT 0x02
31 #define OSPF6_DEBUG_NEIGHBOR_ON(level) (conf_debug_ospf6_neighbor |= (level))
32 #define OSPF6_DEBUG_NEIGHBOR_OFF(level) (conf_debug_ospf6_neighbor &= ~(level))
33 #define IS_OSPF6_DEBUG_NEIGHBOR(level) \
34 (conf_debug_ospf6_neighbor & OSPF6_DEBUG_NEIGHBOR_##level)
35
36 /* Neighbor structure */
37 struct ospf6_neighbor {
38 /* Neighbor Router ID String */
39 char name[32];
40
41 /* OSPFv3 Interface this neighbor belongs to */
42 struct ospf6_interface *ospf6_if;
43
44 /* Neighbor state */
45 u_char state;
46
47 /* timestamp of last changing state */
48 u_int32_t state_change;
49 struct timeval last_changed;
50
51 /* Neighbor Router ID */
52 u_int32_t router_id;
53
54 /* Neighbor Interface ID */
55 ifindex_t ifindex;
56
57 /* Router Priority of this neighbor */
58 u_char priority;
59
60 u_int32_t drouter;
61 u_int32_t bdrouter;
62 u_int32_t prev_drouter;
63 u_int32_t prev_bdrouter;
64
65 /* Options field (Capability) */
66 char options[3];
67
68 /* IPaddr of I/F on our side link */
69 struct in6_addr linklocal_addr;
70
71 /* For Database Exchange */
72 u_char dbdesc_bits;
73 u_int32_t dbdesc_seqnum;
74 /* Last received Database Description packet */
75 struct ospf6_dbdesc dbdesc_last;
76
77 /* LS-list */
78 struct ospf6_lsdb *summary_list;
79 struct ospf6_lsdb *request_list;
80 struct ospf6_lsdb *retrans_list;
81
82 /* LSA list for message transmission */
83 struct ospf6_lsdb *dbdesc_list;
84 struct ospf6_lsdb *lsreq_list;
85 struct ospf6_lsdb *lsupdate_list;
86 struct ospf6_lsdb *lsack_list;
87
88 struct ospf6_lsa *last_ls_req;
89
90 /* Inactivity timer */
91 struct thread *inactivity_timer;
92
93 /* Thread for sending message */
94 struct thread *thread_send_dbdesc;
95 struct thread *thread_send_lsreq;
96 struct thread *thread_send_lsupdate;
97 struct thread *thread_send_lsack;
98
99 /* BFD information */
100 void *bfd_info;
101 };
102
103 /* Neighbor state */
104 #define OSPF6_NEIGHBOR_DOWN 1
105 #define OSPF6_NEIGHBOR_ATTEMPT 2
106 #define OSPF6_NEIGHBOR_INIT 3
107 #define OSPF6_NEIGHBOR_TWOWAY 4
108 #define OSPF6_NEIGHBOR_EXSTART 5
109 #define OSPF6_NEIGHBOR_EXCHANGE 6
110 #define OSPF6_NEIGHBOR_LOADING 7
111 #define OSPF6_NEIGHBOR_FULL 8
112
113 /* Neighbor Events */
114 #define OSPF6_NEIGHBOR_EVENT_NO_EVENT 0
115 #define OSPF6_NEIGHBOR_EVENT_HELLO_RCVD 1
116 #define OSPF6_NEIGHBOR_EVENT_TWOWAY_RCVD 2
117 #define OSPF6_NEIGHBOR_EVENT_NEGOTIATION_DONE 3
118 #define OSPF6_NEIGHBOR_EVENT_EXCHANGE_DONE 4
119 #define OSPF6_NEIGHBOR_EVENT_LOADING_DONE 5
120 #define OSPF6_NEIGHBOR_EVENT_ADJ_OK 6
121 #define OSPF6_NEIGHBOR_EVENT_SEQNUMBER_MISMATCH 7
122 #define OSPF6_NEIGHBOR_EVENT_BAD_LSREQ 8
123 #define OSPF6_NEIGHBOR_EVENT_ONEWAY_RCVD 9
124 #define OSPF6_NEIGHBOR_EVENT_INACTIVITY_TIMER 10
125 #define OSPF6_NEIGHBOR_EVENT_MAX_EVENT 11
126
127 static const char *ospf6_neighbor_event_str[] = {
128 "NoEvent", "HelloReceived", "2-WayReceived", "NegotiationDone",
129 "ExchangeDone", "LoadingDone", "AdjOK?", "SeqNumberMismatch",
130 "BadLSReq", "1-WayReceived", "InactivityTimer",
131 };
132
133 static inline const char *ospf6_neighbor_event_string(int event)
134 {
135 #define OSPF6_NEIGHBOR_UNKNOWN_EVENT_STRING "UnknownEvent"
136
137 if (event < OSPF6_NEIGHBOR_EVENT_MAX_EVENT)
138 return ospf6_neighbor_event_str[event];
139 return OSPF6_NEIGHBOR_UNKNOWN_EVENT_STRING;
140 }
141
142 extern const char *ospf6_neighbor_state_str[];
143
144
145 /* Function Prototypes */
146 int ospf6_neighbor_cmp(void *va, void *vb);
147 void ospf6_neighbor_dbex_init(struct ospf6_neighbor *on);
148
149 struct ospf6_neighbor *ospf6_neighbor_lookup(u_int32_t,
150 struct ospf6_interface *);
151 struct ospf6_neighbor *ospf6_neighbor_create(u_int32_t,
152 struct ospf6_interface *);
153 void ospf6_neighbor_delete(struct ospf6_neighbor *);
154
155 /* Neighbor event */
156 extern int hello_received(struct thread *);
157 extern int twoway_received(struct thread *);
158 extern int negotiation_done(struct thread *);
159 extern int exchange_done(struct thread *);
160 extern int loading_done(struct thread *);
161 extern int adj_ok(struct thread *);
162 extern int seqnumber_mismatch(struct thread *);
163 extern int bad_lsreq(struct thread *);
164 extern int oneway_received(struct thread *);
165 extern int inactivity_timer(struct thread *);
166 extern void ospf6_check_nbr_loading(struct ospf6_neighbor *);
167
168 extern void ospf6_neighbor_init(void);
169 extern int config_write_ospf6_debug_neighbor(struct vty *vty);
170 extern void install_element_ospf6_debug_neighbor(void);
171
172 DECLARE_HOOK(ospf6_neighbor_change,
173 (struct ospf6_neighbor * on, int state, int next_state),
174 (on, state, next_state))
175
176 #endif /* OSPF6_NEIGHBOR_H */