]>
git.proxmox.com Git - mirror_frr.git/blob - bgpd/bgp_keepalives.h
2 * Implements a producer thread to generate BGP keepalives for peers.
3 * Copyright (C) 2017 Cumulus Networks, Inc.
6 * This file is part of FRRouting.
8 * FRRouting is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 2, or (at your option) any later
13 * FRRouting is distributed in the hope that it will be useful, but WITHOUT ANY
14 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
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 _FRR_BGP_KEEPALIVES_H
24 #define _FRR_BGP_KEEPALIVES_H
26 #include "frr_pthread.h"
30 * Turns on keepalives for a peer.
32 * This function adds the peer to an internal list of peers to generate
35 * At set intervals, a BGP KEEPALIVE packet is generated and placed on
36 * peer->obuf. This operation is thread-safe with respect to peer->obuf.
38 * peer->v_keepalive determines the interval. Changing this value before
39 * unregistering this peer with bgp_keepalives_off() results in undefined
42 * If the peer is already registered for keepalives via this function, nothing
45 extern void bgp_keepalives_on(struct peer
*);
48 * Turns off keepalives for a peer.
50 * Removes the peer from the internal list of peers to generate keepalives for.
52 * If the peer is already unregistered for keepalives, nothing happens.
54 extern void bgp_keepalives_off(struct peer
*);
57 * Pre-run initialization function for keepalives pthread.
59 * Initializes synchronization primitives. This should be called before
60 * anything else to avoid race conditions.
62 extern void bgp_keepalives_init(void);
65 * Entry function for keepalives pthread.
67 * This function loops over an internal list of peers, generating keepalives at
68 * regular intervals as determined by each peer's keepalive timer.
70 * See bgp_keepalives_on() for additional details.
72 * @param arg pthread arg, not used
74 extern void *bgp_keepalives_start(void *arg
);
77 * Poking function for keepalives pthread.
79 * Under normal circumstances the pthread will automatically wake itself
80 * whenever it is necessary to do work. This function may be used to force the
81 * thread to wake up and see if there is any work to do, or if it is time to
84 * It is not necessary to call this after bgp_keepalives_on().
86 extern void bgp_keepalives_wake(void);
89 * Stops the thread and blocks until it terminates.
91 int bgp_keepalives_stop(struct frr_pthread
*fpt
, void **result
);
93 #endif /* _FRR_BGP_KEEPALIVES_H */