sensor: towards p2p anomaly reporting
[oweals/gnunet.git] / src / sensor / gnunet-service-sensor.c
1 /*
2      This file is part of GNUnet.
3      (C)
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 sensor/gnunet-service-sensor.c
23  * @brief sensor service implementation
24  * @author Omar Tarabai
25  */
26 #include <inttypes.h>
27 #include "platform.h"
28 #include "gnunet_util_lib.h"
29 #include "sensor.h"
30 #include "gnunet_statistics_service.h"
31 #include "gnunet_peerstore_service.h"
32
33 /**
34  * Our configuration.
35  */
36 static const struct GNUNET_CONFIGURATION_Handle *cfg;
37
38 /**
39  * Hashmap of loaded sensor definitions
40  */
41 static struct GNUNET_CONTAINER_MultiHashMap *sensors;
42
43 /**
44  * Handle to statistics service
45  */
46 struct GNUNET_STATISTICS_Handle *statistics;
47
48 /**
49  * Handle to peerstore service
50  */
51 struct GNUNET_PEERSTORE_Handle *peerstore;
52
53 /**
54  * Service name
55  */
56 char *subsystem = "sensor";
57
58 /**
59  * My peer id
60  */
61 struct GNUNET_PeerIdentity peerid;
62
63
64 /**
65  * Resets the service by stopping components, reloading sensors and starting
66  * components. This is needed when we receive new sensor updates.
67  */
68 static void
69 reset ();
70
71
72 /**
73  * Change the state of the sensor.
74  * Write the change to file to make it persistent.
75  *
76  * @param sensor sensor info struct
77  * @param state new enabled state: #GNUNET_YES / #GNUNET_NO
78  */
79 static void
80 set_sensor_enabled (struct GNUNET_SENSOR_SensorInfo *sensor, int state)
81 {
82   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sensor `%s': Setting enabled to %d.\n",
83               sensor->name, state);
84   sensor->enabled = GNUNET_NO;
85   GNUNET_assert (NULL != sensor->cfg);
86   GNUNET_CONFIGURATION_set_value_string (sensor->cfg, sensor->name, "ENABLED",
87                                          (GNUNET_YES == state) ? "YES" : "NO");
88   GNUNET_CONFIGURATION_write (sensor->cfg, sensor->def_file);
89 }
90
91
92 /**
93  * Stops components and destroys sensors
94  */
95 static void
96 stop ()
97 {
98   SENSOR_update_stop ();
99   SENSOR_reporting_stop ();
100   SENSOR_analysis_stop ();
101   GNUNET_SENSOR_destroy_sensors (sensors);
102 }
103
104
105 /**
106  * Task run during shutdown.
107  *
108  * @param cls unused
109  * @param tc unused
110  */
111 static void
112 shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
113 {
114   stop ();
115   if (NULL != statistics)
116   {
117     GNUNET_STATISTICS_destroy (statistics, GNUNET_YES);
118     statistics = NULL;
119   }
120   if (NULL != peerstore)
121   {
122     GNUNET_PEERSTORE_disconnect (peerstore, GNUNET_YES);
123     peerstore = NULL;
124   }
125   GNUNET_SCHEDULER_shutdown ();
126 }
127
128
129 /**
130  * A client disconnected.  Remove all of its data structure entries.
131  *
132  * @param cls closure, NULL
133  * @param client identification of the client
134  */
135 static void
136 handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
137 {
138 }
139
140
141 /**
142  * Creates a structure with basic sensor info to be sent to a client.
143  *
144  * @param sensor sensor information
145  * @return message ready to be sent to client
146  */
147 static struct SensorInfoMessage *
148 create_sensor_info_msg (struct GNUNET_SENSOR_SensorInfo *sensor)
149 {
150   struct SensorInfoMessage *msg;
151   uint16_t len;
152   size_t name_len;
153   size_t desc_len;
154   char *str_ptr;
155
156   name_len = strlen (sensor->name);
157   if (NULL == sensor->description)
158     desc_len = 0;
159   else
160     desc_len = strlen (sensor->description) + 1;
161   len = 0;
162   len += sizeof (struct SensorInfoMessage);
163   len += name_len;
164   len += desc_len;
165   msg = GNUNET_malloc (len);
166   msg->header.size = htons (len);
167   msg->header.type = htons (GNUNET_MESSAGE_TYPE_SENSOR_INFO);
168   msg->name_len = htons (name_len);
169   msg->description_len = htons (desc_len);
170   msg->version_major = htons (sensor->version_major);
171   msg->version_minor = htons (sensor->version_minor);
172   str_ptr = (char *) &msg[1];
173   memcpy (str_ptr, sensor->name, name_len);
174   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending sensor name (%d): %.*s\n",
175               name_len, name_len, str_ptr);
176   str_ptr += name_len;
177   memcpy (str_ptr, sensor->description, desc_len);
178   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
179               "Sending sensor description (%d): %.*s\n", desc_len, desc_len,
180               str_ptr);
181   return msg;
182 }
183
184
185 /**
186  * Handle GET SENSOR message.
187  *
188  * @param cls closure
189  * @param client identification of the client
190  * @param message the actual message
191  */
192 static void
193 handle_get_sensor (void *cls, struct GNUNET_SERVER_Client *client,
194                    const struct GNUNET_MessageHeader *message)
195 {
196   struct GNUNET_SERVER_TransmitContext *tc;
197   char *sensorname;
198   size_t sensorname_len;
199   struct GNUNET_HashCode key;
200   struct GNUNET_SENSOR_SensorInfo *sensorinfo;
201   struct SensorInfoMessage *msg;
202
203   sensorname = (char *) &message[1];
204   sensorname_len = ntohs (message->size) - sizeof (struct GNUNET_MessageHeader);
205   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
206               "`%s' message received for sensor (%d) `%.*s'\n", "GET SENSOR",
207               sensorname_len, sensorname_len, sensorname);
208   tc = GNUNET_SERVER_transmit_context_create (client);
209   GNUNET_CRYPTO_hash (sensorname, sensorname_len, &key);
210   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
211               "Created key hash for requested sensor\n");
212   sensorinfo =
213       (struct GNUNET_SENSOR_SensorInfo *)
214       GNUNET_CONTAINER_multihashmap_get (sensors, &key);
215   if (NULL != sensorinfo)
216   {
217     msg = create_sensor_info_msg (sensorinfo);
218     GNUNET_SERVER_transmit_context_append_message (tc,
219                                                    (struct GNUNET_MessageHeader
220                                                     *) msg);
221     GNUNET_free (msg);
222   }
223   else
224     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
225                 "Requested sensor `%.*s' was not found\n", sensorname_len,
226                 sensorname);
227   GNUNET_SERVER_transmit_context_append_data (tc, NULL, 0,
228                                               GNUNET_MESSAGE_TYPE_SENSOR_END);
229   GNUNET_SERVER_transmit_context_run (tc, GNUNET_TIME_UNIT_FOREVER_REL);
230 }
231
232
233 /**
234  * Iterator for sensors and adds them to transmit context
235  *
236  * @param cls a `struct GNUNET_SERVER_TransmitContext *`
237  * @param key hash of sensor name, key to hashmap
238  * @param value a `struct GNUNET_SENSOR_SensorInfo *`
239  */
240 static int
241 add_sensor_to_tc (void *cls, const struct GNUNET_HashCode *key, void *value)
242 {
243   struct GNUNET_SERVER_TransmitContext *tc = cls;
244   struct GNUNET_SENSOR_SensorInfo *sensorinfo = value;
245   struct SensorInfoMessage *msg;
246
247   msg = create_sensor_info_msg (sensorinfo);
248   GNUNET_SERVER_transmit_context_append_message (tc,
249                                                  (struct GNUNET_MessageHeader *)
250                                                  msg);
251
252   GNUNET_free (msg);
253   return GNUNET_YES;
254 }
255
256
257 /**
258  * Handle GET ALL SENSORS message.
259  *
260  * @param cls closure
261  * @param client identification of the client
262  * @param message the actual message
263  */
264 static void
265 handle_get_all_sensors (void *cls, struct GNUNET_SERVER_Client *client,
266                         const struct GNUNET_MessageHeader *message)
267 {
268   struct GNUNET_SERVER_TransmitContext *tc;
269
270   GNUNET_log (GNUNET_ERROR_TYPE_INFO, "`%s' message received.\n",
271               "GET ALL SENSOR");
272   tc = GNUNET_SERVER_transmit_context_create (client);
273   GNUNET_CONTAINER_multihashmap_iterate (sensors, &add_sensor_to_tc, tc);
274   GNUNET_SERVER_transmit_context_append_data (tc, NULL, 0,
275                                               GNUNET_MESSAGE_TYPE_SENSOR_END);
276   GNUNET_SERVER_transmit_context_run (tc, GNUNET_TIME_UNIT_FOREVER_REL);
277 }
278
279
280 /**
281  * Do a series of checks to determine if sensor should execute
282  *
283  * @return #GNUNET_YES / #GNUNET_NO
284  */
285 static int
286 should_run_sensor (struct GNUNET_SENSOR_SensorInfo *sensorinfo)
287 {
288   struct GNUNET_TIME_Absolute now;
289
290   if (GNUNET_NO == sensorinfo->enabled)
291   {
292     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
293                 "Sensor `%s' is disabled, will not run\n", sensorinfo->name);
294     return GNUNET_NO;
295   }
296   now = GNUNET_TIME_absolute_get ();
297   if (NULL != sensorinfo->start_time &&
298       now.abs_value_us < sensorinfo->start_time->abs_value_us)
299   {
300     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
301                 "Start time for sensor `%s' not reached yet, will not run\n",
302                 sensorinfo->name);
303     return GNUNET_NO;
304   }
305   if (NULL != sensorinfo->end_time &&
306       now.abs_value_us >= sensorinfo->end_time->abs_value_us)
307   {
308     GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Sensor `%s' expired, disabling.\n",
309                 sensorinfo->name);
310     set_sensor_enabled (sensorinfo, GNUNET_NO);
311     return GNUNET_NO;
312   }
313   return GNUNET_YES;
314 }
315
316
317 /**
318  * Callback function to process statistic values
319  *
320  * @param cls `struct GNUNET_SENSOR_SensorInfo *`
321  * @param ss name of subsystem that created the statistic
322  * @param name the name of the datum
323  * @param value the current value
324  * @param is_persistent #GNUNET_YES if the value is persistent, #GNUNET_NO if not
325  * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration
326  */
327 static int
328 sensor_statistics_iterator (void *cls, const char *ss, const char *name,
329                             uint64_t value, int is_persistent)
330 {
331   struct GNUNET_SENSOR_SensorInfo *sensorinfo = cls;
332   double dvalue = (double) value;
333   struct GNUNET_TIME_Absolute expiry;
334
335   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
336               "Received a value for sensor `%s': %" PRIu64 "\n",
337               sensorinfo->name, value);
338   expiry = GNUNET_TIME_relative_to_absolute (sensorinfo->lifetime);
339   GNUNET_PEERSTORE_store (peerstore, subsystem, &peerid, sensorinfo->name,
340                           &dvalue, sizeof (dvalue), expiry,
341                           GNUNET_PEERSTORE_STOREOPTION_MULTIPLE, NULL, NULL);
342   return GNUNET_SYSERR;         /* We only want one value */
343 }
344
345
346 /**
347  * Continuation called after sensor gets all gnunet statistics values
348  *
349  * @param cls `struct GNUNET_SENSOR_SensorInfo *`
350  * @param success #GNUNET_OK if statistics were
351  *        successfully obtained, #GNUNET_SYSERR if not.
352  */
353 static void
354 end_sensor_run_stat (void *cls, int success)
355 {
356   struct GNUNET_SENSOR_SensorInfo *sensorinfo = cls;
357
358   sensorinfo->gnunet_stat_get_handle = NULL;
359   sensorinfo->running = GNUNET_NO;
360 }
361
362
363 /**
364  * Tries to parse a received sensor value to its
365  * expected datatype
366  *
367  * @param value the string value received, should be null terminated
368  * @param sensor sensor information struct
369  * @param ret pointer to parsed value
370  * @return size of new parsed value, 0 for error
371  */
372 static size_t
373 parse_sensor_value (const char *value, struct GNUNET_SENSOR_SensorInfo *sensor,
374                     void **ret)
375 {
376   double *dval;
377   char *endptr;
378
379   *ret = NULL;
380   if ('\0' == *value)
381     return 0;
382   if (0 == strcmp ("numeric", sensor->expected_datatype))
383   {
384     dval = GNUNET_new (double);
385
386     *dval = strtod (value, &endptr);
387     if (value == endptr)
388       return 0;
389     *ret = dval;
390     return sizeof (double);
391   }
392   if (0 == strcmp ("string", sensor->expected_datatype))
393   {
394     *ret = GNUNET_strdup (value);
395     return strlen (value) + 1;
396   }
397   GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
398               _
399               ("Unknown value type expected by sensor, this should not happen.\n"));
400   return 0;
401 }
402
403
404 /**
405  * Callback for output of executed sensor process
406  *
407  * @param cls `struct GNUNET_SENSOR_SensorInfo *`
408  * @param line line of output from a command, NULL for the end
409  */
410 static void
411 sensor_process_callback (void *cls, const char *line)
412 {
413   struct GNUNET_SENSOR_SensorInfo *sensorinfo = cls;
414   void *value;
415   size_t valsize;
416   struct GNUNET_TIME_Absolute expiry;
417
418   if (NULL == line)
419   {
420     GNUNET_OS_command_stop (sensorinfo->ext_cmd);
421     sensorinfo->ext_cmd = NULL;
422     sensorinfo->running = GNUNET_NO;
423     sensorinfo->ext_cmd_value_received = GNUNET_NO;
424     return;
425   }
426   if (GNUNET_YES == sensorinfo->ext_cmd_value_received)
427     return;                     /* We only want one *valid* value */
428   GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received a value for sensor `%s': %s\n",
429               sensorinfo->name, line);
430   valsize = parse_sensor_value (line, sensorinfo, &value);
431   if (valsize == 0)             /* invalid value, FIXME: should we disable the sensor now? */
432   {
433     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
434                 _("Received an invalid value for sensor `%s': %s\n"),
435                 sensorinfo->name, line);
436   }
437   else
438   {
439     sensorinfo->ext_cmd_value_received = GNUNET_YES;
440     expiry = GNUNET_TIME_relative_to_absolute (sensorinfo->lifetime);
441     GNUNET_PEERSTORE_store (peerstore, subsystem, &peerid, sensorinfo->name,
442                             value, valsize, expiry,
443                             GNUNET_PEERSTORE_STOREOPTION_MULTIPLE, NULL, NULL);
444     GNUNET_free (value);
445   }
446 }
447
448
449 /**
450  * Checks if the given file is a path
451  *
452  * @return #GNUNET_YES / #GNUNET_NO
453  */
454 static int
455 is_path (char *filename)
456 {
457   size_t filename_len;
458   int i;
459
460   filename_len = strlen (filename);
461   for (i = 0; i < filename_len; i++)
462   {
463     if (DIR_SEPARATOR == filename[i])
464       return GNUNET_YES;
465   }
466   return GNUNET_NO;
467 }
468
469
470 /**
471  * Actual execution of a sensor
472  *
473  * @param cls 'struct SensorInfo'
474  * @param tc unsed
475  */
476 static void
477 sensor_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
478 {
479   struct GNUNET_SENSOR_SensorInfo *sensorinfo = cls;
480   int check_result;
481   char *sensors_dir;
482   char *process_path;
483
484   sensorinfo->execution_task =
485       GNUNET_SCHEDULER_add_delayed (sensorinfo->interval, &sensor_run,
486                                     sensorinfo);
487   if (GNUNET_YES == sensorinfo->running)        //FIXME: should we try to kill?
488   {
489     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
490                 "Sensor `%s' running for too long, will try again next interval\n",
491                 sensorinfo->name);
492     return;
493   }
494   if (GNUNET_NO == should_run_sensor (sensorinfo))
495     return;
496   sensorinfo->running = GNUNET_YES;
497   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
498               "Starting the execution of sensor `%s'\n", sensorinfo->name);
499   if (0 == strcmp ("gnunet-statistics", sensorinfo->source))
500   {
501     sensorinfo->gnunet_stat_get_handle = GNUNET_STATISTICS_get (statistics, sensorinfo->gnunet_stat_service, sensorinfo->gnunet_stat_name, sensorinfo->interval,        //try to get values only for the interval of the sensor
502                                                                 &end_sensor_run_stat,
503                                                                 &sensor_statistics_iterator,
504                                                                 sensorinfo);
505   }
506   else if (0 == strcmp ("process", sensorinfo->source))
507   {
508     if (GNUNET_YES == is_path (sensorinfo->ext_process))
509     {
510       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
511                   _
512                   ("Sensor `%s': External process should not be a path, disabling sensor.\n"),
513                   sensorinfo->name);
514       set_sensor_enabled (sensorinfo, GNUNET_NO);
515       return;
516     }
517     //check if the process exists in $PATH
518     process_path = GNUNET_strdup (sensorinfo->ext_process);
519     check_result =
520         GNUNET_OS_check_helper_binary (process_path, GNUNET_NO, NULL);
521     if (GNUNET_SYSERR == check_result)
522     {
523       //search in sensor directory
524       sensors_dir = GNUNET_SENSOR_get_sensor_dir ();
525       GNUNET_free (process_path);
526       GNUNET_asprintf (&process_path, "%s%s-files%s%s", sensors_dir,
527                        sensorinfo->name, DIR_SEPARATOR_STR,
528                        sensorinfo->ext_process);
529       GNUNET_free (sensors_dir);
530       check_result =
531           GNUNET_OS_check_helper_binary (process_path, GNUNET_NO, NULL);
532     }
533     if (GNUNET_SYSERR == check_result)
534     {
535       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
536                   _
537                   ("Sensor `%s' process `%s' problem: binary doesn't exist or not executable\n"),
538                   sensorinfo->name, sensorinfo->ext_process);
539       set_sensor_enabled (sensorinfo, GNUNET_NO);
540       sensorinfo->running = GNUNET_NO;
541       GNUNET_free (process_path);
542       return;
543     }
544     sensorinfo->ext_cmd_value_received = GNUNET_NO;
545     sensorinfo->ext_cmd =
546         GNUNET_OS_command_run (&sensor_process_callback, sensorinfo,
547                                GNUNET_TIME_UNIT_FOREVER_REL, process_path,
548                                sensorinfo->ext_process, sensorinfo->ext_args,
549                                NULL);
550     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Process started for sensor `%s'\n",
551                 sensorinfo->name);
552     GNUNET_free (process_path);
553   }
554   else
555   {
556     sensorinfo->running = GNUNET_NO;
557     GNUNET_break (0);           /* shouldn't happen */
558   }
559 }
560
561
562 /**
563  * Starts the execution of a sensor
564  *
565  * @param cls unused
566  * @param key hash of sensor name, key to hashmap (unused)
567  * @param value a `struct GNUNET_SENSOR_SensorInfo *`
568  * @return #GNUNET_YES if we should continue to
569  *         iterate,
570  *         #GNUNET_NO if not.
571  */
572 static int
573 schedule_sensor (void *cls, const struct GNUNET_HashCode *key, void *value)
574 {
575   struct GNUNET_SENSOR_SensorInfo *sensorinfo = value;
576
577   if (GNUNET_NO == should_run_sensor (sensorinfo))
578     return GNUNET_YES;
579   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
580               "Scheduling sensor `%s' to run after %" PRIu64 " microseconds\n",
581               sensorinfo->name, sensorinfo->interval.rel_value_us);
582   if (GNUNET_SCHEDULER_NO_TASK != sensorinfo->execution_task)
583   {
584     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
585                 _
586                 ("Sensor `%s' execution task already set, this should not happen\n"),
587                 sensorinfo->name);
588     return GNUNET_NO;
589   }
590   sensorinfo->execution_task =
591       GNUNET_SCHEDULER_add_delayed (sensorinfo->interval, &sensor_run,
592                                     sensorinfo);
593   return GNUNET_YES;
594 }
595
596
597 /**
598  * Starts the execution of all enabled sensors
599  */
600 static void
601 schedule_all_sensors ()
602 {
603   GNUNET_CONTAINER_multihashmap_iterate (sensors, &schedule_sensor, NULL);
604 }
605
606
607 /**
608  * Loads sensors and starts different service components
609  */
610 static void
611 start ()
612 {
613   sensors = GNUNET_SENSOR_load_all_sensors ();
614   schedule_all_sensors ();
615   SENSOR_analysis_start (cfg, sensors);
616   SENSOR_reporting_start (cfg, sensors);
617   SENSOR_update_start (cfg, sensors, &reset);
618 }
619
620
621 /**
622  * Process statistics requests.
623  *
624  * @param cls closure
625  * @param server the initialized server
626  * @param c configuration to use
627  */
628 static void
629 run (void *cls, struct GNUNET_SERVER_Handle *server,
630      const struct GNUNET_CONFIGURATION_Handle *c)
631 {
632   static const struct GNUNET_SERVER_MessageHandler handlers[] = {
633     {&handle_get_sensor, NULL, GNUNET_MESSAGE_TYPE_SENSOR_GET,
634      0},
635     {&handle_get_all_sensors, NULL, GNUNET_MESSAGE_TYPE_SENSOR_GETALL,
636      sizeof (struct GNUNET_MessageHeader)},
637     {NULL, NULL, 0, 0}
638   };
639
640   cfg = c;
641   statistics = GNUNET_STATISTICS_create ("sensor", cfg);
642   GNUNET_CRYPTO_get_peer_identity (cfg, &peerid);
643   peerstore = GNUNET_PEERSTORE_connect (cfg);
644   GNUNET_SERVER_add_handlers (server, handlers);
645   GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL);
646   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
647                                 NULL);
648   start ();
649 }
650
651
652 /**
653  * Resets the service by stopping components, reloading sensors and starting
654  * components. This is needed when we receive new sensor updates.
655  */
656 static void
657 reset ()
658 {
659   stop ();
660   start ();
661 }
662
663
664 /**
665  * The main function for the sensor service.
666  *
667  * @param argc number of arguments from the command line
668  * @param argv command line arguments
669  * @return 0 ok, 1 on error
670  */
671 int
672 main (int argc, char *const *argv)
673 {
674   return (GNUNET_OK ==
675           GNUNET_SERVICE_run (argc, argv, "sensor", GNUNET_SERVICE_OPTION_NONE,
676                               &run, NULL)) ? 0 : 1;
677 }
678
679 /* end of gnunet-service-sensor.c */