aboutsummaryrefslogtreecommitdiff
path: root/src/testing/gnunet-cmds-helper.c
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2023-01-06 21:02:55 +0100
committert3sserakt <t3ss@posteo.de>2023-01-06 21:02:55 +0100
commit2c2b2911e1585dc378dbb88d4dd6aaec37b00316 (patch)
tree701cd3a2304a7e1fb74553c78d8a3d2a1cbcc6c2 /src/testing/gnunet-cmds-helper.c
parentd9f74f1751f0c4e08ddb2ce5f81a8cf8e4dcf1a2 (diff)
downloadgnunet-2c2b2911e1585dc378dbb88d4dd6aaec37b00316.tar.gz
gnunet-2c2b2911e1585dc378dbb88d4dd6aaec37b00316.zip
- relsoved an coverity issue, worked on fixmes, code documentation and cleaned up up the barrier API
Diffstat (limited to 'src/testing/gnunet-cmds-helper.c')
-rw-r--r--src/testing/gnunet-cmds-helper.c47
1 files changed, 37 insertions, 10 deletions
diff --git a/src/testing/gnunet-cmds-helper.c b/src/testing/gnunet-cmds-helper.c
index 4d3da6260..90b686891 100644
--- a/src/testing/gnunet-cmds-helper.c
+++ b/src/testing/gnunet-cmds-helper.c
@@ -61,7 +61,7 @@
61 61
62#define NODE_BASE_IP "192.168.15." 62#define NODE_BASE_IP "192.168.15."
63 63
64#define KNOWN_BASE_IP "172.168.151." 64#define KNOWN_BASE_IP "172.16.151."
65 65
66#define ROUTER_BASE_IP "172.16.150." 66#define ROUTER_BASE_IP "172.16.150."
67 67
@@ -213,6 +213,9 @@ do_shutdown (void *cls)
213 (void) GNUNET_DISK_file_close (stdout_fd); 213 (void) GNUNET_DISK_file_close (stdout_fd);
214 GNUNET_MST_destroy (tokenizer); 214 GNUNET_MST_destroy (tokenizer);
215 tokenizer = NULL; 215 tokenizer = NULL;
216 GNUNET_PLUGIN_unload (plugin->library_name,
217 NULL);
218 GNUNET_free (plugin);
216} 219}
217 220
218 221
@@ -286,16 +289,36 @@ delay_shutdown_cb ()
286} 289}
287 290
288 291
292struct GNUNET_MessageHeader *
293GNUNET_TESTING_send_local_test_finished_msg ()
294{
295 struct GNUNET_TESTING_CommandLocalFinished *reply;
296 size_t msg_length;
297
298 msg_length = sizeof(struct GNUNET_TESTING_CommandLocalFinished);
299 reply = GNUNET_new (struct GNUNET_TESTING_CommandLocalFinished);
300 reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED);
301 reply->header.size = htons ((uint16_t) msg_length);
302
303 return (struct GNUNET_MessageHeader *) reply;
304}
305
306
289static void 307static void
290finished_cb () 308finished_cb (enum GNUNET_GenericReturnValue rv)
291{ 309{
292 struct GNUNET_MessageHeader *reply; 310 struct GNUNET_TESTING_CommandLocalFinished *reply;
311 size_t msg_length;
293 312
294 reply = GNUNET_TESTING_send_local_test_finished_msg (); 313 msg_length = sizeof(struct GNUNET_TESTING_CommandLocalFinished);
314 reply = GNUNET_new (struct GNUNET_TESTING_CommandLocalFinished);
315 reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED);
316 reply->header.size = htons ((uint16_t) msg_length);
317 reply->rv = rv;
295 318
296 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 319 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
297 "message prepared\n"); 320 "message prepared\n");
298 write_message (reply, ntohs (reply->size)); 321 write_message ((struct GNUNET_MessageHeader *) reply, msg_length);
299 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 322 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
300 "message send\n"); 323 "message send\n");
301 324
@@ -337,10 +360,11 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message)
337 unsigned int namespace_n; 360 unsigned int namespace_n;
338 361
339 type = ntohs (message->type); 362 type = ntohs (message->type);
340 LOG (GNUNET_ERROR_TYPE_ERROR,
341 "Received message type %u\n",
342 type);
343 msize = ntohs (message->size); 363 msize = ntohs (message->size);
364 LOG (GNUNET_ERROR_TYPE_ERROR,
365 "Received message type %u and size %u\n",
366 type,
367 msize);
344 if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT == ntohs (message->type)) 368 if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT == ntohs (message->type))
345 { 369 {
346 msg = (const struct GNUNET_TESTING_CommandHelperInit *) message; 370 msg = (const struct GNUNET_TESTING_CommandHelperInit *) message;
@@ -412,13 +436,16 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message)
412 436
413 return GNUNET_OK; 437 return GNUNET_OK;
414 } 438 }
415 else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ADVANCED == ntohs ( 439 else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_CROSSABLE == ntohs (
416 message->type)) 440 message->type))
417 { 441 {
418 const char *barrier_name; 442 const char *barrier_name;
419 struct CommandBarrierAdvanced *adm = (struct CommandBarrierAdvanced *) message; 443 struct CommandBarrierCrossable *adm = (struct CommandBarrierCrossable *) message;
420 444
421 barrier_name = (const char *) &adm[1]; 445 barrier_name = (const char *) &adm[1];
446 LOG (GNUNET_ERROR_TYPE_DEBUG,
447 "cross barrier %s\n",
448 barrier_name);
422 TST_interpreter_finish_attached_cmds (is, barrier_name); 449 TST_interpreter_finish_attached_cmds (is, barrier_name);
423 return GNUNET_OK; 450 return GNUNET_OK;
424 } 451 }