]> git.proxmox.com Git - mirror_frr.git/blob - pceplib/pcep_msg_tools.h
Merge pull request #12760 from opensourcerouting/fix/switch_to_pr_for_commitlint
[mirror_frr.git] / pceplib / pcep_msg_tools.h
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 /*
3 * This file is part of the PCEPlib, a PCEP protocol library.
4 *
5 * Copyright (C) 2020 Volta Networks https://voltanet.io/
6 *
7 * Author : Brady Johnson <brady@voltanet.io>
8 */
9
10 #ifndef PCEP_TOOLS_H
11 #define PCEP_TOOLS_H
12
13 #include <stdint.h>
14 #include <netinet/in.h> // struct in_addr
15
16 #include "pcep_utils_double_linked_list.h"
17 #include "pcep_msg_messages.h"
18 #include "pcep_msg_objects.h"
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 #define PCEP_MAX_SIZE 6000
25
26 /* Returns a double linked list of PCEP messages */
27 double_linked_list *pcep_msg_read(int sock_fd);
28 /* Given a double linked list of PCEP messages, return the first node that has
29 * the same message type */
30 struct pcep_message *pcep_msg_get(double_linked_list *msg_list, uint8_t type);
31 /* Given a double linked list of PCEP messages, return the next node after
32 * current node that has the same message type */
33 struct pcep_message *pcep_msg_get_next(double_linked_list *msg_list,
34 struct pcep_message *current,
35 uint8_t type);
36 struct pcep_object_header *pcep_obj_get(double_linked_list *list,
37 uint8_t object_class);
38 struct pcep_object_header *pcep_obj_get_next(double_linked_list *list,
39 struct pcep_object_header *current,
40 uint8_t object_class);
41 struct pcep_object_tlv_header *pcep_tlv_get(double_linked_list *list,
42 uint16_t type);
43 struct pcep_object_tlv_header *
44 pcep_tlv_get_next(double_linked_list *list,
45 struct pcep_object_tlv_header *current, uint16_t type);
46 void pcep_obj_free_tlv(struct pcep_object_tlv_header *tlv);
47 void pcep_obj_free_object(struct pcep_object_header *obj);
48 void pcep_msg_free_message(struct pcep_message *message);
49 void pcep_msg_free_message_list(double_linked_list *list);
50 void pcep_msg_print(double_linked_list *list);
51 const char *get_message_type_str(uint8_t type);
52 const char *get_object_class_str(uint8_t class);
53 int pcep_msg_send(int sock_fd, struct pcep_message *hdr);
54
55 #ifdef __cplusplus
56 }
57 #endif
58
59 #endif