aboutsummaryrefslogtreecommitdiff
path: root/src/lib/testing/testing_cmds.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/testing/testing_cmds.h')
-rw-r--r--src/lib/testing/testing_cmds.h143
1 files changed, 143 insertions, 0 deletions
diff --git a/src/lib/testing/testing_cmds.h b/src/lib/testing/testing_cmds.h
new file mode 100644
index 000000000..9c261aab5
--- /dev/null
+++ b/src/lib/testing/testing_cmds.h
@@ -0,0 +1,143 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 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 testing/testing_cmds.h
23 * @brief Message formats for communication between testing cmds helper and testcase plugins.
24 * @author t3sserakt
25 */
26
27#ifndef TESTING_CMDS_H
28#define TESTING_CMDS_H
29
30#define HELPER_CMDS_BINARY "gnunet-cmds-helper"
31#include "gnunet_common.h"
32
33GNUNET_NETWORK_STRUCT_BEGIN
34
35/**
36 * Initialization message for gnunet-cmds-testbed to start cmd binary.
37 */
38struct GNUNET_TESTING_CommandHelperInit
39{
40 /**
41 * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT
42 */
43 struct GNUNET_MessageHeader header;
44
45 /**
46 *
47 */
48 uint16_t plugin_name_size GNUNET_PACKED;
49
50 /* Followed by plugin name of the plugin running the test case. This is not NULL
51 * terminated */
52};
53
54/**
55 * Reply message from cmds helper process
56 */
57struct GNUNET_TESTING_CommandHelperReply
58{
59 /**
60 * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY
61 */
62 struct GNUNET_MessageHeader header;
63};
64
65struct GNUNET_TESTING_CommandPeerStarted
66{
67 /**
68 * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED
69 */
70 struct GNUNET_MessageHeader header;
71};
72
73struct GNUNET_TESTING_CommandAllPeersStarted
74{
75 /**
76 * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED
77 */
78 struct GNUNET_MessageHeader header;
79};
80
81struct GNUNET_TESTING_CommandLocalFinished
82{
83 /**
84 * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED
85 */
86 struct GNUNET_MessageHeader header;
87
88 /**
89 * The exit status local test return with.
90 */
91 enum GNUNET_GenericReturnValue rv;
92};
93
94
95struct GNUNET_TESTING_CommandLocalTestPrepared
96{
97 /**
98 * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TEST_PREPARED
99 */
100 struct GNUNET_MessageHeader header;
101};
102
103struct GNUNET_TESTING_CommandAllLocalTestsPrepared
104{
105 /**
106 * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_LOCAL_TESTS_PREPARED
107 */
108 struct GNUNET_MessageHeader header;
109};
110
111GNUNET_NETWORK_STRUCT_END
112
113/**
114 * Global state of the interpreter, used by a command
115 * to access information about other commands.
116 */
117struct GNUNET_TESTING_Interpreter;
118
119
120/**
121 * Returns the actual running command.
122 *
123 * @param is Global state of the interpreter, used by a command
124 * to access information about other commands.
125 * @return The actual running command.
126 */
127struct GNUNET_TESTING_Command *
128GNUNET_TESTING_interpreter_get_current_command (
129 struct GNUNET_TESTING_Interpreter *is);
130
131
132/**
133 * Adding a helper handle to the interpreter.
134 *
135 * @param is The interpreter.
136 * @param helper The helper handle.
137 */
138void
139GNUNET_TESTING_add_netjail_helper (struct GNUNET_TESTING_Interpreter *is,
140 const struct GNUNET_HELPER_Handle *helper);
141
142#endif
143/* end of testing_cmds.h */