]>
Commit | Line | Data |
---|---|---|
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 | ||
23 | ||
24 | #ifndef SRC_PCEPSOCKETCOMMINTERNALS_H_ | |
25 | #define SRC_PCEPSOCKETCOMMINTERNALS_H_ | |
26 | ||
27 | #include <pthread.h> | |
28 | #include <stdbool.h> | |
29 | ||
30 | #include "pcep_utils_ordered_list.h" | |
31 | #include "pcep_socket_comm.h" | |
32 | ||
33 | ||
34 | typedef struct pcep_socket_comm_handle_ { | |
35 | bool active; | |
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; | |
50 | ||
51 | } pcep_socket_comm_handle; | |
52 | ||
53 | ||
54 | typedef struct pcep_socket_comm_queued_message_ { | |
55 | const char *encoded_message; | |
56 | int msg_length; | |
57 | bool free_after_send; | |
58 | ||
59 | } pcep_socket_comm_queued_message; | |
60 | ||
61 | ||
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); | |
68 | ||
69 | #endif /* SRC_PCEPSOCKETCOMMINTERNALS_H_ */ |