]>
Commit | Line | Data |
---|---|---|
acddc0ed | 1 | // SPDX-License-Identifier: LGPL-2.1-or-later |
74971473 JG |
2 | /* |
3 | * This file is part of the PCEPlib, a PCEP protocol library. | |
4 | * | |
5 | * Copyright (C) 2020 Volta Networks https://voltanet.io/ | |
6 | * | |
74971473 JG |
7 | * Author : Brady Johnson <brady@voltanet.io> |
8 | * | |
9 | */ | |
10 | ||
11 | /* | |
12 | * This module is built into a separate library, and is used by several | |
13 | * other modules for unit testing, so that real sockets dont have to be | |
14 | * created. | |
15 | */ | |
16 | ||
17 | #ifndef PCEP_SOCKET_COMM_MOCK_SOCKET_COMM_H_ | |
18 | #define PCEP_SOCKET_COMM_MOCK_SOCKET_COMM_H_ | |
19 | ||
20 | #include <stdbool.h> | |
21 | ||
22 | #include "pcep_utils_double_linked_list.h" | |
23 | ||
24 | typedef struct mock_socket_comm_info_ { | |
25 | int socket_comm_initialize_external_infra_times_called; | |
26 | int socket_comm_session_initialize_times_called; | |
27 | int socket_comm_session_initialize_src_times_called; | |
28 | int socket_comm_session_teardown_times_called; | |
29 | int socket_comm_session_connect_tcp_times_called; | |
30 | int socket_comm_session_send_message_times_called; | |
31 | int socket_comm_session_close_tcp_after_write_times_called; | |
32 | int socket_comm_session_close_tcp_times_called; | |
33 | int destroy_socket_comm_loop_times_called; | |
34 | ||
35 | /* TODO later if necessary, we can add return values for | |
36 | * those functions that return something */ | |
37 | ||
38 | /* Used to access messages sent with socket_comm_session_send_message() | |
39 | */ | |
40 | bool send_message_save_message; | |
41 | double_linked_list *sent_message_list; | |
42 | ||
43 | } mock_socket_comm_info; | |
44 | ||
45 | void setup_mock_socket_comm_info(void); | |
46 | void teardown_mock_socket_comm_info(void); | |
47 | void reset_mock_socket_comm_info(void); | |
48 | bool destroy_socket_comm_loop(void); | |
49 | ||
50 | mock_socket_comm_info *get_mock_socket_comm_info(void); | |
51 | void verify_socket_comm_times_called(int initialized, int teardown, int connect, | |
52 | int send_message, int close_after_write, | |
53 | int close, int destroy); | |
54 | ||
55 | #endif /* PCEP_SOCKET_COMM_MOCK_SOCKET_COMM_H_ */ |