]> git.proxmox.com Git - mirror_frr.git/blame - zebra/label_manager.h
Merge pull request #4295 from donaldsharp/topotest_if
[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
bf094f69
QY
32#include "zebra/zserv.h"
33
51e94aa7
EDP
34#ifdef __cplusplus
35extern "C" {
36#endif
37
fea12efb 38#define NO_PROTO 0
39
40/*
41 * Label chunk struct
42 * Client daemon which the chunk belongs to can be identified by either
43 * proto (daemon protocol) + instance.
44 * If the client then passes a non-empty value to keep field when it requests
45 * for chunks, the chunks won't be garbage collected and the client will be
46 * responsible of its release.
47 * Otherwise, if the keep field is not set (value 0) for the chunk, it will be
48 * automatically released when the client disconnects or when it reconnects
49 * (in case it died unexpectedly, we can know it's the same because it will have
50 * the same proto and instance values)
51 */
52struct label_manager_chunk {
d7c0a89a
QY
53 uint8_t proto;
54 unsigned short instance;
55 uint8_t keep;
d62a17ae 56 uint32_t start; /* First label of the chunk */
57 uint32_t end; /* Last label of the chunk */
fea12efb 58};
59
60/*
61 * Main label manager struct
62 * Holds a linked list of label chunks.
63 */
64struct label_manager {
65 struct list *lc_list;
66};
67
68bool lm_is_external;
69
d62a17ae 70int zread_relay_label_manager_request(int cmd, struct zserv *zserv,
0313523d 71 struct stream *msg, vrf_id_t vrf_id);
fea12efb 72void label_manager_init(char *lm_zserv_path);
d7c0a89a
QY
73struct label_manager_chunk *assign_label_chunk(uint8_t proto,
74 unsigned short instance,
75 uint8_t keep, uint32_t size);
76int release_label_chunk(uint8_t proto, unsigned short instance, uint32_t start,
fea12efb 77 uint32_t end);
453844ab 78int release_daemon_label_chunks(struct zserv *client);
fea12efb 79void label_manager_close(void);
80
51e94aa7
EDP
81#ifdef __cplusplus
82}
83#endif
84
d62a17ae 85#endif /* _LABEL_MANAGER_H */