summaryrefslogtreecommitdiffstats
path: root/lib/srv6.h
diff options
context:
space:
mode:
authorHiroki Shirokura <slank.dev@gmail.com>2020-02-23 12:27:15 +0100
committerMark Stapp <mjs@voltanet.io>2021-06-02 16:24:47 +0200
commitf2867068e679900582aeb263d1723f8d7c3aa0ed (patch)
tree8c34cedf751778b49fe9daa9d25415d05f25912c /lib/srv6.h
parent*: new cli-nodes for SRv6 manager (step2) (diff)
downloadfrr-f2867068e679900582aeb263d1723f8d7c3aa0ed.tar.xz
frr-f2867068e679900582aeb263d1723f8d7c3aa0ed.zip
lib: add new structures for srv6-locator (step2)
This commit is a part of #5853 works that add new structures for SRv6-locator. This structure will be used by zebra and another routing daemon and its ZAPI messaging to manage SRv6-locator. Encoder/decoder for ZAPI stream is also added by this commit. Real configuration mechanism isn't implemented at this commit. later commit add real configure implementation. This commit add only SRv6-locator's structures and misc functions. Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
Diffstat (limited to 'lib/srv6.h')
-rw-r--r--lib/srv6.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/srv6.h b/lib/srv6.h
index b72b098c7..46ff830e7 100644
--- a/lib/srv6.h
+++ b/lib/srv6.h
@@ -21,10 +21,14 @@
#define _FRR_SRV6_H
#include <zebra.h>
+#include "prefix.h"
+#include "json.h"
+
#include <arpa/inet.h>
#include <netinet/in.h>
#define SRV6_MAX_SIDS 16
+#define SRV6_LOCNAME_SIZE 256
#ifdef __cplusplus
extern "C" {
@@ -69,6 +73,27 @@ struct seg6local_context {
uint32_t table;
};
+struct srv6_locator {
+ char name[SRV6_LOCNAME_SIZE];
+ struct prefix_ipv6 prefix;
+ uint8_t function_bits_length;
+ int algonum;
+ uint64_t current;
+ bool status_up;
+ struct list *chunks;
+
+ QOBJ_FIELDS;
+};
+DECLARE_QOBJ_TYPE(srv6_locator);
+
+struct srv6_locator_chunk {
+ uint8_t keep;
+ uint8_t proto;
+ uint16_t instance;
+ uint32_t session_id;
+ struct prefix_ipv6 prefix;
+};
+
static inline const char *seg6_mode2str(enum seg6_mode_t mode)
{
switch (mode) {
@@ -126,6 +151,13 @@ const char *seg6local_context2str(char *str, size_t size,
int snprintf_seg6_segs(char *str,
size_t size, const struct seg6_segs *segs);
+extern struct srv6_locator *srv6_locator_alloc(const char *name);
+extern struct srv6_locator_chunk *srv6_locator_chunk_alloc(void);
+extern void srv6_locator_free(struct srv6_locator *locator);
+extern void srv6_locator_chunk_free(struct srv6_locator_chunk *chunk);
+json_object *srv6_locator_chunk_json(const struct srv6_locator_chunk *chunk);
+json_object *srv6_locator_json(const struct srv6_locator *loc);
+
#ifdef __cplusplus
}
#endif