]> git.proxmox.com Git - mirror_frr.git/blame - pceplib/pcep_msg_tools.h
Merge pull request #11096 from anlancs/fix/bgpd-unlock
[mirror_frr.git] / pceplib / pcep_msg_tools.h
CommitLineData
74971473
JG
1/*
2 * This file is part of the PCEPlib, a PCEP protocol library.
3 *
4 * Copyright (C) 2020 Volta Networks https://voltanet.io/
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 *
19 * Author : Brady Johnson <brady@voltanet.io>
20 */
21
22#ifndef PCEP_TOOLS_H
23#define PCEP_TOOLS_H
24
25#include <stdint.h>
26#include <netinet/in.h> // struct in_addr
27
28#include "pcep_utils_double_linked_list.h"
29#include "pcep_msg_messages.h"
30#include "pcep_msg_objects.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36#define PCEP_MAX_SIZE 6000
37
38/* Returns a double linked list of PCEP messages */
39double_linked_list *pcep_msg_read(int sock_fd);
40/* Given a double linked list of PCEP messages, return the first node that has
41 * the same message type */
42struct pcep_message *pcep_msg_get(double_linked_list *msg_list, uint8_t type);
43/* Given a double linked list of PCEP messages, return the next node after
44 * current node that has the same message type */
45struct pcep_message *pcep_msg_get_next(double_linked_list *msg_list,
46 struct pcep_message *current,
47 uint8_t type);
48struct pcep_object_header *pcep_obj_get(double_linked_list *list,
49 uint8_t object_class);
50struct pcep_object_header *pcep_obj_get_next(double_linked_list *list,
51 struct pcep_object_header *current,
52 uint8_t object_class);
53struct pcep_object_tlv_header *pcep_tlv_get(double_linked_list *list,
54 uint16_t type);
55struct pcep_object_tlv_header *
56pcep_tlv_get_next(double_linked_list *list,
57 struct pcep_object_tlv_header *current, uint16_t type);
58void pcep_obj_free_tlv(struct pcep_object_tlv_header *tlv);
59void pcep_obj_free_object(struct pcep_object_header *obj);
60void pcep_msg_free_message(struct pcep_message *message);
61void pcep_msg_free_message_list(double_linked_list *list);
62void pcep_msg_print(double_linked_list *list);
63const char *get_message_type_str(uint8_t type);
64const char *get_object_class_str(uint8_t class);
65int pcep_msg_send(int sock_fd, struct pcep_message *hdr);
66
67#ifdef __cplusplus
68}
69#endif
70
71#endif