aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_cmd_simple_send.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/plugin_cmd_simple_send.c')
-rw-r--r--src/transport/plugin_cmd_simple_send.c74
1 files changed, 63 insertions, 11 deletions
diff --git a/src/transport/plugin_cmd_simple_send.c b/src/transport/plugin_cmd_simple_send.c
index 1fa2f1f03..62bb7544b 100644
--- a/src/transport/plugin_cmd_simple_send.c
+++ b/src/transport/plugin_cmd_simple_send.c
@@ -19,7 +19,7 @@
19 */ 19 */
20 20
21/** 21/**
22 * @file testbed/plugin_testcmd.c 22 * @file testbed/plugin_cmd_simple_send.c
23 * @brief a plugin to provide the API for running test cases. 23 * @brief a plugin to provide the API for running test cases.
24 * @author t3sserakt 24 * @author t3sserakt
25 */ 25 */
@@ -27,8 +27,10 @@
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" 29#include "gnunet_transport_application_service.h"
30#include "gnunet_transport_service.h" 30// #include "gnunet_transport_service.h"
31#include "gnunet_testbed_ng_service.h" 31#include "gnunet_testbed_ng_service.h"
32#include "transport-testing2.h"
33
32/** 34/**
33 * Generic logging shortcut 35 * Generic logging shortcut
34 */ 36 */
@@ -38,10 +40,38 @@
38 40
39struct GNUNET_MQ_MessageHandler *handlers; 41struct GNUNET_MQ_MessageHandler *handlers;
40 42
41const char *cfgname;
42
43unsigned int are_all_peers_started; 43unsigned int are_all_peers_started;
44 44
45static int
46check_test (void *cls,
47 const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
48{
49 return GNUNET_OK;
50}
51
52static void
53handle_test (void *cls,
54 const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
55{
56 LOG (GNUNET_ERROR_TYPE_ERROR,
57 "message received\n");
58}
59
60static int
61check_test2 (void *cls,
62 const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
63{
64 return GNUNET_OK;
65}
66
67static void
68handle_test2 (void *cls,
69 const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
70{
71 LOG (GNUNET_ERROR_TYPE_ERROR,
72 "message received\n");
73}
74
45static void 75static void
46all_peers_started () 76all_peers_started ()
47{ 77{
@@ -58,6 +88,16 @@ start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip,
58 char *n) 88 char *n)
59{ 89{
60 char *testdir; 90 char *testdir;
91 char *cfgname;
92
93 GNUNET_asprintf (&cfgname,
94 "%s%s.conf",
95 "test_transport_api2_tcp_peer",
96 n);
97
98 LOG (GNUNET_ERROR_TYPE_ERROR,
99 "cfgname: %s\n",
100 cfgname);
61 101
62 testdir = GNUNET_malloc (strlen (BASE_DIR) + strlen (m) + strlen (n) 102 testdir = GNUNET_malloc (strlen (BASE_DIR) + strlen (m) + strlen (n)
63 + 1); 103 + 1);
@@ -66,22 +106,34 @@ start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip,
66 strcat (testdir, m); 106 strcat (testdir, m);
67 strcat (testdir, n); 107 strcat (testdir, n);
68 108
109 struct GNUNET_MQ_MessageHandler handlers[] = {
110 GNUNET_MQ_hd_var_size (test,
111 GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE,
112 struct GNUNET_TRANSPORT_TESTING_TestMessage,
113 NULL),
114 GNUNET_MQ_hd_var_size (test2,
115 GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE2,
116 struct GNUNET_TRANSPORT_TESTING_TestMessage,
117 NULL),
118 GNUNET_MQ_handler_end ()
119 };
120
69 struct GNUNET_TESTING_Command commands[] = { 121 struct GNUNET_TESTING_Command commands[] = {
70 GNUNET_TESTING_cmd_system_create ("system-create-1", 122 GNUNET_TESTING_cmd_system_create ("system-create-1",
71 testdir), 123 testdir),
72 /*GNUNET_TRANSPORT_cmd_start_peer ("start-peer-1", 124 GNUNET_TRANSPORT_cmd_start_peer ("start-peer-1",
73 "system-create-1", 125 "system-create-1",
74 m, 126 m,
75 n, 127 n,
76 handlers, 128 handlers,
77 cfgname),*/ 129 cfgname),
78 GNUNET_TESTING_cmd_send_peer_ready ("send-peer-ready-1", 130 GNUNET_TESTING_cmd_send_peer_ready ("send-peer-ready-1",
79 write_message), 131 write_message),
80 GNUNET_TESTING_cmd_block_until_all_peers_started ("block-1", 132 GNUNET_TESTING_cmd_block_until_all_peers_started ("block-1",
81 &are_all_peers_started), 133 &are_all_peers_started),
82 /*GNUNET_TRANSPORT_cmd_connect_peers ("connect-peers-1", 134 GNUNET_TRANSPORT_cmd_connect_peers ("connect-peers-1",
83 "start-peer-1", 135 "start-peer-1",
84 "this is useless"),*/ 136 "this is useless"),
85 /*GNUNET_TESTING_cmd_send_simple ("send-simple-1", 137 /*GNUNET_TESTING_cmd_send_simple ("send-simple-1",
86 char *m, 138 char *m,
87 char *n, 139 char *n,
@@ -106,7 +158,7 @@ start_testcase (TESTBED_CMD_HELPER_write_cb write_message, char *router_ip,
106 * @return the exported block API 158 * @return the exported block API
107 */ 159 */
108void * 160void *
109libgnunet_plugin_testcmd_init (void *cls) 161libgnunet_plugin_cmd_simple_send_init (void *cls)
110{ 162{
111 struct GNUNET_TESTING_PluginFunctions *api; 163 struct GNUNET_TESTING_PluginFunctions *api;
112 164
@@ -124,7 +176,7 @@ libgnunet_plugin_testcmd_init (void *cls)
124 * @return NULL 176 * @return NULL
125 */ 177 */
126void * 178void *
127libgnunet_plugin_testcmd_done (void *cls) 179libgnunet_plugin_cmd_simple_send_done (void *cls)
128{ 180{
129 struct GNUNET_TESTING_PluginFunctions *api = cls; 181 struct GNUNET_TESTING_PluginFunctions *api = cls;
130 182
@@ -133,4 +185,4 @@ libgnunet_plugin_testcmd_done (void *cls)
133} 185}
134 186
135 187
136/* end of plugin_testcmd.c */ 188/* end of plugin_cmd_simple_send.c */