REST/NAMESTORE: rework API
[oweals/gnunet.git] / src / arm / gnunet-arm.c
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2009, 2012, 2013 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
21 /**
22  * @file arm/gnunet-arm.c
23  * @brief arm for writing a tool
24  * @author Christian Grothoff
25  */
26 #include "platform.h"
27 #include "gnunet_arm_service.h"
28 #include "gnunet_constants.h"
29 #include "gnunet_util_lib.h"
30
31 /**
32  * Set if we are to shutdown all services (including ARM).
33  */
34 static int end;
35
36 /**
37  * Set if we are to start default services (including ARM).
38  */
39 static int start;
40
41 /**
42  * Set if we are to stop/start default services (including ARM).
43  */
44 static int restart;
45
46 /**
47  * Set if we should delete configuration and temp directory on exit.
48  */
49 static int delete;
50
51 /**
52  * Set if we should not print status messages.
53  */
54 static int quiet;
55
56 /**
57  * Monitor ARM activity.
58  */
59 static int monitor;
60
61 /**
62  * Set if we should print a list of currently running services.
63  */
64 static int list;
65
66 /**
67  * Set to the name of a service to start.
68  */
69 static char *init;
70
71 /**
72  * Set to the name of a service to kill.
73  */
74 static char *term;
75
76 /**
77  * Set to the name of the config file used.
78  */
79 static char *config_file;
80
81 /**
82  * Set to the directory where runtime files are stored.
83  */
84 static char *dir;
85
86 /**
87  * Final status code.
88  */
89 static int ret;
90
91 /**
92  * Connection with ARM.
93  */
94 static struct GNUNET_ARM_Handle *h;
95
96 /**
97  * Monitor connection with ARM.
98  */
99 static struct GNUNET_ARM_MonitorHandle *m;
100
101 /**
102  * Our configuration.
103  */
104 static struct GNUNET_CONFIGURATION_Handle *cfg;
105
106 /**
107  * Processing stage that we are in.  Simple counter.
108  */
109 static unsigned int phase;
110
111 /**
112  * User defined timestamp for completing operations.
113  */
114 static struct GNUNET_TIME_Relative timeout;
115
116 /**
117  * Task to be run on timeout.
118  */
119 static struct GNUNET_SCHEDULER_Task *timeout_task;
120
121 /**
122  * Do we want to give our stdout to gnunet-service-arm?
123  */
124 static int no_stdout;
125
126 /**
127  * Do we want to give our stderr to gnunet-service-arm?
128  */
129 static int no_stderr;
130
131 /**
132  * Handle for the task running the #action_loop().
133  */
134 static struct GNUNET_SCHEDULER_Task *al_task;
135
136 /**
137  * Current operation.
138  */
139 static struct GNUNET_ARM_Operation *op;
140
141 /**
142  * Attempts to delete configuration file and GNUNET_HOME
143  * on ARM shutdown provided the end and delete options
144  * were specified when gnunet-arm was run.
145  */
146 static void
147 delete_files ()
148 {
149   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
150               "Will attempt to remove configuration file %s and service directory %s\n",
151               config_file,
152               dir);
153   if (0 != UNLINK (config_file))
154   {
155     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
156                 _("Failed to remove configuration file %s\n"),
157                 config_file);
158   }
159   if (GNUNET_OK != GNUNET_DISK_directory_remove (dir))
160   {
161     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
162                 _("Failed to remove servicehome directory %s\n"),
163                 dir);
164   }
165 }
166
167
168 /**
169  * Main continuation-passing-style loop.  Runs the various
170  * jobs that we've been asked to do in order.
171  *
172  * @param cls closure, unused
173  */
174 static void
175 shutdown_task (void *cls)
176 {
177   (void) cls;
178   if (NULL != al_task)
179   {
180     GNUNET_SCHEDULER_cancel (al_task);
181     al_task = NULL;
182   }
183   if (NULL != op)
184   {
185     GNUNET_ARM_operation_cancel (op);
186     op = NULL;
187   }
188   if (NULL != h)
189   {
190     GNUNET_ARM_disconnect (h);
191     h = NULL;
192   }
193   if (NULL != m)
194   {
195     GNUNET_ARM_monitor_stop (m);
196     m = NULL;
197   }
198   if (NULL != timeout_task)
199   {
200     GNUNET_SCHEDULER_cancel (timeout_task);
201     timeout_task = NULL;
202   }
203   if ((GNUNET_YES == end) && (GNUNET_YES == delete))
204     delete_files ();
205   GNUNET_CONFIGURATION_destroy (cfg);
206   cfg = NULL;
207 }
208
209
210 /**
211  * Returns a string interpretation of 'rs'
212  *
213  * @param rs the request status from ARM
214  * @return a string interpretation of the request status
215  */
216 static const char *
217 req_string (enum GNUNET_ARM_RequestStatus rs)
218 {
219   switch (rs)
220   {
221   case GNUNET_ARM_REQUEST_SENT_OK:
222     return _("Message was sent successfully");
223   case GNUNET_ARM_REQUEST_DISCONNECTED:
224     return _("We disconnected from ARM before we could send a request");
225   }
226   return _("Unknown request status");
227 }
228
229
230 /**
231  * Returns a string interpretation of the 'result'
232  *
233  * @param result the arm result
234  * @return a string interpretation
235  */
236 static const char *
237 ret_string (enum GNUNET_ARM_Result result)
238 {
239   switch (result)
240   {
241   case GNUNET_ARM_RESULT_STOPPED:
242     return _("is stopped");
243   case GNUNET_ARM_RESULT_STARTING:
244     return _("is starting");
245   case GNUNET_ARM_RESULT_STOPPING:
246     return _("is stopping");
247   case GNUNET_ARM_RESULT_IS_STARTING_ALREADY:
248     return _("is starting already");
249   case GNUNET_ARM_RESULT_IS_STOPPING_ALREADY:
250     return _("is stopping already");
251   case GNUNET_ARM_RESULT_IS_STARTED_ALREADY:
252     return _("is started already");
253   case GNUNET_ARM_RESULT_IS_STOPPED_ALREADY:
254     return _("is stopped already");
255   case GNUNET_ARM_RESULT_IS_NOT_KNOWN:
256     return _("service is not known to ARM");
257   case GNUNET_ARM_RESULT_START_FAILED:
258     return _("service failed to start");
259   case GNUNET_ARM_RESULT_IN_SHUTDOWN:
260     return _("service cannot be manipulated because ARM is shutting down");
261   }
262   return _("Unknown result code.");
263 }
264
265
266 /**
267  * Main task that runs our various operations in order.
268  *
269  * @param cls closure
270  */
271 static void
272 action_loop (void *cls);
273
274
275 /**
276  * Function called whenever we connect to or disconnect from ARM.
277  * Termiantes the process if we fail to connect to the service on
278  * our first attempt.
279  *
280  * @param cls closure
281  * @param connected #GNUNET_YES if connected, #GNUNET_NO if disconnected,
282  *                  #GNUNET_SYSERR on error.
283  */
284 static void
285 conn_status (void *cls,
286              int connected)
287 {
288   static int once;
289
290   (void) cls;
291   if ( (GNUNET_SYSERR == connected) &&
292        (0 == once) )
293   {
294     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
295                 _("Fatal error initializing ARM API.\n"));
296     GNUNET_SCHEDULER_shutdown ();
297     return;
298   }
299   once = 1;
300 }
301
302
303 /**
304  * We have requested ARM to be started, this function
305  * is called with the result of the operation.  Informs the
306  * use of the result; on success, we continue with the event
307  * loop, on failure we terminate the process.
308  *
309  * @param cls closure unused
310  * @param rs what happened to our request
311  * @param result if the request was processed, this is the result
312  *               according to ARM
313  */
314 static void
315 start_callback (void *cls,
316                 enum GNUNET_ARM_RequestStatus rs,
317                 enum GNUNET_ARM_Result result)
318 {
319   (void) cls;
320   op = NULL;
321   if (GNUNET_ARM_REQUEST_SENT_OK != rs)
322   {
323     FPRINTF (stdout,
324              _("Failed to start the ARM service: %s\n"),
325              req_string (rs));
326     GNUNET_SCHEDULER_shutdown ();
327     return;
328   }
329   if ( (GNUNET_ARM_RESULT_STARTING != result) &&
330        (GNUNET_ARM_RESULT_IS_STARTED_ALREADY != result) )
331   {
332     FPRINTF (stdout,
333              _("Failed to start the ARM service: %s\n"),
334              ret_string (result));
335     GNUNET_SCHEDULER_shutdown ();
336     return;
337   }
338   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
339               "ARM service [re]start successful\n");
340   start = 0;
341   al_task = GNUNET_SCHEDULER_add_now (&action_loop, NULL);
342 }
343
344
345 /**
346  * We have requested ARM to be stopped, this function
347  * is called with the result of the operation.  Informs the
348  * use of the result; on success, we continue with the event
349  * loop, on failure we terminate the process.
350  *
351  * @param cls closure unused
352  * @param rs what happened to our request
353  * @param result if the request was processed, this is the result
354  *               according to ARM
355  */
356 static void
357 stop_callback (void *cls,
358                enum GNUNET_ARM_RequestStatus rs,
359                enum GNUNET_ARM_Result result)
360 {
361   char *msg;
362
363   (void) cls;
364   op = NULL;
365   if (GNUNET_ARM_REQUEST_SENT_OK != rs)
366   {
367     GNUNET_asprintf (&msg, "%s",
368                      _("Failed to send a stop request to the ARM service: %s\n"));
369     FPRINTF (stdout, msg, req_string (rs));
370     GNUNET_free (msg);
371     GNUNET_SCHEDULER_shutdown ();
372     return;
373   }
374   if ((GNUNET_ARM_RESULT_STOPPING != result) &&
375       (GNUNET_ARM_RESULT_STOPPED != result) &&
376       (GNUNET_ARM_RESULT_IS_STOPPED_ALREADY != result))
377   {
378     FPRINTF (stdout,
379              _("Failed to stop the ARM service: %s\n"),
380              ret_string (result));
381     GNUNET_SCHEDULER_shutdown ();
382     return;
383   }
384   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
385               "ARM service shutdown successful\n");
386   end = 0;
387   if (restart)
388   {
389     restart = 0;
390     start = 1;
391     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
392                 "Initiating an ARM restart\n");
393   }
394   al_task = GNUNET_SCHEDULER_add_now (&action_loop, NULL);
395 }
396
397
398 /**
399  * We have requested a service to be started, this function
400  * is called with the result of the operation.  Informs the
401  * use of the result; on success, we continue with the event
402  * loop, on failure we terminate the process.
403  *
404  * @param cls closure unused
405  * @param rs what happened to our request
406  * @param result if the request was processed, this is the result
407  *               according to ARM
408  */
409 static void
410 init_callback (void *cls,
411                enum GNUNET_ARM_RequestStatus rs,
412                enum GNUNET_ARM_Result result)
413 {
414   (void) cls;
415   op = NULL;
416   if (GNUNET_ARM_REQUEST_SENT_OK != rs)
417   {
418     FPRINTF (stdout,
419              _("Failed to send a request to start the `%s' service: %s\n"),
420              init,
421              req_string (rs));
422     GNUNET_SCHEDULER_shutdown ();
423     return;
424   }
425   if ((GNUNET_ARM_RESULT_STARTING != result) &&
426       (GNUNET_ARM_RESULT_IS_STARTED_ALREADY != result))
427   {
428     FPRINTF (stdout,
429              _("Failed to start the `%s' service: %s\n"),
430              init,
431              ret_string (result));
432     GNUNET_SCHEDULER_shutdown ();
433     return;
434   }
435   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
436               "Service %s [re]started successfully\n",
437               init);
438   GNUNET_free (init);
439   init = NULL;
440   al_task = GNUNET_SCHEDULER_add_now (&action_loop, NULL);
441 }
442
443
444 /**
445  * We have requested a service to be stopped, this function
446  * is called with the result of the operation.  Informs the
447  * use of the result; on success, we continue with the event
448  * loop, on failure we terminate the process.
449  *
450  * @param cls closure unused
451  * @param rs what happened to our request
452  * @param result if the request was processed, this is the result
453  *               according to ARM
454  */
455 static void
456 term_callback (void *cls,
457                enum GNUNET_ARM_RequestStatus rs,
458                enum GNUNET_ARM_Result result)
459 {
460   char *msg;
461
462   (void) cls;
463   op = NULL;
464   if (GNUNET_ARM_REQUEST_SENT_OK != rs)
465   {
466     GNUNET_asprintf (&msg,
467                      _("Failed to send a request to kill the `%s' service: %%s\n"),
468                      term);
469     FPRINTF (stdout, msg, req_string (rs));
470     GNUNET_free (msg);
471     GNUNET_SCHEDULER_shutdown ();
472     return;
473   }
474   if ((GNUNET_ARM_RESULT_STOPPED != result) &&
475       (GNUNET_ARM_RESULT_IS_STOPPED_ALREADY != result))
476   {
477     FPRINTF (stdout,
478              _("Failed to kill the `%s' service: %s\n"),
479              term,
480              ret_string (result));
481     GNUNET_SCHEDULER_shutdown ();
482     return;
483   }
484
485   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
486               "Service %s stopped successfully\n",
487               term);
488   GNUNET_free (term);
489   term = NULL;
490   al_task = GNUNET_SCHEDULER_add_now (&action_loop, NULL);
491 }
492
493
494 /**
495  * Function called with the list of running services. Prints
496  * the list to stdout, then starts the event loop again.
497  * Prints an error message and terminates the process on errors.
498  *
499  * @param cls closure (unused)
500  * @param rs request status (success, failure, etc.)
501  * @param count number of services in the list
502  * @param list list of services that are running
503  */
504 static void
505 list_callback (void *cls,
506                enum GNUNET_ARM_RequestStatus rs,
507                unsigned int count,
508                const char *const*list)
509 {
510   unsigned int i;
511
512   (void) cls;
513   op = NULL;
514   if (GNUNET_ARM_REQUEST_SENT_OK != rs)
515   {
516     char *msg;
517
518     GNUNET_asprintf (&msg, "%s",
519                      _("Failed to request a list of services: %s\n"));
520     FPRINTF (stdout, msg, req_string (rs));
521     GNUNET_free (msg);
522     ret = 3;
523     GNUNET_SCHEDULER_shutdown ();
524   }
525   if (NULL == list)
526   {
527     FPRINTF (stderr, "%s",
528              _("Error communicating with ARM. ARM not running?\n"));
529     GNUNET_SCHEDULER_shutdown ();
530     ret = 3;
531     return;
532   }
533   if (! quiet)
534     FPRINTF (stdout, "%s", _("Running services:\n"));
535   for (i = 0; i < count; i++)
536     FPRINTF (stdout, "%s\n", list[i]);
537   al_task = GNUNET_SCHEDULER_add_now (&action_loop, NULL);
538 }
539
540
541 /**
542  * Main action loop.  Runs the various jobs that we've been asked to
543  * do, in order.
544  *
545  * @param cls closure, unused
546  */
547 static void
548 action_loop (void *cls)
549 {
550   (void) cls;
551   al_task = NULL;
552   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
553               "Running requested actions\n");
554   while (1)
555   {
556     switch (phase++)
557     {
558     case 0:
559       if (NULL != term)
560       {
561         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
562                     "Termination action\n");
563         op = GNUNET_ARM_request_service_stop (h,
564                                               term,
565                                               &term_callback,
566                                               NULL);
567         return;
568       }
569       break;
570     case 1:
571       if (end || restart)
572       {
573         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
574                     "End action\n");
575         op = GNUNET_ARM_request_service_stop (h,
576                                               "arm",
577                                               &stop_callback,
578                                               NULL);
579         return;
580       }
581       break;
582     case 2:
583       if (start)
584       {
585         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
586                     "Start action\n");
587         op = GNUNET_ARM_request_service_start (h, "arm",
588                                                (no_stdout ? 0 : GNUNET_OS_INHERIT_STD_OUT) |
589                                                (no_stderr ? 0 : GNUNET_OS_INHERIT_STD_ERR),
590                                                &start_callback,
591                                                NULL);
592         return;
593       }
594       break;
595     case 3:
596       if (NULL != init)
597       {
598         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
599                     "Initialization action\n");
600         op = GNUNET_ARM_request_service_start (h, init,
601                                                GNUNET_OS_INHERIT_STD_NONE,
602                                                &init_callback,
603                                                NULL);
604         return;
605       }
606       break;
607     case 4:
608       if (list)
609       {
610         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
611                     "Going to list all running services controlled by ARM.\n");
612         op = GNUNET_ARM_request_service_list (h,
613                                               &list_callback,
614                                               &list);
615         return;
616       }
617       break;
618     case 5:
619       if (monitor)
620         {
621           if (! quiet)
622             fprintf (stderr,
623                      _("Now only monitoring, press CTRL-C to stop.\n"));
624           quiet = 0; /* does not make sense to stay quiet in monitor mode at this time */
625           return; /* done with tasks, just monitor */
626         }
627       break;
628     default:            /* last phase */
629       GNUNET_SCHEDULER_shutdown ();
630       return;
631     }
632   }
633 }
634
635
636 /**
637  * Function called when a service starts or stops.
638  *
639  * @param cls closure
640  * @param service service name
641  * @param status status of the service
642  */
643 static void
644 srv_status (void *cls,
645             const char *service,
646             enum GNUNET_ARM_ServiceStatus status)
647 {
648   const char *msg;
649
650   (void) cls;
651   switch (status)
652   {
653   case GNUNET_ARM_SERVICE_MONITORING_STARTED:
654     return; /* this should be done silently */
655   case GNUNET_ARM_SERVICE_STOPPED:
656     msg = _("Stopped %s.\n");
657     break;
658   case GNUNET_ARM_SERVICE_STARTING:
659     msg = _("Starting %s...\n");
660     break;
661   case GNUNET_ARM_SERVICE_STOPPING:
662     msg = _("Stopping %s...\n");
663     break;
664   default:
665     msg = NULL;
666     break;
667   }
668   if (! quiet)
669   {
670     if (NULL != msg)
671       FPRINTF (stderr,
672                msg,
673                service);
674     else
675       FPRINTF (stderr,
676                _("Unknown status %u for service %s.\n"),
677                status,
678                service);
679   }
680   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
681               "Got service %s status %d\n",
682               service, (int)
683               status);
684 }
685
686
687 /**
688  * Task run on timeout (if -T is given).
689  */
690 static void
691 timeout_task_cb (void *cls)
692 {
693   (void) cls;
694   timeout_task = NULL;
695   ret = 2;
696   GNUNET_SCHEDULER_shutdown ();
697 }
698
699
700 /**
701  * Main function that will be run by the scheduler.
702  *
703  * @param cls closure
704  * @param args remaining command-line arguments
705  * @param cfgfile name of the configuration file used (for saving, can be NULL!)
706  * @param c configuration
707  */
708 static void
709 run (void *cls,
710      char *const *args,
711      const char *cfgfile,
712      const struct GNUNET_CONFIGURATION_Handle *c)
713 {
714   (void) cls;
715   (void) args;
716   (void) cfgfile;
717   cfg = GNUNET_CONFIGURATION_dup (c);
718   if (GNUNET_OK !=
719       GNUNET_CONFIGURATION_get_value_string (cfg,
720                                              "PATHS",
721                                              "GNUNET_HOME",
722                                              &dir))
723   {
724     GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
725                                "PATHS",
726                                "GNUNET_HOME");
727     return;
728   }
729   (void) GNUNET_CONFIGURATION_get_value_filename (cfg,
730                                                   "arm",
731                                                   "CONFIG",
732                                                   &config_file);
733   if (NULL == (h = GNUNET_ARM_connect (cfg,
734                                        &conn_status,
735                                        NULL)))
736     return;
737   if (monitor)
738     m = GNUNET_ARM_monitor_start (cfg,
739                                   &srv_status,
740                                   NULL);
741   al_task = GNUNET_SCHEDULER_add_now (&action_loop,
742                                       NULL);
743   GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
744                                  NULL);
745   if (0 != timeout.rel_value_us)
746     timeout_task = GNUNET_SCHEDULER_add_delayed (timeout,
747                                                  &timeout_task_cb,
748                                                  NULL);
749 }
750
751
752 /**
753  * The main function to obtain arm from gnunetd.
754  *
755  * @param argc number of arguments from the command line
756  * @param argv command line arguments
757  * @return 0 ok, 1 on error, 2 on timeout
758  */
759 int
760 main (int argc,
761       char *const *argv)
762 {
763   struct GNUNET_GETOPT_CommandLineOption options[] = {
764     GNUNET_GETOPT_option_flag ('e',
765                                "end",
766                                gettext_noop ("stop all GNUnet services"),
767                                &end),
768     GNUNET_GETOPT_option_string ('i',
769                                  "init",
770                                  "SERVICE",
771                                  gettext_noop ("start a particular service"),
772                                  &init),
773     GNUNET_GETOPT_option_string ('k',
774                                  "kill",
775                                  "SERVICE",
776                                  gettext_noop ("stop a particular service"),
777                                  &term),
778     GNUNET_GETOPT_option_flag ('s',
779                                "start",
780                                gettext_noop ("start all GNUnet default services"),
781                                &start),
782     GNUNET_GETOPT_option_flag ('r',
783                                "restart",
784                                gettext_noop ("stop and start all GNUnet default services"),
785                                &restart),
786     GNUNET_GETOPT_option_flag ('d',
787                                "delete",
788                                gettext_noop ("delete config file and directory on exit"),
789                                &delete),
790     GNUNET_GETOPT_option_flag ('m',
791                                "monitor",
792                                gettext_noop ("monitor ARM activities"),
793                                &monitor),
794     GNUNET_GETOPT_option_flag ('q',
795                                "quiet",
796                                gettext_noop ("don't print status messages"),
797                                &quiet),
798     GNUNET_GETOPT_option_relative_time ('T',
799                                         "timeout",
800                                         "DELAY",
801                                         gettext_noop ("exit with error status if operation does not finish after DELAY"),
802                                         &timeout),
803     GNUNET_GETOPT_option_flag ('I',
804                                "info",
805                                gettext_noop ("list currently running services"),
806                                &list), 
807     GNUNET_GETOPT_option_flag ('O',
808                                "no-stdout",
809                                gettext_noop ("don't let gnunet-service-arm inherit standard output"),
810                                &no_stdout),
811     GNUNET_GETOPT_option_flag ('E',
812                                "no-stderr",
813                                gettext_noop ("don't let gnunet-service-arm inherit standard error"),
814                                &no_stderr),
815     GNUNET_GETOPT_OPTION_END
816   };
817
818   if (GNUNET_OK !=
819       GNUNET_STRINGS_get_utf8_args (argc, argv,
820                                     &argc, &argv))
821     return 2;
822
823   if (GNUNET_OK ==
824       GNUNET_PROGRAM_run (argc,
825                           argv,
826                           "gnunet-arm",
827                           gettext_noop
828                           ("Control services and the Automated Restart Manager (ARM)"),
829                           options,
830                           &run, NULL))
831   {
832     GNUNET_free ((void *) argv);
833     return ret;
834   }
835   GNUNET_free ((void*) argv);
836   return 1;
837 }
838
839 /* end of gnunet-arm.c */