]>
git.proxmox.com Git - mirror_frr.git/blob - 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
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 along
18 * with this program; see the file COPYING; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef _QUAGGA_BGP_FSM_H
23 #define _QUAGGA_BGP_FSM_H
25 /* Macro for BGP read, write and timer thread. */
26 #define BGP_TIMER_ON(T, F, V) \
28 if ((peer->status != Deleted)) \
29 thread_add_timer(bm->master, (F), peer, (V), &(T)); \
32 #define BGP_TIMER_OFF(T) \
35 THREAD_TIMER_OFF(T); \
38 #define BGP_EVENT_ADD(P, E) \
40 if ((P)->status != Deleted) \
41 thread_add_event(bm->master, bgp_event, (P), (E), \
45 #define BGP_EVENT_FLUSH(P) \
48 thread_cancel_event(bm->master, (P)); \
51 #define BGP_MSEC_JITTER 10
54 extern void bgp_fsm_nht_update(struct peer
*, int valid
);
55 extern int bgp_event(struct thread
*);
56 extern int bgp_event_update(struct peer
*, int event
);
57 extern int bgp_stop(struct peer
*peer
);
58 extern void bgp_timer_set(struct peer
*);
59 extern int bgp_routeadv_timer(struct thread
*);
60 extern void bgp_fsm_change_status(struct peer
*peer
, int status
);
61 extern const char *peer_down_str
[];
62 extern void bgp_update_delay_end(struct bgp
*);
63 extern void bgp_maxmed_update(struct bgp
*);
64 extern int bgp_maxmed_onstartup_configured(struct bgp
*);
65 extern int bgp_maxmed_onstartup_active(struct bgp
*);
68 * Start the route advertisement timer (that honors MRAI) for all the
69 * peers. Typically called at the end of initial convergence, coming
70 * out of read-only mode.
72 extern void bgp_start_routeadv(struct bgp
*);
75 * See if the route advertisement timer needs to be adjusted for a
76 * peer. For example, if the last update was written to the peer a
77 * long while back, we don't need to wait for the periodic advertisement
78 * timer to expire to send the new set of prefixes. It should fire
79 * instantly and updates should go out sooner.
81 extern void bgp_adjust_routeadv(struct peer
*);
84 DECLARE_HOOK(peer_backward_transition
, (struct peer
* peer
), (peer
))
85 DECLARE_HOOK(peer_established
, (struct peer
* peer
), (peer
))
87 #endif /* _QUAGGA_BGP_FSM_H */