aboutsummaryrefslogtreecommitdiff
path: root/src/service/messenger/messenger-testing.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/service/messenger/messenger-testing.h')
-rw-r--r--src/service/messenger/messenger-testing.h102
1 files changed, 102 insertions, 0 deletions
diff --git a/src/service/messenger/messenger-testing.h b/src/service/messenger/messenger-testing.h
new file mode 100644
index 000000000..850c37243
--- /dev/null
+++ b/src/service/messenger/messenger-testing.h
@@ -0,0 +1,102 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2023 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file messenger-testing.h
23 * @brief testing lib for messenger service
24 * @author Tobias Frisch
25 */
26
27#ifndef MESSENGER_TESTING_H
28#define MESSENGER_TESTING_H
29
30enum GNUNET_MESSENGER_TestStageJoin
31{
32 GNUNET_MESSENGER_STAGE_JOIN_NONE = 0x0,
33 GNUNET_MESSENGER_STAGE_JOIN_OPEN_ROOM = 0x1,
34 GNUNET_MESSENGER_STAGE_JOIN_ENTER_ROOM = 0x2,
35};
36
37struct GNUNET_MESSENGER_TestStage
38{
39 unsigned int door_id;
40 enum GNUNET_MESSENGER_TestStageJoin join;
41};
42
43struct GNUNET_MESSENGER_TestStage
44GNUNET_MESSENGER_create_stage_skip ();
45
46struct GNUNET_MESSENGER_TestStage
47GNUNET_MESSENGER_create_stage_open_room ();
48
49struct GNUNET_MESSENGER_TestStage
50GNUNET_MESSENGER_create_stage_enter_room (unsigned int door_id);
51
52struct GNUNET_MESSENGER_TestStageTopology
53{
54 unsigned int peer_amount;
55 unsigned int stage_amount;
56
57 struct GNUNET_MESSENGER_TestStage *peer_stages;
58};
59
60struct GNUNET_MESSENGER_TestStageTopology *
61GNUNET_MESSENGER_create_topo (unsigned int peer_amount,
62 unsigned int stage_amount,
63 const struct GNUNET_MESSENGER_TestStage
64 peer_stages[static peer_amount * stage_amount]);
65
66void
67GNUNET_MESSENGER_destroy_topo (struct
68 GNUNET_MESSENGER_TestStageTopology *topology);
69
70struct GNUNET_MESSENGER_RoomState
71{
72 struct GNUNET_CONTAINER_MultiPeerMap *doors;
73
74 unsigned int required_doors;
75};
76
77struct GNUNET_MESSENGER_RoomState *
78GNUNET_MESSENGER_create_room_state (struct
79 GNUNET_MESSENGER_TestStageTopology *topology);
80
81void
82GNUNET_MESSENGER_destroy_room_state (struct
83 GNUNET_MESSENGER_RoomState *room_state);
84
85struct GNUNET_MESSENGER_StartServiceState
86{
87 char *peer_label;
88 char *system_label;
89
90 struct GNUNET_MESSENGER_TestStageTopology *topology;
91
92 struct GNUNET_TESTING_Interpreter *is;
93 const struct GNUNET_TESTING_System *tl_system;
94 struct GNUNET_MESSENGER_Handle *msg;
95 struct GNUNET_CONTAINER_MultiHashMap *rooms;
96
97 unsigned int peer_index;
98 unsigned int stage_index;
99};
100
101#endif
102/* end of messenger-testing.h */