]> git.proxmox.com Git - mirror_frr.git/blame - zebra/label_manager.h
Merge pull request #563 from qlyoung/enforce-no-pthread-cancellation
[mirror_frr.git] / zebra / label_manager.h
CommitLineData
fea12efb 1/*
2 * Label Manager header
3 *
4 * Copyright (C) 2017 by Bingen Eguzkitza,
5 * Volta Networks Inc.
6 *
7 * This file is part of FreeRangeRouting (FRR)
8 *
9 * FRR is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2, or (at your option) any
12 * later version.
13 *
14 * FRR is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
896014f4
DL
19 * You should have received a copy of the GNU General Public License along
20 * with this program; see the file COPYING; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
fea12efb 22 */
23
24#ifndef _LABEL_MANAGER_H
25#define _LABEL_MANAGER_H
26
27#include <stdint.h>
28
29#include "lib/linklist.h"
30#include "lib/thread.h"
31
32#define NO_PROTO 0
33
34/*
35 * Label chunk struct
36 * Client daemon which the chunk belongs to can be identified by either
37 * proto (daemon protocol) + instance.
38 * If the client then passes a non-empty value to keep field when it requests
39 * for chunks, the chunks won't be garbage collected and the client will be
40 * responsible of its release.
41 * Otherwise, if the keep field is not set (value 0) for the chunk, it will be
42 * automatically released when the client disconnects or when it reconnects
43 * (in case it died unexpectedly, we can know it's the same because it will have
44 * the same proto and instance values)
45 */
46struct label_manager_chunk {
47 u_char proto;
48 u_short instance;
49 u_char keep;
50 uint32_t start; /* First label of the chunk */
51 uint32_t end; /* Last label of the chunk */
52};
53
54/*
55 * Main label manager struct
56 * Holds a linked list of label chunks.
57 */
58struct label_manager {
59 struct list *lc_list;
60};
61
62bool lm_is_external;
63
5c7ef8dc 64int zread_relay_label_manager_request(int cmd, struct zserv *zserv, vrf_id_t vrf_id);
fea12efb 65void label_manager_init(char *lm_zserv_path);
66struct label_manager_chunk *assign_label_chunk(u_char proto, u_short instance,
67 u_char keep, uint32_t size);
68int release_label_chunk(u_char proto, u_short instance, uint32_t start,
69 uint32_t end);
70int release_daemon_chunks(u_char proto, u_short instance);
71void label_manager_close(void);
72
73#endif /* _LABEL_MANAGER_H */