aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_testbed_service.h
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-08-29 16:39:50 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-08-29 16:39:50 +0000
commit3f8a19f31a2458b639f12a0f31eb182d5c524c18 (patch)
tree21e2fb417575a3c8c40b3d1a64f25d11dde3e468 /src/include/gnunet_testbed_service.h
parenta7f649618eaf082501f357ce899f51141ea57b05 (diff)
downloadgnunet-3f8a19f31a2458b639f12a0f31eb182d5c524c18.tar.gz
gnunet-3f8a19f31a2458b639f12a0f31eb182d5c524c18.zip
GNUNET_TESTBED_run to return a handle which can be used for clean shutdown
Diffstat (limited to 'src/include/gnunet_testbed_service.h')
-rw-r--r--src/include/gnunet_testbed_service.h32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h
index 789627a56..37ffcb750 100644
--- a/src/include/gnunet_testbed_service.h
+++ b/src/include/gnunet_testbed_service.h
@@ -1114,6 +1114,12 @@ GNUNET_TESTBED_destroy (struct GNUNET_TESTBED_Testbed *testbed);
1114 1114
1115 1115
1116/** 1116/**
1117 * Opaque handle to testbed run
1118 */
1119struct GNUNET_TESTBED_RunHandle;
1120
1121
1122/**
1117 * Convenience method for running a testbed with 1123 * Convenience method for running a testbed with
1118 * a single call. Underlay and overlay topology 1124 * a single call. Underlay and overlay topology
1119 * are configured using the "UNDERLAY" and "OVERLAY" 1125 * are configured using the "UNDERLAY" and "OVERLAY"
@@ -1121,8 +1127,7 @@ GNUNET_TESTBED_destroy (struct GNUNET_TESTBED_Testbed *testbed);
1121 * (with possible options given in "UNDERLAY_XXX" and/or 1127 * (with possible options given in "UNDERLAY_XXX" and/or
1122 * "OVERLAY_XXX"). 1128 * "OVERLAY_XXX").
1123 * 1129 *
1124 * The testbed is to be terminated using a call to 1130 * The testbed is to be terminated using a calling GNUNET_TESTBED_shutdown_run()
1125 * "GNUNET_SCHEDULER_shutdown".
1126 * 1131 *
1127 * @param host_filename name of the file with the 'hosts', NULL 1132 * @param host_filename name of the file with the 'hosts', NULL
1128 * to run everything on 'localhost' 1133 * to run everything on 'localhost'
@@ -1132,12 +1137,16 @@ GNUNET_TESTBED_destroy (struct GNUNET_TESTBED_Testbed *testbed);
1132 * or-ed values of "1LL" shifted by the 1137 * or-ed values of "1LL" shifted by the
1133 * respective 'enum GNUNET_TESTBED_EventType' 1138 * respective 'enum GNUNET_TESTBED_EventType'
1134 * (i.e. "(1LL << GNUNET_TESTBED_ET_CONNECT) || ...") 1139 * (i.e. "(1LL << GNUNET_TESTBED_ET_CONNECT) || ...")
1135 * @param cc controller callback to invoke on events 1140 * @param cc controller callback to invoke on events; This callback is called
1141 * for all peer start events even if GNUNET_TESTBED_ET_PEER_START isn't
1142 * set in the event_mask as this is the only way get access to the
1143 * handle of each peer
1136 * @param cc_cls closure for cc 1144 * @param cc_cls closure for cc
1137 * @param master task to run once the testbed is ready 1145 * @param master task to run once the testbed is ready
1138 * @param master_cls closure for 'task'. 1146 * @param master_cls closure for 'task'.
1147 * @return the handle for this testbed run
1139 */ 1148 */
1140void 1149struct GNUNET_TESTBED_RunHandle *
1141GNUNET_TESTBED_run (const char *host_filename, 1150GNUNET_TESTBED_run (const char *host_filename,
1142 const struct GNUNET_CONFIGURATION_Handle *cfg, 1151 const struct GNUNET_CONFIGURATION_Handle *cfg,
1143 unsigned int num_peers, 1152 unsigned int num_peers,
@@ -1149,6 +1158,15 @@ GNUNET_TESTBED_run (const char *host_filename,
1149 1158
1150 1159
1151/** 1160/**
1161 * Stops the testbed run and releases any used resources
1162 *
1163 * @param rh the tesbed run handle
1164 */
1165void
1166GNUNET_TESTBED_shutdown_run (struct GNUNET_TESTBED_RunHandle *rh);
1167
1168
1169/**
1152 * Signature of a main function for a testcase. 1170 * Signature of a main function for a testcase.
1153 * 1171 *
1154 * @param cls closure 1172 * @param cls closure
@@ -1167,9 +1185,9 @@ typedef void (*GNUNET_TESTBED_TestMaster)(void *cls,
1167 * "[testbed]" section of the configuration (with possible options 1185 * "[testbed]" section of the configuration (with possible options
1168 * given in "UNDERLAY_XXX" and/or "OVERLAY_XXX"). 1186 * given in "UNDERLAY_XXX" and/or "OVERLAY_XXX").
1169 * 1187 *
1170 * The test is to be terminated using a call to 1188 * The test is to be terminated by calling GNUNET_TESTBED_shutdown_run()
1171 * "GNUNET_SCHEDULER_shutdown". If starting the test fails, 1189 * If starting the test fails, the program is stopped without 'master' ever
1172 * the program is stopped without 'master' ever being run. 1190 * being run
1173 * 1191 *
1174 * NOTE: this function should be called from 'main', NOT from 1192 * NOTE: this function should be called from 'main', NOT from
1175 * within a GNUNET_SCHEDULER-loop. This function will initialze 1193 * within a GNUNET_SCHEDULER-loop. This function will initialze