GNUnet  0.11.x
gnunet_statistics_service.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2009-2013, 2016 GNUnet e.V.
4 
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.
9 
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.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
39 #ifndef GNUNET_STATISTICS_SERVICE_H
40 #define GNUNET_STATISTICS_SERVICE_H
41 
42 #ifdef __cplusplus
43 extern "C"
44 {
45 #if 0 /* keep Emacsens' auto-indent happy */
46 }
47 #endif
48 #endif
49 
50 #include "gnunet_util_lib.h"
51 
55 #define GNUNET_STATISTICS_VERSION 0x00000000
56 
61 
72 typedef int
74  const char *subsystem,
75  const char *name,
76  uint64_t value,
77  int is_persistent);
78 
79 
88 GNUNET_STATISTICS_create (const char *subsystem,
89  const struct GNUNET_CONFIGURATION_Handle *cfg);
90 
91 
99 void
101  int sync_first);
102 
103 
114 int
116  const char *subsystem,
117  const char *name,
119  void *proc_cls);
120 
121 
132 int
134  const char *subsystem,
135  const char *name,
137  void *proc_cls);
138 
139 
147 typedef void
149  int success);
150 
151 
156 
157 
172  const char *subsystem,
173  const char *name,
176  void *cls);
177 
178 
185 void
187 
188 
198 void
200  const char *name,
201  uint64_t value,
202  int make_persistent);
203 
204 
214 void
216  const char *name,
217  int64_t delta,
218  int make_persistent);
219 
220 
221 #if 0 /* keep Emacsens' auto-indent happy */
222 {
223 #endif
224 #ifdef __cplusplus
225 }
226 #endif
227  /* end of group statistics */
229 
230 #endif
int make_persistent
Flag for SET/UPDATE actions.
static char * subsystem
Set to subsystem that we&#39;re going to get stats for (or NULL for all).
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static struct GNUNET_TIME_Relative delta
Definition: speedup.c:35
GNUNET_STATISTICS_Iterator proc
Function to call (for GET actions only).
struct GNUNET_STATISTICS_Handle * GNUNET_STATISTICS_create(const char *subsystem, const struct GNUNET_CONFIGURATION_Handle *cfg)
Get handle for the statistics service.
void GNUNET_STATISTICS_get_cancel(struct GNUNET_STATISTICS_GetHandle *gh)
Cancel a GNUNET_STATISTICS_get request.
Linked list of things we still need to do.
void GNUNET_STATISTICS_destroy(struct GNUNET_STATISTICS_Handle *h, int sync_first)
Destroy a handle (free all state associated with it).
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
Handle for the service.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
static char * value
Value of the record to add/remove.
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
void GNUNET_STATISTICS_set(struct GNUNET_STATISTICS_Handle *handle, const char *name, uint64_t value, int make_persistent)
Set statistic value for the peer.
int(* GNUNET_STATISTICS_Iterator)(void *cls, const char *subsystem, const char *name, uint64_t value, int is_persistent)
Callback function to process statistic values.
GNUNET_STATISTICS_Callback cont
Continuation to call once action is complete.
int GNUNET_STATISTICS_watch_cancel(struct GNUNET_STATISTICS_Handle *handle, const char *subsystem, const char *name, GNUNET_STATISTICS_Iterator proc, void *proc_cls)
Stop watching statistics from the peer.
struct GNUNET_STATISTICS_GetHandle * GNUNET_STATISTICS_get(struct GNUNET_STATISTICS_Handle *handle, const char *subsystem, const char *name, GNUNET_STATISTICS_Callback cont, GNUNET_STATISTICS_Iterator proc, void *cls)
Get statistic from the peer.
configuration data
Definition: configuration.c:85
const char * name
int GNUNET_STATISTICS_watch(struct GNUNET_STATISTICS_Handle *handle, const char *subsystem, const char *name, GNUNET_STATISTICS_Iterator proc, void *proc_cls)
Watch statistics from the peer (be notified whenever they change).
static struct GNUNET_TRANSPORT_HelloGetHandle * gh
Pending GNUNET_TRANSPORT_hello_get() operation.
void(* GNUNET_STATISTICS_Callback)(void *cls, int success)
Continuation called by GNUNET_STATISTICS_get() functions.