aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_netjail_start.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_cmd_netjail_start.c')
-rw-r--r--src/testing/testing_api_cmd_netjail_start.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/src/testing/testing_api_cmd_netjail_start.c b/src/testing/testing_api_cmd_netjail_start.c
index c82392a08..536b356a6 100644
--- a/src/testing/testing_api_cmd_netjail_start.c
+++ b/src/testing/testing_api_cmd_netjail_start.c
@@ -29,12 +29,19 @@
29 29
30#define NETJAIL_START_SCRIPT "./../testing/netjail_start.sh" 30#define NETJAIL_START_SCRIPT "./../testing/netjail_start.sh"
31 31
32/**
33 * Struct to hold information for callbacks.
34 *
35 */
32struct NetJailState 36struct NetJailState
33{ 37{
38 // Child Wait handle
34 struct GNUNET_ChildWaitHandle *cwh; 39 struct GNUNET_ChildWaitHandle *cwh;
35 40
41 // Number of local nodes in each namespace.
36 char *local_m; 42 char *local_m;
37 43
44 // The number of namespaces.
38 char *global_n; 45 char *global_n;
39 46
40 /** 47 /**
@@ -42,16 +49,15 @@ struct NetJailState
42 */ 49 */
43 struct GNUNET_OS_Process *start_proc; 50 struct GNUNET_OS_Process *start_proc;
44 51
52 // Flag indication if the script finished.
45 unsigned int finished; 53 unsigned int finished;
46}; 54};
47 55
48 56
49/** 57/**
50* 58 * The cleanup function of this cmd frees resources the cmd allocated.
51* 59 *
52* @param cls closure 60 */
53* @param cmd current CMD being cleaned up.
54*/
55static void 61static void
56netjail_start_cleanup (void *cls, 62netjail_start_cleanup (void *cls,
57 const struct GNUNET_TESTING_Command *cmd) 63 const struct GNUNET_TESTING_Command *cmd)
@@ -81,14 +87,9 @@ netjail_start_cleanup (void *cls,
81 87
82 88
83/** 89/**
84* 90 * Trait function of this cmd does nothing.
85* 91 *
86* @param cls closure. 92 */
87* @param[out] ret result
88* @param trait name of the trait.
89* @param index index number of the object to offer.
90* @return #GNUNET_OK on success.
91*/
92static int 93static int
93netjail_start_traits (void *cls, 94netjail_start_traits (void *cls,
94 const void **ret, 95 const void **ret,
@@ -98,6 +99,11 @@ netjail_start_traits (void *cls,
98 return GNUNET_OK; 99 return GNUNET_OK;
99} 100}
100 101
102
103/**
104 * Callback which will be called if the setup script finished.
105 *
106 */
101static void 107static void
102child_completed_callback (void *cls, 108child_completed_callback (void *cls,
103 enum GNUNET_OS_ProcessStatusType type, 109 enum GNUNET_OS_ProcessStatusType type,
@@ -122,7 +128,7 @@ child_completed_callback (void *cls,
122 128
123 129
124/** 130/**
125* Run the "hello world" CMD. 131* The run method starts the script which setup the network namespaces.
126* 132*
127* @param cls closure. 133* @param cls closure.
128* @param cmd CMD being run. 134* @param cmd CMD being run.
@@ -171,6 +177,11 @@ netjail_start_run (void *cls,
171 GNUNET_break (NULL != ns->cwh); 177 GNUNET_break (NULL != ns->cwh);
172} 178}
173 179
180
181/**
182 * This function checks the flag NetJailState#finished, if this cmd finished.
183 *
184 */
174static int 185static int
175netjail_start_finish (void *cls, 186netjail_start_finish (void *cls,
176 GNUNET_SCHEDULER_TaskCallback cont, 187 GNUNET_SCHEDULER_TaskCallback cont,
@@ -189,7 +200,8 @@ netjail_start_finish (void *cls,
189 * Create command. 200 * Create command.
190 * 201 *
191 * @param label name for command. 202 * @param label name for command.
192 * @param binaryname to start. 203 * @param local_m Number of local nodes in each namespace.
204 * @param global_n The number of namespaces.
193 * @return command. 205 * @return command.
194 */ 206 */
195struct GNUNET_TESTING_Command 207struct GNUNET_TESTING_Command