You are here

The STATISTICS Client-Service Protocol.

Primary tabs

Statistics retrieval

To retrieve statistics, the client transmits a message of type GNUNET_MESSAGE_TYPE_STATISTICS_GET containing the given subsystem name and statistic parameter to the STATISTICS service. The service responds with a message of type GNUNET_MESSAGE_TYPE_STATISTICS_VALUE for each of the statistics parameters that match the client request for the client. The end of information retrieved is signaled by the service by sending a message of type GNUNET_MESSAGE_TYPE_STATISTICS_END.

Setting and updating statistics

The subsystem name, parameter name, its value and the persistence flag are communicated to the service through the message GNUNET_MESSAGE_TYPE_STATISTICS_SET.

When the service receives a message of type GNUNET_MESSAGE_TYPE_STATISTICS_SET, it retrieves the subsystem name and checks for a statistic parameter with matching the name given in the message. If a statistic parameter is found, the value is overwritten by the new value from the message; if not found then a new statistic parameter is created with the given name and value.

In addition to just setting an absolute value, it is possible to perform a relative update by sending a message of type GNUNET_MESSAGE_TYPE_STATISTICS_SET with an update flag (GNUNET_STATISTICS_SETFLAG_RELATIVE) signifying that the value in the message should be treated as an update value.

Watching for updates

The function registers the watch at the service by sending a message of type GNUNET_MESSAGE_TYPE_STATISTICS_WATCH. The service then sends notifications through messages of type GNUNET_MESSAGE_TYPE_STATISTICS_WATCH_VALUE whenever the statistic parameter's value is changed.