]> git.proxmox.com Git - mirror_frr.git/blob - lib/admin_group.h
Merge pull request #12760 from opensourcerouting/fix/switch_to_pr_for_commitlint
[mirror_frr.git] / lib / admin_group.h
1 /*
2 * Administrative-group library (RFC3630, RFC5305, RFC5329, RFC7308)
3 *
4 * Copyright 2022 Hiroki Shirokura, LINE Corporation
5 * Copyright 2022 Masakazu Asama
6 * Copyright 2022 6WIND S.A.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23 #ifndef _FRR_ADMIN_GROUP_H
24 #define _FRR_ADMIN_GROUP_H
25
26 #include "zebra.h"
27 #include "memory.h"
28 #include "bitfield.h"
29
30 #define ADMIN_GROUP_PRINT_MAX_SIZE 2048
31 #define EXT_ADMIN_GROUP_MAX_POSITIONS 1024
32
33 struct admin_group {
34 bitfield_t bitmap;
35 };
36
37 char *admin_group_string(char *out, size_t sz, int indent,
38 const struct admin_group *ag);
39 char *admin_group_standard_print(char *out, int indent, uint32_t bitmap);
40 char *admin_group_print(char *out, int indent, const struct admin_group *ag);
41 bool admin_group_cmp(const struct admin_group *ag1,
42 const struct admin_group *ag2);
43 void admin_group_copy(struct admin_group *dst, const struct admin_group *src);
44 void admin_group_init(struct admin_group *ag);
45 void admin_group_term(struct admin_group *ag);
46 uint32_t admin_group_get_offset(const struct admin_group *ag,
47 size_t oct_offset);
48 void admin_group_set(struct admin_group *ag, size_t pos);
49 void admin_group_unset(struct admin_group *ag, size_t pos);
50 int admin_group_get(const struct admin_group *ag, size_t pos);
51 void admin_group_bulk_set(struct admin_group *ag, uint32_t bitmap,
52 size_t oct_offset);
53 size_t admin_group_size(const struct admin_group *ag);
54 size_t admin_group_nb_words(const struct admin_group *ag);
55 void admin_group_clear(struct admin_group *ag);
56 bool admin_group_zero(const struct admin_group *ag);
57 bool admin_group_explicit_zero(const struct admin_group *ag);
58 void admin_group_allow_explicit_zero(struct admin_group *ag);
59 void admin_group_disallow_explicit_zero(struct admin_group *ag);
60
61 bool admin_group_match_any(const struct admin_group *fad_ag,
62 const uint32_t *link_std_ag,
63 const struct admin_group *link_ag);
64 bool admin_group_match_all(const struct admin_group *fad_ag,
65 const uint32_t *link_std_ag,
66 const struct admin_group *link_ag);
67
68 #endif /* _FRR_ADMIN_GROUP_H */