1 /* BGP-4 Finite State Machine
2 From RFC1771 [A Border Gateway Protocol 4 (BGP-4)]
3 Copyright (C) 1998 Kunihiro Ishiguro
5 This file is part of GNU Zebra.
7 GNU Zebra is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2, or (at your option) any
12 GNU Zebra is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU Zebra; see the file COPYING. If not, write to the Free
19 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 #ifndef _QUAGGA_BGP_FSM_H
23 #define _QUAGGA_BGP_FSM_H
25 /* Macro for BGP read, write and timer thread. */
26 #define BGP_READ_ON(T,F,V) \
28 if (!(T) && (peer->status != Deleted)) \
29 THREAD_READ_ON(bm->master,T,F,peer,V); \
32 #define BGP_READ_OFF(T) \
38 #define BGP_WRITE_ON(T,F,V) \
40 if (!(T) && (peer->status != Deleted)) \
41 THREAD_WRITE_ON(bm->master,(T),(F),peer,(V)); \
44 #define BGP_WRITE_OFF(T) \
47 THREAD_WRITE_OFF(T); \
50 #define BGP_TIMER_ON(T,F,V) \
52 if (!(T) && (peer->status != Deleted)) \
53 THREAD_TIMER_ON(bm->master,(T),(F),peer,(V)); \
56 #define BGP_TIMER_OFF(T) \
59 THREAD_TIMER_OFF(T); \
62 #define BGP_EVENT_ADD(P,E) \
64 if ((P)->status != Deleted) \
65 thread_add_event (bm->master, bgp_event, (P), (E)); \
68 #define BGP_EVENT_FLUSH(P) \
71 thread_cancel_event (bm->master, (P)); \
75 extern int bgp_event (struct thread *);
76 extern int bgp_stop (struct peer *peer);
77 extern void bgp_timer_set (struct peer *);
78 extern void bgp_fsm_change_status (struct peer *peer, int status);
79 extern const char *peer_down_str[];
81 #endif /* _QUAGGA_BGP_FSM_H */