+// 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/
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
* Author : Brady Johnson <brady@voltanet.io>
*
*/
/* Reads an array of hexbyte strs, and writes them to a temporary file.
* The caller should close the returned file. */
-int convert_hexstrs_to_binary(char *filename,
- const char *hexbyte_strs[],
+int convert_hexstrs_to_binary(char *filename, const char *hexbyte_strs[],
uint16_t hexbyte_strs_length)
{
mode_t oldumask;
- oldumask = umask(S_IXUSR|S_IXGRP|S_IWOTH|S_IROTH|S_IXOTH);
+ oldumask = umask(S_IXUSR | S_IXGRP | S_IWOTH | S_IROTH | S_IXOTH);
/* Set umask before anything for security */
umask(0027);
{
char filename[BASE_TMPFILE_SIZE];
- int fd = convert_hexstrs_to_binary(filename,
- pcep_initiate_hexbyte_strs,
+ int fd = convert_hexstrs_to_binary(filename, pcep_initiate_hexbyte_strs,
pcep_initiate_hexbyte_strs_length);
- if(fd == -1){
- CU_ASSERT_TRUE(fd>=0);
+ if (fd == -1) {
+ CU_ASSERT_TRUE(fd >= 0);
return;
}
double_linked_list *msg_list = pcep_msg_read(fd);
{
char filename[BASE_TMPFILE_SIZE];
- int fd = convert_hexstrs_to_binary(filename,
- pcep_initiate2_hexbyte_strs,
- pcep_initiate2_hexbyte_strs_length);
- if(fd == -1){
- CU_ASSERT_TRUE(fd>=0);
+ int fd =
+ convert_hexstrs_to_binary(filename, pcep_initiate2_hexbyte_strs,
+ pcep_initiate2_hexbyte_strs_length);
+ if (fd == -1) {
+ CU_ASSERT_TRUE(fd >= 0);
return;
}
double_linked_list *msg_list = pcep_msg_read(fd);
{
char filename[BASE_TMPFILE_SIZE];
- int fd = convert_hexstrs_to_binary(filename,
- pcep_open_odl_hexbyte_strs,
+ int fd = convert_hexstrs_to_binary(filename, pcep_open_odl_hexbyte_strs,
pcep_open_hexbyte_strs_length);
- if(fd == -1){
- CU_ASSERT_TRUE(fd>=0);
+ if (fd == -1) {
+ CU_ASSERT_TRUE(fd >= 0);
return;
}
double_linked_list *msg_list = pcep_msg_read(fd);
{
char filename[BASE_TMPFILE_SIZE];
- int fd = convert_hexstrs_to_binary(filename,
- pcep_update_hexbyte_strs,
+ int fd = convert_hexstrs_to_binary(filename, pcep_update_hexbyte_strs,
pcep_update_hexbyte_strs_length);
- if(fd == -1){
- CU_ASSERT_TRUE(fd>=0);
+ if (fd == -1) {
+ CU_ASSERT_TRUE(fd >= 0);
return;
}
double_linked_list *msg_list = pcep_msg_read(fd);
int fd = convert_hexstrs_to_binary(
filename, pcep_open_initiate_odl_hexbyte_strs,
pcep_open_initiate_hexbyte_strs_length);
- if(fd == -1){
- CU_ASSERT_TRUE(fd>=0);
+ if (fd == -1) {
+ CU_ASSERT_TRUE(fd >= 0);
return;
}
double_linked_list *msg_list = pcep_msg_read(fd);
int fd = convert_hexstrs_to_binary(
filename, pcep_open_cisco_pce_hexbyte_strs,
pcep_open_cisco_pce_hexbyte_strs_length);
- if(fd == -1){
- CU_ASSERT_TRUE(fd>=0);
+ if (fd == -1) {
+ CU_ASSERT_TRUE(fd >= 0);
return;
}
double_linked_list *msg_list = pcep_msg_read(fd);
int fd = convert_hexstrs_to_binary(
filename, pcep_update_cisco_pce_hexbyte_strs,
pcep_update_cisco_pce_hexbyte_strs_length);
- if(fd == -1){
- CU_ASSERT_TRUE(fd>=0);
+ if (fd == -1) {
+ CU_ASSERT_TRUE(fd >= 0);
return;
}
double_linked_list *msg_list = pcep_msg_read(fd);
int fd = convert_hexstrs_to_binary(
filename, pcep_report_cisco_pcc_hexbyte_strs,
pcep_report_cisco_pcc_hexbyte_strs_length);
- if(fd == -1){
- CU_ASSERT_TRUE(fd>=0);
+ if (fd == -1) {
+ CU_ASSERT_TRUE(fd >= 0);
return;
}
double_linked_list *msg_list = pcep_msg_read(fd);
int fd = convert_hexstrs_to_binary(
filename, pcep_initiate_cisco_pcc_hexbyte_strs,
pcep_initiate_cisco_pcc_hexbyte_strs_length);
- if(fd == -1){
- CU_ASSERT_TRUE(fd>=0);
+ if (fd == -1) {
+ CU_ASSERT_TRUE(fd >= 0);
return;
}
double_linked_list *msg_list = pcep_msg_read(fd);