send the answer from dns to the vpn
[oweals/gnunet.git] / src / statistics / gnunet-service-statistics.c
1 /*
2      This file is part of GNUnet.
3      (C) 2009, 2010 Christian Grothoff (and other contributing authors)
4
5      GNUnet is free software; you can redistribute it and/or modify
6      it under the terms of the GNU General Public License as published
7      by the Free Software Foundation; either version 3, or (at your
8      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      General Public License for more details.
14
15      You should have received a copy of the GNU General Public License
16      along with GNUnet; see the file COPYING.  If not, write to the
17      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18      Boston, MA 02111-1307, USA.
19 */
20
21 /**
22  * @file statistics/gnunet-service-statistics.c
23  * @brief program that tracks statistics
24  * @author Christian Grothoff
25  * 
26  * TODO:
27  * - use BIO for IO operations
28  */
29 #include "platform.h"
30 #include "gnunet_container_lib.h"
31 #include "gnunet_disk_lib.h"
32 #include "gnunet_getopt_lib.h"
33 #include "gnunet_protocols.h"
34 #include "gnunet_service_lib.h"
35 #include "gnunet_statistics_service.h"
36 #include "gnunet_strings_lib.h"
37 #include "gnunet_time_lib.h"
38 #include "statistics.h"
39
40 /**
41  * Watch entry.
42  */
43 struct WatchEntry
44 {
45
46   struct WatchEntry *next;
47
48   struct WatchEntry *prev;
49
50   struct GNUNET_SERVER_Client *client;
51
52   uint64_t last_value;
53   
54   uint32_t wid;
55
56 };
57
58
59 /**
60  * Client entry.
61  */
62 struct ClientEntry
63 {
64
65   struct ClientEntry *next;
66
67   struct ClientEntry *prev;
68
69   struct GNUNET_SERVER_Client *client;
70   
71   uint32_t max_wid;
72
73 };
74
75 /**
76  * Entry in the statistics list.
77  */
78 struct StatsEntry
79 {
80   /**
81    * This is a linked list.
82    */
83   struct StatsEntry *next;
84
85   /**
86    * Name of the service, points into the
87    * middle of msg.
88    */
89   const char *service;
90
91   /**
92    * Name for the value, points into
93    * the middle of msg.
94    */
95   const char *name;
96
97   /**
98    * Message that can be used to set this value,
99    * stored at the end of the memory used by
100    * this struct.
101    */
102   struct GNUNET_STATISTICS_SetMessage *msg;
103
104   /**
105    * Watch context for changes to this
106    * value, or NULL for none.
107    */
108   struct WatchEntry *we_head;
109
110   /**
111    * Watch context for changes to this
112    * value, or NULL for none.
113    */
114   struct WatchEntry *we_tail;
115
116   /**
117    * Our value.
118    */
119   uint64_t value;
120
121   /**
122    * Unique ID.
123    */
124   uint32_t uid;
125
126   /**
127    * Is this value persistent?
128    */
129   int persistent;
130
131 };
132
133 /**
134  * Our configuration.
135  */
136 static const struct GNUNET_CONFIGURATION_Handle *cfg;
137
138 /**
139  * Linked list of our active statistics.
140  */
141 static struct StatsEntry *start;
142
143 static struct ClientEntry *client_head;
144
145 static struct ClientEntry *client_tail;
146
147 /**
148  * Our notification context.
149  */
150 static struct GNUNET_SERVER_NotificationContext *nc;
151
152 /**
153  * Counter used to generate unique values.
154  */
155 static uint32_t uidgen;
156
157
158 static void
159 inject_message (void *cls,
160                 void *client,
161                 const struct GNUNET_MessageHeader *msg)
162 {
163   struct GNUNET_SERVER_Handle *server = cls;
164
165   GNUNET_break (GNUNET_OK == GNUNET_SERVER_inject (server, NULL, msg));
166 }
167
168
169 /**
170  * Load persistent values from disk.  Disk format is
171  * exactly the same format that we also use for
172  * setting the values over the network.
173  *
174  * @param server handle to the server context
175  */
176 static void
177 load (struct GNUNET_SERVER_Handle *server)
178 {
179   char *fn;
180   struct GNUNET_DISK_FileHandle *fh;
181   struct GNUNET_DISK_MapHandle *mh;
182   struct stat sb;
183   char *buf;
184   struct GNUNET_SERVER_MessageStreamTokenizer *mst;
185
186   fn = GNUNET_DISK_get_home_filename (cfg,
187                                       "statistics", "statistics.data", NULL);
188   if (fn == NULL)
189     return;
190   if ((0 != stat (fn, &sb)) || (sb.st_size == 0))
191     {
192       GNUNET_free (fn);
193       return;
194     }
195   fh = GNUNET_DISK_file_open (fn, GNUNET_DISK_OPEN_READ,
196                               GNUNET_DISK_PERM_NONE);
197   if (!fh)
198     {
199       GNUNET_free (fn);
200       return;
201     }
202   buf = GNUNET_DISK_file_map (fh, &mh, GNUNET_DISK_MAP_TYPE_READ, sb.st_size);
203   if (NULL == buf)
204     {
205       GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "mmap", fn);
206       GNUNET_break (GNUNET_OK == GNUNET_DISK_file_close (fh));
207       GNUNET_free (fn);
208       return;
209     }
210   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
211               _("Loading %llu bytes of statistics from `%s'\n"),
212               (unsigned long long) sb.st_size, fn);
213   mst = GNUNET_SERVER_mst_create (&inject_message,
214                                   server);
215   GNUNET_break (GNUNET_OK ==
216                 GNUNET_SERVER_mst_receive (mst,
217                                            NULL,
218                                            buf,
219                                            sb.st_size,
220                                            GNUNET_YES,
221                                            GNUNET_NO));
222   GNUNET_SERVER_mst_destroy (mst);
223   GNUNET_break (GNUNET_OK == GNUNET_DISK_file_unmap (mh));
224   GNUNET_break (GNUNET_OK == GNUNET_DISK_file_close (fh));
225   GNUNET_free (fn);
226 }
227
228 /**
229  * Write persistent statistics to disk.
230  */
231 static void
232 save ()       
233 {
234   struct StatsEntry *pos;
235   char *fn;
236   struct GNUNET_DISK_FileHandle *fh;
237   uint16_t size;
238   unsigned long long total;
239
240   fh = NULL;
241   fn = GNUNET_DISK_get_home_filename (cfg,
242                                       "statistics", "statistics.data", NULL);
243   if (fn != NULL)
244     fh = GNUNET_DISK_file_open (fn, GNUNET_DISK_OPEN_WRITE
245         | GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_TRUNCATE,
246         GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE);
247   total = 0;
248   while (NULL != (pos = start))
249     {
250       start = pos->next;
251       if ((pos->persistent) && (NULL != fh))
252         {
253           size = htons (pos->msg->header.size);
254           if (size != GNUNET_DISK_file_write (fh, pos->msg, size))
255             {
256               GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
257                                         "write", fn);
258               GNUNET_DISK_file_close (fh);
259               fh = NULL;
260             }
261           else
262             total += size;
263         }
264       GNUNET_free (pos);
265     }
266   if (NULL != fh)
267     {
268       GNUNET_DISK_file_close (fh);
269       if (total == 0)
270         GNUNET_break (0 == UNLINK (fn));
271       else
272         GNUNET_log (GNUNET_ERROR_TYPE_INFO,
273                     _("Wrote %llu bytes of statistics to `%s'\n"), total, fn);
274     }
275   GNUNET_free_non_null (fn);
276 }
277
278
279 /**
280  * Transmit the given stats value.
281  */
282 static void
283 transmit (struct GNUNET_SERVER_Client *client,
284           const struct StatsEntry *e)
285 {
286   struct GNUNET_STATISTICS_ReplyMessage *m;
287   size_t size;
288
289   size =
290     sizeof (struct GNUNET_STATISTICS_ReplyMessage) + strlen (e->service) + 1 +
291     strlen (e->name) + 1;
292   GNUNET_assert (size < GNUNET_SERVER_MAX_MESSAGE_SIZE);
293   m = GNUNET_malloc (size);
294   m->header.type = htons (GNUNET_MESSAGE_TYPE_STATISTICS_VALUE);
295   m->header.size = htons (size);
296   m->uid = htonl (e->uid);
297   if (e->persistent)
298     m->uid |= htonl (GNUNET_STATISTICS_PERSIST_BIT);
299   m->value = GNUNET_htonll (e->value);
300   size -= sizeof (struct GNUNET_STATISTICS_ReplyMessage);
301   GNUNET_assert (size == GNUNET_STRINGS_buffer_fill ((char *) &m[1],
302                                                      size,
303                                                      2, e->service, e->name));
304 #if DEBUG_STATISTICS
305   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
306               "Transmitting value for `%s:%s' (%d): %llu\n",
307               e->service, e->name,
308               e->persistent, e->value);
309 #endif
310   GNUNET_SERVER_notification_context_unicast (nc, client, &m->header, GNUNET_NO);
311   GNUNET_free (m);
312 }
313
314
315 /**
316  * Does this entry match the request?
317  */
318 static int
319 matches (const struct StatsEntry *e, const char *service, const char *name)
320 {
321   return ((0 == strlen (service)) ||
322           (0 == strcmp (service, e->service)))
323     && ((0 == strlen (name)) || (0 == strcmp (name, e->name)));
324 }
325
326
327 static struct ClientEntry *
328 make_client_entry (struct GNUNET_SERVER_Client *client)
329 {
330   struct ClientEntry *ce;
331
332   GNUNET_assert (client != NULL);
333   ce = client_head;
334   while (ce != NULL)
335     {
336       if (ce->client == client)
337         return ce;
338       ce = ce->next;
339     }
340   ce = GNUNET_malloc (sizeof (struct ClientEntry));
341   ce->client = client;
342   GNUNET_SERVER_client_keep (client);
343   GNUNET_CONTAINER_DLL_insert (client_head,
344                                client_tail,
345                                ce);
346   GNUNET_SERVER_notification_context_add (nc,
347                                           client);
348   return ce;
349 }
350
351
352 /**
353  * Handle GET-message.
354  *
355  * @param cls closure
356  * @param client identification of the client
357  * @param message the actual message
358  * @return GNUNET_OK to keep the connection open,
359  *         GNUNET_SYSERR to close it (signal serious error)
360  */
361 static void
362 handle_get (void *cls,
363             struct GNUNET_SERVER_Client *client,
364             const struct GNUNET_MessageHeader *message)
365 {
366   struct GNUNET_MessageHeader end;
367   char *service;
368   char *name;
369   struct StatsEntry *pos;
370   size_t size;
371
372   if (client != NULL)
373     make_client_entry (client);
374   size = ntohs (message->size) - sizeof (struct GNUNET_MessageHeader);
375   if (size != GNUNET_STRINGS_buffer_tokenize ((const char *) &message[1],
376                                               size, 2, &service, &name))
377     {
378       GNUNET_break (0);
379       GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
380       return;
381     }
382 #if DEBUG_STATISTICS
383   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
384               "Received request for statistics on `%s:%s'\n",
385               strlen (service) ? service : "*", strlen (name) ? name : "*");
386 #endif
387   pos = start;
388   while (pos != NULL)
389     {
390       if (matches (pos, service, name))
391         transmit (client, pos);
392       pos = pos->next;
393     }
394   end.size = htons (sizeof (struct GNUNET_MessageHeader));
395   end.type = htons (GNUNET_MESSAGE_TYPE_STATISTICS_END);
396   GNUNET_SERVER_notification_context_unicast (nc,
397                                               client,
398                                               &end,
399                                               GNUNET_NO);
400   GNUNET_SERVER_receive_done (client,
401                               GNUNET_OK);
402 }
403
404
405 static void
406 notify_change (struct StatsEntry *se)
407 {
408   struct GNUNET_STATISTICS_WatchValueMessage wvm;
409   struct WatchEntry *pos;
410
411   pos = se->we_head;
412   while (pos != NULL)
413     {
414       if (pos->last_value != se->value)
415         {
416           wvm.header.type = htons (GNUNET_MESSAGE_TYPE_STATISTICS_WATCH_VALUE);
417           wvm.header.size = htons (sizeof (struct GNUNET_STATISTICS_WatchValueMessage));
418           wvm.flags = htonl (se->persistent ? GNUNET_STATISTICS_PERSIST_BIT : 0);
419           wvm.wid = htonl (pos->wid);
420           wvm.reserved = htonl (0);
421           wvm.value = GNUNET_htonll (se->value);
422           GNUNET_SERVER_notification_context_unicast (nc,
423                                                       pos->client,
424                                                       &wvm.header,
425                                                       GNUNET_NO);
426           pos->last_value = se->value;
427         }
428       pos = pos->next;
429     }
430 }
431
432 /**
433  * Handle SET-message.
434  *
435  * @param cls closure
436  * @param client identification of the client
437  * @param message the actual message
438  */
439 static void
440 handle_set (void *cls,
441             struct GNUNET_SERVER_Client *client,
442             const struct GNUNET_MessageHeader *message)
443 {
444   char *service;
445   char *name;
446   uint16_t msize;
447   uint16_t size;
448   const struct GNUNET_STATISTICS_SetMessage *msg;
449   struct StatsEntry *pos;
450   struct StatsEntry *prev;
451   uint32_t flags;
452   uint64_t value;
453   int64_t delta;
454   int changed;
455
456   if (client != NULL)
457     make_client_entry (client);
458   msize = ntohs (message->size);
459   if (msize < sizeof (struct GNUNET_STATISTICS_SetMessage))
460     {
461       GNUNET_break (0);
462       GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
463       return;
464     }
465   size = msize - sizeof (struct GNUNET_STATISTICS_SetMessage);
466   msg = (const struct GNUNET_STATISTICS_SetMessage *) message;
467
468   if (size != GNUNET_STRINGS_buffer_tokenize ((const char *) &msg[1],
469                                               size, 2, &service, &name))
470     {
471       GNUNET_break (0);
472       GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
473       return;
474     }
475   flags = ntohl (msg->flags);
476   value = GNUNET_ntohll (msg->value);
477 #if DEBUG_STATISTICS
478   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
479               "Received request to update statistic on `%s:%s' (%u) to/by %llu\n",
480               service, name,
481               (unsigned int) flags,
482               (unsigned long long) value);
483 #endif
484   pos = start;
485   prev = NULL;
486   while (pos != NULL)
487     {
488       if (matches (pos, service, name))
489         {
490           if ((flags & GNUNET_STATISTICS_SETFLAG_RELATIVE) == 0)
491             {
492               changed = (pos->value != value);
493               pos->value = value;
494             }
495           else
496             {
497               delta = (int64_t) value;
498               if ((delta < 0) && (pos->value < -delta))
499                 {
500                   changed = (pos->value != 0);
501                   pos->value = 0;
502                 }
503               else
504                 {
505                   changed = (delta != 0);
506                   GNUNET_break ((delta <= 0) ||
507                                 (pos->value + delta > pos->value));
508                   pos->value += delta;
509                 }
510             }
511           pos->msg->value = GNUNET_htonll (pos->value);
512           pos->msg->flags = msg->flags;
513           pos->persistent =
514             (0 != (flags & GNUNET_STATISTICS_SETFLAG_PERSISTENT));
515           if (prev != NULL)
516             {
517               /* move to front for faster setting next time! */
518               prev->next = pos->next;
519               pos->next = start;
520               start = pos;
521             }
522 #if DEBUG_STATISTICS
523           GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
524                       "Statistic `%s:%s' updated to value %llu.\n",
525                       service, name, pos->value);
526 #endif
527           if (changed) 
528             notify_change (pos);
529           GNUNET_SERVER_receive_done (client, GNUNET_OK);
530           return;
531         }
532       prev = pos;
533       pos = pos->next;
534     }
535   pos = GNUNET_malloc (sizeof (struct StatsEntry) + msize);
536   pos->next = start;
537   if (((flags & GNUNET_STATISTICS_SETFLAG_RELATIVE) == 0) ||
538       (0 < (int64_t) GNUNET_ntohll (msg->value)))
539     pos->value = GNUNET_ntohll (msg->value);
540   pos->uid = uidgen++;
541   pos->persistent = (0 != (flags & GNUNET_STATISTICS_SETFLAG_PERSISTENT));
542   pos->msg = (void *) &pos[1];
543   memcpy (pos->msg, message, ntohs (message->size));
544   pos->service = (const char *) &pos->msg[1];
545   pos->name = &pos->service[strlen (pos->service) + 1];
546
547   start = pos;
548 #if DEBUG_STATISTICS
549   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
550               "New statistic on `%s:%s' with value %llu created.\n",
551               service, name, pos->value);
552 #endif
553   GNUNET_SERVER_receive_done (client, GNUNET_OK);
554 }
555
556
557 /**
558  * Handle WATCH-message.
559  *
560  * @param cls closure
561  * @param client identification of the client
562  * @param message the actual message
563  */
564 static void
565 handle_watch (void *cls,
566               struct GNUNET_SERVER_Client *client,
567               const struct GNUNET_MessageHeader *message)
568 {
569   char *service;
570   char *name;
571   uint16_t msize;
572   uint16_t size;
573   struct StatsEntry *pos;
574   struct ClientEntry *ce;
575   struct WatchEntry *we;
576   size_t slen;
577
578   ce = make_client_entry (client);
579   msize = ntohs (message->size);
580   if (msize < sizeof (struct GNUNET_MessageHeader))
581     {
582       GNUNET_break (0);
583       GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
584       return;
585     }
586   size = msize - sizeof (struct GNUNET_MessageHeader);
587   if (size != GNUNET_STRINGS_buffer_tokenize ((const char *) &message[1],
588                                               size, 2, &service, &name))
589     {
590       GNUNET_break (0);
591       GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
592       return;
593     }
594 #if DEBUG_STATISTICS
595   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
596               "Received request to watch statistic on `%s:%s'\n",
597               service, name);
598 #endif
599   pos = start;
600   while (pos != NULL)
601     {
602       if (matches (pos, service, name))
603         break;
604       pos = pos->next;
605     }
606   if (pos == NULL)
607     {
608       pos = GNUNET_malloc (sizeof (struct StatsEntry) + 
609                            sizeof (struct GNUNET_STATISTICS_SetMessage) + 
610                            size);
611       pos->next = start;
612       pos->uid = uidgen++;
613       pos->msg = (void *) &pos[1];
614       pos->msg->header.size = htons (sizeof (struct GNUNET_STATISTICS_SetMessage) + 
615                                      size);
616       pos->msg->header.type = htons (GNUNET_MESSAGE_TYPE_STATISTICS_SET);
617       pos->service = (const char *) &pos->msg[1];
618       slen = strlen (service) + 1;
619       memcpy ((void*) pos->service, service, slen);
620       pos->name = &pos->service[slen];
621       memcpy ((void*) pos->name, name, strlen (name)+1);
622       start = pos;
623     }
624   we = GNUNET_malloc (sizeof (struct WatchEntry));
625   we->client = client;
626   GNUNET_SERVER_client_keep (client);
627   we->wid = ce->max_wid++;
628   GNUNET_CONTAINER_DLL_insert (pos->we_head,
629                                pos->we_tail,
630                                we);
631   if (pos->value != 0)
632     notify_change (pos);
633   GNUNET_SERVER_receive_done (client,
634                               GNUNET_OK);
635 }
636
637
638 /**
639  * Task run during shutdown.
640  *
641  * @param cls unused
642  * @param tc unused
643  */
644 static void
645 shutdown_task (void *cls,
646                const struct GNUNET_SCHEDULER_TaskContext *tc)
647 {
648   struct ClientEntry *ce;
649   struct WatchEntry *we;
650   struct StatsEntry *se;
651
652   save ();
653   GNUNET_SERVER_notification_context_destroy (nc);
654   nc = NULL;
655   while (NULL != (ce = client_head))
656     {
657       GNUNET_SERVER_client_drop (ce->client);
658       GNUNET_CONTAINER_DLL_remove (client_head,
659                                    client_tail,
660                                    ce);
661       GNUNET_free (ce);
662     }
663   while (NULL != (se = start))
664     {
665       start = se->next;
666       while (NULL != (we = se->we_head))
667         {
668           GNUNET_SERVER_client_drop (we->client);
669           GNUNET_CONTAINER_DLL_remove (se->we_head,
670                                        se->we_tail,
671                                        we);
672           GNUNET_free (we);
673         }
674       GNUNET_free (se);
675     }
676 }
677
678
679 /**
680  * A client disconnected.  Remove all of its data structure entries.
681  *
682  * @param cls closure, NULL
683  * @param client identification of the client
684  */
685 static void
686 handle_client_disconnect (void *cls,
687                           struct GNUNET_SERVER_Client
688                           * client)
689 {
690   struct ClientEntry *ce;
691   struct WatchEntry *we;
692   struct WatchEntry *wen;
693   struct StatsEntry *se;
694   
695   ce = client_head;
696   while (NULL != ce)
697     {
698       if (ce->client == client)
699         {
700           GNUNET_SERVER_client_drop (ce->client);
701           GNUNET_CONTAINER_DLL_remove (client_head,
702                                        client_tail,
703                                        ce);
704           GNUNET_free (ce);
705           break;
706         }
707       ce = ce->next;
708     }
709   se = start;
710   while (NULL != se)
711     {
712       wen = se->we_head;
713       while (NULL != (we = wen))
714         {
715           wen = we->next;
716           if (we->client != client)
717             continue;
718           GNUNET_SERVER_client_drop (we->client);
719           GNUNET_CONTAINER_DLL_remove (se->we_head,
720                                        se->we_tail,
721                                        we);
722           GNUNET_free (we);
723         }
724       se = se->next;
725     }
726 }
727
728
729 /**
730  * Process statistics requests.
731  *
732  * @param cls closure
733  * @param sched scheduler to use
734  * @param server the initialized server
735  * @param c configuration to use
736  */
737 static void
738 run (void *cls,
739      struct GNUNET_SCHEDULER_Handle *sched,
740      struct GNUNET_SERVER_Handle *server,
741      const struct GNUNET_CONFIGURATION_Handle *c)
742 {
743   static const struct GNUNET_SERVER_MessageHandler handlers[] = {
744     {&handle_set, NULL, GNUNET_MESSAGE_TYPE_STATISTICS_SET, 0},
745     {&handle_get, NULL, GNUNET_MESSAGE_TYPE_STATISTICS_GET, 0},
746     {&handle_watch, NULL, GNUNET_MESSAGE_TYPE_STATISTICS_WATCH, 0},
747     {NULL, NULL, 0, 0}
748   };
749   cfg = c;
750   GNUNET_SERVER_add_handlers (server, handlers);
751   nc = GNUNET_SERVER_notification_context_create (server, 16);
752   GNUNET_SERVER_disconnect_notify (server, 
753                                    &handle_client_disconnect,
754                                    NULL);
755   load (server);
756   GNUNET_SCHEDULER_add_delayed (sched,
757                                 GNUNET_TIME_UNIT_FOREVER_REL,
758                                 &shutdown_task,
759                                 NULL);
760 }
761
762
763 /**
764  * The main function for the statistics service.
765  *
766  * @param argc number of arguments from the command line
767  * @param argv command line arguments
768  * @return 0 ok, 1 on error
769  */
770 int
771 main (int argc, char *const *argv)
772 {
773   return (GNUNET_OK ==
774           GNUNET_SERVICE_run (argc,
775                               argv,
776                               "statistics",
777                               GNUNET_SERVICE_OPTION_NONE,
778                               &run, NULL)) ? 0 : 1;
779 }
780
781 /* end of gnunet-service-statistics.c */