]> git.proxmox.com Git - mirror_frr.git/blame - pceplib/pcep_socket_comm_mock.h
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / pceplib / pcep_socket_comm_mock.h
CommitLineData
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
24typedef 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
45void setup_mock_socket_comm_info(void);
46void teardown_mock_socket_comm_info(void);
47void reset_mock_socket_comm_info(void);
48bool destroy_socket_comm_loop(void);
49
50mock_socket_comm_info *get_mock_socket_comm_info(void);
51void 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_ */