]>
git.proxmox.com Git - mirror_frr.git/blob - ospfd/ospf_ism.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * OSPF version 2 Interface State Machine.
4 * From RFC2328 [OSPF Version 2]
5 * Copyright (C) 1999 Toshiaki Takada
8 #ifndef _ZEBRA_OSPF_ISM_H
9 #define _ZEBRA_OSPF_ISM_H
13 /* OSPF Interface State Machine Status. */
14 #define ISM_DependUpon 0
16 #define ISM_Loopback 2
18 #define ISM_PointToPoint 4
22 #define OSPF_ISM_STATE_MAX 8
24 /* OSPF Interface State Machine Event. */
26 #define ISM_InterfaceUp 1
27 #define ISM_WaitTimer 2
28 #define ISM_BackupSeen 3
29 #define ISM_NeighborChange 4
31 #define ISM_UnloopInd 6
32 #define ISM_InterfaceDown 7
33 #define OSPF_ISM_EVENT_MAX 8
35 #define OSPF_ISM_WRITE_ON(O) \
37 if (oi->on_write_q == 0) { \
38 listnode_add((O)->oi_write_q, oi); \
41 if (!list_isempty((O)->oi_write_q)) \
42 thread_add_write(master, ospf_write, (O), (O)->fd, \
46 /* Macro for OSPF ISM timer turn on. */
47 #define OSPF_ISM_TIMER_ON(T, F, V) thread_add_timer(master, (F), oi, (V), &(T))
49 #define OSPF_ISM_TIMER_MSEC_ON(T, F, V) \
50 thread_add_timer_msec(master, (F), oi, (V), &(T))
52 /* convenience macro to set hello timer correctly, according to
53 * whether fast-hello is set or not
55 #define OSPF_HELLO_TIMER_ON(O) \
57 if (OSPF_IF_PARAM((O), fast_hello)) \
58 OSPF_ISM_TIMER_MSEC_ON( \
59 (O)->t_hello, ospf_hello_timer, \
60 1000 / OSPF_IF_PARAM((O), fast_hello)); \
62 OSPF_ISM_TIMER_ON((O)->t_hello, ospf_hello_timer, \
63 OSPF_IF_PARAM((O), v_hello)); \
66 /* Macro for OSPF schedule event. */
67 #define OSPF_ISM_EVENT_SCHEDULE(I, E) \
68 thread_add_event(master, ospf_ism_event, (I), (E), NULL)
70 /* Macro for OSPF execute event. */
71 #define OSPF_ISM_EVENT_EXECUTE(I, E) \
72 thread_execute(master, ospf_ism_event, (I), (E))
75 extern void ospf_ism_event(struct thread
*thread
);
76 extern void ism_change_status(struct ospf_interface
*, int);
77 extern void ospf_hello_timer(struct thread
*thread
);
78 extern int ospf_dr_election(struct ospf_interface
*oi
);
80 DECLARE_HOOK(ospf_ism_change
,
81 (struct ospf_interface
* oi
, int state
, int oldstate
),
82 (oi
, state
, oldstate
));
84 #endif /* _ZEBRA_OSPF_ISM_H */