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");
224 
226  return _("We disconnected from ARM before we could send a request");
227  }
228  return _("Unknown request status");
229 }
230 
231 
238 static const char *
240 {
241  switch (result)
242  {
244  return _("is stopped");
245 
247  return _("is starting");
248 
250  return _("is stopping");
251 
253  return _("is starting already");
254 
256  return _("is stopping already");
257 
259  return _("is started already");
260 
262  return _("is stopped already");
263 
265  return _("service is not known to ARM");
266 
268  return _("service failed to start");
269 
271  return _("service cannot be manipulated because ARM is shutting down");
272  }
273  return _("Unknown result code.");
274 }
275 
276 
282 static void
283 action_loop(void *cls);
284 
285 
295 static void
296 conn_status(void *cls, int connected)
297 {
298  static int once;
299 
300  (void)cls;
301  if ((GNUNET_SYSERR == connected) && (0 == once))
302  {
304  _("Fatal error initializing ARM API.\n"));
306  return;
307  }
308  once = 1;
309 }
310 
311 
323 static void
324 start_callback(void *cls,
325  enum GNUNET_ARM_RequestStatus rs,
327 {
328  (void)cls;
329  op = NULL;
330  if (GNUNET_ARM_REQUEST_SENT_OK != rs)
331  {
332  fprintf(stdout,
333  _("Failed to start the ARM service: %s\n"),
334  req_string(rs));
336  return;
337  }
338  if ((GNUNET_ARM_RESULT_STARTING != result) &&
340  {
341  fprintf(stdout,
342  _("Failed to start the ARM service: %s\n"),
343  ret_string(result));
345  return;
346  }
347  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "ARM service [re]start successful\n");
348  start = 0;
349  al_task = GNUNET_SCHEDULER_add_now(&action_loop, NULL);
350 }
351 
352 
364 static void
365 stop_callback(void *cls,
366  enum GNUNET_ARM_RequestStatus rs,
368 {
369  char *msg;
370 
371  (void)cls;
372  op = NULL;
373  if (GNUNET_ARM_REQUEST_SENT_OK != rs)
374  {
375  GNUNET_asprintf(&msg,
376  "%s",
377  _(
378  "Failed to send a stop request to the ARM service: %s\n"));
379  fprintf(stdout, msg, req_string(rs));
380  GNUNET_free(msg);
382  return;
383  }
384  if ((GNUNET_ARM_RESULT_STOPPING != result) &&
385  (GNUNET_ARM_RESULT_STOPPED != result) &&
387  {
388  fprintf(stdout,
389  _("Failed to stop the ARM service: %s\n"),
390  ret_string(result));
392  return;
393  }
394  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "ARM service shutdown successful\n");
395  end = 0;
396  if (restart)
397  {
398  restart = 0;
399  start = 1;
400  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Initiating an ARM restart\n");
401  }
402  al_task = GNUNET_SCHEDULER_add_now(&action_loop, NULL);
403 }
404 
405 
417 static void
418 init_callback(void *cls,
419  enum GNUNET_ARM_RequestStatus rs,
421 {
422  (void)cls;
423  op = NULL;
424  if (GNUNET_ARM_REQUEST_SENT_OK != rs)
425  {
426  fprintf(stdout,
427  _("Failed to send a request to start the `%s' service: %s\n"),
428  init,
429  req_string(rs));
431  return;
432  }
433  if ((GNUNET_ARM_RESULT_STARTING != result) &&
435  {
436  fprintf(stdout,
437  _("Failed to start the `%s' service: %s\n"),
438  init,
439  ret_string(result));
441  return;
442  }
444  "Service %s [re]started successfully\n",
445  init);
446  GNUNET_free(init);
447  init = NULL;
448  al_task = GNUNET_SCHEDULER_add_now(&action_loop, NULL);
449 }
450 
451 
463 static void
464 term_callback(void *cls,
465  enum GNUNET_ARM_RequestStatus rs,
467 {
468  char *msg;
469 
470  (void)cls;
471  op = NULL;
472  if (GNUNET_ARM_REQUEST_SENT_OK != rs)
473  {
474  GNUNET_asprintf(&msg,
475  _(
476  "Failed to send a request to kill the `%s' service: %%s\n"),
477  term);
478  fprintf(stdout, msg, req_string(rs));
479  GNUNET_free(msg);
481  return;
482  }
483  if ((GNUNET_ARM_RESULT_STOPPED != result) &&
485  {
486  fprintf(stdout,
487  _("Failed to kill the `%s' service: %s\n"),
488  term,
489  ret_string(result));
491  return;
492  }
493 
495  "Service %s stopped successfully\n",
496  term);
497  GNUNET_free(term);
498  term = NULL;
499  al_task = GNUNET_SCHEDULER_add_now(&action_loop, NULL);
500 }
501 
502 
513 static void
514 list_callback(void *cls,
515  enum GNUNET_ARM_RequestStatus rs,
516  unsigned int count,
517  const char *const *list)
518 {
519  (void)cls;
520  op = NULL;
521  if (GNUNET_ARM_REQUEST_SENT_OK != rs)
522  {
523  char *msg;
524 
525  GNUNET_asprintf(&msg,
526  "%s",
527  _("Failed to request a list of services: %s\n"));
528  fprintf(stdout, msg, req_string(rs));
529  GNUNET_free(msg);
530  ret = 3;
532  }
533  if (NULL == list)
534  {
535  fprintf(stderr,
536  "%s",
537  _("Error communicating with ARM. ARM not running?\n"));
539  ret = 3;
540  return;
541  }
542  if (!quiet)
543  fprintf(stdout, "%s", _("Running services:\n"));
544  for (unsigned int i = 0; i < count; i++)
545  fprintf(stdout, "%s\n", list[i]);
546  al_task = GNUNET_SCHEDULER_add_now(&action_loop, NULL);
547 }
548 
549 
556 static void
557 action_loop(void *cls)
558 {
559  (void)cls;
560  al_task = NULL;
561  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Running requested actions\n");
562  while (1)
563  {
564  switch (phase++)
565  {
566  case 0:
567  if (NULL != term)
568  {
569  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Termination action\n");
571  return;
572  }
573  break;
574 
575  case 1:
576  if (end || restart)
577  {
578  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "End action\n");
579  op = GNUNET_ARM_request_service_stop(h, "arm", &stop_callback, NULL);
580  return;
581  }
582  break;
583 
584  case 2:
585  if (start)
586  {
587  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Start action\n");
588  op =
590  "arm",
591  (no_stdout
592  ? 0
594  (no_stderr
595  ? 0
598  NULL);
599  return;
600  }
601  break;
602 
603  case 3:
604  if (NULL != init)
605  {
606  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Initialization action\n");
608  init,
610  &init_callback,
611  NULL);
612  return;
613  }
614  break;
615 
616  case 4:
617  if (list)
618  {
620  "Going to list all running services controlled by ARM.\n");
622  return;
623  }
624  break;
625 
626  case 5:
627  if (monitor)
628  {
629  if (!quiet)
630  fprintf(stderr, _("Now only monitoring, press CTRL-C to stop.\n"));
631  quiet =
632  0; /* does not make sense to stay quiet in monitor mode at this time */
633  return; /* done with tasks, just monitor */
634  }
635  break;
636 
637  default: /* last phase */
639  return;
640  }
641  }
642 }
643 
644 
652 static void
653 srv_status(void *cls,
654  const char *service,
656 {
657  const char *msg;
658 
659  (void)cls;
660  switch (status)
661  {
663  return; /* this should be done silently */
664 
666  msg = _("Stopped %s.\n");
667  break;
668 
670  msg = _("Starting %s...\n");
671  break;
672 
674  msg = _("Stopping %s...\n");
675  break;
676 
677  default:
678  msg = NULL;
679  break;
680  }
681  if (!quiet)
682  {
683  if (NULL != msg)
684  fprintf(stderr, msg, service);
685  else
686  fprintf(stderr,
687  _("Unknown status %u for service %s.\n"),
688  status,
689  service);
690  }
692  "Got service %s status %d\n",
693  service,
694  (int)status);
695 }
696 
697 
701 static void
702 timeout_task_cb(void *cls)
703 {
704  (void)cls;
705  timeout_task = NULL;
706  ret = 2;
708 }
709 
710 
719 static void
720 run(void *cls,
721  char *const *args,
722  const char *cfgfile,
723  const struct GNUNET_CONFIGURATION_Handle *c)
724 {
725  (void)cls;
726  (void)args;
727  (void)cfgfile;
728  cfg = GNUNET_CONFIGURATION_dup(c);
729  if (GNUNET_OK !=
730  GNUNET_CONFIGURATION_get_value_string(cfg, "PATHS", "GNUNET_HOME", &dir))
731  {
732  GNUNET_log_config_missing(GNUNET_ERROR_TYPE_ERROR, "PATHS", "GNUNET_HOME");
733  return;
734  }
736  "arm",
737  "CONFIG",
738  &config_file);
739  if (NULL == (h = GNUNET_ARM_connect(cfg, &conn_status, NULL)))
740  return;
741  if (monitor)
742  m = GNUNET_ARM_monitor_start(cfg, &srv_status, NULL);
743  al_task = GNUNET_SCHEDULER_add_now(&action_loop, NULL);
745  if (0 != timeout.rel_value_us)
746  timeout_task =
748 }
749 
750 
758 int
759 main(int argc, char *const *argv)
760 {
761  struct GNUNET_GETOPT_CommandLineOption options[] =
763  "end",
764  gettext_noop("stop all GNUnet services"),
765  &end),
767  "init",
768  "SERVICE",
769  gettext_noop("start a particular service"),
770  &init),
772  "kill",
773  "SERVICE",
774  gettext_noop("stop a particular service"),
775  &term),
777  "start",
778  gettext_noop(
779  "start all GNUnet default services"),
780  &start),
782  "restart",
783  gettext_noop(
784  "stop and start all GNUnet default services"),
785  &restart),
787  "delete",
788  gettext_noop(
789  "delete config file and directory on exit"),
790  &delete),
792  "monitor",
793  gettext_noop("monitor ARM activities"),
794  &monitor),
796  "quiet",
797  gettext_noop("don't print status messages"),
798  &quiet),
800  'T',
801  "timeout",
802  "DELAY",
803  gettext_noop(
804  "exit with error status if operation does not finish after DELAY"),
805  &timeout),
807  "info",
808  gettext_noop(
809  "list currently running services"),
810  &list),
812  'O',
813  "no-stdout",
814  gettext_noop("don't let gnunet-service-arm inherit standard output"),
815  &no_stdout),
817  'E',
818  "no-stderr",
819  gettext_noop("don't let gnunet-service-arm inherit standard error"),
820  &no_stderr),
822  int lret;
823 
824  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args(argc, argv, &argc, &argv))
825  return 2;
826  if (GNUNET_OK ==
827  (lret = GNUNET_PROGRAM_run(
828  argc,
829  argv,
830  "gnunet-arm",
831  gettext_noop(
832  "Control services and the Automated Restart Manager (ARM)"),
833  options,
834  &run,
835  NULL)))
836  {
837  GNUNET_free((void *)argv);
838  return ret;
839  }
840  GNUNET_free((void *)argv);
841  return lret;
842 }
843 
844 /* 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:720
When this flag is set, the child process will inherit stderr of the parent.
Definition: gnunet_os_lib.h:90
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:702
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:365
static int restart
Set if we are to stop/start default services (including ARM).
Definition: gnunet-arm.c:44
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:1284
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:1439
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:96
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
void GNUNET_ARM_operation_cancel(struct GNUNET_ARM_Operation *op)
Abort an operation.
Definition: arm_api.c:663
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:324
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:517
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:505
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 _(String)
GNU gettext support macro.
Definition: platform.h:181
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:514
int main(int argc, char *const *argv)
The main function to obtain arm from gnunetd.
Definition: gnunet-arm.c:759
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:1237
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:862
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:72
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:1264
When this flag is set, the child process will inherit stdout of the parent.
Definition: gnunet_os_lib.h:84
int GNUNET_DISK_directory_remove(const char *filename)
Remove all files in a directory (rm -rf).
Definition: disk.c:1026
static void conn_status(void *cls, int connected)
Function called whenever we connect to or disconnect from ARM.
Definition: gnunet-arm.c:296
static int once
Global to mark if we&#39;ve run the initialization.
Definition: gnsrecord.c:67
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:894
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:480
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:239
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:787
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
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:418
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:653
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:464
static int monitor
Monitor ARM activity.
Definition: gnunet-arm.c:59
configuration data
Definition: configuration.c:83
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:557
#define GNUNET_log(kind,...)
Entry in list of pending tasks.
Definition: scheduler.c:131
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:367
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:77
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:956