2 * This file is part of the PCEPlib, a PCEP protocol library.
4 * Copyright (C) 2020 Volta Networks https://voltanet.io/
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.
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.
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/>.
19 * Author : Brady Johnson <brady@voltanet.io>
24 #ifndef SRC_PCEPSOCKETCOMMINTERNALS_H_
25 #define SRC_PCEPSOCKETCOMMINTERNALS_H_
30 #include "pcep_utils_ordered_list.h"
31 #include "pcep_socket_comm.h"
34 typedef struct pcep_socket_comm_handle_
{
36 pthread_t socket_comm_thread
;
37 pthread_mutex_t socket_comm_mutex
;
38 fd_set read_master_set
;
39 fd_set write_master_set
;
40 fd_set except_master_set
;
41 /* ordered_list of socket_descriptors to read from */
42 ordered_list_handle
*read_list
;
43 /* ordered_list of socket_descriptors to write to */
44 ordered_list_handle
*write_list
;
45 ordered_list_handle
*session_list
;
46 int num_active_sessions
;
47 void *external_infra_data
;
48 ext_socket_write socket_write_func
;
49 ext_socket_read socket_read_func
;
51 } pcep_socket_comm_handle
;
54 typedef struct pcep_socket_comm_queued_message_
{
55 const char *encoded_message
;
59 } pcep_socket_comm_queued_message
;
62 /* Functions implemented in pcep_socket_comm_loop.c */
63 void *socket_comm_loop(void *data
);
64 bool comm_session_exists(pcep_socket_comm_handle
*socket_comm_handle
,
65 pcep_socket_comm_session
*socket_comm_session
);
66 bool comm_session_exists_locking(pcep_socket_comm_handle
*socket_comm_handle
,
67 pcep_socket_comm_session
*socket_comm_session
);
69 #endif /* SRC_PCEPSOCKETCOMMINTERNALS_H_ */