summaryrefslogtreecommitdiffstats
path: root/pceplib/pcep_msg_tools.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 /pceplib/pcep_msg_tools.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 'pceplib/pcep_msg_tools.h')
-rw-r--r--pceplib/pcep_msg_tools.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/pceplib/pcep_msg_tools.h b/pceplib/pcep_msg_tools.h
new file mode 100644
index 0000000..e756b46
--- /dev/null
+++ b/pceplib/pcep_msg_tools.h
@@ -0,0 +1,59 @@
+// SPDX-License-Identifier: LGPL-2.1-or-later
+/*
+ * This file is part of the PCEPlib, a PCEP protocol library.
+ *
+ * Copyright (C) 2020 Volta Networks https://voltanet.io/
+ *
+ * Author : Brady Johnson <brady@voltanet.io>
+ */
+
+#ifndef PCEP_TOOLS_H
+#define PCEP_TOOLS_H
+
+#include <stdint.h>
+#include <netinet/in.h> // struct in_addr
+
+#include "pcep_utils_double_linked_list.h"
+#include "pcep_msg_messages.h"
+#include "pcep_msg_objects.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define PCEP_MAX_SIZE 6000
+
+/* Returns a double linked list of PCEP messages */
+double_linked_list *pcep_msg_read(int sock_fd);
+/* Given a double linked list of PCEP messages, return the first node that has
+ * the same message type */
+struct pcep_message *pcep_msg_get(double_linked_list *msg_list, uint8_t type);
+/* Given a double linked list of PCEP messages, return the next node after
+ * current node that has the same message type */
+struct pcep_message *pcep_msg_get_next(double_linked_list *msg_list,
+ struct pcep_message *current,
+ uint8_t type);
+struct pcep_object_header *pcep_obj_get(double_linked_list *list,
+ uint8_t object_class);
+struct pcep_object_header *pcep_obj_get_next(double_linked_list *list,
+ struct pcep_object_header *current,
+ uint8_t object_class);
+struct pcep_object_tlv_header *pcep_tlv_get(double_linked_list *list,
+ uint16_t type);
+struct pcep_object_tlv_header *
+pcep_tlv_get_next(double_linked_list *list,
+ struct pcep_object_tlv_header *current, uint16_t type);
+void pcep_obj_free_tlv(struct pcep_object_tlv_header *tlv);
+void pcep_obj_free_object(struct pcep_object_header *obj);
+void pcep_msg_free_message(struct pcep_message *message);
+void pcep_msg_free_message_list(double_linked_list *list);
+void pcep_msg_print(double_linked_list *list);
+const char *get_message_type_str(uint8_t type);
+const char *get_object_class_str(uint8_t class);
+int pcep_msg_send(int sock_fd, struct pcep_message *hdr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif