commented out wrong message type
[oweals/gnunet.git] / src / statistics / statistics.h
index 070a0aba5b7fe99f64e0ce00c3ebde3fb26f731b..41863a64f7c16e7b634d7b7b91e9b4e311a6b23c 100644 (file)
@@ -1,10 +1,10 @@
 /*
      This file is part of GNUnet.
-     (C) 2001, 2002, 2003, 2004, 2009 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2001-2014 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 2, or (at your
+     by the Free Software Foundation; either version 3, or (at your
      option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
@@ -14,8 +14,8 @@
 
      You should have received a copy of the GNU General Public License
      along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 */
 
 /**
@@ -27,7 +27,8 @@
 
 #include "gnunet_common.h"
 
-#define DEBUG_STATISTICS GNUNET_NO
+
+GNUNET_NETWORK_STRUCT_BEGIN
 
 /**
  * Statistics message. Contains how long the system is up
@@ -46,7 +47,8 @@ struct GNUNET_STATISTICS_ReplyMessage
   /**
    * Unique numerical identifier for the value (will
    * not change during the same client-session).  Highest
-   * bit will be set for persistent values.
+   * bit will be set for persistent values (see
+   * #GNUNET_STATISTICS_PERSIST_BIT).
    */
   uint32_t uid GNUNET_PACKED;
 
@@ -57,14 +59,31 @@ struct GNUNET_STATISTICS_ReplyMessage
 
 };
 
-#define GNUNET_STATISTICS_PERSIST_BIT (1<<31)
+/**
+ * Flag for the `struct GNUNET_STATISTICS_ReplyMessage` UID only.
+ * Note that other messages use #GNUNET_STATISTICS_SETFLAG_PERSISTENT.
+ */
+#define GNUNET_STATISTICS_PERSIST_BIT ((uint32_t) (1LLU<<31))
 
+/**
+ * The value being set is an absolute change.
+ */
 #define GNUNET_STATISTICS_SETFLAG_ABSOLUTE 0
 
+/**
+ * The value being set is a relative change.
+ */
 #define GNUNET_STATISTICS_SETFLAG_RELATIVE 1
 
+/**
+ * The value being set is to be persistent (note that
+ * this bit can be combined with #GNUNET_STATISTICS_SETFLAG_RELATIVE).
+ * This value must not be used for the `uid` member of
+ * `struct GNUNET_STATISTICS_ReplyMessage`!
+ */
 #define GNUNET_STATISTICS_SETFLAG_PERSISTENT 2
 
+
 /**
  * Message to set a statistic.  Followed
  * by the subsystem name and the name of
@@ -73,7 +92,7 @@ struct GNUNET_STATISTICS_ReplyMessage
 struct GNUNET_STATISTICS_SetMessage
 {
   /**
-   * Type: GNUNET_MESSAGE_TYPE_STATISTICS_SET
+   * Type: #GNUNET_MESSAGE_TYPE_STATISTICS_SET
    */
   struct GNUNET_MessageHeader header;
 
@@ -98,7 +117,7 @@ struct GNUNET_STATISTICS_SetMessage
 struct GNUNET_STATISTICS_WatchValueMessage
 {
   /**
-   * Type: GNUNET_MESSAGE_TYPE_STATISTICS_WATCH_VALUE
+   * Type: #GNUNET_MESSAGE_TYPE_STATISTICS_WATCH_VALUE
    */
   struct GNUNET_MessageHeader header;
 
@@ -110,9 +129,9 @@ struct GNUNET_STATISTICS_WatchValueMessage
 
   /**
    * Unique watch identification number (watch
-   * requests are enumerated in the order they 
-   * are received, the first request having 
-   * a wid of zero). 
+   * requests are enumerated in the order they
+   * are received, the first request having
+   * a wid of zero).
    */
   uint32_t wid GNUNET_PACKED;
 
@@ -126,8 +145,8 @@ struct GNUNET_STATISTICS_WatchValueMessage
    * be signed even though the type given here is unsigned.
    */
   uint64_t value GNUNET_PACKED;
-  
-};
 
+};
+GNUNET_NETWORK_STRUCT_END
 
 #endif