]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* |
2 | * OSPF version 2 Neighbor State Machine | |
3 | * From RFC2328 [OSPF Version 2] | |
4 | * Copyright (C) 1999 Toshiaki Takada | |
5 | * | |
6 | * This file is part of GNU Zebra. | |
7 | * | |
8 | * GNU Zebra is free software; you can redistribute it and/or modify it | |
9 | * under the terms of the GNU General Public License as published by the | |
10 | * Free Software Foundation; either version 2, or (at your option) any | |
11 | * later version. | |
12 | * | |
13 | * GNU Zebra is distributed in the hope that it will be useful, but | |
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | * General Public License for more details. | |
17 | * | |
896014f4 DL |
18 | * You should have received a copy of the GNU General Public License along |
19 | * with this program; see the file COPYING; if not, write to the Free Software | |
20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
718e3744 | 21 | */ |
22 | ||
23 | #ifndef _ZEBRA_OSPF_NSM_H | |
24 | #define _ZEBRA_OSPF_NSM_H | |
25 | ||
3012671f DL |
26 | #include "hook.h" |
27 | ||
718e3744 | 28 | /* OSPF Neighbor State Machine State. */ |
29 | #define NSM_DependUpon 0 | |
1f2c2743 PJ |
30 | #define NSM_Deleted 1 |
31 | #define NSM_Down 2 | |
32 | #define NSM_Attempt 3 | |
33 | #define NSM_Init 4 | |
34 | #define NSM_TwoWay 5 | |
35 | #define NSM_ExStart 6 | |
36 | #define NSM_Exchange 7 | |
37 | #define NSM_Loading 8 | |
38 | #define NSM_Full 9 | |
39 | #define OSPF_NSM_STATE_MAX 10 | |
718e3744 | 40 | |
41 | /* OSPF Neighbor State Machine Event. */ | |
42 | #define NSM_NoEvent 0 | |
57c5c652 | 43 | #define NSM_PacketReceived 1 /* HelloReceived in the protocol */ |
718e3744 | 44 | #define NSM_Start 2 |
45 | #define NSM_TwoWayReceived 3 | |
46 | #define NSM_NegotiationDone 4 | |
47 | #define NSM_ExchangeDone 5 | |
48 | #define NSM_BadLSReq 6 | |
49 | #define NSM_LoadingDone 7 | |
50 | #define NSM_AdjOK 8 | |
51 | #define NSM_SeqNumberMismatch 9 | |
52 | #define NSM_OneWayReceived 10 | |
53 | #define NSM_KillNbr 11 | |
54 | #define NSM_InactivityTimer 12 | |
55 | #define NSM_LLDown 13 | |
56 | #define OSPF_NSM_EVENT_MAX 14 | |
57 | ||
58 | /* Macro for OSPF NSM timer turn on. */ | |
ffa2c898 | 59 | #define OSPF_NSM_TIMER_ON(T,F,V) thread_add_timer (master, (F), nbr, (V), &(T)) |
718e3744 | 60 | |
61 | /* Macro for OSPF NSM timer turn off. */ | |
d62a17ae | 62 | #define OSPF_NSM_TIMER_OFF(X) \ |
63 | do { \ | |
64 | if (X) { \ | |
65 | thread_cancel(X); \ | |
66 | (X) = NULL; \ | |
67 | } \ | |
68 | } while (0) | |
718e3744 | 69 | |
70 | /* Macro for OSPF NSM schedule event. */ | |
d62a17ae | 71 | #define OSPF_NSM_EVENT_SCHEDULE(N, E) \ |
72 | thread_add_event(master, ospf_nsm_event, (N), (E), NULL) | |
718e3744 | 73 | |
74 | /* Macro for OSPF NSM execute event. */ | |
d62a17ae | 75 | #define OSPF_NSM_EVENT_EXECUTE(N, E) \ |
76 | thread_execute(master, ospf_nsm_event, (N), (E)) | |
718e3744 | 77 | |
78 | /* Prototypes. */ | |
d62a17ae | 79 | extern int ospf_nsm_event(struct thread *); |
80 | extern void ospf_check_nbr_loading(struct ospf_neighbor *); | |
81 | extern int ospf_db_summary_isempty(struct ospf_neighbor *); | |
82 | extern int ospf_db_summary_count(struct ospf_neighbor *); | |
83 | extern void ospf_db_summary_clear(struct ospf_neighbor *); | |
718e3744 | 84 | |
3012671f | 85 | DECLARE_HOOK(ospf_nsm_change, |
d62a17ae | 86 | (struct ospf_neighbor * on, int state, int oldstate), |
87 | (on, state, oldstate)) | |
3012671f | 88 | |
718e3744 | 89 | #endif /* _ZEBRA_OSPF_NSM_H */ |