blob: 9b7e14a4ae71c451eea60bd26eacf35bf67d5925 [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001/*
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
27/* OSPF Neighbor State Machine State. */
28#define NSM_DependUpon 0
Paul Jakma1f2c2742006-07-10 07:45:13 +000029#define NSM_Deleted 1
30#define NSM_Down 2
31#define NSM_Attempt 3
32#define NSM_Init 4
33#define NSM_TwoWay 5
34#define NSM_ExStart 6
35#define NSM_Exchange 7
36#define NSM_Loading 8
37#define NSM_Full 9
38#define OSPF_NSM_STATE_MAX 10
paul718e3742002-12-13 20:15:29 +000039
40/* OSPF Neighbor State Machine Event. */
41#define NSM_NoEvent 0
Paul Jakma57c5c652010-01-07 06:12:53 +000042#define NSM_PacketReceived 1 /* HelloReceived in the protocol */
paul718e3742002-12-13 20:15:29 +000043#define NSM_Start 2
44#define NSM_TwoWayReceived 3
45#define NSM_NegotiationDone 4
46#define NSM_ExchangeDone 5
47#define NSM_BadLSReq 6
48#define NSM_LoadingDone 7
49#define NSM_AdjOK 8
50#define NSM_SeqNumberMismatch 9
51#define NSM_OneWayReceived 10
52#define NSM_KillNbr 11
53#define NSM_InactivityTimer 12
54#define NSM_LLDown 13
55#define OSPF_NSM_EVENT_MAX 14
56
57/* Macro for OSPF NSM timer turn on. */
paul4dadc292005-05-06 21:37:42 +000058#define OSPF_NSM_TIMER_ON(T,F,V) \
59 do { \
60 if (!(T)) \
61 (T) = thread_add_timer (master, (F), nbr, (V)); \
paul718e3742002-12-13 20:15:29 +000062 } while (0)
63
64/* Macro for OSPF NSM timer turn off. */
paul4dadc292005-05-06 21:37:42 +000065#define OSPF_NSM_TIMER_OFF(X) \
66 do { \
67 if (X) \
68 { \
69 thread_cancel (X); \
70 (X) = NULL; \
71 } \
paul718e3742002-12-13 20:15:29 +000072 } while (0)
73
74/* Macro for OSPF NSM schedule event. */
paul4dadc292005-05-06 21:37:42 +000075#define OSPF_NSM_EVENT_SCHEDULE(N,E) \
paul718e3742002-12-13 20:15:29 +000076 thread_add_event (master, ospf_nsm_event, (N), (E))
77
78/* Macro for OSPF NSM execute event. */
paul4dadc292005-05-06 21:37:42 +000079#define OSPF_NSM_EVENT_EXECUTE(N,E) \
paul718e3742002-12-13 20:15:29 +000080 thread_execute (master, ospf_nsm_event, (N), (E))
81
82/* Prototypes. */
paul4dadc292005-05-06 21:37:42 +000083extern int ospf_nsm_event (struct thread *);
paul4dadc292005-05-06 21:37:42 +000084extern void ospf_check_nbr_loading (struct ospf_neighbor *);
85extern int ospf_db_summary_isempty (struct ospf_neighbor *);
86extern int ospf_db_summary_count (struct ospf_neighbor *);
87extern void ospf_db_summary_clear (struct ospf_neighbor *);
paul718e3742002-12-13 20:15:29 +000088
89#endif /* _ZEBRA_OSPF_NSM_H */
90