2 This file is part of GNUnet.
3 Copyright (C) 2001-2014 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
17 * @author Christian Grothoff
18 * @file statistics/statistics.h
23 #include "gnunet_common.h"
26 GNUNET_NETWORK_STRUCT_BEGIN
29 * Statistics message. Contains how long the system is up
32 * The struct is be followed by the service name and
33 * name of the statistic, both 0-terminated.
35 struct GNUNET_STATISTICS_ReplyMessage
38 * Type: GNUNET_MESSAGE_TYPE_STATISTICS_VALUE
40 struct GNUNET_MessageHeader header;
43 * Unique numerical identifier for the value (will
44 * not change during the same client-session). Highest
45 * bit will be set for persistent values (see
46 * #GNUNET_STATISTICS_PERSIST_BIT).
48 uint32_t uid GNUNET_PACKED;
53 uint64_t value GNUNET_PACKED;
58 * Flag for the `struct GNUNET_STATISTICS_ReplyMessage` UID only.
59 * Note that other messages use #GNUNET_STATISTICS_SETFLAG_PERSISTENT.
61 #define GNUNET_STATISTICS_PERSIST_BIT ((uint32_t) (1LLU<<31))
64 * The value being set is an absolute change.
66 #define GNUNET_STATISTICS_SETFLAG_ABSOLUTE 0
69 * The value being set is a relative change.
71 #define GNUNET_STATISTICS_SETFLAG_RELATIVE 1
74 * The value being set is to be persistent (note that
75 * this bit can be combined with #GNUNET_STATISTICS_SETFLAG_RELATIVE).
76 * This value must not be used for the `uid` member of
77 * `struct GNUNET_STATISTICS_ReplyMessage`!
79 #define GNUNET_STATISTICS_SETFLAG_PERSISTENT 2
83 * Message to set a statistic. Followed
84 * by the subsystem name and the name of
85 * the statistic (each 0-terminated).
87 struct GNUNET_STATISTICS_SetMessage
90 * Type: #GNUNET_MESSAGE_TYPE_STATISTICS_SET
92 struct GNUNET_MessageHeader header;
95 * 0 for absolute value, 1 for relative value; 2 to make persistent
96 * (see GNUNET_STATISTICS_SETFLAG_*).
98 uint32_t flags GNUNET_PACKED;
101 * Value. Note that if this is a relative value, it will
102 * be signed even though the type given here is unsigned.
104 uint64_t value GNUNET_PACKED;
110 * Message transmitted if a watched value changes.
112 struct GNUNET_STATISTICS_WatchValueMessage
115 * Type: #GNUNET_MESSAGE_TYPE_STATISTICS_WATCH_VALUE
117 struct GNUNET_MessageHeader header;
120 * 0 for absolute value, 1 for relative value; 2 to make persistent
121 * (see GNUNET_STATISTICS_SETFLAG_*).
123 uint32_t flags GNUNET_PACKED;
126 * Unique watch identification number (watch
127 * requests are enumerated in the order they
128 * are received, the first request having
131 uint32_t wid GNUNET_PACKED;
134 * Reserved (always 0).
136 uint32_t reserved GNUNET_PACKED;
139 * Value. Note that if this is a relative value, it will
140 * be signed even though the type given here is unsigned.
142 uint64_t value GNUNET_PACKED;
145 GNUNET_NETWORK_STRUCT_END