]> git.proxmox.com Git - mirror_frr.git/blob - pceplib/pcep_socket_comm_internals.h
*: auto-convert to SPDX License IDs
[mirror_frr.git] / pceplib / pcep_socket_comm_internals.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
11
12 #ifndef SRC_PCEPSOCKETCOMMINTERNALS_H_
13 #define SRC_PCEPSOCKETCOMMINTERNALS_H_
14
15 #include <pthread.h>
16 #include <stdbool.h>
17
18 #include "pcep_utils_ordered_list.h"
19 #include "pcep_socket_comm.h"
20
21
22 typedef struct pcep_socket_comm_handle_ {
23 bool active;
24 pthread_t socket_comm_thread;
25 pthread_mutex_t socket_comm_mutex;
26 fd_set read_master_set;
27 fd_set write_master_set;
28 fd_set except_master_set;
29 /* ordered_list of socket_descriptors to read from */
30 ordered_list_handle *read_list;
31 /* ordered_list of socket_descriptors to write to */
32 ordered_list_handle *write_list;
33 ordered_list_handle *session_list;
34 int num_active_sessions;
35 void *external_infra_data;
36 ext_socket_write socket_write_func;
37 ext_socket_read socket_read_func;
38
39 } pcep_socket_comm_handle;
40
41
42 typedef struct pcep_socket_comm_queued_message_ {
43 const char *encoded_message;
44 int msg_length;
45 bool free_after_send;
46
47 } pcep_socket_comm_queued_message;
48
49
50 /* Functions implemented in pcep_socket_comm_loop.c */
51 void *socket_comm_loop(void *data);
52 bool comm_session_exists(pcep_socket_comm_handle *socket_comm_handle,
53 pcep_socket_comm_session *socket_comm_session);
54 bool comm_session_exists_locking(pcep_socket_comm_handle *socket_comm_handle,
55 pcep_socket_comm_session *socket_comm_session);
56
57 #endif /* SRC_PCEPSOCKETCOMMINTERNALS_H_ */