summaryrefslogtreecommitdiffstats
path: root/lib/admin_group.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-09 13:16:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-09 13:16:35 +0000
commite2bbf175a2184bd76f6c54ccf8456babeb1a46fc (patch)
treef0b76550d6e6f500ada964a3a4ee933a45e5a6f1 /lib/admin_group.h
parentInitial commit. (diff)
downloadfrr-e2bbf175a2184bd76f6c54ccf8456babeb1a46fc.tar.xz
frr-e2bbf175a2184bd76f6c54ccf8456babeb1a46fc.zip
Adding upstream version 9.1.upstream/9.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/admin_group.h')
-rw-r--r--lib/admin_group.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/lib/admin_group.h b/lib/admin_group.h
new file mode 100644
index 0000000..60f4a05
--- /dev/null
+++ b/lib/admin_group.h
@@ -0,0 +1,68 @@
+/*
+ * Administrative-group library (RFC3630, RFC5305, RFC5329, RFC7308)
+ *
+ * Copyright 2022 Hiroki Shirokura, LINE Corporation
+ * Copyright 2022 Masakazu Asama
+ * Copyright 2022 6WIND S.A.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _FRR_ADMIN_GROUP_H
+#define _FRR_ADMIN_GROUP_H
+
+#include "zebra.h"
+#include "memory.h"
+#include "bitfield.h"
+
+#define ADMIN_GROUP_PRINT_MAX_SIZE 2048
+#define EXT_ADMIN_GROUP_MAX_POSITIONS 1024
+
+struct admin_group {
+ bitfield_t bitmap;
+};
+
+char *admin_group_string(char *out, size_t sz, int indent,
+ const struct admin_group *ag);
+char *admin_group_standard_print(char *out, int indent, uint32_t bitmap);
+char *admin_group_print(char *out, int indent, const struct admin_group *ag);
+bool admin_group_cmp(const struct admin_group *ag1,
+ const struct admin_group *ag2);
+void admin_group_copy(struct admin_group *dst, const struct admin_group *src);
+void admin_group_init(struct admin_group *ag);
+void admin_group_term(struct admin_group *ag);
+uint32_t admin_group_get_offset(const struct admin_group *ag,
+ size_t oct_offset);
+void admin_group_set(struct admin_group *ag, size_t pos);
+void admin_group_unset(struct admin_group *ag, size_t pos);
+int admin_group_get(const struct admin_group *ag, size_t pos);
+void admin_group_bulk_set(struct admin_group *ag, uint32_t bitmap,
+ size_t oct_offset);
+size_t admin_group_size(const struct admin_group *ag);
+size_t admin_group_nb_words(const struct admin_group *ag);
+void admin_group_clear(struct admin_group *ag);
+bool admin_group_zero(const struct admin_group *ag);
+bool admin_group_explicit_zero(const struct admin_group *ag);
+void admin_group_allow_explicit_zero(struct admin_group *ag);
+void admin_group_disallow_explicit_zero(struct admin_group *ag);
+
+bool admin_group_match_any(const struct admin_group *fad_ag,
+ const uint32_t *link_std_ag,
+ const struct admin_group *link_ag);
+bool admin_group_match_all(const struct admin_group *fad_ag,
+ const uint32_t *link_std_ag,
+ const struct admin_group *link_ag);
+
+#endif /* _FRR_ADMIN_GROUP_H */