]> git.proxmox.com Git - mirror_frr.git/blob - bgpd/bgp_labelpool.h
bgpd: Allow 'no set community`
[mirror_frr.git] / bgpd / bgp_labelpool.h
1 /*
2 * BGP Label Pool - Manage label chunk allocations from zebra asynchronously
3 *
4 * Copyright (C) 2018 LabN Consulting, L.L.C.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #ifndef _FRR_BGP_LABELPOOL_H
22 #define _FRR_BGP_LABELPOOL_H
23
24 #include <zebra.h>
25
26 #include "mpls.h"
27
28 /*
29 * Types used in bgp_lp_get for debug tracking; add more as needed
30 */
31 #define LP_TYPE_VRF 0x00000001
32
33 struct labelpool {
34 struct skiplist *ledger; /* all requests */
35 struct skiplist *inuse; /* individual labels */
36 struct list *chunks; /* granted by zebra */
37 struct lp_fifo *requests; /* blocked on zebra */
38 struct work_queue *callback_q;
39 uint32_t pending_count; /* requested from zebra */
40 };
41
42 extern void bgp_lp_init(struct thread_master *master, struct labelpool *pool);
43 extern void bgp_lp_finish(void);
44 extern void bgp_lp_get(int type, void *labelid,
45 int (*cbfunc)(mpls_label_t label, void *labelid, bool allocated));
46 extern void bgp_lp_release(int type, void *labelid, mpls_label_t label);
47 extern void bgp_lp_event_chunk(uint8_t keep, uint32_t first, uint32_t last);
48 extern void bgp_lp_event_zebra_down(void);
49 extern void bgp_lp_event_zebra_up(void);
50
51 #endif /* _FRR_BGP_LABELPOOL_H */