diff options
-rw-r--r-- | src/include/Makefile.am | 3 | ||||
-rw-r--r-- | src/include/gnunet_transport_testing_ng_lib.h | 81 | ||||
-rw-r--r-- | src/testing/Makefile.am | 11 | ||||
-rw-r--r-- | src/testing/test_testing_start_with_config.c | 121 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_start_peer.c | 84 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_stop_peer.c | 130 |
6 files changed, 344 insertions, 86 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 8519883c9..70828b92d 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am | |||
@@ -133,7 +133,8 @@ gnunetinclude_HEADERS = \ | |||
133 | gnunet_transport_hello_service.h \ | 133 | gnunet_transport_hello_service.h \ |
134 | gnunet_transport_manipulation_service.h \ | 134 | gnunet_transport_manipulation_service.h \ |
135 | gnunet_transport_monitor_service.h \ | 135 | gnunet_transport_monitor_service.h \ |
136 | gnunet_transport_plugin.h \ | 136 | gnunet_transport_plugin.h \ |
137 | gnunet_transport_testing_ng_lib.h \ | ||
137 | gnunet_tun_lib.h \ | 138 | gnunet_tun_lib.h \ |
138 | gnunet_uri_lib.h \ | 139 | gnunet_uri_lib.h \ |
139 | gnunet_util_lib.h \ | 140 | gnunet_util_lib.h \ |
diff --git a/src/include/gnunet_transport_testing_ng_lib.h b/src/include/gnunet_transport_testing_ng_lib.h new file mode 100644 index 000000000..72ec11eaf --- /dev/null +++ b/src/include/gnunet_transport_testing_ng_lib.h | |||
@@ -0,0 +1,81 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2021-2023 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 | * @brief API for cmds working with transport sub system. | ||
23 | * @author t3sserakt | ||
24 | */ | ||
25 | #ifndef GNUNET_TRANSPORT_TESTING_NG_LIB_H | ||
26 | #define GNUNET_TRANSPORT_TESTING_NG_LIB_H | ||
27 | |||
28 | |||
29 | #include "gnunet_util_lib.h" | ||
30 | #include "gnunet_testing_lib.h" | ||
31 | |||
32 | |||
33 | /** | ||
34 | * Create command. | ||
35 | * | ||
36 | * @param label name for command. | ||
37 | * @param system_label Label of the cmd to setup a test environment. | ||
38 | * @param no Decimal number representing the last byte of the IP address of this peer. | ||
39 | * @param node_ip The IP address of this node. | ||
40 | * @param cfgname Configuration file name for this peer. | ||
41 | * @param broadcast Flag indicating, if broadcast should be switched on. | ||
42 | * @return command. | ||
43 | */ | ||
44 | struct GNUNET_TESTING_Command | ||
45 | GNUNET_TESTING_cmd_start_peer (const char *label, | ||
46 | const char *system_label, | ||
47 | uint32_t no, | ||
48 | const char *node_ip, | ||
49 | const char *cfgname, | ||
50 | unsigned int broadcast); | ||
51 | |||
52 | |||
53 | struct GNUNET_TESTING_Command | ||
54 | GNUNET_TESTING_cmd_stop_peer (const char *label, | ||
55 | const char *start_label); | ||
56 | |||
57 | |||
58 | /** | ||
59 | * Create command | ||
60 | * | ||
61 | * @param label name for command | ||
62 | * @param start_peer_label Label of the cmd to start a peer. | ||
63 | * @param create_label Label of the cmd which started the test system. | ||
64 | * @param num Number globally identifying the node. | ||
65 | * @param topology The topology for the test setup. | ||
66 | * @param additional_connects Number of additional connects this cmd will wait for not triggered by this cmd. | ||
67 | * @return command. | ||
68 | */ | ||
69 | struct GNUNET_TESTING_Command | ||
70 | GNUNET_CORE_cmd_connect_peers ( | ||
71 | const char *label, | ||
72 | const char *start_peer_label, | ||
73 | const char *create_label, | ||
74 | uint32_t num, | ||
75 | struct GNUNET_TESTING_NetjailTopology *topology, | ||
76 | unsigned int additional_connects, | ||
77 | unsigned int wait_for_connect, | ||
78 | struct GNUNET_MQ_MessageHandler *handlers); | ||
79 | |||
80 | |||
81 | #endif | ||
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am index b40706707..e0b63f05e 100644 --- a/src/testing/Makefile.am +++ b/src/testing/Makefile.am | |||
@@ -14,6 +14,7 @@ dist_pkgcfg_DATA = \ | |||
14 | testing.conf | 14 | testing.conf |
15 | 15 | ||
16 | libexec_PROGRAMS = \ | 16 | libexec_PROGRAMS = \ |
17 | test_testing_start_with_config \ | ||
17 | gnunet-cmds-helper | 18 | gnunet-cmds-helper |
18 | 19 | ||
19 | plugindir = $(libdir)/gnunet | 20 | plugindir = $(libdir)/gnunet |
@@ -29,6 +30,7 @@ gnunet_cmds_helper_LDADD = $(XLIB) \ | |||
29 | $(LTLIBINTL) $(Z_LIBS) | 30 | $(LTLIBINTL) $(Z_LIBS) |
30 | 31 | ||
31 | libgnunettesting_la_SOURCES = \ | 32 | libgnunettesting_la_SOURCES = \ |
33 | testing_api_cmd_stop_peer.c \ | ||
32 | testing_api_cmd_start_peer.c \ | 34 | testing_api_cmd_start_peer.c \ |
33 | testing_api_cmd_exec_bash_script.c \ | 35 | testing_api_cmd_exec_bash_script.c \ |
34 | testing_api_cmd_barrier.c \ | 36 | testing_api_cmd_barrier.c \ |
@@ -51,8 +53,6 @@ libgnunettesting_la_SOURCES = \ | |||
51 | libgnunettesting_la_LIBADD = \ | 53 | libgnunettesting_la_LIBADD = \ |
52 | $(top_builddir)/src/arm/libgnunetarm.la \ | 54 | $(top_builddir)/src/arm/libgnunetarm.la \ |
53 | $(top_builddir)/src/util/libgnunetutil.la \ | 55 | $(top_builddir)/src/util/libgnunetutil.la \ |
54 | $(top_builddir)/src/transport/libgnunettransportapplication.la \ | ||
55 | $(top_builddir)/src/peerstore/libgnunetpeerstore.la \ | ||
56 | $(LTLIBINTL) | 56 | $(LTLIBINTL) |
57 | libgnunettesting_la_LDFLAGS = \ | 57 | libgnunettesting_la_LDFLAGS = \ |
58 | $(GN_LIB_LDFLAGS) \ | 58 | $(GN_LIB_LDFLAGS) \ |
@@ -94,6 +94,13 @@ check_PROGRAMS = \ | |||
94 | # test_testing_servicestartup | 94 | # test_testing_servicestartup |
95 | # endif | 95 | # endif |
96 | 96 | ||
97 | test_testing_start_with_config_SOURCES = \ | ||
98 | test_testing_start_with_config.c | ||
99 | test_testing_start_with_config_LDADD = \ | ||
100 | $(top_builddir)/src/testing/libgnunettesting.la \ | ||
101 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
102 | $(top_builddir)/src/hello/libgnunethello.la | ||
103 | |||
97 | test_testing_portreservation_SOURCES = \ | 104 | test_testing_portreservation_SOURCES = \ |
98 | test_testing_portreservation.c | 105 | test_testing_portreservation.c |
99 | test_testing_portreservation_LDADD = \ | 106 | test_testing_portreservation_LDADD = \ |
diff --git a/src/testing/test_testing_start_with_config.c b/src/testing/test_testing_start_with_config.c new file mode 100644 index 000000000..a2c692dbc --- /dev/null +++ b/src/testing/test_testing_start_with_config.c | |||
@@ -0,0 +1,121 @@ | |||
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 transport/test_transport_start_with_config.c | ||
23 | * @brief Generic program to start testcases in an configurable topology. | ||
24 | * @author t3sserakt | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_testing_ng_lib.h" | ||
28 | #include "gnunet_testing_netjail_lib.h" | ||
29 | #include "gnunet_util_lib.h" | ||
30 | |||
31 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600) | ||
32 | |||
33 | |||
34 | int | ||
35 | main (int argc, | ||
36 | char *const *argv) | ||
37 | { | ||
38 | char *topology_data; | ||
39 | char *topology_data_script; | ||
40 | struct GNUNET_TESTING_NetjailTopology *topology; | ||
41 | unsigned int read_file = GNUNET_YES; | ||
42 | int ret; | ||
43 | char *rest = NULL; | ||
44 | char *token; | ||
45 | size_t single_line_len; | ||
46 | size_t data_len; | ||
47 | |||
48 | GNUNET_log_setup ("test-netjail", | ||
49 | "INFO", | ||
50 | NULL); | ||
51 | |||
52 | if (0 == strcmp ("-s", argv[1])) | ||
53 | { | ||
54 | data_len = strlen (argv[2]); | ||
55 | topology_data = GNUNET_malloc (data_len); | ||
56 | topology_data_script = GNUNET_malloc (data_len); | ||
57 | token = strtok_r (argv[2], "\n", &rest); | ||
58 | while (NULL != token) | ||
59 | { | ||
60 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
61 | "token1 %s\n", | ||
62 | token); | ||
63 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
64 | "token2 %s\n", | ||
65 | token); | ||
66 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
67 | "topology_data %s\n", | ||
68 | topology_data); | ||
69 | strcat (topology_data_script, token); | ||
70 | strcat (topology_data_script, " "); | ||
71 | strcat (topology_data, token); | ||
72 | strcat (topology_data, "\n"); | ||
73 | token = strtok_r (NULL, "\n", &rest); | ||
74 | } | ||
75 | single_line_len = strlen (topology_data); | ||
76 | topology_data_script [single_line_len - 1] = '\0'; | ||
77 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
78 | "read from string\n"); | ||
79 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
80 | "topology_data %s\n", | ||
81 | topology_data); | ||
82 | read_file = GNUNET_NO; | ||
83 | topology = GNUNET_TESTING_get_topo_from_string (topology_data); | ||
84 | } | ||
85 | else | ||
86 | { | ||
87 | topology_data = argv[1]; | ||
88 | topology_data_script = argv[1]; | ||
89 | topology = GNUNET_TESTING_get_topo_from_file (topology_data); | ||
90 | } | ||
91 | |||
92 | struct GNUNET_TESTING_Command commands[] = { | ||
93 | GNUNET_TESTING_cmd_netjail_start ("netjail-start", | ||
94 | topology_data_script, | ||
95 | &read_file), | ||
96 | GNUNET_TESTING_cmd_netjail_start_cmds_helper ("netjail-start-testbed", | ||
97 | topology, | ||
98 | &read_file, | ||
99 | topology_data_script, | ||
100 | TIMEOUT), | ||
101 | GNUNET_TESTING_cmd_stop_cmds_helper ("stop-testbed", | ||
102 | "netjail-start-testbed", | ||
103 | topology), | ||
104 | GNUNET_TESTING_cmd_netjail_stop ("netjail-stop", | ||
105 | topology_data_script, | ||
106 | &read_file), | ||
107 | GNUNET_TESTING_cmd_end () | ||
108 | }; | ||
109 | |||
110 | ret = GNUNET_TESTING_main (commands, | ||
111 | TIMEOUT); | ||
112 | |||
113 | if (0 == strcmp ("-s", argv[1])) | ||
114 | { | ||
115 | GNUNET_free (topology_data_script); | ||
116 | GNUNET_free (topology_data); | ||
117 | } | ||
118 | GNUNET_TESTING_free_topology (topology); | ||
119 | |||
120 | return ret; | ||
121 | } | ||
diff --git a/src/testing/testing_api_cmd_start_peer.c b/src/testing/testing_api_cmd_start_peer.c index f6b471be4..e2a2c0fbf 100644 --- a/src/testing/testing_api_cmd_start_peer.c +++ b/src/testing/testing_api_cmd_start_peer.c | |||
@@ -28,9 +28,6 @@ | |||
28 | #include "testing_cmds.h" | 28 | #include "testing_cmds.h" |
29 | #include "gnunet_testing_ng_lib.h" | 29 | #include "gnunet_testing_ng_lib.h" |
30 | #include "gnunet_testing_netjail_lib.h" | 30 | #include "gnunet_testing_netjail_lib.h" |
31 | #include "gnunet_peerstore_service.h" | ||
32 | #include "gnunet_transport_core_service.h" | ||
33 | #include "gnunet_transport_application_service.h" | ||
34 | 31 | ||
35 | /** | 32 | /** |
36 | * Generic logging shortcut | 33 | * Generic logging shortcut |
@@ -38,61 +35,6 @@ | |||
38 | #define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) | 35 | #define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) |
39 | 36 | ||
40 | 37 | ||
41 | static void | ||
42 | retrieve_hello (void *cls); | ||
43 | |||
44 | |||
45 | /** | ||
46 | * Callback delivering the hello of this peer from peerstore. | ||
47 | * | ||
48 | */ | ||
49 | static void | ||
50 | hello_iter_cb (void *cb_cls, | ||
51 | const struct GNUNET_PEERSTORE_Record *record, | ||
52 | const char *emsg) | ||
53 | { | ||
54 | struct GNUNET_TESTING_StartPeerState *sps = cb_cls; | ||
55 | if (NULL == record) | ||
56 | { | ||
57 | sps->pic = NULL; | ||
58 | sps->rh_task = GNUNET_SCHEDULER_add_now (retrieve_hello, sps); | ||
59 | return; | ||
60 | } | ||
61 | // Check record type et al? | ||
62 | sps->hello_size = record->value_size; | ||
63 | sps->hello = GNUNET_malloc (sps->hello_size); | ||
64 | memcpy (sps->hello, record->value, sps->hello_size); | ||
65 | sps->hello[sps->hello_size - 1] = '\0'; | ||
66 | |||
67 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
68 | "Our hello %s\n", | ||
69 | sps->hello); | ||
70 | GNUNET_PEERSTORE_iterate_cancel (sps->pic); | ||
71 | sps->pic = NULL; | ||
72 | GNUNET_TESTING_async_finish (&sps->ac); | ||
73 | } | ||
74 | |||
75 | |||
76 | /** | ||
77 | * Function to start the retrieval task to retrieve the hello of this peer | ||
78 | * from the peerstore. | ||
79 | * | ||
80 | */ | ||
81 | static void | ||
82 | retrieve_hello (void *cls) | ||
83 | { | ||
84 | struct GNUNET_TESTING_StartPeerState *sps = cls; | ||
85 | sps->rh_task = NULL; | ||
86 | sps->pic = GNUNET_PEERSTORE_iterate (sps->ph, | ||
87 | "transport", | ||
88 | &sps->id, | ||
89 | GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY, | ||
90 | hello_iter_cb, | ||
91 | sps); | ||
92 | |||
93 | } | ||
94 | |||
95 | |||
96 | /** | 38 | /** |
97 | * The run method of this cmd will start all services of a peer to test the transport service. | 39 | * The run method of this cmd will start all services of a peer to test the transport service. |
98 | * | 40 | * |
@@ -254,30 +196,6 @@ start_peer_run (void *cls, | |||
254 | sps->no, | 196 | sps->no, |
255 | GNUNET_i2s_full (&sps->id)); | 197 | GNUNET_i2s_full (&sps->id)); |
256 | 198 | ||
257 | sps->ph = GNUNET_PEERSTORE_connect (sps->cfg); | ||
258 | if (NULL == sps->ph) | ||
259 | { | ||
260 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
261 | "Failed to connect to peerstore service for peer `%s': `%s'\n", | ||
262 | sps->cfgname, | ||
263 | emsg); | ||
264 | GNUNET_free (emsg); | ||
265 | GNUNET_TESTING_interpreter_fail (is); | ||
266 | return; | ||
267 | } | ||
268 | |||
269 | sps->ah = GNUNET_TRANSPORT_application_init (sps->cfg); | ||
270 | if (NULL == sps->ah) | ||
271 | { | ||
272 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
273 | "Failed to initialize the TRANSPORT application suggestion client handle for peer `%s': `%s'\n", | ||
274 | sps->cfgname, | ||
275 | emsg); | ||
276 | GNUNET_free (emsg); | ||
277 | GNUNET_TESTING_interpreter_fail (is); | ||
278 | return; | ||
279 | } | ||
280 | sps->rh_task = GNUNET_SCHEDULER_add_now (retrieve_hello, sps); | ||
281 | GNUNET_free (home); | 199 | GNUNET_free (home); |
282 | GNUNET_free (transport_unix_path); | 200 | GNUNET_free (transport_unix_path); |
283 | GNUNET_free (tcp_communicator_unix_path); | 201 | GNUNET_free (tcp_communicator_unix_path); |
@@ -376,5 +294,5 @@ GNUNET_TESTING_cmd_start_peer (const char *label, | |||
376 | &start_peer_run, | 294 | &start_peer_run, |
377 | &start_peer_cleanup, | 295 | &start_peer_cleanup, |
378 | &start_peer_traits, | 296 | &start_peer_traits, |
379 | &sps->ac); | 297 | NULL); |
380 | } | 298 | } |
diff --git a/src/testing/testing_api_cmd_stop_peer.c b/src/testing/testing_api_cmd_stop_peer.c new file mode 100644 index 000000000..2cbf978c6 --- /dev/null +++ b/src/testing/testing_api_cmd_stop_peer.c | |||
@@ -0,0 +1,130 @@ | |||
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 testing_api_cmd_stop_peer.c | ||
23 | * @brief cmd to stop 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_testing_netjail_lib.h" | ||
30 | |||
31 | /** | ||
32 | * Generic logging shortcut | ||
33 | */ | ||
34 | #define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) | ||
35 | |||
36 | |||
37 | /** | ||
38 | * Struct to hold information for callbacks. | ||
39 | * | ||
40 | */ | ||
41 | struct StopPeerState | ||
42 | { | ||
43 | // Label of the cmd to start the peer. | ||
44 | const char *start_label; | ||
45 | }; | ||
46 | |||
47 | |||
48 | /** | ||
49 | * The run method of this cmd will stop all services of a peer which were used to test the transport service. | ||
50 | * | ||
51 | */ | ||
52 | static void | ||
53 | stop_peer_run (void *cls, | ||
54 | struct GNUNET_TESTING_Interpreter *is) | ||
55 | { | ||
56 | struct StopPeerState *stop_ps = cls; | ||
57 | const struct GNUNET_TESTING_StartPeerState *sps; | ||
58 | const struct GNUNET_TESTING_Command *start_cmd; | ||
59 | |||
60 | start_cmd = GNUNET_TESTING_interpreter_lookup_command (is, | ||
61 | stop_ps->start_label); | ||
62 | GNUNET_TESTING_get_trait_state (start_cmd, | ||
63 | &sps); | ||
64 | |||
65 | if (NULL != sps->peer) | ||
66 | { | ||
67 | if (GNUNET_OK != | ||
68 | GNUNET_TESTING_peer_stop (sps->peer)) | ||
69 | { | ||
70 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
71 | "Testing lib failed to stop peer %u (`%s')\n", | ||
72 | sps->no, | ||
73 | GNUNET_i2s (&sps->id)); | ||
74 | } | ||
75 | GNUNET_TESTING_peer_destroy (sps->peer); | ||
76 | } | ||
77 | if (NULL != sps->rh_task) | ||
78 | GNUNET_SCHEDULER_cancel (sps->rh_task); | ||
79 | } | ||
80 | |||
81 | |||
82 | /** | ||
83 | * The cleanup function of this cmd frees resources the cmd allocated. | ||
84 | * | ||
85 | */ | ||
86 | static void | ||
87 | stop_peer_cleanup (void *cls) | ||
88 | { | ||
89 | struct StopPeerState *sps = cls; | ||
90 | |||
91 | GNUNET_free (sps); | ||
92 | } | ||
93 | |||
94 | |||
95 | /** | ||
96 | * Trait function of this cmd does nothing. | ||
97 | * | ||
98 | */ | ||
99 | static int | ||
100 | stop_peer_traits (void *cls, | ||
101 | const void **ret, | ||
102 | const char *trait, | ||
103 | unsigned int index) | ||
104 | { | ||
105 | return GNUNET_OK; | ||
106 | } | ||
107 | |||
108 | |||
109 | /** | ||
110 | * Create command. | ||
111 | * | ||
112 | * @param label name for command. | ||
113 | * @param start_label Label of the cmd to start the peer. | ||
114 | * @return command. | ||
115 | */ | ||
116 | struct GNUNET_TESTING_Command | ||
117 | GNUNET_TESTING_cmd_stop_peer (const char *label, | ||
118 | const char *start_label) | ||
119 | { | ||
120 | struct StopPeerState *sps; | ||
121 | |||
122 | sps = GNUNET_new (struct StopPeerState); | ||
123 | sps->start_label = start_label; | ||
124 | return GNUNET_TESTING_command_new (sps, | ||
125 | label, | ||
126 | &stop_peer_run, | ||
127 | &stop_peer_cleanup, | ||
128 | &stop_peer_traits, | ||
129 | NULL); | ||
130 | } | ||