]>
Commit | Line | Data |
---|---|---|
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 | * | |
19 | * You should have received a copy of the GNU General Public License | |
20 | * along with FRR; see the file COPYING. If not, write to the Free | |
21 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
22 | * 02111-1307, USA. | |
23 | */ | |
24 | ||
25 | #ifndef _LABEL_MANAGER_H | |
26 | #define _LABEL_MANAGER_H | |
27 | ||
28 | #include <stdint.h> | |
29 | ||
30 | #include "lib/linklist.h" | |
31 | #include "lib/thread.h" | |
32 | ||
33 | #define NO_PROTO 0 | |
34 | ||
35 | /* | |
36 | * Label chunk struct | |
37 | * Client daemon which the chunk belongs to can be identified by either | |
38 | * proto (daemon protocol) + instance. | |
39 | * If the client then passes a non-empty value to keep field when it requests | |
40 | * for chunks, the chunks won't be garbage collected and the client will be | |
41 | * responsible of its release. | |
42 | * Otherwise, if the keep field is not set (value 0) for the chunk, it will be | |
43 | * automatically released when the client disconnects or when it reconnects | |
44 | * (in case it died unexpectedly, we can know it's the same because it will have | |
45 | * the same proto and instance values) | |
46 | */ | |
47 | struct label_manager_chunk { | |
48 | u_char proto; | |
49 | u_short instance; | |
50 | u_char keep; | |
51 | uint32_t start; /* First label of the chunk */ | |
52 | uint32_t end; /* Last label of the chunk */ | |
53 | }; | |
54 | ||
55 | /* | |
56 | * Main label manager struct | |
57 | * Holds a linked list of label chunks. | |
58 | */ | |
59 | struct label_manager { | |
60 | struct list *lc_list; | |
61 | }; | |
62 | ||
63 | bool lm_is_external; | |
64 | ||
5c7ef8dc | 65 | int zread_relay_label_manager_request(int cmd, struct zserv *zserv, vrf_id_t vrf_id); |
fea12efb | 66 | void label_manager_init(char *lm_zserv_path); |
67 | struct label_manager_chunk *assign_label_chunk(u_char proto, u_short instance, | |
68 | u_char keep, uint32_t size); | |
69 | int release_label_chunk(u_char proto, u_short instance, uint32_t start, | |
70 | uint32_t end); | |
71 | int release_daemon_chunks(u_char proto, u_short instance); | |
72 | void label_manager_close(void); | |
73 | ||
74 | #endif /* _LABEL_MANAGER_H */ |