aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_netjail_stop_v2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_cmd_netjail_stop_v2.c')
-rw-r--r--src/testing/testing_api_cmd_netjail_stop_v2.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/src/testing/testing_api_cmd_netjail_stop_v2.c b/src/testing/testing_api_cmd_netjail_stop_v2.c
index 8c1f3cedd..348e8c9f7 100644
--- a/src/testing/testing_api_cmd_netjail_stop_v2.c
+++ b/src/testing/testing_api_cmd_netjail_stop_v2.c
@@ -19,7 +19,7 @@
19 */ 19 */
20 20
21/** 21/**
22 * @file testing/testing_api_cmd_hello_world.c 22 * @file testing/testing_api_cmd_netjail_stop_v2.c
23 * @brief Command to stop the netjail script. 23 * @brief Command to stop the netjail script.
24 * @author t3sserakt 24 * @author t3sserakt
25 */ 25 */
@@ -50,7 +50,7 @@ struct NetJailState
50 struct GNUNET_OS_Process *stop_proc; 50 struct GNUNET_OS_Process *stop_proc;
51 51
52 // Flag indication if the script finished. 52 // Flag indication if the script finished.
53 unsigned int finished; 53 enum GNUNET_GenericReturnValue finished;
54}; 54};
55 55
56 56
@@ -59,8 +59,7 @@ struct NetJailState
59 * 59 *
60 */ 60 */
61static void 61static void
62netjail_stop_cleanup (void *cls, 62netjail_stop_cleanup (void *cls)
63 const struct GNUNET_TESTING_Command *cmd)
64{ 63{
65 struct NetJailState *ns = cls; 64 struct NetJailState *ns = cls;
66 65
@@ -86,13 +85,13 @@ netjail_stop_cleanup (void *cls,
86 * Trait function of this cmd does nothing. 85 * Trait function of this cmd does nothing.
87 * 86 *
88 */ 87 */
89static int 88static enum GNUNET_GenericReturnValue
90netjail_stop_traits (void *cls, 89netjail_stop_traits (void *cls,
91 const void **ret, 90 const void **ret,
92 const char *trait, 91 const char *trait,
93 unsigned int index) 92 unsigned int index)
94{ 93{
95 return GNUNET_OK; 94 return GNUNET_NO;
96} 95}
97 96
98 97
@@ -125,12 +124,10 @@ child_completed_callback (void *cls,
125* The run method starts the script which deletes the network namespaces. 124* The run method starts the script which deletes the network namespaces.
126* 125*
127* @param cls closure. 126* @param cls closure.
128* @param cmd CMD being run.
129* @param is interpreter state. 127* @param is interpreter state.
130*/ 128*/
131static void 129static void
132netjail_stop_run (void *cls, 130netjail_stop_run (void *cls,
133 const struct GNUNET_TESTING_Command *cmd,
134 struct GNUNET_TESTING_Interpreter *is) 131 struct GNUNET_TESTING_Interpreter *is)
135{ 132{
136 struct NetJailState *ns = cls; 133 struct NetJailState *ns = cls;
@@ -152,14 +149,14 @@ netjail_stop_run (void *cls,
152 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 149 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
153 "No SUID for %s!\n", 150 "No SUID for %s!\n",
154 NETJAIL_STOP_SCRIPT); 151 NETJAIL_STOP_SCRIPT);
155 GNUNET_TESTING_interpreter_fail (); 152 GNUNET_TESTING_interpreter_fail (is);
156 } 153 }
157 else if (GNUNET_NO == helper_check) 154 else if (GNUNET_NO == helper_check)
158 { 155 {
159 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 156 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
160 "%s not found!\n", 157 "%s not found!\n",
161 NETJAIL_STOP_SCRIPT); 158 NETJAIL_STOP_SCRIPT);
162 GNUNET_TESTING_interpreter_fail (); 159 GNUNET_TESTING_interpreter_fail (is);
163 } 160 }
164 161
165 ns->stop_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR, 162 ns->stop_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR,
@@ -181,7 +178,7 @@ netjail_stop_run (void *cls,
181 * This function checks the flag NetJailState#finished, if this cmd finished. 178 * This function checks the flag NetJailState#finished, if this cmd finished.
182 * 179 *
183 */ 180 */
184static int 181static enum GNUNET_GenericReturnValue
185netjail_stop_finish (void *cls, 182netjail_stop_finish (void *cls,
186 GNUNET_SCHEDULER_TaskCallback cont, 183 GNUNET_SCHEDULER_TaskCallback cont,
187 void *cont_cls) 184 void *cont_cls)
@@ -211,15 +208,16 @@ GNUNET_TESTING_cmd_netjail_stop_v2 (const char *label,
211 208
212 ns = GNUNET_new (struct NetJailState); 209 ns = GNUNET_new (struct NetJailState);
213 ns->topology_config = topology_config; 210 ns->topology_config = topology_config;
214 211 {
215 struct GNUNET_TESTING_Command cmd = { 212 struct GNUNET_TESTING_Command cmd = {
216 .cls = ns, 213 .cls = ns,
217 .label = label, 214 .label = label,
218 .run = &netjail_stop_run, 215 .run = &netjail_stop_run,
219 .finish = &netjail_stop_finish, 216 .finish = &netjail_stop_finish,
220 .cleanup = &netjail_stop_cleanup, 217 .cleanup = &netjail_stop_cleanup,
221 .traits = &netjail_stop_traits 218 .traits = &netjail_stop_traits
222 }; 219 };
223 220
224 return cmd; 221 return cmd;
222 }
225} 223}