summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/srv6.c15
-rw-r--r--lib/srv6.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/srv6.c b/lib/srv6.c
index abaff7eab8..1f485fb8ac 100644
--- a/lib/srv6.c
+++ b/lib/srv6.c
@@ -141,6 +141,21 @@ struct srv6_locator_chunk *srv6_locator_chunk_alloc(void)
return chunk;
}
+void srv6_locator_copy(struct srv6_locator *copy,
+ const struct srv6_locator *locator)
+{
+ strlcpy(copy->name, locator->name, sizeof(locator->name));
+ copy->prefix = locator->prefix;
+ copy->block_bits_length = locator->block_bits_length;
+ copy->node_bits_length = locator->node_bits_length;
+ copy->function_bits_length = locator->function_bits_length;
+ copy->argument_bits_length = locator->argument_bits_length;
+ copy->algonum = locator->algonum;
+ copy->current = locator->current;
+ copy->status_up = locator->status_up;
+ copy->flags = locator->flags;
+}
+
void srv6_locator_free(struct srv6_locator *locator)
{
if (locator) {
diff --git a/lib/srv6.h b/lib/srv6.h
index 04f560b267..66f1854dab 100644
--- a/lib/srv6.h
+++ b/lib/srv6.h
@@ -311,6 +311,8 @@ extern struct srv6_locator_chunk *srv6_locator_chunk_alloc(void);
extern void srv6_locator_free(struct srv6_locator *locator);
extern void srv6_locator_chunk_list_free(void *data);
extern void srv6_locator_chunk_free(struct srv6_locator_chunk **chunk);
+extern void srv6_locator_copy(struct srv6_locator *copy,
+ const struct srv6_locator *locator);
json_object *srv6_locator_chunk_json(const struct srv6_locator_chunk *chunk);
json_object *srv6_locator_json(const struct srv6_locator *loc);
json_object *srv6_locator_detailed_json(const struct srv6_locator *loc);