From c96fdfad67a3eed8ca61b9e228b81f3a85a3b2c5 Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Fri, 23 Jul 2021 13:31:34 +0200 Subject: - moving cmds to other packages --- src/transport/Makefile.am | 5 +-- src/transport/plugin_cmd_simple_send.c | 38 +++++++++++++++------- src/transport/transport_api_cmd_connecting_peers.c | 11 ++++--- src/transport/transport_api_cmd_start_peer.c | 23 ++++++------- 4 files changed, 47 insertions(+), 30 deletions(-) (limited to 'src/transport') 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 = \ $(HTTPS_SERVER_PLUGIN_LA) \ $(WLAN_PLUGIN_LA) \ $(BT_PLUGIN_LA) - # libgnunet_plugin_simple_send.la +# libgnunet_plugin_cmd_simple_send.la # libgnunet_plugin_cmd_simple_send_la_SOURCES = \ -# plugin_cmd_simple_send.c +# plugin_cmd_simple_send.c # libgnunet_plugin_cmd_simple_send_la_LIBADD = \ # $(top_builddir)/src/util/libgnunetutil.la \ # $(top_builddir)/src/testing/libgnunettesting.la \ # $(top_builddir)/src/statistics/libgnunetstatistics.la \ # $(top_builddir)/src/testbed/libgnunettestbed.la \ +# libgnunettransport.la \ # $(LTLIBINTL) # libgnunet_plugin_cmd_simple_send_la_LDFLAGS = \ # $(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 @@ #include "platform.h" #include "gnunet_testing_ng_lib.h" #include "gnunet_util_lib.h" +#include "gnunet_transport_application_service.h" +#include "gnunet_transport_service.h" #include "gnunet_testbed_ng_service.h" - /** * Generic logging shortcut */ @@ -35,6 +36,20 @@ #define BASE_DIR "testdir" +struct GNUNET_MQ_MessageHandler *handlers; + +const char *cfgname; + +unsigned int are_all_peers_started; + +static void +all_peers_started () +{ + are_all_peers_started = GNUNET_YES; + LOG (GNUNET_ERROR_TYPE_ERROR, + "setting are_all_peers_started: %d\n", + are_all_peers_started); +} static void start_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, char *m, char *n) { - struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); char *testdir; - testdir = GNUNET_malloc (strlen (basedir) + strlen (m) + strlen (n) + testdir = GNUNET_malloc (strlen (BASE_DIR) + strlen (m) + strlen (n) + 1); strcpy (testdir, BASE_DIR); @@ -55,19 +69,19 @@ start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip, struct GNUNET_TESTING_Command commands[] = { GNUNET_TESTING_cmd_system_create ("system-create-1", testdir), - GNUNET_TESTING_cmd_start_peer ("start-peer-1", - "system-create-1", - m, - n, - struct GNUNET_MQ_MessageHandler *handlers, - const char *cfgname), + /*GNUNET_TRANSPORT_cmd_start_peer ("start-peer-1", + "system-create-1", + m, + n, + handlers, + cfgname),*/ GNUNET_TESTING_cmd_send_peer_ready ("send-peer-ready-1", write_message), GNUNET_TESTING_cmd_block_until_all_peers_started ("block-1", &are_all_peers_started), - GNUNET_TESTING_cmd_connect_peers ("connect-peers-1", - "start-peer-1", - "this is useless"), + /*GNUNET_TRANSPORT_cmd_connect_peers ("connect-peers-1", + "start-peer-1", + "this is useless"),*/ /*GNUNET_TESTING_cmd_send_simple ("send-simple-1", char *m, 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 @@ #include "gnunet_testing_ng_lib.h" #include "gnunet_transport_application_service.h" #include "gnunet_hello_lib.h" +#include "gnunet_transport_service.h" /** * Generic logging shortcut @@ -59,8 +60,8 @@ connect_peers_run (void *cls, enum GNUNET_NetworkType nt = 0; peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (cps->peer1_label); - GNUNET_TESTING_get_trait_application_handle (peer1_cmd, - &ah); + GNUNET_TRANSPORT_get_trait_application_handle (peer1_cmd, + &ah); GNUNET_TESTING_get_trait_hello (peer1_cmd, &hello); @@ -154,9 +155,9 @@ connect_peers_cleanup (void *cls, * @return command. */ struct GNUNET_TESTING_Command -GNUNET_TESTING_cmd_connect_peers (const char *label, - const char *peer1_label, - const char *peer2_label) +GNUNET_TRANSPORT_cmd_connect_peers (const char *label, + const char *peer1_label, + const char *peer2_label) { struct ConnectPeersState *cps; 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 @@ #include "gnunet_testing_ng_lib.h" #include "gnunet_peerstore_service.h" #include "gnunet_transport_core_service.h" +#include "gnunet_transport_application_service.h" /** * Generic logging shortcut @@ -483,11 +484,11 @@ GNUNET_TESTING_get_trait_connected_peers_map (const struct int -GNUNET_TESTING_get_trait_application_handle (const struct - GNUNET_TESTING_Command *cmd, - struct - GNUNET_TRANSPORT_ApplicationHandle - **ah) +GNUNET_TRANSPORT_get_trait_application_handle (const struct + GNUNET_TESTING_Command *cmd, + struct + GNUNET_TRANSPORT_ApplicationHandle + **ah) { return cmd->traits (cmd->cls, (const void **) ah, @@ -515,12 +516,12 @@ GNUNET_TESTING_get_trait_peer_id (const struct * @return command. */ struct GNUNET_TESTING_Command -GNUNET_TESTING_cmd_start_peer (const char *label, - const char *system_label, - char *m, - char *n, - struct GNUNET_MQ_MessageHandler *handlers, - const char *cfgname) +GNUNET_TRANSPORT_cmd_start_peer (const char *label, + const char *system_label, + char *m, + char *n, + struct GNUNET_MQ_MessageHandler *handlers, + const char *cfgname) { struct StartPeerState *sps; struct GNUNET_CONTAINER_MultiPeerMap *connected_peers_map = -- cgit v1.2.3