]>
git.proxmox.com Git - mirror_frr.git/blob - ospfd/ospf_ism.h
2 * OSPF version 2 Interface State Machine.
3 * From RFC2328 [OSPF Version 2]
4 * Copyright (C) 1999 Toshiaki Takada
6 * This file is part of GNU Zebra.
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
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.
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
23 #ifndef _ZEBRA_OSPF_ISM_H
24 #define _ZEBRA_OSPF_ISM_H
28 /* OSPF Interface State Machine Status. */
29 #define ISM_DependUpon 0
31 #define ISM_Loopback 2
33 #define ISM_PointToPoint 4
37 #define OSPF_ISM_STATE_MAX 8
39 /* OSPF Interface State Machine Event. */
41 #define ISM_InterfaceUp 1
42 #define ISM_WaitTimer 2
43 #define ISM_BackupSeen 3
44 #define ISM_NeighborChange 4
46 #define ISM_UnloopInd 6
47 #define ISM_InterfaceDown 7
48 #define OSPF_ISM_EVENT_MAX 8
50 #define OSPF_ISM_WRITE_ON(O) \
52 if (oi->on_write_q == 0) { \
53 listnode_add((O)->oi_write_q, oi); \
56 thread_add_write(master, ospf_write, (O), (O)->fd, \
60 /* Macro for OSPF ISM timer turn on. */
61 #define OSPF_ISM_TIMER_ON(T, F, V) thread_add_timer(master, (F), oi, (V), &(T))
63 #define OSPF_ISM_TIMER_MSEC_ON(T, F, V) \
64 thread_add_timer_msec(master, (F), oi, (V), &(T))
66 /* convenience macro to set hello timer correctly, according to
67 * whether fast-hello is set or not
69 #define OSPF_HELLO_TIMER_ON(O) \
71 if (OSPF_IF_PARAM((O), fast_hello)) \
72 OSPF_ISM_TIMER_MSEC_ON( \
73 (O)->t_hello, ospf_hello_timer, \
74 1000 / OSPF_IF_PARAM((O), fast_hello)); \
76 OSPF_ISM_TIMER_ON((O)->t_hello, ospf_hello_timer, \
77 OSPF_IF_PARAM((O), v_hello)); \
80 /* Macro for OSPF ISM timer turn off. */
81 #define OSPF_ISM_TIMER_OFF(X) \
89 /* Macro for OSPF schedule event. */
90 #define OSPF_ISM_EVENT_SCHEDULE(I, E) \
91 thread_add_event(master, ospf_ism_event, (I), (E), NULL)
93 /* Macro for OSPF execute event. */
94 #define OSPF_ISM_EVENT_EXECUTE(I, E) \
95 thread_execute(master, ospf_ism_event, (I), (E))
98 extern int ospf_ism_event(struct thread
*);
99 extern void ism_change_status(struct ospf_interface
*, int);
100 extern int ospf_hello_timer(struct thread
*thread
);
102 DECLARE_HOOK(ospf_ism_change
,
103 (struct ospf_interface
* oi
, int state
, int oldstate
),
104 (oi
, state
, oldstate
))
106 #endif /* _ZEBRA_OSPF_ISM_H */