]>
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 _BGP_KEEPALIVES_H_
24 #define _BGP_KEEPALIVES_H_
26 #include "frr_pthread.h"
29 /* Turns on keepalives for a peer.
31 * This function adds the peer to an internal list of peers to generate
34 * At set intervals, a BGP KEEPALIVE packet is generated and placed on
35 * peer->obuf. This operation is thread-safe with respect to peer->obuf.
37 * peer->v_keepalive determines the interval. Changing this value before
38 * unregistering this peer with bgp_keepalives_off() results in undefined
41 * If the peer is already registered for keepalives via this function, nothing
44 extern void bgp_keepalives_on(struct peer
*);
46 /* Turns off keepalives for a peer.
48 * Removes the peer from the internal list of peers to generate keepalives for.
50 * If the peer is already unregistered for keepalives, nothing happens.
52 extern void bgp_keepalives_off(struct peer
*);
54 /* Pre-run initialization function for keepalives pthread.
56 * Initializes synchronization primitives. This should be called before
57 * anything else to avoid race conditions.
59 extern void bgp_keepalives_init(void);
61 /* Entry function for keepalives pthread.
63 * This function loops over an internal list of peers, generating keepalives at
64 * regular intervals as determined by each peer's keepalive timer.
66 * See bgp_keepalives_on() for additional details.
68 * @param arg pthread arg, not used
70 extern void *bgp_keepalives_start(void *arg
);
72 /* Poking function for keepalives pthread.
74 * Under normal circumstances the pthread will automatically wake itself
75 * whenever it is necessary to do work. This function may be used to force the
76 * thread to wake up and see if there is any work to do, or if it is time to
79 * It is not necessary to call this after bgp_keepalives_on().
81 extern void bgp_keepalives_wake(void);
84 * Stops the thread and blocks until it terminates.
86 int bgp_keepalives_stop(void **result
, struct frr_pthread
*fpt
);
88 #endif /* _BGP_KEEPALIVES_H */