aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_netjail_stop.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_cmd_netjail_stop.c')
-rw-r--r--src/testing/testing_api_cmd_netjail_stop.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/src/testing/testing_api_cmd_netjail_stop.c b/src/testing/testing_api_cmd_netjail_stop.c
index 710b4fbf4..99084d9af 100644
--- a/src/testing/testing_api_cmd_netjail_stop.c
+++ b/src/testing/testing_api_cmd_netjail_stop.c
@@ -30,12 +30,19 @@
30 30
31#define NETJAIL_STOP_SCRIPT "./../testing/netjail_stop.sh" 31#define NETJAIL_STOP_SCRIPT "./../testing/netjail_stop.sh"
32 32
33// Child Wait handle
33struct GNUNET_ChildWaitHandle *cwh; 34struct GNUNET_ChildWaitHandle *cwh;
34 35
36/**
37 * Struct to hold information for callbacks.
38 *
39 */
35struct NetJailState 40struct NetJailState
36{ 41{
42 // Number of local nodes in each namespace.
37 char *local_m; 43 char *local_m;
38 44
45 // The number of namespaces.
39 char *global_n; 46 char *global_n;
40 47
41 /** 48 /**
@@ -43,16 +50,15 @@ struct NetJailState
43 */ 50 */
44 struct GNUNET_OS_Process *stop_proc; 51 struct GNUNET_OS_Process *stop_proc;
45 52
53 // Flag indication if the script finished.
46 unsigned int finished; 54 unsigned int finished;
47}; 55};
48 56
49 57
50/** 58/**
51* 59 * The cleanup function of this cmd frees resources the cmd allocated.
52* 60 *
53* @param cls closure 61 */
54* @param cmd current CMD being cleaned up.
55*/
56static void 62static void
57netjail_stop_cleanup (void *cls, 63netjail_stop_cleanup (void *cls,
58 const struct GNUNET_TESTING_Command *cmd) 64 const struct GNUNET_TESTING_Command *cmd)
@@ -78,14 +84,9 @@ netjail_stop_cleanup (void *cls,
78 84
79 85
80/** 86/**
81* 87 * Trait function of this cmd does nothing.
82* 88 *
83* @param cls closure. 89 */
84* @param[out] ret result
85* @param trait name of the trait.
86* @param index index number of the object to offer.
87* @return #GNUNET_OK on success.
88*/
89static int 90static int
90netjail_stop_traits (void *cls, 91netjail_stop_traits (void *cls,
91 const void **ret, 92 const void **ret,
@@ -96,6 +97,10 @@ netjail_stop_traits (void *cls,
96} 97}
97 98
98 99
100/**
101 * Callback which will be called if the setup script finished.
102 *
103 */
99static void 104static void
100child_completed_callback (void *cls, 105child_completed_callback (void *cls,
101 enum GNUNET_OS_ProcessStatusType type, 106 enum GNUNET_OS_ProcessStatusType type,
@@ -118,7 +123,7 @@ child_completed_callback (void *cls,
118 123
119 124
120/** 125/**
121* Run the "hello world" CMD. 126* The run method starts the script which deletes the network namespaces.
122* 127*
123* @param cls closure. 128* @param cls closure.
124* @param cmd CMD being run. 129* @param cmd CMD being run.
@@ -169,6 +174,10 @@ netjail_stop_run (void *cls,
169} 174}
170 175
171 176
177/**
178 * This function checks the flag NetJailState#finished, if this cmd finished.
179 *
180 */
172static int 181static int
173netjail_stop_finish (void *cls, 182netjail_stop_finish (void *cls,
174 GNUNET_SCHEDULER_TaskCallback cont, 183 GNUNET_SCHEDULER_TaskCallback cont,
@@ -188,7 +197,8 @@ netjail_stop_finish (void *cls,
188 * Create command. 197 * Create command.
189 * 198 *
190 * @param label name for command. 199 * @param label name for command.
191 * @param binaryname to stop. 200 * @param local_m Number of local nodes in each namespace.
201 * @param global_n The number of namespaces.
192 * @return command. 202 * @return command.
193 */ 203 */
194struct GNUNET_TESTING_Command 204struct GNUNET_TESTING_Command