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