]> git.proxmox.com Git - mirror_frr.git/blob - bgpd/bgp_fsm.h
bgpd-maxmed-administrative-onstartup.patch
[mirror_frr.git] / bgpd / bgp_fsm.h
1 /* BGP-4 Finite State Machine
2 From RFC1771 [A Border Gateway Protocol 4 (BGP-4)]
3 Copyright (C) 1998 Kunihiro Ishiguro
4
5 This file is part of GNU Zebra.
6
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
10 later version.
11
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.
16
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
20 02111-1307, USA. */
21
22 #ifndef _QUAGGA_BGP_FSM_H
23 #define _QUAGGA_BGP_FSM_H
24
25 /* Macro for BGP read, write and timer thread. */
26 #define BGP_READ_ON(T,F,V) \
27 do { \
28 if (!(T) && (peer->status != Deleted)) \
29 THREAD_READ_ON(master,T,F,peer,V); \
30 } while (0)
31
32 #define BGP_READ_OFF(T) \
33 do { \
34 if (T) \
35 THREAD_READ_OFF(T); \
36 } while (0)
37
38 #define BGP_WRITE_ON(T,F,V) \
39 do { \
40 if (!(T) && (peer->status != Deleted)) \
41 THREAD_WRITE_ON(master,(T),(F),peer,(V)); \
42 } while (0)
43
44 #define BGP_WRITE_OFF(T) \
45 do { \
46 if (T) \
47 THREAD_WRITE_OFF(T); \
48 } while (0)
49
50 #define BGP_TIMER_ON(T,F,V) \
51 do { \
52 if (!(T) && (peer->status != Deleted)) \
53 THREAD_TIMER_ON(master,(T),(F),peer,(V)); \
54 } while (0)
55
56 #define BGP_TIMER_OFF(T) \
57 do { \
58 if (T) \
59 THREAD_TIMER_OFF(T); \
60 } while (0)
61
62 #define BGP_EVENT_ADD(P,E) \
63 do { \
64 if ((P)->status != Deleted) \
65 thread_add_event (master, bgp_event, (P), (E)); \
66 } while (0)
67
68 #define BGP_EVENT_FLUSH(P) \
69 do { \
70 assert (peer); \
71 thread_cancel_event (master, (P)); \
72 } while (0)
73
74 #define BGP_MSEC_JITTER 10
75
76 /* Prototypes. */
77 extern int bgp_event (struct thread *);
78 extern int bgp_event_update (struct peer *, int event);
79 extern int bgp_stop (struct peer *peer);
80 extern void bgp_timer_set (struct peer *);
81 extern void bgp_fsm_change_status (struct peer *peer, int status);
82 extern const char *peer_down_str[];
83 extern void bgp_update_delay_end (struct bgp *);
84 extern void bgp_maxmed_update (struct bgp *);
85 extern int bgp_maxmed_onstartup_configured (struct bgp *);
86 extern int bgp_maxmed_onstartup_active (struct bgp *);
87
88 /**
89 * Start the route advertisement timer (that honors MRAI) for all the
90 * peers. Typically called at the end of initial convergence, coming
91 * out of read-only mode.
92 */
93 extern void bgp_start_routeadv (struct bgp *);
94
95 /**
96 * See if the route advertisement timer needs to be adjusted for a
97 * peer. For example, if the last update was written to the peer a
98 * long while back, we don't need to wait for the periodic advertisement
99 * timer to expire to send the new set of prefixes. It should fire
100 * instantly and updates should go out sooner.
101 */
102 extern void bgp_adjust_routeadv (struct peer *);
103
104 #endif /* _QUAGGA_BGP_FSM_H */