aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_testing_lib.h
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-02-12 10:33:19 +0000
committerNathan S. Evans <evans@in.tum.de>2010-02-12 10:33:19 +0000
commite710565b349e7e45f3e650a07ddb7383de9001aa (patch)
tree1979182321fe12c5c366315cf477af9e706ae69a /src/include/gnunet_testing_lib.h
parentc463c4f0ae78dcfd9acbc41b489d9cb8d7d1192e (diff)
downloadgnunet-e710565b349e7e45f3e650a07ddb7383de9001aa.tar.gz
gnunet-e710565b349e7e45f3e650a07ddb7383de9001aa.zip
missing definitions
Diffstat (limited to 'src/include/gnunet_testing_lib.h')
-rw-r--r--src/include/gnunet_testing_lib.h183
1 files changed, 175 insertions, 8 deletions
diff --git a/src/include/gnunet_testing_lib.h b/src/include/gnunet_testing_lib.h
index aa4068199..13dbc7a9e 100644
--- a/src/include/gnunet_testing_lib.h
+++ b/src/include/gnunet_testing_lib.h
@@ -42,15 +42,10 @@ extern "C"
42#endif 42#endif
43#endif 43#endif
44 44
45 45/* Forward declaration */
46
47/**
48 * Handle for a GNUnet daemon (technically a set of
49 * daemons; the handle is really for the master ARM
50 * daemon) started by the testing library.
51 */
52struct GNUNET_TESTING_Daemon; 46struct GNUNET_TESTING_Daemon;
53 47/* Forward declaration */
48struct GNUNET_TESTING_PeerGroup;
54 49
55/** 50/**
56 * Prototype of a function that will be called whenever 51 * Prototype of a function that will be called whenever
@@ -112,6 +107,8 @@ GNUNET_TESTING_daemon_start (struct GNUNET_SCHEDULER_Handle *sched,
112 GNUNET_TESTING_NotifyDaemonRunning cb, 107 GNUNET_TESTING_NotifyDaemonRunning cb,
113 void *cb_cls); 108 void *cb_cls);
114 109
110struct GNUNET_TESTING_Daemon *
111GNUNET_TESTING_daemon_get (struct GNUNET_TESTING_PeerGroup *pg, unsigned int position);
115 112
116/** 113/**
117 * Prototype of a function that will be called when a 114 * Prototype of a function that will be called when a
@@ -149,6 +146,7 @@ void GNUNET_TESTING_daemon_reconfigure (struct GNUNET_TESTING_Daemon *d,
149 GNUNET_TESTING_NotifyCompletion cb, 146 GNUNET_TESTING_NotifyCompletion cb,
150 void * cb_cls); 147 void * cb_cls);
151 148
149#if HIDDEN
152/* 150/*
153 * Get the short name of a running peer 151 * Get the short name of a running peer
154 * 152 *
@@ -157,6 +155,19 @@ void GNUNET_TESTING_daemon_reconfigure (struct GNUNET_TESTING_Daemon *d,
157char * 155char *
158GNUNET_TESTING_daemon_get_shortname(struct GNUNET_TESTING_Daemon *d); 156GNUNET_TESTING_daemon_get_shortname(struct GNUNET_TESTING_Daemon *d);
159 157
158char *
159GNUNET_TESTING_daemon_get_hostname (struct GNUNET_TESTING_Daemon *d);
160
161char *
162GNUNET_TESTING_daemon_get_username (struct GNUNET_TESTING_Daemon *d);
163
164struct GNUNET_PeerIdentity *
165GNUNET_TESTING_daemon_get_peer (struct GNUNET_TESTING_Daemon *d);
166
167struct GNUNET_CONFIGURATION_Handle *
168GNUNET_TESTING_daemon_get_config (struct GNUNET_TESTING_Daemon *d);
169#endif
170
160/** 171/**
161 * Establish a connection between two GNUnet daemons. 172 * Establish a connection between two GNUnet daemons.
162 * 173 *
@@ -226,6 +237,162 @@ GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg);
226 */ 237 */
227struct GNUNET_TESTING_Testbed; 238struct GNUNET_TESTING_Testbed;
228 239
240/**
241 * Phases of starting GNUnet on a system.
242 */
243enum StartPhase
244{
245 /**
246 * Copy the configuration file to the target system.
247 */
248 SP_COPYING,
249
250 /**
251 * Configuration file has been copied, start ARM on target system.
252 */
253 SP_COPIED,
254
255 /**
256 * ARM has been started, check that it has properly daemonized and
257 * then try to connect to the CORE service (which should be
258 * auto-started by ARM).
259 */
260 SP_START_ARMING,
261
262 /**
263 * We're waiting for CORE to start.
264 */
265 SP_START_CORE,
266
267 /**
268 * Core has notified us that we've established a connection to the service.
269 * The main FSM halts here and waits to be moved to UPDATE or CLEANUP.
270 */
271 SP_START_DONE,
272
273 /**
274 * We've been asked to terminate the instance and are now waiting for
275 * the remote command to delete the configuration file to complete.
276 */
277 SP_CLEANUP,
278
279 /**
280 * We've received a configuration update and are currently waiting for
281 * the copy process for the update to complete. Once it is, we will
282 * return to "SP_START_DONE" (and rely on ARM to restart all affected
283 * services).
284 */
285 SP_CONFIG_UPDATE
286};
287
288
289/**
290 * Handle for a GNUnet daemon (technically a set of
291 * daemons; the handle is really for the master ARM
292 * daemon) started by the testing library.
293 */
294struct GNUNET_TESTING_Daemon
295{
296 /**
297 * Our scheduler.
298 */
299 struct GNUNET_SCHEDULER_Handle *sched;
300
301 /**
302 * Our configuration.
303 */
304 struct GNUNET_CONFIGURATION_Handle *cfg;
305
306 /**
307 * Host to run GNUnet on.
308 */
309 char *hostname;
310
311 /*
312 * Result of GNUNET_i2s of this peer,
313 * for printing
314 */
315 char *shortname;
316
317 /**
318 * Username we are using.
319 */
320 char *username;
321
322 /**
323 * Name of the configuration file
324 */
325 char *cfgfile;
326
327 /**
328 * Function to call when the peer is running.
329 */
330 GNUNET_TESTING_NotifyDaemonRunning cb;
331
332 /**
333 * Closure for cb.
334 */
335 void *cb_cls;
336
337 /**
338 * Arguments from "daemon_stop" call.
339 */
340 GNUNET_TESTING_NotifyCompletion dead_cb;
341
342 /**
343 * Closure for 'dead_cb'.
344 */
345 void *dead_cb_cls;
346
347 /**
348 * Arguments from "daemon_stop" call.
349 */
350 GNUNET_TESTING_NotifyCompletion update_cb;
351
352 /**
353 * Closure for 'update_cb'.
354 */
355 void *update_cb_cls;
356
357 /**
358 * Identity of this peer (once started).
359 */
360 struct GNUNET_PeerIdentity id;
361
362 /**
363 * Flag to indicate that we've already been asked
364 * to terminate (but could not because some action
365 * was still pending).
366 */
367 int dead;
368
369 /**
370 * PID of the process that we started last.
371 */
372 pid_t pid;
373
374 /**
375 * How many iterations have we been waiting for
376 * the started process to complete?
377 */
378 unsigned int wait_runs;
379
380 /**
381 * In which phase are we during the start of
382 * this process?
383 */
384 enum StartPhase phase;
385
386 /**
387 * ID of the current task.
388 */
389 GNUNET_SCHEDULER_TaskIdentifier task;
390
391 /**
392 * Handle to the server.
393 */
394 struct GNUNET_CORE_Handle *server;
395};
229 396
230/** 397/**
231 * Topologies supported for testbeds. 398 * Topologies supported for testbeds.