-change vpn wire data format
[oweals/gnunet.git] / src / include / gnunet_statistics_service.h
index 90cc612df84de5168ec88afd2eaa9195c967302f..051533182e360f0e887c1f37dbc48883ce1ddec7 100644 (file)
@@ -72,11 +72,9 @@ typedef int (*GNUNET_STATISTICS_Iterator) (void *cls, const char *subsystem,
  * @param cfg services configuration in use
  * @return handle to use
  */
-struct GNUNET_STATISTICS_Handle *GNUNET_STATISTICS_create (const char
-                                                           *subsystem,
-                                                           const struct
-                                                           GNUNET_CONFIGURATION_Handle
-                                                           *cfg);
+struct GNUNET_STATISTICS_Handle *
+GNUNET_STATISTICS_create (const char *subsystem,
+                          const struct GNUNET_CONFIGURATION_Handle *cfg);
 
 
 /**
@@ -87,14 +85,12 @@ struct GNUNET_STATISTICS_Handle *GNUNET_STATISTICS_create (const char
  * @param sync_first set to GNUNET_YES if pending SET requests should
  *        be completed
  */
-void GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h,
-                                int sync_first);
+void
+GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, int sync_first);
 
 
 /**
  * Watch statistics from the peer (be notified whenever they change).
- * Note that the only way to cancel a "watch" request is to destroy
- * the statistics handle given as the first argument to this call.
  *
  * @param handle identification of the statistics service
  * @param subsystem limit to the specified subsystem, never NULL
@@ -103,9 +99,26 @@ void GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h,
  * @param proc_cls closure for proc
  * @return GNUNET_OK on success, GNUNET_SYSERR on error
  */
-int GNUNET_STATISTICS_watch (struct GNUNET_STATISTICS_Handle *handle,
-                             const char *subsystem, const char *name,
-                             GNUNET_STATISTICS_Iterator proc, void *proc_cls);
+int
+GNUNET_STATISTICS_watch (struct GNUNET_STATISTICS_Handle *handle,
+                         const char *subsystem, const char *name,
+                         GNUNET_STATISTICS_Iterator proc, void *proc_cls);
+
+
+/**
+ * Stop watching statistics from the peer.
+ *
+ * @param handle identification of the statistics service
+ * @param subsystem limit to the specified subsystem, never NULL
+ * @param name name of the statistic value, never NULL
+ * @param proc function to call on each value
+ * @param proc_cls closure for proc
+ * @return GNUNET_OK on success, GNUNET_SYSERR on error (no such watch)
+ */
+int
+GNUNET_STATISTICS_watch_cancel (struct GNUNET_STATISTICS_Handle *handle,
+                               const char *subsystem, const char *name,
+                               GNUNET_STATISTICS_Iterator proc, void *proc_cls);
 
 
 /**
@@ -117,6 +130,7 @@ int GNUNET_STATISTICS_watch (struct GNUNET_STATISTICS_Handle *handle,
  */
 typedef void (*GNUNET_STATISTICS_Callback) (void *cls, int success);
 
+
 /**
  * Handle that can be used to cancel a statistics 'get' operation.
  */
@@ -131,32 +145,27 @@ struct GNUNET_STATISTICS_GetHandle;
  * @param timeout after how long should we give up (and call
  *        notify with buf NULL and size 0)?
  * @param cont continuation to call when done (can be NULL)
+ *        This callback CANNOT destroy the statistics handle in the same call.
  * @param proc function to call on each value
  * @param cls closure for proc and cont
  * @return NULL on error
  */
-struct GNUNET_STATISTICS_GetHandle *GNUNET_STATISTICS_get (struct
-                                                           GNUNET_STATISTICS_Handle
-                                                           *handle,
-                                                           const char
-                                                           *subsystem,
-                                                           const char *name,
-                                                           struct
-                                                           GNUNET_TIME_Relative
-                                                           timeout,
-                                                           GNUNET_STATISTICS_Callback
-                                                           cont,
-                                                           GNUNET_STATISTICS_Iterator
-                                                           proc, void *cls);
+struct GNUNET_STATISTICS_GetHandle *
+GNUNET_STATISTICS_get (struct GNUNET_STATISTICS_Handle *handle,
+                       const char *subsystem, const char *name,
+                       struct GNUNET_TIME_Relative timeout,
+                       GNUNET_STATISTICS_Callback cont,
+                       GNUNET_STATISTICS_Iterator proc, void *cls);
 
 
 /**
- * Cancel a 'get' request.  Must be called before the 'cont' 
+ * Cancel a 'get' request.  Must be called before the 'cont'
  * function is called.
  *
  * @param gh handle of the request to cancel
  */
-void GNUNET_STATISTICS_get_cancel (struct GNUNET_STATISTICS_GetHandle *gh);
+void
+GNUNET_STATISTICS_get_cancel (struct GNUNET_STATISTICS_GetHandle *gh);
 
 
 /**
@@ -168,9 +177,9 @@ void GNUNET_STATISTICS_get_cancel (struct GNUNET_STATISTICS_GetHandle *gh);
  * @param value new value to set
  * @param make_persistent should the value be kept across restarts?
  */
-void GNUNET_STATISTICS_set (struct GNUNET_STATISTICS_Handle *handle,
-                            const char *name, uint64_t value,
-                            int make_persistent);
+void
+GNUNET_STATISTICS_set (struct GNUNET_STATISTICS_Handle *handle,
+                       const char *name, uint64_t value, int make_persistent);
 
 /**
  * Set statistic value for the peer.  Will always use our
@@ -181,9 +190,9 @@ void GNUNET_STATISTICS_set (struct GNUNET_STATISTICS_Handle *handle,
  * @param delta change in value (added to existing value)
  * @param make_persistent should the value be kept across restarts?
  */
-void GNUNET_STATISTICS_update (struct GNUNET_STATISTICS_Handle *handle,
-                               const char *name, int64_t delta,
-                               int make_persistent);
+void
+GNUNET_STATISTICS_update (struct GNUNET_STATISTICS_Handle *handle,
+                          const char *name, int64_t delta, int make_persistent);