aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2021-07-23 13:31:34 +0200
committert3sserakt <t3ss@posteo.de>2021-07-23 13:31:34 +0200
commitc96fdfad67a3eed8ca61b9e228b81f3a85a3b2c5 (patch)
treed83c9584bb010fae36b0994c5a95f30509d72694 /src
parent6b2c5a92fbc3a57c42fc9fb38c4705ecb7afb328 (diff)
downloadgnunet-c96fdfad67a3eed8ca61b9e228b81f3a85a3b2c5.tar.gz
gnunet-c96fdfad67a3eed8ca61b9e228b81f3a85a3b2c5.zip
- moving cmds to other packages
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_testing_ng_lib.h13
-rw-r--r--src/include/gnunet_transport_application_service.h9
-rw-r--r--src/include/gnunet_transport_service.h14
-rw-r--r--src/testbed/gnunet-cmd.c2
-rw-r--r--src/transport/Makefile.am5
-rw-r--r--src/transport/plugin_cmd_simple_send.c38
-rw-r--r--src/transport/transport_api_cmd_connecting_peers.c11
-rw-r--r--src/transport/transport_api_cmd_start_peer.c23
8 files changed, 77 insertions, 38 deletions
diff --git a/src/include/gnunet_testing_ng_lib.h b/src/include/gnunet_testing_ng_lib.h
index 994ce31f1..08bc63aae 100644
--- a/src/include/gnunet_testing_ng_lib.h
+++ b/src/include/gnunet_testing_ng_lib.h
@@ -29,7 +29,6 @@
29 29
30#include "gnunet_util_lib.h" 30#include "gnunet_util_lib.h"
31#include "gnunet_testing_plugin.h" 31#include "gnunet_testing_plugin.h"
32#include "gnunet_transport_application_service.h"
33#include "gnunet_testing_lib.h" 32#include "gnunet_testing_lib.h"
34 33
35 34
@@ -833,12 +832,7 @@ int
833GNUNET_TESTING_get_trait_what_am_i (const struct GNUNET_TESTING_Command *cmd, 832GNUNET_TESTING_get_trait_what_am_i (const struct GNUNET_TESTING_Command *cmd,
834 char **what_am_i); 833 char **what_am_i);
835 834
836int 835
837GNUNET_TESTING_get_trait_application_handle (const struct
838 GNUNET_TESTING_Command *cmd,
839 struct
840 GNUNET_TRANSPORT_ApplicationHandle
841 **ah);
842 836
843int 837int
844GNUNET_TESTING_get_trait_peer_id (const struct 838GNUNET_TESTING_get_trait_peer_id (const struct
@@ -868,4 +862,9 @@ int
868GNUNET_TESTING_get_trait_test_system (const struct 862GNUNET_TESTING_get_trait_test_system (const struct
869 GNUNET_TESTING_Command *cmd, 863 GNUNET_TESTING_Command *cmd,
870 struct GNUNET_TESTING_System **test_system); 864 struct GNUNET_TESTING_System **test_system);
865
866struct GNUNET_TESTING_Command
867GNUNET_TESTING_cmd_system_create (const char *label,
868 const char *testdir);
869
871#endif 870#endif
diff --git a/src/include/gnunet_transport_application_service.h b/src/include/gnunet_transport_application_service.h
index 35585d954..0562e2183 100644
--- a/src/include/gnunet_transport_application_service.h
+++ b/src/include/gnunet_transport_application_service.h
@@ -35,6 +35,8 @@
35#include "gnunet_constants.h" 35#include "gnunet_constants.h"
36#include "gnunet_util_lib.h" 36#include "gnunet_util_lib.h"
37#include "gnunet_nt_lib.h" 37#include "gnunet_nt_lib.h"
38#include "gnunet_testing_lib.h"
39#include "gnunet_testing_ng_lib.h"
38 40
39/** 41/**
40 * Handle to the TRANSPORT subsystem for making suggestions about 42 * Handle to the TRANSPORT subsystem for making suggestions about
@@ -114,6 +116,13 @@ GNUNET_TRANSPORT_application_validate (
114 enum GNUNET_NetworkType nt, 116 enum GNUNET_NetworkType nt,
115 const char *addr); 117 const char *addr);
116 118
119int
120GNUNET_TRANSPORT_get_trait_application_handle (const struct
121 GNUNET_TESTING_Command *cmd,
122 struct
123 GNUNET_TRANSPORT_ApplicationHandle
124 **ah);
125
117/** @} */ /* end of group */ 126/** @} */ /* end of group */
118 127
119#endif 128#endif
diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h
index d190eff92..97dfda1ec 100644
--- a/src/include/gnunet_transport_service.h
+++ b/src/include/gnunet_transport_service.h
@@ -686,6 +686,20 @@ GNUNET_TRANSPORT_core_get_mq (struct GNUNET_TRANSPORT_CoreHandle *handle,
686 const struct GNUNET_PeerIdentity *peer); 686 const struct GNUNET_PeerIdentity *peer);
687 687
688 688
689struct GNUNET_TESTING_Command
690GNUNET_TRANSPORT_cmd_start_peer (const char *label,
691 const char *system_label,
692 char *m,
693 char *n,
694 struct GNUNET_MQ_MessageHandler *handlers,
695 const char *cfgname);
696
697struct GNUNET_TESTING_Command
698GNUNET_TRANSPORT_cmd_connect_peers (const char *label,
699 const char *peer1_label,
700 const char *peer2_label);
701
702
689#if 0 /* keep Emacsens' auto-indent happy */ 703#if 0 /* keep Emacsens' auto-indent happy */
690{ 704{
691#endif 705#endif
diff --git a/src/testbed/gnunet-cmd.c b/src/testbed/gnunet-cmd.c
index 7889750ba..f232bd805 100644
--- a/src/testbed/gnunet-cmd.c
+++ b/src/testbed/gnunet-cmd.c
@@ -90,7 +90,7 @@ run (void *cls)
90 strcat (node_ip, NODE_BASE_IP); 90 strcat (node_ip, NODE_BASE_IP);
91 strcat (node_ip, plugin->n); 91 strcat (node_ip, plugin->n);
92 92
93 plugin->api->start_testcase (NULL, router_ip, node_ip); 93 plugin->api->start_testcase (NULL, router_ip, node_ip, NULL, NULL);
94 94
95} 95}
96 96
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 9f680ad3b..255a7973f 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -398,15 +398,16 @@ plugin_LTLIBRARIES = \
398 $(HTTPS_SERVER_PLUGIN_LA) \ 398 $(HTTPS_SERVER_PLUGIN_LA) \
399 $(WLAN_PLUGIN_LA) \ 399 $(WLAN_PLUGIN_LA) \
400 $(BT_PLUGIN_LA) 400 $(BT_PLUGIN_LA)
401 # libgnunet_plugin_simple_send.la 401# libgnunet_plugin_cmd_simple_send.la
402 402
403# libgnunet_plugin_cmd_simple_send_la_SOURCES = \ 403# libgnunet_plugin_cmd_simple_send_la_SOURCES = \
404# plugin_cmd_simple_send.c 404# plugin_cmd_simple_send.c
405# libgnunet_plugin_cmd_simple_send_la_LIBADD = \ 405# libgnunet_plugin_cmd_simple_send_la_LIBADD = \
406# $(top_builddir)/src/util/libgnunetutil.la \ 406# $(top_builddir)/src/util/libgnunetutil.la \
407# $(top_builddir)/src/testing/libgnunettesting.la \ 407# $(top_builddir)/src/testing/libgnunettesting.la \
408# $(top_builddir)/src/statistics/libgnunetstatistics.la \ 408# $(top_builddir)/src/statistics/libgnunetstatistics.la \
409# $(top_builddir)/src/testbed/libgnunettestbed.la \ 409# $(top_builddir)/src/testbed/libgnunettestbed.la \
410# libgnunettransport.la \
410# $(LTLIBINTL) 411# $(LTLIBINTL)
411# libgnunet_plugin_cmd_simple_send_la_LDFLAGS = \ 412# libgnunet_plugin_cmd_simple_send_la_LDFLAGS = \
412# $(GN_PLUGIN_LDFLAGS) 413# $(GN_PLUGIN_LDFLAGS)
diff --git a/src/transport/plugin_cmd_simple_send.c b/src/transport/plugin_cmd_simple_send.c
index ed3481c00..1fa2f1f03 100644
--- a/src/transport/plugin_cmd_simple_send.c
+++ b/src/transport/plugin_cmd_simple_send.c
@@ -26,8 +26,9 @@
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_testing_ng_lib.h" 27#include "gnunet_testing_ng_lib.h"
28#include "gnunet_util_lib.h" 28#include "gnunet_util_lib.h"
29#include "gnunet_transport_application_service.h"
30#include "gnunet_transport_service.h"
29#include "gnunet_testbed_ng_service.h" 31#include "gnunet_testbed_ng_service.h"
30
31/** 32/**
32 * Generic logging shortcut 33 * Generic logging shortcut
33 */ 34 */
@@ -35,6 +36,20 @@
35 36
36#define BASE_DIR "testdir" 37#define BASE_DIR "testdir"
37 38
39struct GNUNET_MQ_MessageHandler *handlers;
40
41const char *cfgname;
42
43unsigned int are_all_peers_started;
44
45static void
46all_peers_started ()
47{
48 are_all_peers_started = GNUNET_YES;
49 LOG (GNUNET_ERROR_TYPE_ERROR,
50 "setting are_all_peers_started: %d\n",
51 are_all_peers_started);
52}
38 53
39static void 54static void
40start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip, 55start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip,
@@ -42,10 +57,9 @@ start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip,
42 char *m, 57 char *m,
43 char *n) 58 char *n)
44{ 59{
45 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
46 char *testdir; 60 char *testdir;
47 61
48 testdir = GNUNET_malloc (strlen (basedir) + strlen (m) + strlen (n) 62 testdir = GNUNET_malloc (strlen (BASE_DIR) + strlen (m) + strlen (n)
49 + 1); 63 + 1);
50 64
51 strcpy (testdir, BASE_DIR); 65 strcpy (testdir, BASE_DIR);
@@ -55,19 +69,19 @@ start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip,
55 struct GNUNET_TESTING_Command commands[] = { 69 struct GNUNET_TESTING_Command commands[] = {
56 GNUNET_TESTING_cmd_system_create ("system-create-1", 70 GNUNET_TESTING_cmd_system_create ("system-create-1",
57 testdir), 71 testdir),
58 GNUNET_TESTING_cmd_start_peer ("start-peer-1", 72 /*GNUNET_TRANSPORT_cmd_start_peer ("start-peer-1",
59 "system-create-1", 73 "system-create-1",
60 m, 74 m,
61 n, 75 n,
62 struct GNUNET_MQ_MessageHandler *handlers, 76 handlers,
63 const char *cfgname), 77 cfgname),*/
64 GNUNET_TESTING_cmd_send_peer_ready ("send-peer-ready-1", 78 GNUNET_TESTING_cmd_send_peer_ready ("send-peer-ready-1",
65 write_message), 79 write_message),
66 GNUNET_TESTING_cmd_block_until_all_peers_started ("block-1", 80 GNUNET_TESTING_cmd_block_until_all_peers_started ("block-1",
67 &are_all_peers_started), 81 &are_all_peers_started),
68 GNUNET_TESTING_cmd_connect_peers ("connect-peers-1", 82 /*GNUNET_TRANSPORT_cmd_connect_peers ("connect-peers-1",
69 "start-peer-1", 83 "start-peer-1",
70 "this is useless"), 84 "this is useless"),*/
71 /*GNUNET_TESTING_cmd_send_simple ("send-simple-1", 85 /*GNUNET_TESTING_cmd_send_simple ("send-simple-1",
72 char *m, 86 char *m,
73 char *n, 87 char *n,
diff --git a/src/transport/transport_api_cmd_connecting_peers.c b/src/transport/transport_api_cmd_connecting_peers.c
index 297b90864..06e2b8d61 100644
--- a/src/transport/transport_api_cmd_connecting_peers.c
+++ b/src/transport/transport_api_cmd_connecting_peers.c
@@ -28,6 +28,7 @@
28#include "gnunet_testing_ng_lib.h" 28#include "gnunet_testing_ng_lib.h"
29#include "gnunet_transport_application_service.h" 29#include "gnunet_transport_application_service.h"
30#include "gnunet_hello_lib.h" 30#include "gnunet_hello_lib.h"
31#include "gnunet_transport_service.h"
31 32
32/** 33/**
33 * Generic logging shortcut 34 * Generic logging shortcut
@@ -59,8 +60,8 @@ connect_peers_run (void *cls,
59 enum GNUNET_NetworkType nt = 0; 60 enum GNUNET_NetworkType nt = 0;
60 61
61 peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (cps->peer1_label); 62 peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (cps->peer1_label);
62 GNUNET_TESTING_get_trait_application_handle (peer1_cmd, 63 GNUNET_TRANSPORT_get_trait_application_handle (peer1_cmd,
63 &ah); 64 &ah);
64 65
65 GNUNET_TESTING_get_trait_hello (peer1_cmd, 66 GNUNET_TESTING_get_trait_hello (peer1_cmd,
66 &hello); 67 &hello);
@@ -154,9 +155,9 @@ connect_peers_cleanup (void *cls,
154 * @return command. 155 * @return command.
155 */ 156 */
156struct GNUNET_TESTING_Command 157struct GNUNET_TESTING_Command
157GNUNET_TESTING_cmd_connect_peers (const char *label, 158GNUNET_TRANSPORT_cmd_connect_peers (const char *label,
158 const char *peer1_label, 159 const char *peer1_label,
159 const char *peer2_label) 160 const char *peer2_label)
160{ 161{
161 struct ConnectPeersState *cps; 162 struct ConnectPeersState *cps;
162 163
diff --git a/src/transport/transport_api_cmd_start_peer.c b/src/transport/transport_api_cmd_start_peer.c
index 4077b7561..0ad9f99af 100644
--- a/src/transport/transport_api_cmd_start_peer.c
+++ b/src/transport/transport_api_cmd_start_peer.c
@@ -28,6 +28,7 @@
28#include "gnunet_testing_ng_lib.h" 28#include "gnunet_testing_ng_lib.h"
29#include "gnunet_peerstore_service.h" 29#include "gnunet_peerstore_service.h"
30#include "gnunet_transport_core_service.h" 30#include "gnunet_transport_core_service.h"
31#include "gnunet_transport_application_service.h"
31 32
32/** 33/**
33 * Generic logging shortcut 34 * Generic logging shortcut
@@ -483,11 +484,11 @@ GNUNET_TESTING_get_trait_connected_peers_map (const struct
483 484
484 485
485int 486int
486GNUNET_TESTING_get_trait_application_handle (const struct 487GNUNET_TRANSPORT_get_trait_application_handle (const struct
487 GNUNET_TESTING_Command *cmd, 488 GNUNET_TESTING_Command *cmd,
488 struct 489 struct
489 GNUNET_TRANSPORT_ApplicationHandle 490 GNUNET_TRANSPORT_ApplicationHandle
490 **ah) 491 **ah)
491{ 492{
492 return cmd->traits (cmd->cls, 493 return cmd->traits (cmd->cls,
493 (const void **) ah, 494 (const void **) ah,
@@ -515,12 +516,12 @@ GNUNET_TESTING_get_trait_peer_id (const struct
515 * @return command. 516 * @return command.
516 */ 517 */
517struct GNUNET_TESTING_Command 518struct GNUNET_TESTING_Command
518GNUNET_TESTING_cmd_start_peer (const char *label, 519GNUNET_TRANSPORT_cmd_start_peer (const char *label,
519 const char *system_label, 520 const char *system_label,
520 char *m, 521 char *m,
521 char *n, 522 char *n,
522 struct GNUNET_MQ_MessageHandler *handlers, 523 struct GNUNET_MQ_MessageHandler *handlers,
523 const char *cfgname) 524 const char *cfgname)
524{ 525{
525 struct StartPeerState *sps; 526 struct StartPeerState *sps;
526 struct GNUNET_CONTAINER_MultiPeerMap *connected_peers_map = 527 struct GNUNET_CONTAINER_MultiPeerMap *connected_peers_map =