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