GNUnet  0.10.x
gnunet-arm.c
Go to the documentation of this file.
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 
26 #include "platform.h"
27 #include "gnunet_arm_service.h"
28 #include "gnunet_constants.h"
29 #include "gnunet_util_lib.h"
30 
34 static int end;
35 
39 static int start;
40 
44 static int restart;
45 
49 static int delete;
50 
54 static int quiet;
55 
59 static int monitor;
60 
64 static int list;
65 
69 static char *init;
70 
74 static char *term;
75 
79 static char *config_file;
80 
84 static char *dir;
85 
89 static int ret;
90 
94 static struct GNUNET_ARM_Handle *h;
95 
99 static struct GNUNET_ARM_MonitorHandle *m;
100 
105 
109 static unsigned int phase;
110 
115 
120 
124 static int no_stdout;
125 
129 static int no_stderr;
130 
135 
139 static struct GNUNET_ARM_Operation *op;
140 
146 static void
148 {
149  GNUNET_log (
151  "Will attempt to remove configuration file %s and service directory %s\n",
152  config_file,
153  dir);
154  if (0 != UNLINK (config_file))
155  {
157  _ ("Failed to remove configuration file %s\n"),
158  config_file);
159  }
161  {
163  _ ("Failed to remove servicehome directory %s\n"),
164  dir);
165  }
166 }
167 
168 
175 static void
176 shutdown_task (void *cls)
177 {
178  (void) cls;
179  if (NULL != al_task)
180  {
181  GNUNET_SCHEDULER_cancel (al_task);
182  al_task = NULL;
183  }
184  if (NULL != op)
185  {
187  op = NULL;
188  }
189  if (NULL != h)
190  {
192  h = NULL;
193  }
194  if (NULL != m)
195  {
197  m = NULL;
198  }
199  if (NULL != timeout_task)
200  {
201  GNUNET_SCHEDULER_cancel (timeout_task);
202  timeout_task = NULL;
203  }
204  if ((GNUNET_YES == end) && (GNUNET_YES == delete))
205  delete_files ();
207  cfg = NULL;
208 }
209 
210 
217 static const char *
219 {
220  switch (rs)
221  {
223  return _ ("Message was sent successfully");
225  return _ ("We disconnected from ARM before we could send a request");
226  }
227  return _ ("Unknown request status");
228 }
229 
230 
237 static const char *
239 {
240  switch (result)
241  {
243  return _ ("is stopped");
245  return _ ("is starting");
247  return _ ("is stopping");
249  return _ ("is starting already");
251  return _ ("is stopping already");
253  return _ ("is started already");
255  return _ ("is stopped already");
257  return _ ("service is not known to ARM");
259  return _ ("service failed to start");
261  return _ ("service cannot be manipulated because ARM is shutting down");
262  }
263  return _ ("Unknown result code.");
264 }
265 
266 
272 static void
273 action_loop (void *cls);
274 
275 
285 static void
286 conn_status (void *cls, int connected)
287 {
288  static int once;
289 
290  (void) cls;
291  if ((GNUNET_SYSERR == connected) && (0 == once))
292  {
294  _ ("Fatal error initializing ARM API.\n"));
296  return;
297  }
298  once = 1;
299 }
300 
301 
313 static void
314 start_callback (void *cls,
315  enum GNUNET_ARM_RequestStatus rs,
317 {
318  (void) cls;
319  op = NULL;
320  if (GNUNET_ARM_REQUEST_SENT_OK != rs)
321  {
322  FPRINTF (stdout,
323  _ ("Failed to start the ARM service: %s\n"),
324  req_string (rs));
326  return;
327  }
328  if ((GNUNET_ARM_RESULT_STARTING != result) &&
330  {
331  FPRINTF (stdout,
332  _ ("Failed to start the ARM service: %s\n"),
333  ret_string (result));
335  return;
336  }
337  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ARM service [re]start successful\n");
338  start = 0;
339  al_task = GNUNET_SCHEDULER_add_now (&action_loop, NULL);
340 }
341 
342 
354 static void
355 stop_callback (void *cls,
356  enum GNUNET_ARM_RequestStatus rs,
358 {
359  char *msg;
360 
361  (void) cls;
362  op = NULL;
363  if (GNUNET_ARM_REQUEST_SENT_OK != rs)
364  {
365  GNUNET_asprintf (&msg,
366  "%s",
367  _ (
368  "Failed to send a stop request to the ARM service: %s\n"));
369  FPRINTF (stdout, msg, req_string (rs));
370  GNUNET_free (msg);
372  return;
373  }
374  if ((GNUNET_ARM_RESULT_STOPPING != result) &&
375  (GNUNET_ARM_RESULT_STOPPED != result) &&
377  {
378  FPRINTF (stdout,
379  _ ("Failed to stop the ARM service: %s\n"),
380  ret_string (result));
382  return;
383  }
384  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ARM service shutdown successful\n");
385  end = 0;
386  if (restart)
387  {
388  restart = 0;
389  start = 1;
390  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Initiating an ARM restart\n");
391  }
392  al_task = GNUNET_SCHEDULER_add_now (&action_loop, NULL);
393 }
394 
395 
407 static void
408 init_callback (void *cls,
409  enum GNUNET_ARM_RequestStatus rs,
411 {
412  (void) cls;
413  op = NULL;
414  if (GNUNET_ARM_REQUEST_SENT_OK != rs)
415  {
416  FPRINTF (stdout,
417  _ ("Failed to send a request to start the `%s' service: %s\n"),
418  init,
419  req_string (rs));
421  return;
422  }
423  if ((GNUNET_ARM_RESULT_STARTING != result) &&
425  {
426  FPRINTF (stdout,
427  _ ("Failed to start the `%s' service: %s\n"),
428  init,
429  ret_string (result));
431  return;
432  }
434  "Service %s [re]started successfully\n",
435  init);
436  GNUNET_free (init);
437  init = NULL;
438  al_task = GNUNET_SCHEDULER_add_now (&action_loop, NULL);
439 }
440 
441 
453 static void
454 term_callback (void *cls,
455  enum GNUNET_ARM_RequestStatus rs,
457 {
458  char *msg;
459 
460  (void) cls;
461  op = NULL;
462  if (GNUNET_ARM_REQUEST_SENT_OK != rs)
463  {
464  GNUNET_asprintf (&msg,
465  _ (
466  "Failed to send a request to kill the `%s' service: %%s\n"),
467  term);
468  FPRINTF (stdout, msg, req_string (rs));
469  GNUNET_free (msg);
471  return;
472  }
473  if ((GNUNET_ARM_RESULT_STOPPED != result) &&
475  {
476  FPRINTF (stdout,
477  _ ("Failed to kill the `%s' service: %s\n"),
478  term,
479  ret_string (result));
481  return;
482  }
483 
485  "Service %s stopped successfully\n",
486  term);
487  GNUNET_free (term);
488  term = NULL;
489  al_task = GNUNET_SCHEDULER_add_now (&action_loop, NULL);
490 }
491 
492 
503 static void
504 list_callback (void *cls,
505  enum GNUNET_ARM_RequestStatus rs,
506  unsigned int count,
507  const char *const *list)
508 {
509  (void) cls;
510  op = NULL;
511  if (GNUNET_ARM_REQUEST_SENT_OK != rs)
512  {
513  char *msg;
514 
515  GNUNET_asprintf (&msg,
516  "%s",
517  _ ("Failed to request a list of services: %s\n"));
518  FPRINTF (stdout, msg, req_string (rs));
519  GNUNET_free (msg);
520  ret = 3;
522  }
523  if (NULL == list)
524  {
525  FPRINTF (stderr,
526  "%s",
527  _ ("Error communicating with ARM. ARM not running?\n"));
529  ret = 3;
530  return;
531  }
532  if (! quiet)
533  FPRINTF (stdout, "%s", _ ("Running services:\n"));
534  for (unsigned int i = 0; i < count; i++)
535  FPRINTF (stdout, "%s\n", list[i]);
536  al_task = GNUNET_SCHEDULER_add_now (&action_loop, NULL);
537 }
538 
539 
546 static void
547 action_loop (void *cls)
548 {
549  (void) cls;
550  al_task = NULL;
551  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Running requested actions\n");
552  while (1)
553  {
554  switch (phase++)
555  {
556  case 0:
557  if (NULL != term)
558  {
559  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Termination action\n");
561  return;
562  }
563  break;
564  case 1:
565  if (end || restart)
566  {
567  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "End action\n");
568  op = GNUNET_ARM_request_service_stop (h, "arm", &stop_callback, NULL);
569  return;
570  }
571  break;
572  case 2:
573  if (start)
574  {
575  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Start action\n");
576  op =
578  "arm",
579  (no_stdout
580  ? 0
582  (no_stderr
583  ? 0
586  NULL);
587  return;
588  }
589  break;
590  case 3:
591  if (NULL != init)
592  {
593  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Initialization action\n");
595  init,
597  &init_callback,
598  NULL);
599  return;
600  }
601  break;
602  case 4:
603  if (list)
604  {
606  "Going to list all running services controlled by ARM.\n");
608  return;
609  }
610  break;
611  case 5:
612  if (monitor)
613  {
614  if (! quiet)
615  fprintf (stderr, _ ("Now only monitoring, press CTRL-C to stop.\n"));
616  quiet =
617  0; /* does not make sense to stay quiet in monitor mode at this time */
618  return; /* done with tasks, just monitor */
619  }
620  break;
621  default: /* last phase */
623  return;
624  }
625  }
626 }
627 
628 
636 static void
637 srv_status (void *cls,
638  const char *service,
640 {
641  const char *msg;
642 
643  (void) cls;
644  switch (status)
645  {
647  return; /* this should be done silently */
649  msg = _ ("Stopped %s.\n");
650  break;
652  msg = _ ("Starting %s...\n");
653  break;
655  msg = _ ("Stopping %s...\n");
656  break;
657  default:
658  msg = NULL;
659  break;
660  }
661  if (! quiet)
662  {
663  if (NULL != msg)
664  FPRINTF (stderr, msg, service);
665  else
666  FPRINTF (stderr,
667  _ ("Unknown status %u for service %s.\n"),
668  status,
669  service);
670  }
672  "Got service %s status %d\n",
673  service,
674  (int) status);
675 }
676 
677 
681 static void
682 timeout_task_cb (void *cls)
683 {
684  (void) cls;
685  timeout_task = NULL;
686  ret = 2;
688 }
689 
690 
699 static void
700 run (void *cls,
701  char *const *args,
702  const char *cfgfile,
703  const struct GNUNET_CONFIGURATION_Handle *c)
704 {
705  (void) cls;
706  (void) args;
707  (void) cfgfile;
708  cfg = GNUNET_CONFIGURATION_dup (c);
709  if (GNUNET_OK !=
710  GNUNET_CONFIGURATION_get_value_string (cfg, "PATHS", "GNUNET_HOME", &dir))
711  {
712  GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "PATHS", "GNUNET_HOME");
713  return;
714  }
716  "arm",
717  "CONFIG",
718  &config_file);
719  if (NULL == (h = GNUNET_ARM_connect (cfg, &conn_status, NULL)))
720  return;
721  if (monitor)
722  m = GNUNET_ARM_monitor_start (cfg, &srv_status, NULL);
723  al_task = GNUNET_SCHEDULER_add_now (&action_loop, NULL);
725  if (0 != timeout.rel_value_us)
726  timeout_task =
728 }
729 
730 
738 int
739 main (int argc, char *const *argv)
740 {
741  struct GNUNET_GETOPT_CommandLineOption options[] =
743  "end",
744  gettext_noop ("stop all GNUnet services"),
745  &end),
747  "init",
748  "SERVICE",
749  gettext_noop ("start a particular service"),
750  &init),
752  "kill",
753  "SERVICE",
754  gettext_noop ("stop a particular service"),
755  &term),
757  "start",
758  gettext_noop (
759  "start all GNUnet default services"),
760  &start),
762  "restart",
763  gettext_noop (
764  "stop and start all GNUnet default services"),
765  &restart),
767  "delete",
768  gettext_noop (
769  "delete config file and directory on exit"),
770  &delete),
772  "monitor",
773  gettext_noop ("monitor ARM activities"),
774  &monitor),
776  "quiet",
777  gettext_noop ("don't print status messages"),
778  &quiet),
780  'T',
781  "timeout",
782  "DELAY",
783  gettext_noop (
784  "exit with error status if operation does not finish after DELAY"),
785  &timeout),
787  "info",
788  gettext_noop (
789  "list currently running services"),
790  &list),
792  'O',
793  "no-stdout",
794  gettext_noop ("don't let gnunet-service-arm inherit standard output"),
795  &no_stdout),
797  'E',
798  "no-stderr",
799  gettext_noop ("don't let gnunet-service-arm inherit standard error"),
800  &no_stderr),
802  int lret;
803 
804  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
805  return 2;
806  if (GNUNET_OK ==
807  (lret = GNUNET_PROGRAM_run (
808  argc,
809  argv,
810  "gnunet-arm",
811  gettext_noop (
812  "Control services and the Automated Restart Manager (ARM)"),
813  options,
814  &run,
815  NULL)))
816  {
817  GNUNET_free ((void *) argv);
818  return ret;
819  }
820  GNUNET_free ((void *) argv);
821  return lret;
822 }
823 
824 /* end of gnunet-arm.c */
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_relative_time(char shortName, const char *name, const char *argumentHelp, const char *description, struct GNUNET_TIME_Relative *val)
Allow user to specify a struct GNUNET_TIME_Relative (using human-readable "fancy" time)...
static struct GNUNET_SCHEDULER_Task * al_task
Handle for the task running the action_loop().
Definition: gnunet-arm.c:134
static char * dir
Set to the directory where runtime files are stored.
Definition: gnunet-arm.c:84
ARM stopping was initiated (there&#39;s no "stopped" for ARM itself).
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
Main function that will be run by the scheduler.
Definition: gnunet-arm.c:700
When this flag is set, the child process will inherit stderr of the parent.
Definition: gnunet_os_lib.h:92
static struct GNUNET_SERVICE_Handle * service
Handle to our service instance.
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
static unsigned int phase
Processing stage that we are in.
Definition: gnunet-arm.c:109
static void timeout_task_cb(void *cls)
Task run on timeout (if -T is given).
Definition: gnunet-arm.c:682
uint64_t rel_value_us
The actual value.
static int end
Set if we are to shutdown all services (including ARM).
Definition: gnunet-arm.c:34
Asked to stop it, but it&#39;s already stopping.
static void stop_callback(void *cls, enum GNUNET_ARM_RequestStatus rs, enum GNUNET_ARM_Result result)
We have requested ARM to be stopped, this function is called with the result of the operation...
Definition: gnunet-arm.c:355
static int restart
Set if we are to stop/start default services (including ARM).
Definition: gnunet-arm.c:44
#define FPRINTF
Definition: plibc.h:683
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received, or when GNUNET_SCHEDULER_shutdown() is being invoked.
Definition: scheduler.c:1293
static int start
Set if we are to start default services (including ARM).
Definition: gnunet-arm.c:39
int GNUNET_STRINGS_get_utf8_args(int argc, char *const *argv, int *u8argc, char *const **u8argv)
Returns utf-8 encoded arguments.
Definition: strings.c:1521
Entry in a doubly-linked list of operations awaiting for replies (in-order) from the ARM service...
Definition: arm_api.c:40
static char * config_file
Set to the name of the config file used.
Definition: gnunet-arm.c:79
We disconnected from ARM, and request was not sent.
Handle for interacting with ARM.
Definition: arm_api.c:97
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
void GNUNET_ARM_operation_cancel(struct GNUNET_ARM_Operation *op)
Abort an operation.
Definition: arm_api.c:665
GNUNET_ARM_Result
Replies to ARM requests.
Definition of a command line option.
Service starting was initiated.
Handle for interacting with ARM.
Asked to start it, but it&#39;s already started.
static void start_callback(void *cls, enum GNUNET_ARM_RequestStatus rs, enum GNUNET_ARM_Result result)
We have requested ARM to be started, this function is called with the result of the operation...
Definition: gnunet-arm.c:314
static int quiet
Set if we should not print status messages.
Definition: gnunet-arm.c:54
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:524
static int ret
Final status code.
Definition: gnunet-arm.c:89
void GNUNET_ARM_disconnect(struct GNUNET_ARM_Handle *h)
Disconnect from the ARM service (if connected) and destroy the context.
Definition: arm_api.c:507
static char * term
Set to the name of a service to kill.
Definition: gnunet-arm.c:74
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
Definition: 002.c:13
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:94
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_string(char shortName, const char *name, const char *argumentHelp, const char *description, char **str)
Allow user to specify a string.
#define UNLINK(f)
Definition: plibc.h:666
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
static void list_callback(void *cls, enum GNUNET_ARM_RequestStatus rs, unsigned int count, const char *const *list)
Function called with the list of running services.
Definition: gnunet-arm.c:504
int main(int argc, char *const *argv)
The main function to obtain arm from gnunetd.
Definition: gnunet-arm.c:739
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
Definition: gnunet-arm.c:99
static void shutdown_task(void *cls)
Main continuation-passing-style loop.
Definition: gnunet-arm.c:176
int GNUNET_asprintf(char **buf, const char *format,...)
Like asprintf, just portable.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1246
static struct GNUNET_TIME_Relative timeout
User defined timestamp for completing operations.
Definition: gnunet-arm.c:114
Tried to start a service, but that failed for some reason.
static void delete_files()
Attempts to delete configuration file and GNUNET_HOME on ARM shutdown provided the end and delete opt...
Definition: gnunet-arm.c:147
struct GNUNET_ARM_Operation * GNUNET_ARM_request_service_stop(struct GNUNET_ARM_Handle *h, const char *service_name, GNUNET_ARM_ResultCallback cont, void *cont_cls)
Request a service to be stopped.
Definition: arm_api.c:864
void GNUNET_log_config_missing(enum GNUNET_ErrorType kind, const char *section, const char *option)
Log error message about missing configuration option.
Service starting was initiated.
No standard streams should be inherited.
Definition: gnunet_os_lib.h:74
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1273
When this flag is set, the child process will inherit stdout of the parent.
Definition: gnunet_os_lib.h:86
int GNUNET_DISK_directory_remove(const char *filename)
Remove all files in a directory (rm -rf).
Definition: disk.c:1359
static void conn_status(void *cls, int connected)
Function called whenever we connect to or disconnect from ARM.
Definition: gnunet-arm.c:286
static int once
Global to mark if we&#39;ve run the initialization.
Definition: gnsrecord.c:68
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
uint16_t status
See PRISM_STATUS_*-constants.
struct GNUNET_ARM_Operation * GNUNET_ARM_request_service_list(struct GNUNET_ARM_Handle *h, GNUNET_ARM_ServiceListCallback cont, void *cont_cls)
Request a list of running services.
Definition: arm_api.c:896
Asked to start it, but it&#39;s already starting.
static int result
Global testing status.
Service was stopped.
struct GNUNET_ARM_Handle * GNUNET_ARM_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_ARM_ConnectionStatusCallback conn_status, void *conn_status_cls)
Set up a context for communicating with ARM, then start connecting to the ARM service using that cont...
Definition: arm_api.c:482
Asked to start something, but ARM is shutting down and can&#39;t comply.
int GNUNET_CONFIGURATION_get_value_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be a string.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
static const char * ret_string(enum GNUNET_ARM_Result result)
Returns a string interpretation of the result.
Definition: gnunet-arm.c:238
struct GNUNET_ARM_Operation * GNUNET_ARM_request_service_start(struct GNUNET_ARM_Handle *h, const char *service_name, enum GNUNET_OS_InheritStdioFlags std_inheritance, GNUNET_ARM_ResultCallback cont, void *cont_cls)
Request for a service to be started.
Definition: arm_api.c:789
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
static void init_callback(void *cls, enum GNUNET_ARM_RequestStatus rs, enum GNUNET_ARM_Result result)
We have requested a service to be started, this function is called with the result of the operation...
Definition: gnunet-arm.c:408
static struct GNUNET_SCHEDULER_Task * timeout_task
Task to be run on timeout.
Definition: gnunet-arm.c:119
static char * init
Set to the name of a service to start.
Definition: gnunet-arm.c:69
Asked to stop it, but it&#39;s already stopped.
static void srv_status(void *cls, const char *service, enum GNUNET_ARM_ServiceStatus status)
Function called when a service starts or stops.
Definition: gnunet-arm.c:637
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_dup(const struct GNUNET_CONFIGURATION_Handle *cfg)
Duplicate an existing configuration object.
void GNUNET_ARM_monitor_stop(struct GNUNET_ARM_MonitorHandle *h)
Disconnect from the ARM service (if connected) and destroy the context.
Message was sent successfully.
GNUNET_ARM_ServiceStatus
Statuses of services.
static const char * req_string(enum GNUNET_ARM_RequestStatus rs)
Returns a string interpretation of rs.
Definition: gnunet-arm.c:218
GNUNET_ARM_RequestStatus
Statuses of the requests that client can send to ARM.
static void term_callback(void *cls, enum GNUNET_ARM_RequestStatus rs, enum GNUNET_ARM_Result result)
We have requested a service to be stopped, this function is called with the result of the operation...
Definition: gnunet-arm.c:454
static int monitor
Monitor ARM activity.
Definition: gnunet-arm.c:59
configuration data
Definition: configuration.c:85
Service stopping was initiated.
static int no_stderr
Do we want to give our stderr to gnunet-service-arm?
Definition: gnunet-arm.c:129
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_flag(char shortName, const char *name, const char *description, int *val)
Allow user to specify a flag (which internally means setting an integer to 1/GNUNET_YES/GNUNET_OK.
static void action_loop(void *cls)
Main task that runs our various operations in order.
Definition: gnunet-arm.c:547
#define GNUNET_log(kind,...)
Entry in list of pending tasks.
Definition: scheduler.c:134
Asked to start or stop a service, but it&#39;s not known.
int GNUNET_CONFIGURATION_get_value_filename(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be the name of a file or directory.
int GNUNET_PROGRAM_run(int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration, parse options).
Definition: program.c:361
static int no_stdout
Do we want to give our stdout to gnunet-service-arm?
Definition: gnunet-arm.c:124
#define GNUNET_YES
Definition: gnunet_common.h:80
struct GNUNET_ARM_MonitorHandle * GNUNET_ARM_monitor_start(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_ARM_ServiceStatusCallback cont, void *cont_cls)
Setup a context for monitoring ARM, then start connecting to the ARM service for monitoring using tha...
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:139
Service was stopped (never sent for ARM itself).
static int list
Set if we should print a list of currently running services.
Definition: gnunet-arm.c:64
#define GNUNET_free(ptr)
Wrapper around free.
Time for relative time used by GNUnet, in microseconds.
#define gettext_noop(String)
Definition: gettext.h:69
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:965