]>
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 | * | |
18 | * You should have received a copy of the GNU General Public License | |
19 | * along with GNU Zebra; see the file COPYING. If not, write to the Free | |
20 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
21 | * 02111-1307, USA. | |
22 | */ | |
23 | ||
24 | #ifndef _ZEBRA_OSPF_NSM_H | |
25 | #define _ZEBRA_OSPF_NSM_H | |
26 | ||
3012671f DL |
27 | #include "hook.h" |
28 | ||
718e3744 | 29 | /* OSPF Neighbor State Machine State. */ |
30 | #define NSM_DependUpon 0 | |
1f2c2743 PJ |
31 | #define NSM_Deleted 1 |
32 | #define NSM_Down 2 | |
33 | #define NSM_Attempt 3 | |
34 | #define NSM_Init 4 | |
35 | #define NSM_TwoWay 5 | |
36 | #define NSM_ExStart 6 | |
37 | #define NSM_Exchange 7 | |
38 | #define NSM_Loading 8 | |
39 | #define NSM_Full 9 | |
40 | #define OSPF_NSM_STATE_MAX 10 | |
718e3744 | 41 | |
42 | /* OSPF Neighbor State Machine Event. */ | |
43 | #define NSM_NoEvent 0 | |
57c5c652 | 44 | #define NSM_PacketReceived 1 /* HelloReceived in the protocol */ |
718e3744 | 45 | #define NSM_Start 2 |
46 | #define NSM_TwoWayReceived 3 | |
47 | #define NSM_NegotiationDone 4 | |
48 | #define NSM_ExchangeDone 5 | |
49 | #define NSM_BadLSReq 6 | |
50 | #define NSM_LoadingDone 7 | |
51 | #define NSM_AdjOK 8 | |
52 | #define NSM_SeqNumberMismatch 9 | |
53 | #define NSM_OneWayReceived 10 | |
54 | #define NSM_KillNbr 11 | |
55 | #define NSM_InactivityTimer 12 | |
56 | #define NSM_LLDown 13 | |
57 | #define OSPF_NSM_EVENT_MAX 14 | |
58 | ||
59 | /* Macro for OSPF NSM timer turn on. */ | |
ac4d0be5 | 60 | #define OSPF_NSM_TIMER_ON(T, F, V) \ |
61 | do { \ | |
62 | if (!(T)) \ | |
63 | (T) = thread_add_timer(master, (F), nbr, (V)); \ | |
64 | } while (0) | |
718e3744 | 65 | |
66 | /* Macro for OSPF NSM timer turn off. */ | |
ac4d0be5 | 67 | #define OSPF_NSM_TIMER_OFF(X) \ |
68 | do { \ | |
69 | if (X) { \ | |
70 | thread_cancel(X); \ | |
71 | (X) = NULL; \ | |
72 | } \ | |
73 | } while (0) | |
718e3744 | 74 | |
75 | /* Macro for OSPF NSM schedule event. */ | |
ac4d0be5 | 76 | #define OSPF_NSM_EVENT_SCHEDULE(N, E) \ |
77 | thread_add_event(master, ospf_nsm_event, (N), (E)) | |
718e3744 | 78 | |
79 | /* Macro for OSPF NSM execute event. */ | |
ac4d0be5 | 80 | #define OSPF_NSM_EVENT_EXECUTE(N, E) \ |
81 | thread_execute(master, ospf_nsm_event, (N), (E)) | |
718e3744 | 82 | |
83 | /* Prototypes. */ | |
ac4d0be5 | 84 | extern int ospf_nsm_event(struct thread *); |
85 | extern void ospf_check_nbr_loading(struct ospf_neighbor *); | |
86 | extern int ospf_db_summary_isempty(struct ospf_neighbor *); | |
87 | extern int ospf_db_summary_count(struct ospf_neighbor *); | |
88 | extern void ospf_db_summary_clear(struct ospf_neighbor *); | |
718e3744 | 89 | |
3012671f | 90 | DECLARE_HOOK(ospf_nsm_change, |
ac4d0be5 | 91 | (struct ospf_neighbor * on, int state, int oldstate), |
92 | (on, state, oldstate)) | |
3012671f | 93 | |
718e3744 | 94 | #endif /* _ZEBRA_OSPF_NSM_H */ |