aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2021-08-17 14:21:53 +0200
committert3sserakt <t3ss@posteo.de>2021-08-17 14:21:53 +0200
commit1e063cd73452396778cf00127346b9b08a922317 (patch)
treedc0c119ecf8511c5c56a469e580fee09800fc45a
parent0f00c002810907f4edf740203bdf24d81124fd32 (diff)
downloadgnunet-1e063cd73452396778cf00127346b9b08a922317.tar.gz
gnunet-1e063cd73452396778cf00127346b9b08a922317.zip
- renamed methods and variables to prepare moving files from testbed to testing, to fix circular dependency problem
-rw-r--r--po/POTFILES.in124
-rw-r--r--src/include/gnunet_testbed_ng_service.h203
-rw-r--r--src/include/gnunet_testing_plugin.h4
-rw-r--r--src/testbed/Makefile.am11
-rw-r--r--src/testbed/gnunet-cmd.c123
-rw-r--r--src/testbed/plugin_testcmd.c2
-rw-r--r--src/testbed/test_testbed_api_cmd_netjail.c20
-rw-r--r--src/testbed/testbed_api_cmd_controller.c203
-rw-r--r--src/testbed/testbed_api_cmd_local_test_finished.c4
-rw-r--r--src/testbed/testbed_api_cmd_netjail_start.c11
-rw-r--r--src/testbed/testbed_api_cmd_netjail_start_testbed.c99
-rw-r--r--src/testbed/testbed_api_cmd_netjail_stop.c11
-rw-r--r--src/testbed/testbed_api_cmd_netjail_stop_testbed.c36
-rw-r--r--src/testbed/testbed_api_cmd_peer.c281
-rw-r--r--src/testbed/testbed_api_cmd_peer_store.c60
-rw-r--r--src/testbed/testbed_api_cmd_send_peer_ready.c4
-rw-r--r--src/testbed/testbed_api_cmd_tng_connect.c55
-rw-r--r--src/testbed/testbed_api_cmd_tng_service.c276
-rwxr-xr-xsrc/testing/netjail_exec.sh16
-rwxr-xr-xsrc/testing/netjail_start.sh52
-rwxr-xr-xsrc/testing/netjail_stop.sh26
-rw-r--r--src/testing/testing_api_cmd_send_peer_ready.c4
-rw-r--r--src/transport/plugin_cmd_simple_send.c2
-rw-r--r--src/transport/test_transport_api_cmd_simple_send.c22
24 files changed, 264 insertions, 1385 deletions
diff --git a/po/POTFILES.in b/po/POTFILES.in
index edd56bf95..8ed952089 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -10,13 +10,21 @@ src/arm/arm_monitor_api.c
10src/arm/gnunet-arm.c 10src/arm/gnunet-arm.c
11src/arm/gnunet-service-arm.c 11src/arm/gnunet-service-arm.c
12src/arm/mockup-service.c 12src/arm/mockup-service.c
13src/ats-tests/ats-testing-experiment.c
14src/ats-tests/ats-testing-log.c
15src/ats-tests/ats-testing-preferences.c
16src/ats-tests/ats-testing-traffic.c
17src/ats-tests/ats-testing.c
18src/ats-tests/gnunet-ats-sim.c
19src/ats-tests/gnunet-solver-eval.c
20src/ats-tool/gnunet-ats.c
13src/ats/ats_api_connectivity.c 21src/ats/ats_api_connectivity.c
14src/ats/ats_api_performance.c 22src/ats/ats_api_performance.c
15src/ats/ats_api_scanner.c 23src/ats/ats_api_scanner.c
16src/ats/ats_api_scheduling.c 24src/ats/ats_api_scheduling.c
17src/ats/gnunet-ats-solver-eval.c 25src/ats/gnunet-ats-solver-eval.c
18src/ats/gnunet-service-ats_addresses.c
19src/ats/gnunet-service-ats.c 26src/ats/gnunet-service-ats.c
27src/ats/gnunet-service-ats_addresses.c
20src/ats/gnunet-service-ats_connectivity.c 28src/ats/gnunet-service-ats_connectivity.c
21src/ats/gnunet-service-ats_normalization.c 29src/ats/gnunet-service-ats_normalization.c
22src/ats/gnunet-service-ats_performance.c 30src/ats/gnunet-service-ats_performance.c
@@ -25,14 +33,6 @@ src/ats/gnunet-service-ats_preferences.c
25src/ats/gnunet-service-ats_reservations.c 33src/ats/gnunet-service-ats_reservations.c
26src/ats/gnunet-service-ats_scheduling.c 34src/ats/gnunet-service-ats_scheduling.c
27src/ats/plugin_ats_proportional.c 35src/ats/plugin_ats_proportional.c
28src/ats-tests/ats-testing.c
29src/ats-tests/ats-testing-experiment.c
30src/ats-tests/ats-testing-log.c
31src/ats-tests/ats-testing-preferences.c
32src/ats-tests/ats-testing-traffic.c
33src/ats-tests/gnunet-ats-sim.c
34src/ats-tests/gnunet-solver-eval.c
35src/ats-tool/gnunet-ats.c
36src/auction/gnunet-auction-create.c 36src/auction/gnunet-auction-create.c
37src/auction/gnunet-auction-info.c 37src/auction/gnunet-auction-info.c
38src/auction/gnunet-auction-join.c 38src/auction/gnunet-auction-join.c
@@ -50,8 +50,8 @@ src/cadet/cadet_api_list_peers.c
50src/cadet/cadet_api_list_tunnels.c 50src/cadet/cadet_api_list_tunnels.c
51src/cadet/cadet_test_lib.c 51src/cadet/cadet_test_lib.c
52src/cadet/desirability_table.c 52src/cadet/desirability_table.c
53src/cadet/gnunet-cadet.c
54src/cadet/gnunet-cadet-profiler.c 53src/cadet/gnunet-cadet-profiler.c
54src/cadet/gnunet-cadet.c
55src/cadet/gnunet-service-cadet.c 55src/cadet/gnunet-service-cadet.c
56src/cadet/gnunet-service-cadet_channel.c 56src/cadet/gnunet-service-cadet_channel.c
57src/cadet/gnunet-service-cadet_connection.c 57src/cadet/gnunet-service-cadet_connection.c
@@ -67,15 +67,15 @@ src/consensus/gnunet-service-consensus.c
67src/consensus/plugin_block_consensus.c 67src/consensus/plugin_block_consensus.c
68src/conversation/conversation_api.c 68src/conversation/conversation_api.c
69src/conversation/conversation_api_call.c 69src/conversation/conversation_api_call.c
70src/conversation/gnunet-conversation.c
71src/conversation/gnunet-conversation-test.c 70src/conversation/gnunet-conversation-test.c
72src/conversation/gnunet_gst.c 71src/conversation/gnunet-conversation.c
73src/conversation/gnunet_gst_test.c
74src/conversation/gnunet-helper-audio-playback.c
75src/conversation/gnunet-helper-audio-playback-gst.c 72src/conversation/gnunet-helper-audio-playback-gst.c
76src/conversation/gnunet-helper-audio-record.c 73src/conversation/gnunet-helper-audio-playback.c
77src/conversation/gnunet-helper-audio-record-gst.c 74src/conversation/gnunet-helper-audio-record-gst.c
75src/conversation/gnunet-helper-audio-record.c
78src/conversation/gnunet-service-conversation.c 76src/conversation/gnunet-service-conversation.c
77src/conversation/gnunet_gst.c
78src/conversation/gnunet_gst_test.c
79src/conversation/microphone.c 79src/conversation/microphone.c
80src/conversation/plugin_gnsrecord_conversation.c 80src/conversation/plugin_gnsrecord_conversation.c
81src/conversation/speaker.c 81src/conversation/speaker.c
@@ -105,7 +105,6 @@ src/dht/dht_api.c
105src/dht/dht_test_lib.c 105src/dht/dht_test_lib.c
106src/dht/gnunet-dht-get.c 106src/dht/gnunet-dht-get.c
107src/dht/gnunet-dht-monitor.c 107src/dht/gnunet-dht-monitor.c
108src/dht/gnunet_dht_profiler.c
109src/dht/gnunet-dht-put.c 108src/dht/gnunet-dht-put.c
110src/dht/gnunet-service-dht.c 109src/dht/gnunet-service-dht.c
111src/dht/gnunet-service-dht_clients.c 110src/dht/gnunet-service-dht_clients.c
@@ -114,6 +113,7 @@ src/dht/gnunet-service-dht_hello.c
114src/dht/gnunet-service-dht_neighbours.c 113src/dht/gnunet-service-dht_neighbours.c
115src/dht/gnunet-service-dht_nse.c 114src/dht/gnunet-service-dht_nse.c
116src/dht/gnunet-service-dht_routing.c 115src/dht/gnunet-service-dht_routing.c
116src/dht/gnunet_dht_profiler.c
117src/dht/plugin_block_dht.c 117src/dht/plugin_block_dht.c
118src/dhtu/plugin_dhtu_gnunet.c 118src/dhtu/plugin_dhtu_gnunet.c
119src/dhtu/plugin_dhtu_ip.c 119src/dhtu/plugin_dhtu_ip.c
@@ -150,8 +150,8 @@ src/fs/gnunet-auto-share.c
150src/fs/gnunet-daemon-fsprofiler.c 150src/fs/gnunet-daemon-fsprofiler.c
151src/fs/gnunet-directory.c 151src/fs/gnunet-directory.c
152src/fs/gnunet-download.c 152src/fs/gnunet-download.c
153src/fs/gnunet-fs.c
154src/fs/gnunet-fs-profiler.c 153src/fs/gnunet-fs-profiler.c
154src/fs/gnunet-fs.c
155src/fs/gnunet-helper-fs-publish.c 155src/fs/gnunet-helper-fs-publish.c
156src/fs/gnunet-publish.c 156src/fs/gnunet-publish.c
157src/fs/gnunet-search.c 157src/fs/gnunet-search.c
@@ -171,9 +171,9 @@ src/gns/gns_tld_api.c
171src/gns/gnunet-bcd.c 171src/gns/gnunet-bcd.c
172src/gns/gnunet-dns2gns.c 172src/gns/gnunet-dns2gns.c
173src/gns/gnunet-gns-benchmark.c 173src/gns/gnunet-gns-benchmark.c
174src/gns/gnunet-gns.c
175src/gns/gnunet-gns-import.c 174src/gns/gnunet-gns-import.c
176src/gns/gnunet-gns-proxy.c 175src/gns/gnunet-gns-proxy.c
176src/gns/gnunet-gns.c
177src/gns/gnunet-service-gns.c 177src/gns/gnunet-service-gns.c
178src/gns/gnunet-service-gns_interceptor.c 178src/gns/gnunet-service-gns_interceptor.c
179src/gns/gnunet-service-gns_resolver.c 179src/gns/gnunet-service-gns_resolver.c
@@ -191,8 +191,8 @@ src/gnsrecord/json_gnsrecord.c
191src/gnsrecord/plugin_gnsrecord_dns.c 191src/gnsrecord/plugin_gnsrecord_dns.c
192src/hello/address.c 192src/hello/address.c
193src/hello/gnunet-hello.c 193src/hello/gnunet-hello.c
194src/hello/hello.c
195src/hello/hello-ng.c 194src/hello/hello-ng.c
195src/hello/hello.c
196src/hostlist/gnunet-daemon-hostlist.c 196src/hostlist/gnunet-daemon-hostlist.c
197src/hostlist/gnunet-daemon-hostlist_client.c 197src/hostlist/gnunet-daemon-hostlist_client.c
198src/hostlist/gnunet-daemon-hostlist_server.c 198src/hostlist/gnunet-daemon-hostlist_server.c
@@ -208,8 +208,8 @@ src/json/json_helper.c
208src/json/json_mhd.c 208src/json/json_mhd.c
209src/json/json_pack.c 209src/json/json_pack.c
210src/messenger/gnunet-messenger.c 210src/messenger/gnunet-messenger.c
211src/messenger/gnunet-service-messenger_basement.c
212src/messenger/gnunet-service-messenger.c 211src/messenger/gnunet-service-messenger.c
212src/messenger/gnunet-service-messenger_basement.c
213src/messenger/gnunet-service-messenger_ego_store.c 213src/messenger/gnunet-service-messenger_ego_store.c
214src/messenger/gnunet-service-messenger_handle.c 214src/messenger/gnunet-service-messenger_handle.c
215src/messenger/gnunet-service-messenger_list_handles.c 215src/messenger/gnunet-service-messenger_list_handles.c
@@ -248,8 +248,8 @@ src/namecache/namecache_api.c
248src/namecache/plugin_namecache_flat.c 248src/namecache/plugin_namecache_flat.c
249src/namecache/plugin_namecache_postgres.c 249src/namecache/plugin_namecache_postgres.c
250src/namecache/plugin_namecache_sqlite.c 250src/namecache/plugin_namecache_sqlite.c
251src/namestore/gnunet-namestore.c
252src/namestore/gnunet-namestore-fcfsd.c 251src/namestore/gnunet-namestore-fcfsd.c
252src/namestore/gnunet-namestore.c
253src/namestore/gnunet-service-namestore.c 253src/namestore/gnunet-service-namestore.c
254src/namestore/gnunet-zoneimport.c 254src/namestore/gnunet-zoneimport.c
255src/namestore/namestore_api.c 255src/namestore/namestore_api.c
@@ -275,17 +275,17 @@ src/nat/gnunet-service-nat_mini.c
275src/nat/gnunet-service-nat_stun.c 275src/nat/gnunet-service-nat_stun.c
276src/nat/nat_api.c 276src/nat/nat_api.c
277src/nat/nat_api_stun.c 277src/nat/nat_api_stun.c
278src/nse/gnunet-nse.c
279src/nse/gnunet-nse-profiler.c 278src/nse/gnunet-nse-profiler.c
279src/nse/gnunet-nse.c
280src/nse/gnunet-service-nse.c 280src/nse/gnunet-service-nse.c
281src/nse/nse_api.c 281src/nse/nse_api.c
282src/nt/nt.c 282src/nt/nt.c
283src/peerinfo/gnunet-service-peerinfo.c
284src/peerinfo/peerinfo_api.c
285src/peerinfo/peerinfo_api_notify.c
286src/peerinfo-tool/gnunet-peerinfo.c 283src/peerinfo-tool/gnunet-peerinfo.c
287src/peerinfo-tool/gnunet-peerinfo_plugins.c 284src/peerinfo-tool/gnunet-peerinfo_plugins.c
288src/peerinfo-tool/plugin_rest_peerinfo.c 285src/peerinfo-tool/plugin_rest_peerinfo.c
286src/peerinfo/gnunet-service-peerinfo.c
287src/peerinfo/peerinfo_api.c
288src/peerinfo/peerinfo_api_notify.c
289src/peerstore/gnunet-peerstore.c 289src/peerstore/gnunet-peerstore.c
290src/peerstore/gnunet-service-peerstore.c 290src/peerstore/gnunet-service-peerstore.c
291src/peerstore/peerstore_api.c 291src/peerstore/peerstore_api.c
@@ -335,27 +335,27 @@ src/rest/gnunet-rest-server.c
335src/rest/plugin_rest_config.c 335src/rest/plugin_rest_config.c
336src/rest/plugin_rest_copying.c 336src/rest/plugin_rest_copying.c
337src/rest/rest.c 337src/rest/rest.c
338src/revocation/gnunet-revocation.c
339src/revocation/gnunet-revocation-tvg.c 338src/revocation/gnunet-revocation-tvg.c
339src/revocation/gnunet-revocation.c
340src/revocation/gnunet-service-revocation.c 340src/revocation/gnunet-service-revocation.c
341src/revocation/plugin_block_revocation.c 341src/revocation/plugin_block_revocation.c
342src/revocation/revocation_api.c 342src/revocation/revocation_api.c
343src/rps/gnunet-rps.c
344src/rps/gnunet-rps-profiler.c 343src/rps/gnunet-rps-profiler.c
344src/rps/gnunet-rps.c
345src/rps/gnunet-service-rps.c 345src/rps/gnunet-service-rps.c
346src/rps/gnunet-service-rps_custommap.c 346src/rps/gnunet-service-rps_custommap.c
347src/rps/gnunet-service-rps_sampler.c 347src/rps/gnunet-service-rps_sampler.c
348src/rps/gnunet-service-rps_sampler_elem.c 348src/rps/gnunet-service-rps_sampler_elem.c
349src/rps/gnunet-service-rps_view.c 349src/rps/gnunet-service-rps_view.c
350src/rps/rps_api.c
351src/rps/rps-sampler_client.c 350src/rps/rps-sampler_client.c
352src/rps/rps-sampler_common.c 351src/rps/rps-sampler_common.c
353src/rps/rps-test_util.c 352src/rps/rps-test_util.c
353src/rps/rps_api.c
354src/scalarproduct/gnunet-scalarproduct.c 354src/scalarproduct/gnunet-scalarproduct.c
355src/scalarproduct/gnunet-service-scalarproduct_alice.c
356src/scalarproduct/gnunet-service-scalarproduct_bob.c
357src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c 355src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
358src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c 356src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
357src/scalarproduct/gnunet-service-scalarproduct_alice.c
358src/scalarproduct/gnunet-service-scalarproduct_bob.c
359src/scalarproduct/scalarproduct_api.c 359src/scalarproduct/scalarproduct_api.c
360src/secretsharing/gnunet-secretsharing-profiler.c 360src/secretsharing/gnunet-secretsharing-profiler.c
361src/secretsharing/gnunet-service-secretsharing.c 361src/secretsharing/gnunet-service-secretsharing.c
@@ -369,12 +369,12 @@ src/set/gnunet-set-ibf-profiler.c
369src/set/gnunet-set-profiler.c 369src/set/gnunet-set-profiler.c
370src/set/ibf.c 370src/set/ibf.c
371src/set/ibf_sim.c 371src/set/ibf_sim.c
372src/set/plugin_block_set_test.c
373src/set/set_api.c
372src/seti/gnunet-service-seti.c 374src/seti/gnunet-service-seti.c
373src/seti/gnunet-seti-profiler.c 375src/seti/gnunet-seti-profiler.c
374src/seti/plugin_block_seti_test.c 376src/seti/plugin_block_seti_test.c
375src/seti/seti_api.c 377src/seti/seti_api.c
376src/set/plugin_block_set_test.c
377src/set/set_api.c
378src/setu/gnunet-service-setu.c 378src/setu/gnunet-service-setu.c
379src/setu/gnunet-service-setu_strata_estimator.c 379src/setu/gnunet-service-setu_strata_estimator.c
380src/setu/gnunet-setu-ibf-profiler.c 380src/setu/gnunet-setu-ibf-profiler.c
@@ -393,17 +393,17 @@ src/statistics/gnunet-statistics.c
393src/statistics/statistics_api.c 393src/statistics/statistics_api.c
394src/template/gnunet-service-template.c 394src/template/gnunet-service-template.c
395src/template/gnunet-template.c 395src/template/gnunet-template.c
396src/testbed-logger/gnunet-service-testbed-logger.c
397src/testbed-logger/testbed_logger_api.c
396src/testbed/generate-underlay-topology.c 398src/testbed/generate-underlay-topology.c
397src/testbed/gnunet-cmd.c
398src/testbed/gnunet-cmds-helper.c 399src/testbed/gnunet-cmds-helper.c
399src/testbed/gnunet-daemon-latency-logger.c 400src/testbed/gnunet-daemon-latency-logger.c
400src/testbed/gnunet-daemon-testbed-blacklist.c 401src/testbed/gnunet-daemon-testbed-blacklist.c
401src/testbed/gnunet-daemon-testbed-underlay.c 402src/testbed/gnunet-daemon-testbed-underlay.c
402src/testbed/gnunet-helper-testbed.c 403src/testbed/gnunet-helper-testbed.c
403src/testbed/gnunet_mpi_test.c
404src/testbed/gnunet-service-test-barriers.c 404src/testbed/gnunet-service-test-barriers.c
405src/testbed/gnunet-service-testbed_barriers.c
406src/testbed/gnunet-service-testbed.c 405src/testbed/gnunet-service-testbed.c
406src/testbed/gnunet-service-testbed_barriers.c
407src/testbed/gnunet-service-testbed_cache.c 407src/testbed/gnunet-service-testbed_cache.c
408src/testbed/gnunet-service-testbed_connectionpool.c 408src/testbed/gnunet-service-testbed_connectionpool.c
409src/testbed/gnunet-service-testbed_cpustatus.c 409src/testbed/gnunet-service-testbed_cpustatus.c
@@ -411,67 +411,61 @@ src/testbed/gnunet-service-testbed_links.c
411src/testbed/gnunet-service-testbed_meminfo.c 411src/testbed/gnunet-service-testbed_meminfo.c
412src/testbed/gnunet-service-testbed_oc.c 412src/testbed/gnunet-service-testbed_oc.c
413src/testbed/gnunet-service-testbed_peers.c 413src/testbed/gnunet-service-testbed_peers.c
414src/testbed/gnunet_testbed_mpi_spawn.c
415src/testbed/gnunet-testbed-profiler.c 414src/testbed/gnunet-testbed-profiler.c
416src/testbed-logger/gnunet-service-testbed-logger.c 415src/testbed/gnunet_mpi_test.c
417src/testbed-logger/testbed_logger_api.c 416src/testbed/gnunet_testbed_mpi_spawn.c
418src/testbed/plugin_testcmd.c 417src/testbed/plugin_testcmd.c
419src/testbed/testbed_api_barriers.c
420src/testbed/testbed_api.c 418src/testbed/testbed_api.c
419src/testbed/testbed_api_barriers.c
421src/testbed/testbed_api_cmd_block_until_all_peers_started.c 420src/testbed/testbed_api_cmd_block_until_all_peers_started.c
422src/testbed/testbed_api_cmd_controller.c
423src/testbed/testbed_api_cmd_local_test_finished.c 421src/testbed/testbed_api_cmd_local_test_finished.c
424src/testbed/testbed_api_cmd_netjail_start.c 422src/testbed/testbed_api_cmd_netjail_start.c
425src/testbed/testbed_api_cmd_netjail_start_testbed.c 423src/testbed/testbed_api_cmd_netjail_start_testbed.c
426src/testbed/testbed_api_cmd_netjail_stop.c 424src/testbed/testbed_api_cmd_netjail_stop.c
427src/testbed/testbed_api_cmd_netjail_stop_testbed.c 425src/testbed/testbed_api_cmd_netjail_stop_testbed.c
428src/testbed/testbed_api_cmd_peer.c
429src/testbed/testbed_api_cmd_peer_store.c
430src/testbed/testbed_api_cmd_send_peer_ready.c 426src/testbed/testbed_api_cmd_send_peer_ready.c
431src/testbed/testbed_api_cmd_tng_connect.c
432src/testbed/testbed_api_cmd_tng_service.c
433src/testbed/testbed_api_hosts.c 427src/testbed/testbed_api_hosts.c
434src/testbed/testbed_api_operations.c 428src/testbed/testbed_api_operations.c
435src/testbed/testbed_api_peers.c 429src/testbed/testbed_api_peers.c
436src/testbed/testbed_api_sd.c 430src/testbed/testbed_api_sd.c
437src/testbed/testbed_api_services.c 431src/testbed/testbed_api_services.c
438src/testbed/testbed_api_statistics.c 432src/testbed/testbed_api_statistics.c
439src/testbed/testbed_api_testbed.c
440src/testbed/testbed_api_test.c 433src/testbed/testbed_api_test.c
434src/testbed/testbed_api_testbed.c
441src/testbed/testbed_api_topology.c 435src/testbed/testbed_api_topology.c
442src/testbed/testbed_api_underlay.c 436src/testbed/testbed_api_underlay.c
443src/testing/gnunet-testing.c 437src/testing/gnunet-testing.c
444src/testing/list-keys.c 438src/testing/list-keys.c
439src/testing/testing.c
445src/testing/testing_api_cmd_batch.c 440src/testing/testing_api_cmd_batch.c
446src/testing/testing_api_cmd_hello_world_birth.c
447src/testing/testing_api_cmd_hello_world.c 441src/testing/testing_api_cmd_hello_world.c
442src/testing/testing_api_cmd_hello_world_birth.c
448src/testing/testing_api_cmd_send_peer_ready.c 443src/testing/testing_api_cmd_send_peer_ready.c
449src/testing/testing_api_cmd_system_create.c 444src/testing/testing_api_cmd_system_create.c
450src/testing/testing_api_loop.c 445src/testing/testing_api_loop.c
451src/testing/testing_api_trait_cmd.c 446src/testing/testing_api_trait_cmd.c
452src/testing/testing_api_trait_process.c 447src/testing/testing_api_trait_process.c
453src/testing/testing_api_traits.c 448src/testing/testing_api_traits.c
454src/testing/testing.c
455src/topology/friends.c 449src/topology/friends.c
456src/topology/gnunet-daemon-topology.c 450src/topology/gnunet-daemon-topology.c
457src/transport/gnunet-communicator-tcp.c 451src/transport/gnunet-communicator-tcp.c
458src/transport/gnunet-communicator-udp.c 452src/transport/gnunet-communicator-udp.c
459src/transport/gnunet-communicator-unix.c 453src/transport/gnunet-communicator-unix.c
460src/transport/gnunet-helper-transport-bluetooth.c 454src/transport/gnunet-helper-transport-bluetooth.c
461src/transport/gnunet-helper-transport-wlan.c
462src/transport/gnunet-helper-transport-wlan-dummy.c 455src/transport/gnunet-helper-transport-wlan-dummy.c
456src/transport/gnunet-helper-transport-wlan.c
463src/transport/gnunet-service-tng.c 457src/transport/gnunet-service-tng.c
464src/transport/gnunet-service-transport_ats.c
465src/transport/gnunet-service-transport.c 458src/transport/gnunet-service-transport.c
459src/transport/gnunet-service-transport_ats.c
466src/transport/gnunet-service-transport_hello.c 460src/transport/gnunet-service-transport_hello.c
467src/transport/gnunet-service-transport_manipulation.c 461src/transport/gnunet-service-transport_manipulation.c
468src/transport/gnunet-service-transport_neighbours.c 462src/transport/gnunet-service-transport_neighbours.c
469src/transport/gnunet-service-transport_plugins.c 463src/transport/gnunet-service-transport_plugins.c
470src/transport/gnunet-service-transport_validation.c 464src/transport/gnunet-service-transport_validation.c
471src/transport/gnunet-transport.c
472src/transport/gnunet-transport-profiler.c 465src/transport/gnunet-transport-profiler.c
473src/transport/gnunet-transport-wlan-receiver.c 466src/transport/gnunet-transport-wlan-receiver.c
474src/transport/gnunet-transport-wlan-sender.c 467src/transport/gnunet-transport-wlan-sender.c
468src/transport/gnunet-transport.c
475src/transport/plugin_cmd_simple_send.c 469src/transport/plugin_cmd_simple_send.c
476src/transport/plugin_transport_http_client.c 470src/transport/plugin_transport_http_client.c
477src/transport/plugin_transport_http_common.c 471src/transport/plugin_transport_http_common.c
@@ -479,14 +473,25 @@ src/transport/plugin_transport_http_server.c
479src/transport/plugin_transport_smtp.c 473src/transport/plugin_transport_smtp.c
480src/transport/plugin_transport_tcp.c 474src/transport/plugin_transport_tcp.c
481src/transport/plugin_transport_template.c 475src/transport/plugin_transport_template.c
482src/transport/plugin_transport_udp_broadcasting.c
483src/transport/plugin_transport_udp.c 476src/transport/plugin_transport_udp.c
477src/transport/plugin_transport_udp_broadcasting.c
484src/transport/plugin_transport_unix.c 478src/transport/plugin_transport_unix.c
485src/transport/plugin_transport_wlan.c 479src/transport/plugin_transport_wlan.c
486src/transport/tcp_connection_legacy.c 480src/transport/tcp_connection_legacy.c
487src/transport/tcp_server_legacy.c 481src/transport/tcp_server_legacy.c
488src/transport/tcp_server_mst_legacy.c 482src/transport/tcp_server_mst_legacy.c
489src/transport/tcp_service_legacy.c 483src/transport/tcp_service_legacy.c
484src/transport/transport-testing-communicator.c
485src/transport/transport-testing-filenames.c
486src/transport/transport-testing-filenames2.c
487src/transport/transport-testing-loggers.c
488src/transport/transport-testing-loggers2.c
489src/transport/transport-testing-main.c
490src/transport/transport-testing-main2.c
491src/transport/transport-testing-send.c
492src/transport/transport-testing-send2.c
493src/transport/transport-testing.c
494src/transport/transport-testing2.c
490src/transport/transport_api2_application.c 495src/transport/transport_api2_application.c
491src/transport/transport_api2_communication.c 496src/transport/transport_api2_communication.c
492src/transport/transport_api2_core.c 497src/transport/transport_api2_core.c
@@ -502,17 +507,6 @@ src/transport/transport_api_manipulation.c
502src/transport/transport_api_monitor_peers.c 507src/transport/transport_api_monitor_peers.c
503src/transport/transport_api_monitor_plugins.c 508src/transport/transport_api_monitor_plugins.c
504src/transport/transport_api_offer_hello.c 509src/transport/transport_api_offer_hello.c
505src/transport/transport-testing2.c
506src/transport/transport-testing.c
507src/transport/transport-testing-communicator.c
508src/transport/transport-testing-filenames2.c
509src/transport/transport-testing-filenames.c
510src/transport/transport-testing-loggers2.c
511src/transport/transport-testing-loggers.c
512src/transport/transport-testing-main2.c
513src/transport/transport-testing-main.c
514src/transport/transport-testing-send2.c
515src/transport/transport-testing-send.c
516src/util/bandwidth.c 510src/util/bandwidth.c
517src/util/benchmark.c 511src/util/benchmark.c
518src/util/bio.c 512src/util/bio.c
@@ -527,8 +521,8 @@ src/util/consttime_memcmp.c
527src/util/container_bloomfilter.c 521src/util/container_bloomfilter.c
528src/util/container_heap.c 522src/util/container_heap.c
529src/util/container_meta_data.c 523src/util/container_meta_data.c
530src/util/container_multihashmap32.c
531src/util/container_multihashmap.c 524src/util/container_multihashmap.c
525src/util/container_multihashmap32.c
532src/util/container_multipeermap.c 526src/util/container_multipeermap.c
533src/util/container_multishortmap.c 527src/util/container_multishortmap.c
534src/util/container_multiuuidmap.c 528src/util/container_multiuuidmap.c
@@ -554,8 +548,8 @@ src/util/dnsstub.c
554src/util/getopt.c 548src/util/getopt.c
555src/util/getopt_helpers.c 549src/util/getopt_helpers.c
556src/util/gnunet-base32.c 550src/util/gnunet-base32.c
557src/util/gnunet-config.c
558src/util/gnunet-config-diff.c 551src/util/gnunet-config-diff.c
552src/util/gnunet-config.c
559src/util/gnunet-crypto-tvg.c 553src/util/gnunet-crypto-tvg.c
560src/util/gnunet-ecc.c 554src/util/gnunet-ecc.c
561src/util/gnunet-qr.c 555src/util/gnunet-qr.c
@@ -593,8 +587,8 @@ src/vpn/gnunet-helper-vpn.c
593src/vpn/gnunet-service-vpn.c 587src/vpn/gnunet-service-vpn.c
594src/vpn/gnunet-vpn.c 588src/vpn/gnunet-vpn.c
595src/vpn/vpn_api.c 589src/vpn/vpn_api.c
596src/zonemaster/gnunet-service-zonemaster.c
597src/zonemaster/gnunet-service-zonemaster-monitor.c 590src/zonemaster/gnunet-service-zonemaster-monitor.c
591src/zonemaster/gnunet-service-zonemaster.c
598src/fs/fs_api.h 592src/fs/fs_api.h
599src/include/gnunet_json_lib.h 593src/include/gnunet_json_lib.h
600src/testbed/testbed_api.h 594src/testbed/testbed_api.h
diff --git a/src/include/gnunet_testbed_ng_service.h b/src/include/gnunet_testbed_ng_service.h
index 2ff5228cf..5979cd85a 100644
--- a/src/include/gnunet_testbed_ng_service.h
+++ b/src/include/gnunet_testbed_ng_service.h
@@ -38,176 +38,6 @@
38#include "gnunet_util_lib.h" 38#include "gnunet_util_lib.h"
39#include "gnunet_testing_ng_lib.h" 39#include "gnunet_testing_ng_lib.h"
40 40
41struct TngState;
42
43struct PeerCmdState
44{
45 /**
46 * The label of a controller command.
47 */
48 const char *controller_label;
49
50 /**
51 * Handle to operation
52 */
53 struct GNUNET_TESTBED_Operation *operation;
54
55 /**
56 * Name of the host, use "NULL" for localhost.
57 */
58 const char *hostname;
59
60 /**
61 * Username to use for the login; may be NULL.
62 */
63 const char *username;
64
65 /**
66 * Port number to use for ssh; use 0 to let ssh decide.
67 */
68 uint16_t port;
69
70 /**
71 * The configuration to use as a template while starting a controller
72 * on this host. Operation queue sizes specific to a host are also
73 * read from this configuration handle.
74 */
75 struct GNUNET_CONFIGURATION_Handle *cfg;
76
77 /**
78 * The host to run peers and controllers on
79 */
80 struct GNUNET_TESTBED_Host *host;
81
82 /**
83 * Abort task identifier
84 */
85 struct GNUNET_SCHEDULER_Task *abort_task;
86
87 /**
88 * Flag indicating if peer is ready.
89 */
90 int peer_ready;
91
92 /**
93 * Flag indicating controller is going down.
94 */
95 int peer_going_down;
96
97 /**
98 * Interpreter state.
99 */
100 struct GNUNET_TESTING_Interpreter *is;
101
102 /**
103 * Peer to start
104 */
105 struct GNUNET_TESTBED_Peer *peer;
106};
107
108struct ControllerState
109{
110 /**
111 * The ip address of the controller which will be set as TRUSTED
112 * HOST(all connections form this ip are permitted by the testbed) when
113 * starting testbed controller at host. This can either be a single ip
114 * address or a network address in CIDR notation.
115 */
116 const char *trusted_ip;
117
118 /**
119 * Name of the host, use "NULL" for localhost.
120 */
121 const char *hostname;
122
123 /**
124 * Username to use for the login; may be NULL.
125 */
126 const char *username;
127
128 /**
129 * Port number to use for ssh; use 0 to let ssh decide.
130 */
131 uint16_t port;
132
133 /**
134 * The configuration to use as a template while starting a controller
135 * on this host. Operation queue sizes specific to a host are also
136 * read from this configuration handle.
137 */
138 struct GNUNET_CONFIGURATION_Handle *cfg;
139
140 /**
141 * The host to run peers and controllers on
142 */
143 struct GNUNET_TESTBED_Host *host;
144
145 /**
146 * The controller process
147 */
148 struct GNUNET_TESTBED_ControllerProc *cp;
149
150 /**
151 * The controller handle
152 */
153 struct GNUNET_TESTBED_Controller *controller;
154
155 /**
156 * A bit mask with set of events to call the controller for.
157 */
158 uint64_t event_mask;
159
160 /**
161 * Abort task identifier
162 */
163 struct GNUNET_SCHEDULER_Task *abort_task;
164
165 /**
166 * Handle for host registration
167 */
168 struct GNUNET_TESTBED_HostRegistrationHandle *reg_handle;
169
170 /**
171 * Flag indicating if host create with controller is ready.
172 */
173 int host_ready;
174
175 /**
176 * Flag indicating controller is going down.
177 */
178 int controller_going_down;
179
180 /**
181 * Interpreter state.
182 */
183 struct GNUNET_TESTING_Interpreter *is;
184};
185
186/**
187 * Offer data from trait
188 *
189 * @param cmd command to extract the controller from.
190 * @param pt pointer to controller.
191 * @return #GNUNET_OK on success.
192 */
193int
194GNUNET_TESTBED_get_trait_controller (const struct GNUNET_TESTING_Command *cmd,
195 struct GNUNET_TESTBED_Controller **
196 controller);
197
198struct GNUNET_TESTING_Command
199GNUNET_TESTBED_cmd_controller (const char *label,
200 const char *host,
201 uint64_t event_mask);
202
203void
204GNUNET_TESTBED_shutdown_controller (struct ControllerState *cs);
205
206void
207GNUNET_TESTBED_shutdown_peer (struct PeerCmdState *ps);
208
209void
210GNUNET_TESTBED_shutdown_service (struct TngState *ss);
211 41
212/** 42/**
213 * Create command. 43 * Create command.
@@ -217,7 +47,7 @@ GNUNET_TESTBED_shutdown_service (struct TngState *ss);
217 * @return command. 47 * @return command.
218 */ 48 */
219struct GNUNET_TESTING_Command 49struct GNUNET_TESTING_Command
220GNUNET_TESTBED_cmd_netjail_start (const char *label, 50GNUNET_TESTING_cmd_netjail_start (const char *label,
221 char *local_m, 51 char *local_m,
222 char *global_n); 52 char *global_n);
223 53
@@ -230,11 +60,11 @@ GNUNET_TESTBED_cmd_netjail_start (const char *label,
230 * @return command. 60 * @return command.
231 */ 61 */
232struct GNUNET_TESTING_Command 62struct GNUNET_TESTING_Command
233GNUNET_TESTBED_cmd_netjail_start_testbed (const char *label, 63GNUNET_TESTING_cmd_netjail_start_testing_system (const char *label,
234 char *local_m, 64 char *local_m,
235 char *global_n, 65 char *global_n,
236 char *plugin_name, 66 char *plugin_name,
237 unsigned int *rv); 67 unsigned int *rv);
238 68
239 69
240/** 70/**
@@ -245,29 +75,24 @@ GNUNET_TESTBED_cmd_netjail_start_testbed (const char *label,
245 * @return command. 75 * @return command.
246 */ 76 */
247struct GNUNET_TESTING_Command 77struct GNUNET_TESTING_Command
248GNUNET_TESTBED_cmd_netjail_stop (const char *label, 78GNUNET_TESTING_cmd_netjail_stop (const char *label,
249 char *local_m, 79 char *local_m,
250 char *global_n); 80 char *global_n);
251 81
252 82
253struct GNUNET_TESTING_Command 83struct GNUNET_TESTING_Command
254GNUNET_TESTBED_cmd_stop_testbed (const char *label, 84GNUNET_TESTING_cmd_stop_testing_system (const char *label,
255 const char *helper_start_label, 85 const char *helper_start_label,
256 char *local_m, 86 char *local_m,
257 char *global_n); 87 char *global_n);
258 88
259 89
260int 90int
261GNUNET_TESTBED_get_trait_helper_handles (const struct 91GNUNET_TESTING_get_trait_helper_handles (const struct
262 GNUNET_TESTING_Command *cmd, 92 GNUNET_TESTING_Command *cmd,
263 struct GNUNET_HELPER_Handle ***helper); 93 struct GNUNET_HELPER_Handle ***helper);
264 94
265 95
266int
267GNUNET_TESTBED_get_trait_hosts (const struct
268 GNUNET_TESTING_Command *cmd,
269 struct GNUNET_TESTBED_Host ***hosts);
270
271struct GNUNET_TESTING_Command 96struct GNUNET_TESTING_Command
272GNUNET_TESTING_cmd_block_until_all_peers_started (const char *label, 97GNUNET_TESTING_cmd_block_until_all_peers_started (const char *label,
273 unsigned int * 98 unsigned int *
@@ -275,11 +100,11 @@ GNUNET_TESTING_cmd_block_until_all_peers_started (const char *label,
275 100
276struct GNUNET_TESTING_Command 101struct GNUNET_TESTING_Command
277GNUNET_TESTING_cmd_send_peer_ready (const char *label, 102GNUNET_TESTING_cmd_send_peer_ready (const char *label,
278 TESTBED_CMD_HELPER_write_cb write_message); 103 TESTING_CMD_HELPER_write_cb write_message);
279 104
280struct GNUNET_TESTING_Command 105struct GNUNET_TESTING_Command
281GNUNET_TESTING_cmd_local_test_finished (const char *label, 106GNUNET_TESTING_cmd_local_test_finished (const char *label,
282 TESTBED_CMD_HELPER_write_cb 107 TESTING_CMD_HELPER_write_cb
283 write_message); 108 write_message);
284 109
285#endif 110#endif
diff --git a/src/include/gnunet_testing_plugin.h b/src/include/gnunet_testing_plugin.h
index 103eb23be..151827d4b 100644
--- a/src/include/gnunet_testing_plugin.h
+++ b/src/include/gnunet_testing_plugin.h
@@ -37,11 +37,11 @@ extern "C"
37#endif 37#endif
38 38
39typedef void 39typedef void
40(*TESTBED_CMD_HELPER_write_cb) (struct GNUNET_MessageHeader *message, size_t 40(*TESTING_CMD_HELPER_write_cb) (struct GNUNET_MessageHeader *message, size_t
41 msg_length); 41 msg_length);
42 42
43typedef void 43typedef void
44(*GNUNET_TESTING_PLUGIN_StartTestCase) (TESTBED_CMD_HELPER_write_cb 44(*GNUNET_TESTING_PLUGIN_StartTestCase) (TESTING_CMD_HELPER_write_cb
45 write_message, char *router_ip, 45 write_message, char *router_ip,
46 char *node_ip, 46 char *node_ip,
47 char *n, 47 char *n,
diff --git a/src/testbed/Makefile.am b/src/testbed/Makefile.am
index b4b2cff97..5a221cd69 100644
--- a/src/testbed/Makefile.am
+++ b/src/testbed/Makefile.am
@@ -23,7 +23,6 @@ if HAVE_SQLITE
23endif 23endif
24 24
25libexec_PROGRAMS = \ 25libexec_PROGRAMS = \
26 gnunet-cmd \
27 gnunet-cmds-helper \ 26 gnunet-cmds-helper \
28 gnunet-service-testbed \ 27 gnunet-service-testbed \
29 gnunet-helper-testbed \ 28 gnunet-helper-testbed \
@@ -90,14 +89,6 @@ gnunet_helper_testbed_LDADD = $(XLIB) \
90 libgnunettestbed.la \ 89 libgnunettestbed.la \
91 $(LTLIBINTL) $(Z_LIBS) 90 $(LTLIBINTL) $(Z_LIBS)
92 91
93gnunet_cmd_SOURCES = \
94 gnunet-cmd.c
95gnunet_cmd_LDADD = $(XLIB) \
96 $(top_builddir)/src/util/libgnunetutil.la \
97 $(top_builddir)/src/testing/libgnunettesting.la \
98 libgnunettestbed.la \
99 $(LTLIBINTL) $(Z_LIBS)
100
101gnunet_cmds_helper_SOURCES = \ 92gnunet_cmds_helper_SOURCES = \
102 gnunet-cmds-helper.c 93 gnunet-cmds-helper.c
103gnunet_cmds_helper_LDADD = $(XLIB) \ 94gnunet_cmds_helper_LDADD = $(XLIB) \
@@ -138,8 +129,6 @@ libgnunettestbed_la_SOURCES = \
138 testbed_api_cmd_netjail_stop.c \ 129 testbed_api_cmd_netjail_stop.c \
139 testbed_api.c testbed_api.h testbed.h \ 130 testbed_api.c testbed_api.h testbed.h \
140 testbed_api_hosts.c testbed_api_hosts.h testbed_helper.h \ 131 testbed_api_hosts.c testbed_api_hosts.h testbed_helper.h \
141 testbed_api_cmd_controller.c \
142 testbed_api_cmd_peer.c \
143 testbed_api_operations.c testbed_api_operations.h \ 132 testbed_api_operations.c testbed_api_operations.h \
144 testbed_api_peers.c testbed_api_peers.h \ 133 testbed_api_peers.c testbed_api_peers.h \
145 testbed_api_services.c \ 134 testbed_api_services.c \
diff --git a/src/testbed/gnunet-cmd.c b/src/testbed/gnunet-cmd.c
deleted file mode 100644
index 0ba94fdd9..000000000
--- a/src/testbed/gnunet-cmd.c
+++ /dev/null
@@ -1,123 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2008--2013, 2016 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/gnunet-cmd.c
23 *
24 * @brief Binary to start testcase plugins
25 *
26 * @author t3sserakt
27 */
28
29#include "platform.h"
30#include "gnunet_util_lib.h"
31#include "gnunet_testing_lib.h"
32#include "gnunet_testing_plugin.h"
33
34/**
35 * Generic logging shortcut
36 */
37#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
38
39#define NODE_BASE_IP "192.168.15."
40
41#define ROUTER_BASE_IP "92.68.150."
42
43/**
44 * Handle for a plugin.
45 */
46struct Plugin
47{
48 /**
49 * Name of the shared library.
50 */
51 char *library_name;
52
53 /**
54 * Plugin API.
55 */
56 struct GNUNET_TESTING_PluginFunctions *api;
57
58 char *node_ip;
59
60 char *plugin_name;
61
62 char *global_n;
63
64 char *local_m;
65
66 char *n;
67
68 char *m;
69};
70
71
72/**
73 * Main function to run the test cases.
74 *
75 * @param cls plugin to use.
76 *
77 */
78static void
79run (void *cls)
80{
81 struct Plugin *plugin = cls;
82 char *router_ip;
83 char *node_ip;
84
85 router_ip = GNUNET_malloc (strlen (ROUTER_BASE_IP) + strlen (plugin->m) + 1);
86 strcpy (router_ip, ROUTER_BASE_IP);
87 strcat (router_ip, plugin->m);
88
89 node_ip = GNUNET_malloc (strlen (NODE_BASE_IP) + strlen (plugin->n) + 1);
90 strcat (node_ip, NODE_BASE_IP);
91 strcat (node_ip, plugin->n);
92
93 plugin->api->start_testcase (NULL, router_ip, node_ip, NULL, NULL, NULL);
94
95}
96
97
98int
99main (int argc, char *const *argv)
100{
101 int rv = 0;
102 struct Plugin *plugin;
103
104 GNUNET_log_setup ("gnunet-cmd",
105 "DEBUG",
106 NULL);
107
108 plugin = GNUNET_new (struct Plugin);
109 plugin->api = GNUNET_PLUGIN_load (argv[0],
110 NULL);
111 plugin->library_name = GNUNET_strdup (argv[0]);
112
113 plugin->global_n = argv[1];
114 plugin->local_m = argv[2];
115 plugin->n = argv[3];
116 plugin->m = argv[4];
117
118 GNUNET_SCHEDULER_run (&run,
119 plugin);
120
121 GNUNET_free (plugin);
122 return rv;
123}
diff --git a/src/testbed/plugin_testcmd.c b/src/testbed/plugin_testcmd.c
index e08ec067d..b74b67240 100644
--- a/src/testbed/plugin_testcmd.c
+++ b/src/testbed/plugin_testcmd.c
@@ -45,7 +45,7 @@ all_peers_started ()
45} 45}
46 46
47static void 47static void
48start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip, 48start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
49 char *node_ip, 49 char *node_ip,
50 char *n, 50 char *n,
51 char *m, 51 char *m,
diff --git a/src/testbed/test_testbed_api_cmd_netjail.c b/src/testbed/test_testbed_api_cmd_netjail.c
index 8bb9e40e8..85da39f0e 100644
--- a/src/testbed/test_testbed_api_cmd_netjail.c
+++ b/src/testbed/test_testbed_api_cmd_netjail.c
@@ -39,18 +39,18 @@ static void
39run (void *cls) 39run (void *cls)
40{ 40{
41 struct GNUNET_TESTING_Command commands[] = { 41 struct GNUNET_TESTING_Command commands[] = {
42 GNUNET_TESTBED_cmd_netjail_start ("netjail-start-1", 42 GNUNET_TESTING_cmd_netjail_start ("netjail-start-1",
43 "2", 43 "2",
44 "2"), 44 "2"),
45 GNUNET_TESTBED_cmd_netjail_start_testbed ("netjail-start-testbed-1", 45 GNUNET_TESTING_cmd_netjail_start_testing_system ("netjail-start-testbed-1",
46 "2", 46 "2",
47 "2", 47 "2",
48 "libgnunet_plugin_testcmd"), 48 "libgnunet_plugin_testcmd"),
49 GNUNET_TESTBED_cmd_stop_testbed ("stop-testbed", 49 GNUNET_TESTING_cmd_stop_testing_system ("stop-testbed",
50 "netjail-start-testbed-1", 50 "netjail-start-testbed-1",
51 "2", 51 "2",
52 "2"), 52 "2"),
53 GNUNET_TESTBED_cmd_netjail_stop ("netjail-stop-1", 53 GNUNET_TESTING_cmd_netjail_stop ("netjail-stop-1",
54 "2", 54 "2",
55 "2"), 55 "2"),
56 GNUNET_TESTING_cmd_end () 56 GNUNET_TESTING_cmd_end ()
diff --git a/src/testbed/testbed_api_cmd_controller.c b/src/testbed/testbed_api_cmd_controller.c
deleted file mode 100644
index 794b1ccf3..000000000
--- a/src/testbed/testbed_api_cmd_controller.c
+++ /dev/null
@@ -1,203 +0,0 @@
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*
43*
44* @param cls closure
45* @param cmd current CMD being cleaned up.
46*/
47static void
48controller_cleanup (void *cls,
49 const struct GNUNET_TESTING_Command *cmd)
50{
51 (void) cls;
52}
53
54
55/**
56 * Signature of the event handler function called by the
57 * respective event controller.
58 *
59 * @param cls closure
60 * @param event information about the event
61 */
62static void
63controller_cb (void *cls,
64 const struct GNUNET_TESTBED_EventInformation *event)
65{
66 struct ControllerState *cs = cls;
67
68 if (NULL != event->details.operation_finished.emsg)
69 {
70 LOG (GNUNET_ERROR_TYPE_ERROR, "There was an operation error: %s\n",
71 event->details.operation_finished.emsg);
72 GNUNET_TESTBED_shutdown_controller (cs);
73 }
74 else if (NULL == event->details.operation_finished.generic)
75 {
76 GNUNET_TESTBED_operation_done (event->op);
77 }
78}
79
80
81static void
82controller_run (void *cls,
83 const struct GNUNET_TESTING_Command *cmd,
84 struct GNUNET_TESTING_Interpreter *is)
85{
86 struct ControllerState *cs = cls;
87
88 cs->is = is;
89
90 cs->controller =
91 GNUNET_TESTBED_controller_connect (cs->host, cs->event_mask, &controller_cb,
92 cs);
93
94
95}
96
97/**
98*
99*
100* @param cls closure.
101* @param[out] ret result
102* @param trait name of the trait.
103* @param index index number of the object to offer.
104* @return #GNUNET_OK on success.
105*/
106static int
107controller_traits (void *cls,
108 const void **ret,
109 const char *trait,
110 unsigned int index)
111{
112 (void) cls;
113
114 struct ControllerState *cs = cls;
115
116
117 struct GNUNET_TESTING_Trait traits[] = {
118 {
119 .index = 0,
120 .trait_name = "controller",
121 .ptr = (const void *) cs->controller,
122 },
123 GNUNET_TESTING_trait_end ()
124 };
125
126 return GNUNET_TESTING_get_trait (traits,
127 ret,
128 trait,
129 index);
130 return GNUNET_OK;
131}
132
133
134/**
135 * Offer data from trait
136 *
137 * @param cmd command to extract the controller from.
138 * @param pt pointer to controller.
139 * @return #GNUNET_OK on success.
140 */
141int
142GNUNET_TESTBED_get_trait_controller (const struct GNUNET_TESTING_Command *cmd,
143 struct GNUNET_TESTBED_Controller **
144 controller)
145{
146 return cmd->traits (cmd->cls,
147 (const void **) controller,
148 "controller",
149 (unsigned int) 0);
150}
151
152
153/**
154 * Shutdown nicely
155 *
156 * @param cs controller state.
157 */
158void
159GNUNET_TESTBED_shutdown_controller (struct ControllerState *cs)
160{
161 LOG (GNUNET_ERROR_TYPE_DEBUG,
162 "Shutting down...\n");
163
164 cs->controller_going_down = GNUNET_YES;
165
166 if (NULL != cs->abort_task)
167 GNUNET_SCHEDULER_cancel (cs->abort_task);
168 if (NULL != cs->reg_handle)
169 GNUNET_TESTBED_cancel_registration (cs->reg_handle);
170 if (NULL != cs->controller)
171 GNUNET_TESTBED_controller_disconnect (cs->controller);
172 if (NULL != cs->cfg)
173 GNUNET_CONFIGURATION_destroy (cs->cfg);
174 if (NULL != cs->cp)
175 GNUNET_TESTBED_controller_stop (cs->cp);
176 if (NULL != cs->host)
177 GNUNET_TESTBED_host_destroy (cs->host);
178}
179
180
181
182struct GNUNET_TESTING_Command
183GNUNET_TESTBED_cmd_controller (const char *label,
184 const char *host,
185 uint64_t event_mask)
186{
187 struct ControllerState *cs;
188
189 cs = GNUNET_new (struct ControllerState);
190 cs->event_mask = event_mask;
191 cs->hostname = host;
192
193
194 struct GNUNET_TESTING_Command cmd = {
195 .cls = cs,
196 .label = label,
197 .run = &controller_run,
198 .cleanup = &controller_cleanup,
199 .traits = &controller_traits
200 };
201
202 return cmd;
203}
diff --git a/src/testbed/testbed_api_cmd_local_test_finished.c b/src/testbed/testbed_api_cmd_local_test_finished.c
index b5f4b8b31..c02546945 100644
--- a/src/testbed/testbed_api_cmd_local_test_finished.c
+++ b/src/testbed/testbed_api_cmd_local_test_finished.c
@@ -35,7 +35,7 @@
35 35
36struct LocalFinishedState 36struct LocalFinishedState
37{ 37{
38 TESTBED_CMD_HELPER_write_cb write_message; 38 TESTING_CMD_HELPER_write_cb write_message;
39 39
40 struct GNUNET_CMDS_LOCAL_FINISHED *reply; 40 struct GNUNET_CMDS_LOCAL_FINISHED *reply;
41}; 41};
@@ -107,7 +107,7 @@ local_test_finished_finish (void *cls,
107 */ 107 */
108struct GNUNET_TESTING_Command 108struct GNUNET_TESTING_Command
109GNUNET_TESTING_cmd_local_test_finished (const char *label, 109GNUNET_TESTING_cmd_local_test_finished (const char *label,
110 TESTBED_CMD_HELPER_write_cb 110 TESTING_CMD_HELPER_write_cb
111 write_message) 111 write_message)
112{ 112{
113 struct LocalFinishedState *lfs; 113 struct LocalFinishedState *lfs;
diff --git a/src/testbed/testbed_api_cmd_netjail_start.c b/src/testbed/testbed_api_cmd_netjail_start.c
index 8edfb8b62..0cc020275 100644
--- a/src/testbed/testbed_api_cmd_netjail_start.c
+++ b/src/testbed/testbed_api_cmd_netjail_start.c
@@ -28,7 +28,7 @@
28#include "gnunet_testing_ng_lib.h" 28#include "gnunet_testing_ng_lib.h"
29#include "gnunet_testbed_ng_service.h" 29#include "gnunet_testbed_ng_service.h"
30 30
31#define NETJAIL_START_SCRIPT "./../testbed/netjail_start.sh" 31#define NETJAIL_START_SCRIPT "./../testing/netjail_start.sh"
32 32
33struct NetJailState 33struct NetJailState
34{ 34{
@@ -139,9 +139,10 @@ netjail_start_run (void *cls,
139 ns->local_m, 139 ns->local_m,
140 ns->global_n, 140 ns->global_n,
141 NULL}; 141 NULL};
142 unsigned int helper_check = GNUNET_OS_check_helper_binary (NETJAIL_START_SCRIPT, 142 unsigned int helper_check = GNUNET_OS_check_helper_binary (
143 GNUNET_YES, 143 NETJAIL_START_SCRIPT,
144 NULL); 144 GNUNET_YES,
145 NULL);
145 146
146 if (GNUNET_NO == helper_check) 147 if (GNUNET_NO == helper_check)
147 { 148 {
@@ -193,7 +194,7 @@ netjail_start_finish (void *cls,
193 * @return command. 194 * @return command.
194 */ 195 */
195struct GNUNET_TESTING_Command 196struct GNUNET_TESTING_Command
196GNUNET_TESTBED_cmd_netjail_start (const char *label, 197GNUNET_TESTING_cmd_netjail_start (const char *label,
197 char *local_m, 198 char *local_m,
198 char *global_n) 199 char *global_n)
199{ 200{
diff --git a/src/testbed/testbed_api_cmd_netjail_start_testbed.c b/src/testbed/testbed_api_cmd_netjail_start_testbed.c
index db9cf7508..3d1a1d893 100644
--- a/src/testbed/testbed_api_cmd_netjail_start_testbed.c
+++ b/src/testbed/testbed_api_cmd_netjail_start_testbed.c
@@ -30,7 +30,7 @@
30#include "testbed_api_hosts.h" 30#include "testbed_api_hosts.h"
31#include "testbed_helper.h" 31#include "testbed_helper.h"
32 32
33#define NETJAIL_EXEC_SCRIPT "./../testbed/netjail_exec.sh" 33#define NETJAIL_EXEC_SCRIPT "./../testing/netjail_exec.sh"
34 34
35struct HelperMessage; 35struct HelperMessage;
36 36
@@ -87,23 +87,16 @@ struct NetJailState
87 87
88 unsigned int n_msg; 88 unsigned int n_msg;
89 89
90 unsigned int number_of_testbeds_started; 90 unsigned int number_of_testsystems_started;
91 91
92 unsigned int number_of_peers_started; 92 unsigned int number_of_peers_started;
93 93
94 unsigned int number_of_local_test_finished; 94 unsigned int number_of_local_test_finished;
95 95
96 /**
97 * The host where the controller is running
98 */
99 struct GNUNET_TESTBED_Host **host;
100
101 unsigned int n_host;
102
103 char *plugin_name; 96 char *plugin_name;
104}; 97};
105 98
106struct TestbedCount 99struct TestingSystemCount
107{ 100{
108 unsigned int count; 101 unsigned int count;
109 102
@@ -168,14 +161,14 @@ netjail_exec_traits (void *cls,
168 161
169 162
170/** 163/**
171 * Offer handles to testbed helper from trait 164 * Offer handles to testing cmd helper from trait
172 * 165 *
173 * @param cmd command to extract the message from. 166 * @param cmd command to extract the message from.
174 * @param pt pointer to message. 167 * @param pt pointer to message.
175 * @return #GNUNET_OK on success. 168 * @return #GNUNET_OK on success.
176 */ 169 */
177int 170int
178GNUNET_TESTBED_get_trait_helper_handles (const struct 171GNUNET_TESTING_get_trait_helper_handles (const struct
179 GNUNET_TESTING_Command *cmd, 172 GNUNET_TESTING_Command *cmd,
180 struct GNUNET_HELPER_Handle ***helper) 173 struct GNUNET_HELPER_Handle ***helper)
181{ 174{
@@ -186,14 +179,14 @@ GNUNET_TESTBED_get_trait_helper_handles (const struct
186} 179}
187 180
188/** 181/**
189 * Offer handles to testbed helper from trait 182 * Offer messages received via testing cmd helper from trait
190 * 183 *
191 * @param cmd command to extract the message from. 184 * @param cmd command to extract the message from.
192 * @param pt pointer to message. 185 * @param pt pointer to message.
193 * @return #GNUNET_OK on success. 186 * @return #GNUNET_OK on success.
194 */ 187 */
195int 188int
196GNUNET_TESTBED_get_trait_helper_messages (const struct 189GNUNET_TESTING_get_trait_helper_messages (const struct
197 GNUNET_TESTING_Command *cmd, 190 GNUNET_TESTING_Command *cmd,
198 struct HelperMessage *** 191 struct HelperMessage ***
199 hp_messages_head) 192 hp_messages_head)
@@ -216,7 +209,7 @@ GNUNET_TESTBED_get_trait_helper_messages (const struct
216static void 209static void
217clear_msg (void *cls, int result) 210clear_msg (void *cls, int result)
218{ 211{
219 struct TestbedCount *tbc = cls; 212 struct TestingSystemCount *tbc = cls;
220 struct NetJailState *ns = tbc->ns; 213 struct NetJailState *ns = tbc->ns;
221 214
222 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 215 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -244,7 +237,7 @@ clear_msg (void *cls, int result)
244static int 237static int
245helper_mst (void *cls, const struct GNUNET_MessageHeader *message) 238helper_mst (void *cls, const struct GNUNET_MessageHeader *message)
246{ 239{
247 struct TestbedCount *tbc = cls; 240 struct TestingSystemCount *tbc = cls;
248 struct NetJailState *ns = tbc->ns; 241 struct NetJailState *ns = tbc->ns;
249 struct HelperMessage *hp_msg; 242 struct HelperMessage *hp_msg;
250 243
@@ -253,10 +246,9 @@ helper_mst (void *cls, const struct GNUNET_MessageHeader *message)
253 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 246 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
254 "helper_mst tbc->count: %d\n", 247 "helper_mst tbc->count: %d\n",
255 tbc->count); 248 tbc->count);
256 // GNUNET_TESTBED_extract_cfg (host, message);
257 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 249 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
258 "Received message from helper.\n"); 250 "Received message from helper.\n");
259 ns->number_of_testbeds_started++; 251 ns->number_of_testsystems_started++;
260 } 252 }
261 else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED == ntohs ( 253 else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED == ntohs (
262 message->type)) 254 message->type))
@@ -320,57 +312,38 @@ create_helper_init_msg_ (char *m_char,
320 312
321 313
322static void 314static void
323start_testbed (struct NetJailState *ns, struct 315start_helper (struct NetJailState *ns, struct
324 GNUNET_CONFIGURATION_Handle *config, 316 GNUNET_CONFIGURATION_Handle *config,
325 char *m_char, 317 char *m_char,
326 char *n_char) 318 char *n_char)
327{ 319{
328 // struct GNUNET_CONFIGURATION_Handle *cfg; 320 // struct GNUNET_CONFIGURATION_Handle *cfg;
329 struct GNUNET_CMDS_HelperInit *msg; 321 struct GNUNET_CMDS_HelperInit *msg;
330 struct TestbedCount *tbc; 322 struct TestingSystemCount *tbc;
331 char *const script_argv[] = {NETJAIL_EXEC_SCRIPT, 323 char *const script_argv[] = {NETJAIL_EXEC_SCRIPT,
332 m_char, 324 m_char,
333 n_char, 325 n_char,
334 GNUNET_OS_get_libexec_binary_path(HELPER_CMDS_BINARY), 326 GNUNET_OS_get_libexec_binary_path (
327 HELPER_CMDS_BINARY),
335 ns->global_n, 328 ns->global_n,
336 ns->local_m, 329 ns->local_m,
337 NULL}; 330 NULL};
338 unsigned int m = atoi (m_char); 331 unsigned int m = atoi (m_char);
339 unsigned int n = atoi (n_char); 332 unsigned int n = atoi (n_char);
340 unsigned int helper_check = GNUNET_OS_check_helper_binary (NETJAIL_EXEC_SCRIPT, 333 unsigned int helper_check = GNUNET_OS_check_helper_binary (
341 GNUNET_YES, 334 NETJAIL_EXEC_SCRIPT,
342 NULL); 335 GNUNET_YES,
336 NULL);
343 337
344 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 338 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
345 "m: %d n: %d\n", 339 "m: %d n: %d\n",
346 m, 340 m,
347 n); 341 n);
348 342
349 tbc = GNUNET_new (struct TestbedCount); 343 tbc = GNUNET_new (struct TestingSystemCount);
350 tbc->ns = ns; 344 tbc->ns = ns;
351 tbc->count = (n - 1) * atoi (ns->local_m) + m; 345 tbc->count = (n - 1) * atoi (ns->local_m) + m;
352 346
353 // cfg = GNUNET_CONFIGURATION_dup (config);
354
355 // TODO We do not need this?
356 /*GNUNET_array_append (ns->host, ns->n_host,
357 GNUNET_TESTBED_host_create_with_id (tbc->count - 1,
358 NULL,
359 NULL,
360 cfg,
361 0));*/
362
363 /*if ((GNUNET_YES != GNUNET_DISK_file_test ("test_testbed_api.conf")) ||
364 (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (config,
365 "test_testbed_api.conf")))
366 {
367 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
368 _ (
369 "Unreadable or malformed configuration file `%s', exit ...\n"),
370 "test_testbed_api.conf");
371 }*/
372
373
374 347
375 if (GNUNET_NO == helper_check) 348 if (GNUNET_NO == helper_check)
376 { 349 {
@@ -396,13 +369,13 @@ start_testbed (struct NetJailState *ns, struct
396 tbc)); 369 tbc));
397 370
398 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 371 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
399 "First using helper %d %d\n", 372 "First using helper %d %d\n",
400 tbc->count - 1, 373 tbc->count - 1,
401 ns->n_helper); 374 ns->n_helper);
402 struct GNUNET_HELPER_Handle *helper = ns->helper[tbc->count - 1]; 375 struct GNUNET_HELPER_Handle *helper = ns->helper[tbc->count - 1];
403 376
404 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 377 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
405 "First using helper %d %d %p\n", 378 "First using helper %d %d %p\n",
406 tbc->count - 1, 379 tbc->count - 1,
407 ns->n_helper, 380 ns->n_helper,
408 helper); 381 helper);
@@ -456,9 +429,9 @@ netjail_exec_run (void *cls,
456 { 429 {
457 sprintf (str_n, "%d", i); 430 sprintf (str_n, "%d", i);
458 sprintf (str_m, "%d", j); 431 sprintf (str_m, "%d", j);
459 start_testbed (ns, config, 432 start_helper (ns, config,
460 str_m, 433 str_m,
461 str_n); 434 str_n);
462 } 435 }
463 } 436 }
464} 437}
@@ -475,7 +448,7 @@ netjail_start_finish (void *cls,
475 struct GNUNET_CMDS_ALL_PEERS_STARTED *reply; 448 struct GNUNET_CMDS_ALL_PEERS_STARTED *reply;
476 size_t msg_length; 449 size_t msg_length;
477 struct GNUNET_HELPER_Handle *helper; 450 struct GNUNET_HELPER_Handle *helper;
478 struct TestbedCount *tbc; 451 struct TestingSystemCount *tbc;
479 452
480 if (ns->number_of_local_test_finished == total_number) 453 if (ns->number_of_local_test_finished == total_number)
481 { 454 {
@@ -483,11 +456,11 @@ netjail_start_finish (void *cls,
483 cont (cont_cls); 456 cont (cont_cls);
484 } 457 }
485 458
486 if (ns->number_of_testbeds_started == total_number) 459 if (ns->number_of_testsystems_started == total_number)
487 { 460 {
488 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 461 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
489 "All helpers started!\n"); 462 "All helpers started!\n");
490 ns->number_of_testbeds_started = 0; 463 ns->number_of_testsystems_started = 0;
491 } 464 }
492 465
493 if (ns->number_of_peers_started == total_number) 466 if (ns->number_of_peers_started == total_number)
@@ -498,7 +471,7 @@ netjail_start_finish (void *cls,
498 for (int i = 1; i <= atoi (ns->global_n); i++) { 471 for (int i = 1; i <= atoi (ns->global_n); i++) {
499 for (int j = 1; j <= atoi (ns->local_m); j++) 472 for (int j = 1; j <= atoi (ns->local_m); j++)
500 { 473 {
501 tbc = GNUNET_new (struct TestbedCount); 474 tbc = GNUNET_new (struct TestingSystemCount);
502 tbc->ns = ns; 475 tbc->ns = ns;
503 // TODO This needs to be more generic. As we send more messages back and forth, we can not grow the arrays again and again, because this is to error prone. 476 // TODO This needs to be more generic. As we send more messages back and forth, we can not grow the arrays again and again, because this is to error prone.
504 tbc->count = (i - 1) * atoi (ns->local_m) + j + total_number; 477 tbc->count = (i - 1) * atoi (ns->local_m) + j + total_number;
@@ -544,11 +517,11 @@ netjail_start_finish (void *cls,
544 * @return command. 517 * @return command.
545 */ 518 */
546struct GNUNET_TESTING_Command 519struct GNUNET_TESTING_Command
547GNUNET_TESTBED_cmd_netjail_start_testbed (const char *label, 520GNUNET_TESTING_cmd_netjail_start_testing_system (const char *label,
548 char *local_m, 521 char *local_m,
549 char *global_n, 522 char *global_n,
550 char *plugin_name, 523 char *plugin_name,
551 unsigned int *rv) 524 unsigned int *rv)
552{ 525{
553 struct NetJailState *ns; 526 struct NetJailState *ns;
554 527
diff --git a/src/testbed/testbed_api_cmd_netjail_stop.c b/src/testbed/testbed_api_cmd_netjail_stop.c
index 947384fed..f837ec08c 100644
--- a/src/testbed/testbed_api_cmd_netjail_stop.c
+++ b/src/testbed/testbed_api_cmd_netjail_stop.c
@@ -29,7 +29,7 @@
29#include "gnunet_testbed_ng_service.h" 29#include "gnunet_testbed_ng_service.h"
30 30
31 31
32#define NETJAIL_STOP_SCRIPT "./../testbed/netjail_stop.sh" 32#define NETJAIL_STOP_SCRIPT "./../testing/netjail_stop.sh"
33 33
34struct GNUNET_ChildWaitHandle *cwh; 34struct GNUNET_ChildWaitHandle *cwh;
35 35
@@ -135,9 +135,10 @@ netjail_stop_run (void *cls,
135 ns->local_m, 135 ns->local_m,
136 ns->global_n, 136 ns->global_n,
137 NULL}; 137 NULL};
138 unsigned int helper_check = GNUNET_OS_check_helper_binary (NETJAIL_STOP_SCRIPT, 138 unsigned int helper_check = GNUNET_OS_check_helper_binary (
139 GNUNET_YES, 139 NETJAIL_STOP_SCRIPT,
140 NULL); 140 GNUNET_YES,
141 NULL);
141 142
142 if (GNUNET_NO == helper_check) 143 if (GNUNET_NO == helper_check)
143 { 144 {
@@ -192,7 +193,7 @@ netjail_stop_finish (void *cls,
192 * @return command. 193 * @return command.
193 */ 194 */
194struct GNUNET_TESTING_Command 195struct GNUNET_TESTING_Command
195GNUNET_TESTBED_cmd_netjail_stop (const char *label, 196GNUNET_TESTING_cmd_netjail_stop (const char *label,
196 char *local_m, 197 char *local_m,
197 char *global_n) 198 char *global_n)
198{ 199{
diff --git a/src/testbed/testbed_api_cmd_netjail_stop_testbed.c b/src/testbed/testbed_api_cmd_netjail_stop_testbed.c
index 9a9d489a7..c74c1e94f 100644
--- a/src/testbed/testbed_api_cmd_netjail_stop_testbed.c
+++ b/src/testbed/testbed_api_cmd_netjail_stop_testbed.c
@@ -53,8 +53,8 @@ struct StopHelperState
53* @param cmd current CMD being cleaned up. 53* @param cmd current CMD being cleaned up.
54*/ 54*/
55static void 55static void
56stop_testbed_cleanup (void *cls, 56stop_testing_system_cleanup (void *cls,
57 const struct GNUNET_TESTING_Command *cmd) 57 const struct GNUNET_TESTING_Command *cmd)
58{ 58{
59 59
60} 60}
@@ -70,10 +70,10 @@ stop_testbed_cleanup (void *cls,
70* @return #GNUNET_OK on success. 70* @return #GNUNET_OK on success.
71*/ 71*/
72static int 72static int
73stop_testbed_traits (void *cls, 73stop_testing_system_traits (void *cls,
74 const void **ret, 74 const void **ret,
75 const char *trait, 75 const char *trait,
76 unsigned int index) 76 unsigned int index)
77{ 77{
78 return GNUNET_OK; 78 return GNUNET_OK;
79} 79}
@@ -87,9 +87,9 @@ stop_testbed_traits (void *cls,
87* @param is interpreter state. 87* @param is interpreter state.
88*/ 88*/
89static void 89static void
90stop_testbed_run (void *cls, 90stop_testing_system_run (void *cls,
91 const struct GNUNET_TESTING_Command *cmd, 91 const struct GNUNET_TESTING_Command *cmd,
92 struct GNUNET_TESTING_Interpreter *is) 92 struct GNUNET_TESTING_Interpreter *is)
93{ 93{
94 struct StopHelperState *shs = cls; 94 struct StopHelperState *shs = cls;
95 struct GNUNET_HELPER_Handle **helper; 95 struct GNUNET_HELPER_Handle **helper;
@@ -97,7 +97,7 @@ stop_testbed_run (void *cls,
97 97
98 start_helper_cmd = GNUNET_TESTING_interpreter_lookup_command ( 98 start_helper_cmd = GNUNET_TESTING_interpreter_lookup_command (
99 shs->helper_start_label); 99 shs->helper_start_label);
100 GNUNET_TESTBED_get_trait_helper_handles (start_helper_cmd, 100 GNUNET_TESTING_get_trait_helper_handles (start_helper_cmd,
101 &helper); 101 &helper);
102 102
103 for (int i = 1; i <= atoi (shs->global_n); i++) { 103 for (int i = 1; i <= atoi (shs->global_n); i++) {
@@ -118,11 +118,11 @@ stop_testbed_run (void *cls,
118 * @return command. 118 * @return command.
119 */ 119 */
120struct GNUNET_TESTING_Command 120struct GNUNET_TESTING_Command
121GNUNET_TESTBED_cmd_stop_testbed (const char *label, 121GNUNET_TESTING_cmd_stop_testing_system (const char *label,
122 const char *helper_start_label, 122 const char *helper_start_label,
123 char *local_m, 123 char *local_m,
124 char *global_n 124 char *global_n
125 ) 125 )
126{ 126{
127 struct StopHelperState *shs; 127 struct StopHelperState *shs;
128 128
@@ -134,9 +134,9 @@ GNUNET_TESTBED_cmd_stop_testbed (const char *label,
134 struct GNUNET_TESTING_Command cmd = { 134 struct GNUNET_TESTING_Command cmd = {
135 .cls = shs, 135 .cls = shs,
136 .label = label, 136 .label = label,
137 .run = &stop_testbed_run, 137 .run = &stop_testing_system_run,
138 .cleanup = &stop_testbed_cleanup, 138 .cleanup = &stop_testing_system_cleanup,
139 .traits = &stop_testbed_traits 139 .traits = &stop_testing_system_traits
140 }; 140 };
141 141
142 return cmd; 142 return cmd;
diff --git a/src/testbed/testbed_api_cmd_peer.c b/src/testbed/testbed_api_cmd_peer.c
deleted file mode 100644
index 2e253e408..000000000
--- a/src/testbed/testbed_api_cmd_peer.c
+++ /dev/null
@@ -1,281 +0,0 @@
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_peer.c
24 * @brief Command to create a peer.
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 struct PeerCmdState *ps = cls;
58
59 struct GNUNET_TESTING_Trait traits[] = {
60 {
61 .index = 0,
62 .trait_name = "peer",
63 .ptr = (const void *) ps->peer,
64 },
65 GNUNET_TESTING_trait_end ()
66 };
67
68 return GNUNET_TESTING_get_trait (traits,
69 ret,
70 trait,
71 index);
72
73 return GNUNET_OK;
74}
75
76/**
77 * Offer data from trait
78 *
79 * @param cmd command to extract the controller from.
80 * @param peer pointer GNUNET_TESTBED_PEER
81 * @return #GNUNET_OK on success.
82 */
83int
84GNUNET_TESTBED_get_trait_peer (const struct GNUNET_TESTING_Command *cmd,
85 struct GNUNET_TESTBED_Peer **
86 peer)
87{
88 return cmd->traits (cmd->cls,
89 (const void **) peer,
90 "peer",
91 (unsigned int) 0);
92}
93
94
95/**
96*
97*
98* @param cls closure
99* @param cmd current CMD being cleaned up.
100*/
101static void
102peer_cleanup (void *cls,
103 const struct GNUNET_TESTING_Command *cmd)
104{
105 (void) cls;
106}
107
108
109/**
110 * abort task to run on test timed out
111 *
112 * @param cls NULL
113 * @param tc the task context
114 */
115static void
116do_abort (void *cls)
117{
118 struct PeerCmdState *ps = cls;
119
120 if (GNUNET_NO == ps->peer_ready)
121 {
122 LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n");
123 ps->abort_task = NULL;
124 GNUNET_TESTBED_shutdown_peer (ps);
125 }
126}
127
128
129/**
130 * Functions of this signature are called when a peer has been successfully
131 * created
132 *
133 * @param cls the closure from GNUNET_TESTBED_peer_create()
134 * @param emsg MAY contain an error description, if starting peer failed.
135 */
136static void
137peer_started_cb (void *cls,
138 const char *emsg)
139{
140 struct PeerCmdState *ps = cls;
141
142 GNUNET_TESTBED_operation_done (ps->operation);
143 if (NULL == emsg)
144 {
145 ps->peer_ready = GNUNET_YES;
146 }
147 else
148 {
149 LOG (GNUNET_ERROR_TYPE_ERROR, "There was an error starting a peer: %s\n",
150 emsg);
151 }
152
153}
154
155
156/**
157 * Functions of this signature are called when a peer has been successfully
158 * created
159 *
160 * @param cls the closure from GNUNET_TESTBED_peer_create()
161 * @param peer the handle for the created peer; NULL on any error during
162 * creation
163 * @param emsg NULL if peer is not NULL; else MAY contain the error description
164 */
165static void
166peer_create_cb (void *cls,
167 struct GNUNET_TESTBED_Peer *peer,
168 const char *emsg)
169{
170 struct PeerCmdState *ps = cls;
171
172 ps->peer = peer;
173 GNUNET_TESTBED_operation_done (ps->operation);
174 ps->operation = GNUNET_TESTBED_peer_start (NULL,
175 peer,
176 &peer_started_cb,
177 ps);
178}
179
180
181static void
182peer_run (void *cls,
183 const struct GNUNET_TESTING_Command *cmd,
184 struct GNUNET_TESTING_Interpreter *is)
185{
186 struct PeerCmdState *ps = cls;
187 const struct GNUNET_TESTING_Command *controller_cmd;
188 struct GNUNET_TESTBED_Controller *controller;
189
190 ps->is = is;
191 controller_cmd = GNUNET_TESTING_interpreter_lookup_command (
192 ps->controller_label);
193 GNUNET_TESTBED_get_trait_controller (controller_cmd,
194 &controller);
195 ps->host = GNUNET_TESTBED_host_create (ps->hostname, ps->username, ps->cfg,
196 ps->port);
197 ps->operation =
198 GNUNET_TESTBED_peer_create (controller,
199 ps->host,
200 ps->cfg,
201 &peer_create_cb,
202 ps);
203
204 ps->abort_task =
205 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
206 (GNUNET_TIME_UNIT_MINUTES, 5),
207 &do_abort,
208 ps);
209}
210
211
212void
213peer_stopped_cb (void *cls,
214 const char *emsg)
215{
216 struct PeerCmdState *ps = cls;
217
218 if (NULL != emsg)
219 {
220 LOG (GNUNET_ERROR_TYPE_ERROR, "There was an error stopping a peer: %s\n",
221 emsg);
222 }
223 GNUNET_TESTBED_operation_done (ps->operation);
224 GNUNET_TESTBED_peer_destroy (ps->peer);
225}
226
227
228/**
229 * Shutdown nicely
230 *
231 * @param cs controller state.
232 */
233void
234GNUNET_TESTBED_shutdown_peer (struct PeerCmdState *ps)
235{
236 LOG (GNUNET_ERROR_TYPE_DEBUG,
237 "Shutting down...\n");
238
239 ps->peer_going_down = GNUNET_YES;
240
241 if (NULL != ps->abort_task)
242 GNUNET_SCHEDULER_cancel (ps->abort_task);
243 if (NULL != ps->cfg)
244 GNUNET_CONFIGURATION_destroy (ps->cfg);
245 if (NULL != ps->host)
246 GNUNET_TESTBED_host_destroy (ps->host);
247
248 GNUNET_TESTBED_operation_done (ps->operation);
249 ps->operation = GNUNET_TESTBED_peer_stop (NULL, ps->peer, peer_stopped_cb,
250 ps);
251
252}
253
254
255struct GNUNET_TESTING_Command
256GNUNET_TESTBED_cmd_peer (const char *label,
257 const char *controller_label,
258 const char *hostname,
259 const char *username,
260 uint16_t port,
261 struct GNUNET_CONFIGURATION_Handle *cfg)
262{
263 struct PeerCmdState *ps;
264
265 ps = GNUNET_new (struct PeerCmdState);
266 ps->hostname = hostname;
267 ps->username = username;
268 ps->port = port;
269 ps->cfg = cfg;
270 ps->controller_label = controller_label;
271
272 struct GNUNET_TESTING_Command cmd = {
273 .cls = ps,
274 .label = label,
275 .run = &peer_run,
276 .cleanup = &peer_cleanup,
277 .traits = &peer_traits
278 };
279
280 return cmd;
281}
diff --git a/src/testbed/testbed_api_cmd_peer_store.c b/src/testbed/testbed_api_cmd_peer_store.c
deleted file mode 100644
index fc96f589c..000000000
--- a/src/testbed/testbed_api_cmd_peer_store.c
+++ /dev/null
@@ -1,60 +0,0 @@
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_peer_store.c
23 * @brief Command to start the peer store service of a peer.
24 * @author t3sserakt
25 */
26
27
28static void
29service_run (void *cls,
30 const struct GNUNET_TESTING_Command *cmd,
31 struct GNUNET_TESTING_Interpreter *is)
32{
33 struct PeerStoreState *pss = cls;
34
35 pss->psh = GNUNET_PEERSTORE_connect (pss->cfg);
36 GNUNET_TESTING_interpreter_next (ps->is);
37}
38
39
40struct GNUNET_TESTING_Command
41GNUNET_TESTBED_cmd_peer_store (const char *label,
42 struct GNUNET_CONFIGURATION_Handle *cfg)
43{
44
45 struct PeerStoreState *pss;
46
47 pss = GNUNET_new (struct PeerStoreState);
48 pss->cfg = cfg;
49
50 struct GNUNET_TESTING_Command cmd = {
51 .cls = pss,
52 .label = label,
53 .run = &peer_store_run,
54 .cleanup = &peer_store_cleanup,
55 .traits = &peer_store_traits
56 };
57
58 return cmd;
59
60}
diff --git a/src/testbed/testbed_api_cmd_send_peer_ready.c b/src/testbed/testbed_api_cmd_send_peer_ready.c
index f175a3e18..987f0853e 100644
--- a/src/testbed/testbed_api_cmd_send_peer_ready.c
+++ b/src/testbed/testbed_api_cmd_send_peer_ready.c
@@ -31,7 +31,7 @@
31 31
32struct SendPeerReadyState 32struct SendPeerReadyState
33{ 33{
34 TESTBED_CMD_HELPER_write_cb write_message; 34 TESTING_CMD_HELPER_write_cb write_message;
35 35
36 struct GNUNET_CMDS_PEER_STARTED *reply; 36 struct GNUNET_CMDS_PEER_STARTED *reply;
37}; 37};
@@ -84,7 +84,7 @@ send_peer_ready_run (void *cls,
84 */ 84 */
85struct GNUNET_TESTING_Command 85struct GNUNET_TESTING_Command
86GNUNET_TESTING_cmd_send_peer_ready (const char *label, 86GNUNET_TESTING_cmd_send_peer_ready (const char *label,
87 TESTBED_CMD_HELPER_write_cb write_message) 87 TESTING_CMD_HELPER_write_cb write_message)
88{ 88{
89 struct SendPeerReadyState *sprs; 89 struct SendPeerReadyState *sprs;
90 90
diff --git a/src/testbed/testbed_api_cmd_tng_connect.c b/src/testbed/testbed_api_cmd_tng_connect.c
deleted file mode 100644
index e52cd3c76..000000000
--- a/src/testbed/testbed_api_cmd_tng_connect.c
+++ /dev/null
@@ -1,55 +0,0 @@
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_peer.c
24 * @brief Command to create a peer.
25 * @author t3sserakt
26 */
27
28
29static void
30tng_connect_run (void *cls,
31 const struct GNUNET_TESTING_Command *cmd,
32 struct GNUNET_TESTING_Interpreter *is)
33{
34 struct TngConnectState *tcs = cls;
35
36 tcs->ah = GNUNET_TRANSPORT_application_init (tcs->cfg);
37}
38
39struct GNUNET_TESTING_Command
40GNUNET_TESTBED_cmd_tng_connect (const char *label)
41{
42 struct TngConnectState *tcs;
43
44 ts = GNUNET_new (struct TngConnectState);
45
46 struct GNUNET_TESTING_Command cmd = {
47 .cls = tcs,
48 .label = label,
49 .run = &tng_connect_run,
50 .cleanup = &tmg_connect_cleanup,
51 .traits = &tng_connect_traits
52 };
53
54 return cmd;
55}
diff --git a/src/testbed/testbed_api_cmd_tng_service.c b/src/testbed/testbed_api_cmd_tng_service.c
deleted file mode 100644
index cce2e14e3..000000000
--- a/src/testbed/testbed_api_cmd_tng_service.c
+++ /dev/null
@@ -1,276 +0,0 @@
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_tng.c
23 * @brief Command to start the transport service of a peer.
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 * Generic logging shortcut
35 */
36#define LOG(kind, ...) \
37 GNUNET_log (kind, __VA_ARGS__)
38
39
40/**
41 * abort task to run on test timed out
42 *
43 * @param cls NULL
44 * @param tc the task context
45 */
46static void
47do_abort (void *cls)
48{
49 struct TngState *ts = cls;
50
51 if (GNUNET_NO == ts->service_ready)
52 {
53 LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n");
54 ts->abort_task = NULL;
55 GNUNET_TESTBED_shutdown_service (ts);
56 }
57}
58
59/**
60*
61*
62* @param cls closure
63* @param cmd current CMD being cleaned up.
64*/
65static void
66tng_service_cleanup (void *cls,
67 const struct GNUNET_TESTING_Command *cmd)
68{
69 (void) cls;
70}
71
72/**
73*
74*
75* @param cls closure.
76* @param[out] ret result
77* @param trait name of the trait.
78* @param index index number of the object to offer.
79* @return #GNUNET_OK on success.
80*/
81static int
82tng_service_traits (void *cls,
83 const void **ret,
84 const char *trait,
85 unsigned int index)
86{
87 (void) cls;
88 return GNUNET_OK;
89}
90
91
92static void *
93notify_connect (void *cls,
94 const struct GNUNET_PeerIdentity *peer,
95 struct GNUNET_MQ_Handle *mq)
96{
97 struct TngState *ts = cls;
98
99 if (NULL != emsg)
100 {
101 LOG (GNUNET_ERROR_TYPE_ERROR,
102 "There was an error starting the transport subsystem: %s\n",
103 emsg);
104 }
105 GNUNET_TESTING_interpreter_next (ps->is);
106 return ts->nc (ts->cb_cls);
107
108}
109
110
111static void
112notify_disconnect (void *cls,
113 const struct GNUNET_PeerIdentity *peer,
114 void *handler_cls)
115{
116}
117
118
119
120
121/**
122 * Adapter function called to establish a connection to
123 * a service.
124 *
125 * @param cls closure
126 * @param cfg configuration of the peer to connect to; will be available until
127 * GNUNET_TESTBED_operation_done() is called on the operation returned
128 * from GNUNET_TESTBED_service_connect()
129 * @return service handle to return in 'op_result', NULL on error
130 */
131static void *
132connect_adapter (void *cls,
133 const struct GNUNET_CONFIGURATION_Handle *cfg)
134{
135 struct TngState *ts = cls;
136
137 service_handle = GNUNET_TRANSPORT_core_connect (cfg,
138 ts->peer_identity,
139 ts->handlers,
140 ts,
141 &notify_connect,
142 &notify_disconnect);
143 return service_handle;
144}
145
146
147/**
148 * Adapter function called to destroy a connection to
149 * a service.
150 *
151 * @param cls closure
152 * @param op_result service handle returned from the connect adapter
153 */
154static void
155disconnect_adapter (void *cls,
156 void *op_result)
157{
158}
159
160/**
161 * Callback to be called when a service connect operation is completed
162 *
163 * @param cls the callback closure from functions generating an operation
164 * @param op the operation that has been finished
165 * @param ca_result the service handle returned from GNUNET_TESTBED_ConnectAdapter()
166 * @param emsg error message in case the operation has failed; will be NULL if
167 * operation has executed successfully.
168 */
169static void
170service_connect_comp_cb (void *cls,
171 struct GNUNET_TESTBED_Operation *op,
172 void *ca_result,
173 const char *emsg)
174{
175 struct TngState *ts = cls;
176
177 if (NULL != emsg)
178 {
179 LOG (GNUNET_ERROR_TYPE_DEBUG,
180 "An error occurred connecting to service %s\n",
181 emsg);
182 GNUNET_TESTBED_operation_done (ts->operation);
183 }
184}
185
186
187/**
188 * Callback to be called when the requested peer information is available
189 *
190 * @param cls the closure from GNUNET_TESTBED_peer_getinformation()
191 * @param op the operation this callback corresponds to
192 * @param pinfo the result; will be NULL if the operation has failed
193 * @param emsg error message if the operation has failed;
194 * NULL if the operation is successful
195 */
196static void
197pi_cb (void *cls,
198 struct GNUNET_TESTBED_Operation *op,
199 const struct GNUNET_TESTBED_PeerInformation *pinfo,
200 const char *emsg)
201{
202 struct TngState *ts = cls;
203
204 ts->peer_identity = pinfo->id;
205 ts->operation =
206 GNUNET_TESTBED_service_connect (NULL, peer, NULL,
207 &service_connect_comp_cb, ts,
208 &connect_adapter,
209 &disconnect_adapter,
210 ts);
211}
212
213
214static void
215tng_service_run (void *cls,
216 const struct GNUNET_TESTING_Command *cmd,
217 struct GNUNET_TESTING_Interpreter *is)
218{
219 struct TngState *ts = cls;
220 struct GNUNET_TESTBED_Peer *peer;
221 const struct GNUNET_TESTING_Command *peer_cmd;
222
223 ts->is = is;
224 peer_cmd = GNUNET_TESTING_interpreter_lookup_command (
225 ts->peer_label);
226 GNUNET_TESTBED_get_trait_peer (peer_cmd,
227 &peer);
228
229 ts->operation = GNUNET_TESTBED_peer_get_information (peer,
230 GNUNET_TESTBED_PIT_IDENTITY,
231 &pi_cb,
232 ts);
233}
234
235/**
236 * Shutdown nicely
237 *
238 * @param cs service state.
239 */
240void
241GNUNET_TESTBED_shutdown_service (struct TngState *cs)
242{
243 LOG (GNUNET_ERROR_TYPE_DEBUG,
244 "Shutting down...\n");
245}
246
247
248struct GNUNET_TESTING_Command
249GNUNET_TESTBED_cmd_tng_service (const char *label,
250 const char *peer_label,
251 const struct GNUNET_MQ_MessageHandler *handlers,
252 GNUNET_TRANSPORT_NotifyConnect nc,
253 void *cb_cls)
254
255{
256 struct TngState *ts;
257
258 ts = GNUNET_new (struct TngState);
259 ts->servicename = servicename;
260 ts->peer_label = peer_label;
261 ts->handlers = handlers;
262 ts->nc = nc;
263 ts->nd = nd;
264 ts->cb_cls;
265
266
267 struct GNUNET_TESTING_Command cmd = {
268 .cls = ts,
269 .label = label,
270 .run = &tng_service_run,
271 .cleanup = &tmg_service_cleanup,
272 .traits = &tng_service_traits
273 };
274
275 return cmd;
276}
diff --git a/src/testing/netjail_exec.sh b/src/testing/netjail_exec.sh
new file mode 100755
index 000000000..b76d2e444
--- /dev/null
+++ b/src/testing/netjail_exec.sh
@@ -0,0 +1,16 @@
1#!/bin/sh
2. "./../testbed/netjail_core.sh"
3
4set -eu
5set -x
6
7export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
8
9M=$1
10N=$2
11
12NODE=$(netjail_print_name "N" $N $M)
13
14
15
16netjail_node_exec_without_fds $NODE $3 $4 $5 $1 $2
diff --git a/src/testing/netjail_start.sh b/src/testing/netjail_start.sh
new file mode 100755
index 000000000..4c1c33c83
--- /dev/null
+++ b/src/testing/netjail_start.sh
@@ -0,0 +1,52 @@
1#!/bin/sh
2. "./../testbed/netjail_core.sh"
3
4set -eu
5set -x
6
7export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
8
9LOCAL_M=$1
10GLOBAL_N=$2
11
12# TODO: stunserver? ..and globally known peer?
13
14shift 2
15
16LOCAL_GROUP="192.168.15"
17GLOBAL_GROUP="92.68.150"
18
19NETWORK_NET=$(netjail_print_name "n" $GLOBAL_N $LOCAL_M)
20
21netjail_bridge $NETWORK_NET
22
23for N in $(seq $GLOBAL_N); do
24 ROUTER=$(netjail_print_name "R" $N)
25
26 netjail_node $ROUTER
27 netjail_node_link_bridge $ROUTER $NETWORK_NET "$GLOBAL_GROUP.$N" 24
28
29 ROUTER_NET=$(netjail_print_name "r" $N)
30
31 netjail_bridge $ROUTER_NET
32
33 for M in $(seq $LOCAL_M); do
34 NODE=$(netjail_print_name "N" $N $M)
35
36 netjail_node $NODE
37 netjail_node_link_bridge $NODE $ROUTER_NET "$LOCAL_GROUP.$M" 24
38 done
39
40 ROUTER_ADDR="$LOCAL_GROUP.$(($LOCAL_M+1))"
41
42 netjail_node_link_bridge $ROUTER $ROUTER_NET $ROUTER_ADDR 24
43 netjail_node_add_nat $ROUTER $ROUTER_ADDR 24
44
45 for M in $(seq $LOCAL_M); do
46 NODE=$(netjail_print_name "N" $N $M)
47
48 netjail_node_add_default $NODE $ROUTER_ADDR
49 done
50done
51
52
diff --git a/src/testing/netjail_stop.sh b/src/testing/netjail_stop.sh
new file mode 100755
index 000000000..689bf7ae9
--- /dev/null
+++ b/src/testing/netjail_stop.sh
@@ -0,0 +1,26 @@
1#!/bin/sh
2. "./../testbed/netjail_core.sh"
3
4set -eu
5set -x
6
7export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
8
9LOCAL_M=$1
10GLOBAL_N=$2
11NETWORK_NET=$(netjail_print_name "n" $GLOBAL_N $LOCAL_M)
12
13shift 2
14
15for N in $(seq $GLOBAL_N); do
16 for M in $(seq $LOCAL_M); do
17 netjail_node_clear $(netjail_print_name "N" $N $M)
18 done
19
20 netjail_bridge_clear $(netjail_print_name "r" $N)
21 netjail_node_clear $(netjail_print_name "R" $N)
22done
23
24netjail_bridge_clear $NETWORK_NET
25
26echo "Done"
diff --git a/src/testing/testing_api_cmd_send_peer_ready.c b/src/testing/testing_api_cmd_send_peer_ready.c
index 27761c4d5..e5e004924 100644
--- a/src/testing/testing_api_cmd_send_peer_ready.c
+++ b/src/testing/testing_api_cmd_send_peer_ready.c
@@ -32,7 +32,7 @@
32 32
33struct SendPeerReadyState 33struct SendPeerReadyState
34{ 34{
35 TESTBED_CMD_HELPER_write_cb write_message; 35 TESTING_CMD_HELPER_write_cb write_message;
36 36
37 struct GNUNET_CMDS_PEER_STARTED *reply; 37 struct GNUNET_CMDS_PEER_STARTED *reply;
38}; 38};
@@ -85,7 +85,7 @@ send_peer_ready_run (void *cls,
85 */ 85 */
86struct GNUNET_TESTING_Command 86struct GNUNET_TESTING_Command
87GNUNET_TESTING_cmd_send_peer_ready (const char *label, 87GNUNET_TESTING_cmd_send_peer_ready (const char *label,
88 TESTBED_CMD_HELPER_write_cb write_message) 88 TESTING_CMD_HELPER_write_cb write_message)
89{ 89{
90 struct SendPeerReadyState *sprs; 90 struct SendPeerReadyState *sprs;
91 91
diff --git a/src/transport/plugin_cmd_simple_send.c b/src/transport/plugin_cmd_simple_send.c
index 2a4a8c137..468f4e48a 100644
--- a/src/transport/plugin_cmd_simple_send.c
+++ b/src/transport/plugin_cmd_simple_send.c
@@ -83,7 +83,7 @@ all_peers_started ()
83} 83}
84 84
85static void 85static void
86start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip, 86start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
87 char *node_ip, 87 char *node_ip,
88 char *m, 88 char *m,
89 char *n, 89 char *n,
diff --git a/src/transport/test_transport_api_cmd_simple_send.c b/src/transport/test_transport_api_cmd_simple_send.c
index 26da53c47..1cc16f307 100644
--- a/src/transport/test_transport_api_cmd_simple_send.c
+++ b/src/transport/test_transport_api_cmd_simple_send.c
@@ -43,19 +43,19 @@ static void
43run (void *cls) 43run (void *cls)
44{ 44{
45 struct GNUNET_TESTING_Command commands[] = { 45 struct GNUNET_TESTING_Command commands[] = {
46 GNUNET_TESTBED_cmd_netjail_start ("netjail-start-1", 46 GNUNET_TESTING_cmd_netjail_start ("netjail-start-1",
47 "2", 47 "2",
48 "1"), 48 "1"),
49 GNUNET_TESTBED_cmd_netjail_start_testbed ("netjail-start-testbed-1", 49 GNUNET_TESTING_cmd_netjail_start_testing_system ("netjail-start-testbed-1",
50 "2", 50 "2",
51 "1", 51 "1",
52 "libgnunet_plugin_cmd_simple_send", 52 "libgnunet_plugin_cmd_simple_send",
53 &rv), 53 &rv),
54 GNUNET_TESTBED_cmd_stop_testbed ("stop-testbed", 54 GNUNET_TESTING_cmd_stop_testing_system ("stop-testbed",
55 "netjail-start-testbed-1", 55 "netjail-start-testbed-1",
56 "2", 56 "2",
57 "1"), 57 "1"),
58 GNUNET_TESTBED_cmd_netjail_stop ("netjail-stop-1", 58 GNUNET_TESTING_cmd_netjail_stop ("netjail-stop-1",
59 "2", 59 "2",
60 "1"), 60 "1"),
61 GNUNET_TESTING_cmd_end () 61 GNUNET_TESTING_cmd_end ()