dhtlog updates
[oweals/gnunet.git] / src / include / gnunet_testing_lib.h
index 479cb07e09c3eb068a0eaa97e8f894e175f3c93b..8199607a13f7d485f7ef09cb13e5cfece2b433ab 100644 (file)
@@ -33,6 +33,7 @@
 #define GNUNET_TESTING_LIB_H
 
 #include "gnunet_util_lib.h"
+#include "gnunet_statistics_service.h"
 
 #ifdef __cplusplus
 extern "C"
@@ -455,6 +456,18 @@ struct GNUNET_TESTING_Daemon *
 GNUNET_TESTING_daemon_get (struct GNUNET_TESTING_PeerGroup *pg, 
                           unsigned int position);
 
+/*
+ * Get a daemon by peer identity, so callers can
+ * retrieve the daemon without knowing it's offset.
+ *
+ * @param pg the peer group to retrieve the daemon from
+ * @param peer_id the peer identity of the daemon to retrieve
+ *
+ * @return the daemon on success, or NULL if no such peer identity is found
+ */
+struct GNUNET_TESTING_Daemon *
+GNUNET_TESTING_daemon_get_by_id (struct GNUNET_TESTING_PeerGroup *pg,
+                                 struct GNUNET_PeerIdentity *peer_id);
 
 /**
  * Stops a GNUnet daemon.
@@ -615,6 +628,32 @@ GNUNET_TESTING_daemons_churn (struct GNUNET_TESTING_PeerGroup *pg,
                               GNUNET_TESTING_NotifyCompletion cb,
                               void *cb_cls);
 
+/**
+ * Callback function to process statistic values.
+ *
+ * @param cls closure
+ * @param peer the peer the statistics belong to
+ * @param subsystem name of subsystem that created the statistic
+ * @param name the name of the datum
+ * @param value the current value
+ * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not
+ * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
+ */
+typedef int (*GNUNET_TESTING_STATISTICS_Iterator) (void *cls,
+                                                   const struct GNUNET_PeerIdentity *peer,
+                                                   const char *subsystem,
+                                                   const char *name,
+                                                   uint64_t value,
+                                                   int is_persistent);
+
+/**
+ * Iterate over all (running) peers in the peer group, retrieve
+ * all statistics from each.
+ */
+void
+GNUNET_TESTING_get_statistics (struct GNUNET_TESTING_PeerGroup *pg,
+                               GNUNET_STATISTICS_Callback cont,
+                               GNUNET_TESTING_STATISTICS_Iterator proc, void *cls);
 
 /**
  * Topologies supported for testbeds.