]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* |
508e53e2 | 2 | * Copyright (C) 2003 Yasuhiro Ohara |
718e3744 | 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 | * | |
896014f4 DL |
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 | |
718e3744 | 19 | */ |
20 | ||
21 | #ifndef OSPF6_NEIGHBOR_H | |
22 | #define OSPF6_NEIGHBOR_H | |
23 | ||
3012671f DL |
24 | #include "hook.h" |
25 | ||
71165098 RW |
26 | /* Forward declaration(s). */ |
27 | struct ospf6_area; | |
28 | ||
508e53e2 | 29 | /* Debug option */ |
30 | extern unsigned char conf_debug_ospf6_neighbor; | |
31 | #define OSPF6_DEBUG_NEIGHBOR_STATE 0x01 | |
32 | #define OSPF6_DEBUG_NEIGHBOR_EVENT 0x02 | |
d62a17ae | 33 | #define OSPF6_DEBUG_NEIGHBOR_ON(level) (conf_debug_ospf6_neighbor |= (level)) |
34 | #define OSPF6_DEBUG_NEIGHBOR_OFF(level) (conf_debug_ospf6_neighbor &= ~(level)) | |
35 | #define IS_OSPF6_DEBUG_NEIGHBOR(level) \ | |
36 | (conf_debug_ospf6_neighbor & OSPF6_DEBUG_NEIGHBOR_##level) | |
508e53e2 | 37 | |
91c169f7 | 38 | struct ospf6_helper_info { |
39 | ||
40 | /* Grace interval received from | |
41 | * Restarting Router. | |
42 | */ | |
43 | uint32_t recvd_grace_period; | |
44 | ||
45 | /* Grace interval used for grace | |
46 | * gracetimer. | |
47 | */ | |
48 | uint32_t actual_grace_period; | |
49 | ||
50 | /* Grace timer,This Router acts as | |
51 | * helper until this timer until | |
52 | * this timer expires. | |
53 | */ | |
54 | struct thread *t_grace_timer; | |
55 | ||
56 | /* Helper status */ | |
57 | uint32_t gr_helper_status; | |
58 | ||
59 | /* Helper exit reason*/ | |
60 | uint32_t helper_exit_reason; | |
61 | ||
62 | /* Planned/Unplanned restart*/ | |
63 | uint32_t gr_restart_reason; | |
64 | ||
65 | ||
66 | /* Helper rejected reason */ | |
67 | uint32_t rejected_reason; | |
68 | }; | |
69 | ||
718e3744 | 70 | /* Neighbor structure */ |
d62a17ae | 71 | struct ospf6_neighbor { |
72 | /* Neighbor Router ID String */ | |
ff44f570 | 73 | char name[36]; |
718e3744 | 74 | |
d62a17ae | 75 | /* OSPFv3 Interface this neighbor belongs to */ |
76 | struct ospf6_interface *ospf6_if; | |
718e3744 | 77 | |
d62a17ae | 78 | /* Neighbor state */ |
d7c0a89a | 79 | uint8_t state; |
508e53e2 | 80 | |
d62a17ae | 81 | /* timestamp of last changing state */ |
d7c0a89a | 82 | uint32_t state_change; |
d62a17ae | 83 | struct timeval last_changed; |
718e3744 | 84 | |
bb382e24 PR |
85 | /* last received hello */ |
86 | struct timeval last_hello; | |
87 | uint32_t hello_in; | |
88 | ||
d62a17ae | 89 | /* Neighbor Router ID */ |
858f9c08 | 90 | in_addr_t router_id; |
718e3744 | 91 | |
d62a17ae | 92 | /* Neighbor Interface ID */ |
93 | ifindex_t ifindex; | |
508e53e2 | 94 | |
d62a17ae | 95 | /* Router Priority of this neighbor */ |
d7c0a89a | 96 | uint8_t priority; |
718e3744 | 97 | |
858f9c08 DL |
98 | in_addr_t drouter; |
99 | in_addr_t bdrouter; | |
100 | in_addr_t prev_drouter; | |
101 | in_addr_t prev_bdrouter; | |
718e3744 | 102 | |
d62a17ae | 103 | /* Options field (Capability) */ |
104 | char options[3]; | |
718e3744 | 105 | |
6a5bb300 | 106 | /* IPaddr of I/F on neighbour's link */ |
d62a17ae | 107 | struct in6_addr linklocal_addr; |
718e3744 | 108 | |
d62a17ae | 109 | /* For Database Exchange */ |
d7c0a89a QY |
110 | uint8_t dbdesc_bits; |
111 | uint32_t dbdesc_seqnum; | |
d62a17ae | 112 | /* Last received Database Description packet */ |
113 | struct ospf6_dbdesc dbdesc_last; | |
718e3744 | 114 | |
d62a17ae | 115 | /* LS-list */ |
116 | struct ospf6_lsdb *summary_list; | |
117 | struct ospf6_lsdb *request_list; | |
118 | struct ospf6_lsdb *retrans_list; | |
718e3744 | 119 | |
d62a17ae | 120 | /* LSA list for message transmission */ |
121 | struct ospf6_lsdb *dbdesc_list; | |
122 | struct ospf6_lsdb *lsreq_list; | |
123 | struct ospf6_lsdb *lsupdate_list; | |
124 | struct ospf6_lsdb *lsack_list; | |
718e3744 | 125 | |
d62a17ae | 126 | struct ospf6_lsa *last_ls_req; |
eb82e9ee | 127 | |
d62a17ae | 128 | /* Inactivity timer */ |
129 | struct thread *inactivity_timer; | |
718e3744 | 130 | |
bc09f3e6 YR |
131 | /* Timer to release the last dbdesc packet */ |
132 | struct thread *last_dbdesc_release_timer; | |
133 | ||
d62a17ae | 134 | /* Thread for sending message */ |
135 | struct thread *thread_send_dbdesc; | |
136 | struct thread *thread_send_lsreq; | |
137 | struct thread *thread_send_lsupdate; | |
138 | struct thread *thread_send_lsack; | |
9318fc6a | 139 | struct thread *thread_exchange_done; |
81e06dd3 | 140 | struct thread *thread_adj_ok; |
68fe91d6 | 141 | |
d62a17ae | 142 | /* BFD information */ |
d06cc416 | 143 | struct bfd_session_params *bfd_session; |
91c169f7 | 144 | |
145 | /* ospf6 graceful restart HELPER info */ | |
146 | struct ospf6_helper_info gr_helper_info; | |
6cb85350 AR |
147 | |
148 | /* seqnum_h/l is used to compare sequence | |
149 | * number in received packet Auth header | |
150 | */ | |
151 | uint32_t seqnum_h[OSPF6_MESSAGE_TYPE_MAX]; | |
152 | uint32_t seqnum_l[OSPF6_MESSAGE_TYPE_MAX]; | |
153 | bool auth_present; | |
154 | bool lls_present; | |
718e3744 | 155 | }; |
156 | ||
508e53e2 | 157 | /* Neighbor state */ |
158 | #define OSPF6_NEIGHBOR_DOWN 1 | |
159 | #define OSPF6_NEIGHBOR_ATTEMPT 2 | |
160 | #define OSPF6_NEIGHBOR_INIT 3 | |
161 | #define OSPF6_NEIGHBOR_TWOWAY 4 | |
162 | #define OSPF6_NEIGHBOR_EXSTART 5 | |
163 | #define OSPF6_NEIGHBOR_EXCHANGE 6 | |
164 | #define OSPF6_NEIGHBOR_LOADING 7 | |
165 | #define OSPF6_NEIGHBOR_FULL 8 | |
166 | ||
3d35ca48 DD |
167 | /* Neighbor Events */ |
168 | #define OSPF6_NEIGHBOR_EVENT_NO_EVENT 0 | |
169 | #define OSPF6_NEIGHBOR_EVENT_HELLO_RCVD 1 | |
170 | #define OSPF6_NEIGHBOR_EVENT_TWOWAY_RCVD 2 | |
171 | #define OSPF6_NEIGHBOR_EVENT_NEGOTIATION_DONE 3 | |
172 | #define OSPF6_NEIGHBOR_EVENT_EXCHANGE_DONE 4 | |
173 | #define OSPF6_NEIGHBOR_EVENT_LOADING_DONE 5 | |
174 | #define OSPF6_NEIGHBOR_EVENT_ADJ_OK 6 | |
175 | #define OSPF6_NEIGHBOR_EVENT_SEQNUMBER_MISMATCH 7 | |
176 | #define OSPF6_NEIGHBOR_EVENT_BAD_LSREQ 8 | |
177 | #define OSPF6_NEIGHBOR_EVENT_ONEWAY_RCVD 9 | |
178 | #define OSPF6_NEIGHBOR_EVENT_INACTIVITY_TIMER 10 | |
179 | #define OSPF6_NEIGHBOR_EVENT_MAX_EVENT 11 | |
180 | ||
2b64873d | 181 | extern const char *const ospf6_neighbor_event_str[]; |
d62a17ae | 182 | |
183 | static inline const char *ospf6_neighbor_event_string(int event) | |
3d35ca48 | 184 | { |
d62a17ae | 185 | #define OSPF6_NEIGHBOR_UNKNOWN_EVENT_STRING "UnknownEvent" |
3d35ca48 | 186 | |
d62a17ae | 187 | if (event < OSPF6_NEIGHBOR_EVENT_MAX_EVENT) |
188 | return ospf6_neighbor_event_str[event]; | |
189 | return OSPF6_NEIGHBOR_UNKNOWN_EVENT_STRING; | |
3d35ca48 DD |
190 | } |
191 | ||
2b64873d | 192 | extern const char *const ospf6_neighbor_state_str[]; |
718e3744 | 193 | |
6b0655a2 | 194 | |
718e3744 | 195 | /* Function Prototypes */ |
d62a17ae | 196 | int ospf6_neighbor_cmp(void *va, void *vb); |
197 | void ospf6_neighbor_dbex_init(struct ospf6_neighbor *on); | |
508e53e2 | 198 | |
7932dd93 DS |
199 | struct ospf6_neighbor *ospf6_neighbor_lookup(uint32_t router_id, |
200 | struct ospf6_interface *oi); | |
71165098 RW |
201 | struct ospf6_neighbor *ospf6_area_neighbor_lookup(struct ospf6_area *area, |
202 | uint32_t router_id); | |
7932dd93 DS |
203 | struct ospf6_neighbor *ospf6_neighbor_create(uint32_t router_id, |
204 | struct ospf6_interface *oi); | |
205 | void ospf6_neighbor_delete(struct ospf6_neighbor *on); | |
508e53e2 | 206 | |
207 | /* Neighbor event */ | |
cc9f21da DS |
208 | extern void hello_received(struct thread *thread); |
209 | extern void twoway_received(struct thread *thread); | |
210 | extern void negotiation_done(struct thread *thread); | |
211 | extern void exchange_done(struct thread *thread); | |
212 | extern void loading_done(struct thread *thread); | |
213 | extern void adj_ok(struct thread *thread); | |
214 | extern void seqnumber_mismatch(struct thread *thread); | |
215 | extern void bad_lsreq(struct thread *thread); | |
216 | extern void oneway_received(struct thread *thread); | |
217 | extern void inactivity_timer(struct thread *thread); | |
7932dd93 | 218 | extern void ospf6_check_nbr_loading(struct ospf6_neighbor *on); |
d62a17ae | 219 | |
220 | extern void ospf6_neighbor_init(void); | |
221 | extern int config_write_ospf6_debug_neighbor(struct vty *vty); | |
222 | extern void install_element_ospf6_debug_neighbor(void); | |
718e3744 | 223 | |
3012671f | 224 | DECLARE_HOOK(ospf6_neighbor_change, |
d62a17ae | 225 | (struct ospf6_neighbor * on, int state, int next_state), |
8451921b | 226 | (on, state, next_state)); |
3012671f | 227 | |
718e3744 | 228 | #endif /* OSPF6_NEIGHBOR_H */ |