]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_labelpool.h
yang: change EIGRP authentication enum name
[mirror_frr.git] / bgpd / bgp_labelpool.h
CommitLineData
955bfd98
PZ
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
57592a53 32#define LP_TYPE_BGP_LU 0x00000002
955bfd98 33
41397f2e
DL
34PREDECL_LIST(lp_fifo)
35
955bfd98
PZ
36struct labelpool {
37 struct skiplist *ledger; /* all requests */
38 struct skiplist *inuse; /* individual labels */
39 struct list *chunks; /* granted by zebra */
41397f2e 40 struct lp_fifo_head requests; /* blocked on zebra */
955bfd98
PZ
41 struct work_queue *callback_q;
42 uint32_t pending_count; /* requested from zebra */
43};
44
45extern void bgp_lp_init(struct thread_master *master, struct labelpool *pool);
46extern void bgp_lp_finish(void);
47extern void bgp_lp_get(int type, void *labelid,
48 int (*cbfunc)(mpls_label_t label, void *labelid, bool allocated));
49extern void bgp_lp_release(int type, void *labelid, mpls_label_t label);
50extern void bgp_lp_event_chunk(uint8_t keep, uint32_t first, uint32_t last);
51extern void bgp_lp_event_zebra_down(void);
52extern void bgp_lp_event_zebra_up(void);
53
54#endif /* _FRR_BGP_LABELPOOL_H */