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