aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/gnunet_testbed_ng_service.h247
-rw-r--r--src/include/gnunet_testbed_service.h2
-rw-r--r--src/testbed/Makefile.am3
-rw-r--r--src/testbed/testbed_api_cmd_controller.c294
-rw-r--r--src/testbed/testbed_api_cmd_peer.c249
-rw-r--r--src/testing/testing_api_cmd_hello_world_birth.c6
6 files changed, 796 insertions, 5 deletions
diff --git a/src/include/gnunet_testbed_ng_service.h b/src/include/gnunet_testbed_ng_service.h
new file mode 100644
index 000000000..a6f30889f
--- /dev/null
+++ b/src/include/gnunet_testbed_ng_service.h
@@ -0,0 +1,247 @@
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 * @author t3sserakt
23 *
24 * @file
25 * API for writing tests and creating large-scale emulation testbeds for GNUnet with command pattern.
26 *
27 * @defgroup testbed Testbed service
28 * Writing tests and creating large-scale emulation testbeds for GNUnet with command pattern.
29 *
30 * @see [Documentation](https://docs.gnunet.org/handbook/gnunet.html#TESTBED-NG-Subsystem)
31 *
32 * @{
33 */
34
35#ifndef GNUNET_TESTBED_NG_SERVICE_H
36#define GNUNET_TESTBED_NG_SERVICE_H
37
38#include "gnunet_util_lib.h"
39#include "gnunet_testing_ng_lib.h"
40
41struct ServiceState
42{
43 /**
44 * Handle to operation
45 */
46 struct GNUNET_TESTBED_Operation *operation;
47
48 /**
49 * Flag indicating if service is ready.
50 */
51 int service_ready;
52
53 /**
54 * Abort task identifier
55 */
56 struct GNUNET_SCHEDULER_Task *abort_task;
57
58 /**
59 * Label of peer command.
60 */
61 const char *peer_label;
62
63 /**
64 * Name of service to start.
65 */
66 const char *servicename;
67};
68
69struct PeerCmdState
70{
71 /**
72 * The label of a controller command.
73 */
74 const char *controller_label;
75
76 /**
77 * Handle to operation
78 */
79 struct GNUNET_TESTBED_Operation *operation;
80
81 /**
82 * Name of the host, use "NULL" for localhost.
83 */
84 const char *hostname;
85
86 /**
87 * Username to use for the login; may be NULL.
88 */
89 const char *username;
90
91 /**
92 * Port number to use for ssh; use 0 to let ssh decide.
93 */
94 uint16_t port;
95
96 /**
97 * The configuration to use as a template while starting a controller
98 * on this host. Operation queue sizes specific to a host are also
99 * read from this configuration handle.
100 */
101 struct GNUNET_CONFIGURATION_Handle *cfg;
102
103 /**
104 * The host to run peers and controllers on
105 */
106 struct GNUNET_TESTBED_Host *host;
107
108 /**
109 * Abort task identifier
110 */
111 struct GNUNET_SCHEDULER_Task *abort_task;
112
113 /**
114 * Handle for host registration
115 */
116 struct GNUNET_TESTBED_HostRegistrationHandle *reg_handle;
117
118 /**
119 * Flag indicating if peer is ready.
120 */
121 int peer_ready;
122
123 /**
124 * Flag indicating controller is going down.
125 */
126 int peer_going_down;
127
128 /**
129 * Interpreter state.
130 */
131 struct GNUNET_TESTING_Interpreter *is;
132
133 /**
134 * Peer to start
135 */
136 struct GNUNET_TESTBED_Peer *peer;
137};
138
139struct ControllerState
140{
141 /**
142 * The ip address of the controller which will be set as TRUSTED
143 * HOST(all connections form this ip are permitted by the testbed) when
144 * starting testbed controller at host. This can either be a single ip
145 * address or a network address in CIDR notation.
146 */
147 const char *trusted_ip;
148
149 /**
150 * Name of the host, use "NULL" for localhost.
151 */
152 const char *hostname;
153
154 /**
155 * Username to use for the login; may be NULL.
156 */
157 const char *username;
158
159 /**
160 * Port number to use for ssh; use 0 to let ssh decide.
161 */
162 uint16_t port;
163
164 /**
165 * The configuration to use as a template while starting a controller
166 * on this host. Operation queue sizes specific to a host are also
167 * read from this configuration handle.
168 */
169 struct GNUNET_CONFIGURATION_Handle *cfg;
170
171 /**
172 * The host to run peers and controllers on
173 */
174 struct GNUNET_TESTBED_Host *host;
175
176 /**
177 * The controller process
178 */
179 struct GNUNET_TESTBED_ControllerProc *cp;
180
181 /**
182 * The controller handle
183 */
184 struct GNUNET_TESTBED_Controller *controller;
185
186 /**
187 * A bit mask with set of events to call the controller for.
188 */
189 uint64_t event_mask;
190
191 /**
192 * Abort task identifier
193 */
194 struct GNUNET_SCHEDULER_Task *abort_task;
195
196 /**
197 * Handle for host registration
198 */
199 struct GNUNET_TESTBED_HostRegistrationHandle *reg_handle;
200
201 /**
202 * Flag indicating if host create with controller is ready.
203 */
204 int host_ready;
205
206 /**
207 * Flag indicating controller is going down.
208 */
209 int controller_going_down;
210
211 /**
212 * Interpreter state.
213 */
214 struct GNUNET_TESTING_Interpreter *is;
215};
216
217/**
218 * Offer data from trait
219 *
220 * @param cmd command to extract the controller from.
221 * @param pt pointer to controller.
222 * @return #GNUNET_OK on success.
223 */
224int
225GNUNET_TESTBED_get_trait_controller (const struct GNUNET_TESTING_Command *cmd,
226 struct GNUNET_TESTBED_Controller **
227 controller);
228
229struct GNUNET_TESTING_Command
230GNUNET_TESTBED_cmd_controller (const char *label,
231 const char *trusted_ip,
232 const char *hostname,
233 const char *username,
234 uint16_t port,
235 struct GNUNET_CONFIGURATION_Handle *cfg,
236 uint64_t event_mask);
237
238void
239GNUNET_TESTBED_shutdown_controller (struct ControllerState *cs);
240
241void
242GNUNET_TESTBED_shutdown_peer (struct PeerCmdState *ps);
243
244void
245GNUNET_TESTBED_shutdown_service (struct ServiceState *ss);
246
247#endif
diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h
index 70cbfa90d..acdfb2034 100644
--- a/src/include/gnunet_testbed_service.h
+++ b/src/include/gnunet_testbed_service.h
@@ -27,7 +27,7 @@
27 * @defgroup testbed Testbed service 27 * @defgroup testbed Testbed service
28 * Writing tests and creating large-scale emulation testbeds for GNUnet. 28 * Writing tests and creating large-scale emulation testbeds for GNUnet.
29 * 29 *
30 * @see [Documentation](https://gnunet.org/gnunet-testbed-subsystem) 30 * @see [Documentation](https://docs.gnunet.org/handbook/gnunet.html#TESTBED-Subsystem)
31 * 31 *
32 * @{ 32 * @{
33 */ 33 */
diff --git a/src/testbed/Makefile.am b/src/testbed/Makefile.am
index 7c1e217bb..7a59670cb 100644
--- a/src/testbed/Makefile.am
+++ b/src/testbed/Makefile.am
@@ -94,6 +94,9 @@ lib_LTLIBRARIES = \
94libgnunettestbed_la_SOURCES = \ 94libgnunettestbed_la_SOURCES = \
95 testbed_api.c testbed_api.h testbed.h \ 95 testbed_api.c testbed_api.h testbed.h \
96 testbed_api_hosts.c testbed_api_hosts.h testbed_helper.h \ 96 testbed_api_hosts.c testbed_api_hosts.h testbed_helper.h \
97 testbed_api_cmd_controller.c \
98 testbed_api_cmd_peer.c \
99 testbed_api_cmd_service.c \
97 testbed_api_operations.c testbed_api_operations.h \ 100 testbed_api_operations.c testbed_api_operations.h \
98 testbed_api_peers.c testbed_api_peers.h \ 101 testbed_api_peers.c testbed_api_peers.h \
99 testbed_api_services.c \ 102 testbed_api_services.c \
diff --git a/src/testbed/testbed_api_cmd_controller.c b/src/testbed/testbed_api_cmd_controller.c
new file mode 100644
index 000000000..d65f41760
--- /dev/null
+++ b/src/testbed/testbed_api_cmd_controller.c
@@ -0,0 +1,294 @@
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 testbed/testbed_api_cmd_controller.c
23 * @brief Command to create a controller.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_testing_ng_lib.h"
29#include "gnunet-service-testbed.h"
30#include "testbed_api_hosts.h"
31#include "gnunet_testbed_ng_service.h"
32
33
34/**
35 * Generic logging shortcut
36 */
37#define LOG(kind, ...) \
38 GNUNET_log (kind, __VA_ARGS__)
39
40
41/**
42 * abort task to run on test timed out
43 *
44 * @param cls NULL
45 * @param tc the task context
46 */
47static void
48do_abort (void *cls)
49{
50 struct ControllerState *cs = cls;
51
52 if (GNUNET_NO == cs->host_ready)
53 {
54 LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n");
55 cs->abort_task = NULL;
56 GNUNET_TESTBED_shutdown_controller (cs);
57 }
58}
59
60
61/**
62*
63*
64* @param cls closure
65* @param cmd current CMD being cleaned up.
66*/
67static void
68controller_cleanup (void *cls,
69 const struct GNUNET_TESTING_Command *cmd)
70{
71 (void) cls;
72}
73
74
75/**
76 * Signature of the event handler function called by the
77 * respective event controller.
78 *
79 * @param cls closure
80 * @param event information about the event
81 */
82static void
83controller_cb (void *cls,
84 const struct GNUNET_TESTBED_EventInformation *event)
85{
86 struct ControllerState *cs = cls;
87
88 if (NULL != event->details.operation_finished.emsg)
89 {
90 LOG (GNUNET_ERROR_TYPE_ERROR, "There was an operation error: %s\n",
91 event->details.operation_finished.emsg);
92 GNUNET_TESTBED_shutdown_controller (cs);
93 }
94 else if (NULL == event->details.operation_finished.generic)
95 {
96 GNUNET_TESTBED_operation_done (event->op);
97 }
98}
99
100
101/**
102 * Callback which will be called to after a host registration succeeded or failed
103 *
104 * @param cls the host which has been registered
105 * @param emsg the error message; NULL if host registration is successful
106 */
107static void
108registration_comp (void *cls,
109 const char *emsg)
110{
111 struct ControllerState *cs = cls;
112
113 if (NULL != emsg)
114 {
115 LOG (GNUNET_ERROR_TYPE_ERROR,
116 "There was an error during host registration: %s\n",
117 emsg);
118 GNUNET_TESTBED_shutdown_controller (cs);
119 }
120 else
121 {
122 cs->reg_handle = NULL;
123 cs->host_ready = GNUNET_YES;
124 GNUNET_TESTING_interpreter_next (cs->is);
125 }
126}
127
128
129/**
130 * Callback to signal successfull startup of the controller process
131 *
132 * @param cls the closure from GNUNET_TESTBED_controller_start()
133 * @param cfg the configuration with which the controller has been started;
134 * NULL if status is not #GNUNET_OK
135 * @param status #GNUNET_OK if the startup is successfull; #GNUNET_SYSERR if not,
136 * GNUNET_TESTBED_controller_stop() shouldn't be called in this case
137 */
138static void
139controller_status_cb (void *cls,
140 const struct GNUNET_CONFIGURATION_Handle *cfg_,
141 int status)
142{
143 struct ControllerState *cs = cls;
144
145 if (GNUNET_OK != status)
146 {
147 cs->cp = NULL;
148 return;
149 }
150
151 cs->controller =
152 GNUNET_TESTBED_controller_connect (cs->host, cs->event_mask, &controller_cb,
153 cs);
154 cs->reg_handle =
155 GNUNET_TESTBED_register_host (cs->controller, cs->host, &registration_comp,
156 cs);
157}
158
159
160static void
161controller_run (void *cls,
162 const struct GNUNET_TESTING_Command *cmd,
163 struct GNUNET_TESTING_Interpreter *is)
164{
165 struct ControllerState *cs = cls;
166
167 cs->is = is;
168 cs->host = GNUNET_TESTBED_host_create (cs->hostname, cs->username, cs->cfg,
169 cs->port);
170 cs->cp = GNUNET_TESTBED_controller_start (cs->trusted_ip,
171 cs->host,
172 &controller_status_cb,
173 cs);
174 cs->abort_task =
175 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
176 (GNUNET_TIME_UNIT_MINUTES, 5),
177 &do_abort,
178 cs);
179}
180
181/**
182*
183*
184* @param cls closure.
185* @param[out] ret result
186* @param trait name of the trait.
187* @param index index number of the object to offer.
188* @return #GNUNET_OK on success.
189*/
190static int
191controller_traits (void *cls,
192 const void **ret,
193 const char *trait,
194 unsigned int index)
195{
196 (void) cls;
197
198 struct ControllerState *cs = cls;
199
200
201 struct GNUNET_TESTING_Trait traits[] = {
202 {
203 .index = 0,
204 .trait_name = "controller",
205 .ptr = (const void *) cs->controller,
206 },
207 GNUNET_TESTING_trait_end ()
208 };
209
210 return GNUNET_TESTING_get_trait (traits,
211 ret,
212 trait,
213 index);
214 return GNUNET_OK;
215}
216
217
218/**
219 * Offer data from trait
220 *
221 * @param cmd command to extract the controller from.
222 * @param pt pointer to controller.
223 * @return #GNUNET_OK on success.
224 */
225int
226GNUNET_TESTBED_get_trait_controller (const struct GNUNET_TESTING_Command *cmd,
227 struct GNUNET_TESTBED_Controller **
228 controller)
229{
230 return cmd->traits (cmd->cls,
231 (const void **) controller,
232 "controller",
233 (unsigned int) 0);
234}
235
236
237/**
238 * Shutdown nicely
239 *
240 * @param cs controller state.
241 */
242void
243GNUNET_TESTBED_shutdown_controller (struct ControllerState *cs)
244{
245 LOG (GNUNET_ERROR_TYPE_DEBUG,
246 "Shutting down...\n");
247
248 cs->controller_going_down = GNUNET_YES;
249
250 if (NULL != cs->abort_task)
251 GNUNET_SCHEDULER_cancel (cs->abort_task);
252 if (NULL != cs->reg_handle)
253 GNUNET_TESTBED_cancel_registration (cs->reg_handle);
254 if (NULL != cs->controller)
255 GNUNET_TESTBED_controller_disconnect (cs->controller);
256 if (NULL != cs->cfg)
257 GNUNET_CONFIGURATION_destroy (cs->cfg);
258 if (NULL != cs->cp)
259 GNUNET_TESTBED_controller_stop (cs->cp);
260 if (NULL != cs->host)
261 GNUNET_TESTBED_host_destroy (cs->host);
262}
263
264
265
266struct GNUNET_TESTING_Command
267GNUNET_TESTBED_cmd_controller (const char *label,
268 const char *trusted_ip,
269 const char *hostname,
270 const char *username,
271 uint16_t port,
272 struct GNUNET_CONFIGURATION_Handle *cfg,
273 uint64_t event_mask)
274{
275 struct ControllerState *cs;
276
277 cs = GNUNET_new (struct ControllerState);
278 cs->event_mask = event_mask;
279 cs->trusted_ip = trusted_ip;
280 cs->hostname = hostname;
281 cs->username = username;
282 cs->port = port;
283 cs->cfg = cfg;
284
285 struct GNUNET_TESTING_Command cmd = {
286 .cls = cs,
287 .label = label,
288 .run = &controller_run,
289 .cleanup = &controller_cleanup,
290 .traits = &controller_traits
291 };
292
293 return cmd;
294}
diff --git a/src/testbed/testbed_api_cmd_peer.c b/src/testbed/testbed_api_cmd_peer.c
new file mode 100644
index 000000000..4a727bc94
--- /dev/null
+++ b/src/testbed/testbed_api_cmd_peer.c
@@ -0,0 +1,249 @@
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/**
23 * @file testbed/testbed_api_cmd_controller.c
24 * @brief Command to create a controller.
25 * @author t3sserakt
26 */
27#include "platform.h"
28#include "gnunet_util_lib.h"
29#include "gnunet_testing_ng_lib.h"
30#include "gnunet_testbed_ng_service.h"
31#include "gnunet-service-testbed.h"
32#include "testbed_api_peers.h"
33
34
35/**
36 * Generic logging shortcut
37 */
38#define LOG(kind, ...) \
39 GNUNET_log (kind, __VA_ARGS__)
40
41
42/**
43*
44*
45* @param cls closure.
46* @param[out] ret result
47* @param trait name of the trait.
48* @param index index number of the object to offer.
49* @return #GNUNET_OK on success.
50*/
51static int
52peer_traits (void *cls,
53 const void **ret,
54 const char *trait,
55 unsigned int index)
56{
57 (void) cls;
58 return GNUNET_OK;
59}
60
61
62/**
63*
64*
65* @param cls closure
66* @param cmd current CMD being cleaned up.
67*/
68static void
69peer_cleanup (void *cls,
70 const struct GNUNET_TESTING_Command *cmd)
71{
72 (void) cls;
73}
74
75
76/**
77 * abort task to run on test timed out
78 *
79 * @param cls NULL
80 * @param tc the task context
81 */
82static void
83do_abort (void *cls)
84{
85 struct PeerCmdState *ps = cls;
86
87 if (GNUNET_NO == ps->peer_ready)
88 {
89 LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n");
90 ps->abort_task = NULL;
91 GNUNET_TESTBED_shutdown_peer (ps);
92 }
93}
94
95
96/**
97 * Functions of this signature are called when a peer has been successfully
98 * created
99 *
100 * @param cls the closure from GNUNET_TESTBED_peer_create()
101 * @param emsg MAY contain an error description, if starting peer failed.
102 */
103static void
104peer_started_cb (void *cls,
105 const char *emsg)
106{
107 struct PeerCmdState *ps = cls;
108
109 GNUNET_TESTBED_operation_done (ps->operation);
110 if (NULL == emsg)
111 {
112 ps->peer_ready = GNUNET_YES;
113 GNUNET_TESTING_interpreter_next (ps->is);
114 }
115 else
116 {
117 LOG (GNUNET_ERROR_TYPE_ERROR, "There was an error starting a peer: %s\n",
118 emsg);
119 }
120
121}
122
123
124/**
125 * Functions of this signature are called when a peer has been successfully
126 * created
127 *
128 * @param cls the closure from GNUNET_TESTBED_peer_create()
129 * @param peer the handle for the created peer; NULL on any error during
130 * creation
131 * @param emsg NULL if peer is not NULL; else MAY contain the error description
132 */
133static void
134peer_create_cb (void *cls,
135 struct GNUNET_TESTBED_Peer *peer,
136 const char *emsg)
137{
138 struct PeerCmdState *ps = cls;
139
140 ps->peer = peer;
141 GNUNET_TESTBED_operation_done (ps->operation);
142 ps->operation = GNUNET_TESTBED_peer_start (NULL,
143 peer,
144 &peer_started_cb,
145 ps);
146}
147
148
149static void
150peer_run (void *cls,
151 const struct GNUNET_TESTING_Command *cmd,
152 struct GNUNET_TESTING_Interpreter *is)
153{
154 struct PeerCmdState *ps = cls;
155 const struct GNUNET_TESTING_Command *controller_cmd;
156 struct GNUNET_TESTBED_Controller *controller;
157
158 ps->is = is;
159 controller_cmd = GNUNET_TESTING_interpreter_lookup_command (
160 ps->controller_label);
161 GNUNET_TESTBED_get_trait_controller (controller_cmd,
162 &controller);
163 ps->host = GNUNET_TESTBED_host_create (ps->hostname, ps->username, ps->cfg,
164 ps->port);
165 ps->operation =
166 GNUNET_TESTBED_peer_create (controller,
167 ps->host,
168 ps->cfg,
169 &peer_create_cb,
170 ps);
171
172 ps->abort_task =
173 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
174 (GNUNET_TIME_UNIT_MINUTES, 5),
175 &do_abort,
176 ps);
177}
178
179
180void
181peer_stopped_cb (void *cls,
182 const char *emsg)
183{
184 struct PeerCmdState *ps = cls;
185
186 if (NULL != emsg)
187 {
188 LOG (GNUNET_ERROR_TYPE_ERROR, "There was an error stopping a peer: %s\n",
189 emsg);
190 }
191 GNUNET_TESTBED_operation_done (ps->operation);
192 GNUNET_TESTBED_peer_destroy (ps->peer);
193}
194
195
196/**
197 * Shutdown nicely
198 *
199 * @param cs controller state.
200 */
201void
202GNUNET_TESTBED_shutdown_peer (struct PeerCmdState *ps)
203{
204 LOG (GNUNET_ERROR_TYPE_DEBUG,
205 "Shutting down...\n");
206
207 ps->peer_going_down = GNUNET_YES;
208
209 if (NULL != ps->abort_task)
210 GNUNET_SCHEDULER_cancel (ps->abort_task);
211 if (NULL != ps->cfg)
212 GNUNET_CONFIGURATION_destroy (ps->cfg);
213 if (NULL != ps->host)
214 GNUNET_TESTBED_host_destroy (ps->host);
215
216 GNUNET_TESTBED_operation_done (ps->operation);
217 ps->operation = GNUNET_TESTBED_peer_stop (NULL, ps->peer, peer_stopped_cb,
218 ps);
219
220}
221
222
223struct GNUNET_TESTING_Command
224GNUNET_TESTBED_cmd_peer (const char *label,
225 const char *controller_label,
226 const char *hostname,
227 const char *username,
228 uint16_t port,
229 struct GNUNET_CONFIGURATION_Handle *cfg)
230{
231 struct PeerCmdState *ps;
232
233 ps = GNUNET_new (struct PeerCmdState);
234 ps->hostname = hostname;
235 ps->username = username;
236 ps->port = port;
237 ps->cfg = cfg;
238 ps->controller_label = controller_label;
239
240 struct GNUNET_TESTING_Command cmd = {
241 .cls = ps,
242 .label = label,
243 .run = &peer_run,
244 .cleanup = &peer_cleanup,
245 .traits = &peer_traits
246 };
247
248 return cmd;
249}
diff --git a/src/testing/testing_api_cmd_hello_world_birth.c b/src/testing/testing_api_cmd_hello_world_birth.c
index 546b30212..0faf93cd8 100644
--- a/src/testing/testing_api_cmd_hello_world_birth.c
+++ b/src/testing/testing_api_cmd_hello_world_birth.c
@@ -118,10 +118,8 @@ hello_world_birth_run (void *cls,
118/** 118/**
119 * Offer data from trait 119 * Offer data from trait
120 * 120 *
121 * @param cmd command to extract the url from. 121 * @param cmd command to extract the message from.
122 * @param pt which url is to be picked, in case 122 * @param pt pointer to message.
123 * multiple are offered.
124 * @param[out] url where to write the url.
125 * @return #GNUNET_OK on success. 123 * @return #GNUNET_OK on success.
126 */ 124 */
127int 125int