]> git.proxmox.com Git - mirror_frr.git/blame - zebra/table_manager.h
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / zebra / table_manager.h
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
50261279
PG
2/* zebra table Manager for routing table identifier management
3 * Copyright (C) 2018 6WIND
50261279
PG
4 */
5
6#ifndef _TABLE_MANAGER_H
7#define _TABLE_MANAGER_H
8
9#include <stdint.h>
10
11#include "lib/linklist.h"
12#include "lib/thread.h"
bf094f69
QY
13#include "lib/ns.h"
14
15#include "zebra/zserv.h"
50261279 16
51e94aa7
EDP
17#ifdef __cplusplus
18extern "C" {
19#endif
20
50261279
PG
21/*
22 * Table chunk struct
23 * Client daemon which the chunk belongs to can be identified by either
24 * proto (daemon protocol) + instance + VRF.
25 * If the client then passes a non-empty value to keep field when it requests
26 * for chunks, the chunks won't be garbage collected and the client will be
27 * responsible of its release.
28 * Otherwise, if the keep field is not set (value 0) for the chunk, it will be
29 * automatically released when the client disconnects or when it reconnects
30 * (in case it died unexpectedly, we can know it's the same because it will have
31 * the same proto and instance values)
32 */
33struct table_manager_chunk {
34 vrf_id_t vrf_id;
35 uint8_t proto;
36 uint16_t instance;
37 uint32_t start; /* First table RT ID of the chunk */
38 uint32_t end; /* Last table RT ID of the chunk */
39};
40
41/*
42 * Main table manager struct
43 * Holds a linked list of table chunks.
44 */
45struct table_manager {
46 struct list *lc_list;
42d4b30e
PG
47 uint32_t start;
48 uint32_t end;
50261279
PG
49};
50
42d4b30e 51void table_manager_enable(struct zebra_vrf *zvrf);
50261279 52struct table_manager_chunk *assign_table_chunk(uint8_t proto, uint16_t instance,
42d4b30e
PG
53 uint32_t size,
54 struct zebra_vrf *zvrf);
50261279 55int release_table_chunk(uint8_t proto, uint16_t instance, uint32_t start,
42d4b30e 56 uint32_t end, struct zebra_vrf *zvrf);
453844ab 57int release_daemon_table_chunks(struct zserv *client);
42d4b30e
PG
58void table_manager_disable(struct zebra_vrf *zvrf);
59int table_manager_range(struct vty *vty, bool add, struct zebra_vrf *zvrf,
60 const char *min, const char *max);
50261279 61
51e94aa7
EDP
62#ifdef __cplusplus
63}
64#endif
65
50261279 66#endif /* _TABLE_MANAGER_H */