+typedef void (*GNUNET_ATS_TESTING_EpisodeDoneCallback) (
+ struct Episode *e);
+
+typedef void (*GNUNET_ATS_TESTING_ExperimentDoneCallback) (struct Experiment *e,
+ struct GNUNET_TIME_Relative duration,int success);
+
+struct Operation
+{
+ struct Operation *next;
+ struct Operation *prev;
+ long long unsigned int src_id;
+ long long unsigned int dest_id;
+ long long unsigned int value;
+ enum OperationType type;
+};
+
+struct Episode
+{
+ int id;
+ struct Episode *next;
+ struct GNUNET_TIME_Relative duration;
+
+ struct Operation *head;
+ struct Operation *tail;
+};
+
+
+struct Experiment
+{
+ char *name;
+ char *cfg_file;
+ unsigned long long int num_masters;
+ unsigned long long int num_slaves;
+ struct GNUNET_TIME_Relative max_duration;
+ struct GNUNET_TIME_Relative total_duration;
+ struct GNUNET_TIME_Absolute start_time;
+ unsigned int num_episodes;
+ struct Episode *start;
+
+ GNUNET_SCHEDULER_TaskIdentifier experiment_timeout_task;
+ GNUNET_SCHEDULER_TaskIdentifier episode_timeout_task;
+ struct Episode *cur;
+
+ GNUNET_ATS_TESTING_EpisodeDoneCallback ep_done_cb;
+ GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb;
+};
+
+/*
+ * Experiment related functions
+ */
+
+
+/**
+ * Execute the specified experiment
+ *
+ * @param e the Experiment
+ * @param ep_done_cb a episode is completed
+ * @param e_done_cb the experiment is completed
+ */
+void
+GNUNET_ATS_TEST_experimentation_run (struct Experiment *e,
+ GNUNET_ATS_TESTING_EpisodeDoneCallback ep_done_cb,
+ GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb);
+
+/**
+ * Load an experiment from a file
+ *
+ * @param filename the file
+ * @return the Experiment or NULL on failure
+ */
+struct Experiment *
+GNUNET_ATS_TEST_experimentation_load (char *filename);
+
+
+/**
+ * Stop an experiment
+ *
+ * @param e the experiment
+ */
+void
+GNUNET_ATS_TEST_experimentation_stop (struct Experiment *e);
+
+/*
+ * Traffic related functions
+ */
+
+void
+GNUNET_ATS_TEST_traffic_handle_ping (struct BenchmarkPartner *p);
+
+void
+GNUNET_ATS_TEST_traffic_handle_pong (struct BenchmarkPartner *p);
+
+
+struct TrafficGenerator *
+GNUNET_ATS_TEST_generate_traffic_start (struct BenchmarkPeer *src,
+ struct BenchmarkPartner *dest,
+ unsigned int rate,
+ struct GNUNET_TIME_Relative duration);
+
+void
+GNUNET_ATS_TEST_generate_traffic_stop (struct TrafficGenerator *tg);
+
+/**
+ * Stop all traffic generators
+ */
+void
+GNUNET_ATS_TEST_generate_traffic_stop_all ();
+
+
+/*
+ * Logging related functions
+ */
+
+/**
+ * Start logging
+ *
+ * @param log_frequency the logging frequency
+ * @param testname the testname
+ * @param masters the master peers used for benchmarking
+ * @param num_master the number of master peers
+ * @return the logging handle or NULL on error
+ */
+struct LoggingHandle *
+GNUNET_ATS_TEST_logging_start (struct GNUNET_TIME_Relative log_frequency,
+ char * testname,
+ struct BenchmarkPeer *masters,
+ int num_masters);
+
+/**
+ * Stop logging
+ *
+ * @param l the logging handle
+ */
+void
+GNUNET_ATS_TEST_logging_clean_up (struct LoggingHandle *l);
+
+/**
+ * Stop logging
+ *
+ * @param l the logging handle
+ */
+void
+GNUNET_ATS_TEST_logging_stop (struct LoggingHandle *l);
+
+/**
+ * Log all data now
+ *
+ * @param llogging handle to use
+ */
+void
+GNUNET_ATS_TEST_logging_now (struct LoggingHandle *l);
+
+
+/**
+ * Write logging data to file
+ *
+ * @param l logging handle to use
+ * @param test_name name of the current test
+ * @param plots create gnuplots: GNUNET_YES or GNUNET_NO
+ */
+void
+GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l,
+ char *test_name, int plots);
+
+/*
+ * Topology related functions
+ */
+
+/**
+ * Create a topology for ats testing
+ *
+ * @param name test name
+ * @param cfg_file configuration file to use for the peers
+ * @param num_slaves number of slaves
+ * @param num_masters number of masters
+ * @param test_core connect to CORE service (GNUNET_YES) or transport (GNUNET_NO)
+ * @param done_cb function to call when topology is setup
+ * @param done_cb_cls cls for callback
+ * @param recv_cb callback to call when data are received
+ * @param perf_cb callback to call when performance info are received
+ */
+void