GNUnet 0.28.1-dev.5-1-gae1c02d74
 
Loading...
Searching...
No Matches
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_util_lib.h"
29
33static int end;
34
38static int start;
39
43static int restart;
44
48static int delete;
49
53static int quiet;
54
58static int show_all;
59
63static int monitor;
64
68static int list;
69
73static char *init;
74
78static char *term;
79
83static char *config_file;
84
88static char *dir;
89
93static int ret;
94
98static struct GNUNET_ARM_Handle *h;
99
104
109
113static unsigned int phase;
114
119
124
128static int no_stdout;
129
133static int no_stderr;
134
139
144
150static void
152{
153 GNUNET_log (
155 "Will attempt to remove configuration file %s and service directory %s\n",
157 dir);
158 if (0 != unlink (config_file))
159 {
161 _ ("Failed to remove configuration file %s\n"),
163 }
165 {
167 _ ("Failed to remove servicehome directory %s\n"),
168 dir);
169 }
170}
171
172
179static void
180shutdown_task (void *cls)
181{
182 (void) cls;
183 if (NULL != al_task)
184 {
186 al_task = NULL;
187 }
188 if (NULL != op)
189 {
191 op = NULL;
192 }
193 if (NULL != h)
194 {
196 h = NULL;
197 }
198 if (NULL != m)
199 {
201 m = NULL;
202 }
203 if (NULL != timeout_task)
204 {
206 timeout_task = NULL;
207 }
208 if ( (GNUNET_YES == end) &&
209 (GNUNET_YES == delete) )
210 delete_files ();
212 cfg = NULL;
213}
214
215
222static const char *
224{
225 switch (rs)
226 {
228 return _ ("Message was sent successfully");
229
231 return _ ("We disconnected from ARM before we could send a request");
232 }
233 return _ ("Unknown request status");
234}
235
236
243static const char *
245{
246 switch (result)
247 {
249 return _ ("is stopped");
250
252 return _ ("is starting");
253
255 return _ ("is stopping");
256
258 return _ ("is starting already");
259
261 return _ ("is stopping already");
262
264 return _ ("is started already");
265
267 return _ ("is stopped already");
268
270 return _ ("service is not known to ARM");
271
273 return _ ("service failed to start");
274
276 return _ ("service cannot be manipulated because ARM is shutting down");
277 }
278 return _ ("Unknown result code.");
279}
280
281
290static bool
292{
293 return (GNUNET_YES ==
295 "arm"));
296}
297
298
304static void
305action_loop (void *cls);
306
307
317static void
318conn_status (void *cls,
319 int connected)
320{
321 static int once;
322
323 (void) cls;
324 if ( (GNUNET_SYSERR == connected) &&
325 (0 == once) )
326 {
328 _ ("Fatal error initializing ARM API.\n"));
330 return;
331 }
332 once = 1;
333}
334
335
347static void
348start_callback (void *cls,
351{
352 (void) cls;
353 op = NULL;
355 {
356 fprintf (stdout,
357 _ ("Failed to start the ARM service: %s\n"),
358 req_string (rs));
360 return;
361 }
364 {
365 fprintf (stdout,
366 _ ("Failed to start the ARM service: %s\n"),
369 return;
370 }
372 "ARM service [re]start successful\n");
373 start = 0;
375 NULL);
376}
377
378
390static void
391stop_callback (void *cls,
394{
395 char *msg;
396
397 (void) cls;
398 op = NULL;
400 {
402 "%s",
403 _ (
404 "Failed to send a stop request to the ARM service: %s\n")
405 );
406 fprintf (stdout, msg, req_string (rs));
409 return;
410 }
414 {
415 fprintf (stdout,
416 _ ("Failed to stop the ARM service: %s\n"),
419 return;
420 }
422 "ARM service shutdown successful\n");
423 end = 0;
424 if (restart)
425 {
426 restart = 0;
427 start = 1;
429 "Initiating an ARM restart\n");
430 }
432 NULL);
433}
434
435
447static void
448init_callback (void *cls,
451{
452 (void) cls;
453 op = NULL;
455 {
456 fprintf (stdout,
457 _ ("Failed to send a request to start the `%s' service: %s\n"),
458 init,
459 req_string (rs));
461 return;
462 }
465 {
466 fprintf (stdout,
467 _ ("Failed to start the `%s' service: %s\n"),
468 init,
471 return;
472 }
474 "Service %s [re]started successfully\n",
475 init);
477 init = NULL;
479 NULL);
480}
481
482
494static void
495term_callback (void *cls,
498{
499 char *msg;
500
501 (void) cls;
502 op = NULL;
504 {
506 _ (
507 "Failed to send a request to kill the `%s' service: %%s\n"),
508 term);
509 fprintf (stdout,
510 msg,
511 req_string (rs));
514 return;
515 }
518 {
519 fprintf (stdout,
520 _ ("Failed to kill the `%s' service: %s\n"),
521 term,
524 return;
525 }
526
528 "Service %s stopped successfully\n",
529 term);
531 term = NULL;
533 NULL);
534}
535
536
547static void
548list_callback (void *cls,
550 unsigned int count,
551 const struct GNUNET_ARM_ServiceInfo *service_info)
552{
553 unsigned int num_stopped = 0;
554 unsigned int num_started = 0;
555 unsigned int num_stopping = 0;
556 unsigned int num_failed = 0;
557 unsigned int num_finished = 0;
558 (void) cls;
559 op = NULL;
561 {
562 char *msg;
563
565 "%s",
566 _ ("Failed to request a list of services: %s\n"));
567 fprintf (stdout,
568 msg,
569 req_string (rs));
571 ret = 3;
573 }
574 if (NULL == service_info)
575 {
576 fprintf (stderr,
577 "%s",
578 _ ("Error communicating with ARM. ARM not running?\n"));
580 ret = 3;
581 return;
582 }
583 for (unsigned int i = 0; i < count; i++)
584 {
585 switch (service_info[i].status)
586 {
588 num_stopped++;
589 break;
591 num_failed++;
592 break;
594 num_finished++;
595 break;
597 num_started++;
598 break;
600 num_stopping++;
601 fprintf (stdout,
602 "%s (binary='%s', status=stopping)\n",
603 service_info[i].name,
604 service_info[i].binary);
605 break;
606 default:
607 GNUNET_break_op (0);
608 fprintf (stdout,
609 "%s (binary='%s', status=unknown)\n",
610 service_info[i].name,
611 service_info[i].binary);
612 break;
613 }
614 }
615 if (! quiet)
616 {
617 if (show_all)
618 fprintf (stdout,
619 "%s",
620 _ ("All services:\n"));
621 else
622 fprintf (stdout,
623 "%s",
624 _ ("Services (excluding stopped services):\n"));
625 if (num_stopped || num_failed || num_finished || num_stopping ||
626 num_started)
627 {
628 int sep = 0;
629 fprintf (stdout, "(");
630 if (0 != num_started)
631 {
632 if (sep)
633 fprintf (stdout, " / ");
634 fprintf (stdout,
635 "started: %u",
636 num_started);
637 sep = 1;
638 }
639 if (0 != num_failed)
640 {
641 if (sep)
642 fprintf (stdout, " / ");
643 fprintf (stdout,
644 "failed: %u",
645 num_failed);
646 sep = 1;
647 }
648 if (0 != num_stopping)
649 {
650 if (sep)
651 fprintf (stdout, " / ");
652 fprintf (stdout,
653 "stopping: %u",
654 num_stopping);
655 sep = 1;
656 }
657 if (0 != num_stopped)
658 {
659 if (sep)
660 fprintf (stdout, " / ");
661 fprintf (stdout,
662 "stopped: %u",
663 num_stopped);
664 sep = 1;
665 }
666 if (0 != num_finished)
667 {
668 if (sep)
669 fprintf (stdout, " / ");
670 fprintf (stdout,
671 "finished: %u",
672 num_finished);
673 sep = 1;
674 }
675 fprintf (stdout, ")\n");
676 }
677 else
678 {
679 fprintf (stdout,
680 "%s",
681 _ ("(No services configured.)\n"));
682 }
683 }
684 for (unsigned int i = 0; i < count; i++)
685 {
686 struct GNUNET_TIME_Relative restart_in;
687 switch (service_info[i].status)
688 {
690 if (show_all)
691 fprintf (stdout,
692 "%s (binary='%s', status=stopped)\n",
693 service_info[i].name,
694 service_info[i].binary);
695 break;
697 restart_in = GNUNET_TIME_absolute_get_remaining (service_info[i].
698 restart_at);
699 fprintf (stdout,
700 "%s (binary='%s', status=failed, exit_status=%d, restart_delay='%s')\n",
701 service_info[i].name,
702 service_info[i].binary,
703 service_info[i].last_exit_status,
705 GNUNET_YES));
706 break;
708 fprintf (stdout,
709 "%s (binary='%s', status=finished)\n",
710 service_info[i].name,
711 service_info[i].binary);
712 break;
714 fprintf (stdout,
715 "%s (binary='%s', status=started)\n",
716 service_info[i].name,
717 service_info[i].binary);
718 break;
720 fprintf (stdout,
721 "%s (binary='%s', status=stopping)\n",
722 service_info[i].name,
723 service_info[i].binary);
724 break;
725 default:
726 GNUNET_break_op (0);
727 fprintf (stdout,
728 "%s (binary='%s', status=unknown)\n",
729 service_info[i].name,
730 service_info[i].binary);
731 break;
732 }
733 }
735 NULL);
736}
737
738
745static void
746action_loop (void *cls)
747{
748 (void) cls;
749 al_task = NULL;
751 "Running requested actions\n");
752 while (1)
753 {
754 switch (phase++)
755 {
756 case 0:
757 if (NULL != term)
758 {
759 if (! arm_is_running ())
760 {
761 fprintf (stderr,
762 _ ("Cannot stop the `%s' service: ARM is not running.\n"),
763 term);
764 ret = 4;
766 return;
767 }
769 "Termination action\n");
771 term,
773 NULL);
774 return;
775 }
776 break;
777
778 case 1:
779 if (end || restart)
780 {
781 if (! arm_is_running ())
782 {
784 "GNUnet not running, cannot stop the peer\n");
785 if (restart)
786 {
787 /* nothing to stop, so just start the peer */
788 restart = 0;
789 start = 1;
790 }
791 }
792 else
793 {
795 "End action\n");
797 "arm",
799 NULL);
800 return;
801 }
802 }
803 break;
804
805 case 2:
806 if (start)
807 {
809 "Start action\n");
810 op =
812 "arm",
813 (no_stdout
814 ? 0
816 | (no_stderr
817 ? 0
820 NULL);
821 return;
822 }
823 break;
824
825 case 3:
826 if (NULL != init)
827 {
828 if (! arm_is_running ())
829 {
830 fprintf (stderr,
831 _ ("Cannot start the `%s' service: ARM is not running.\n"),
832 init);
833 ret = 4;
835 return;
836 }
838 "Initialization action\n");
840 init,
843 NULL);
844 return;
845 }
846 break;
847
848 case 4:
849 if (list)
850 {
851 if (! arm_is_running ())
852 {
853 fprintf (stderr,
854 "%s",
855 _ ("Cannot list services: ARM is not running.\n"));
856 ret = 4;
858 return;
859 }
861 "Going to list all running services controlled by ARM.\n");
864 &list);
865 return;
866 }
867 break;
868
869 case 5:
870 if (monitor)
871 {
872 if (! quiet)
873 fprintf (stderr,
874 _ ("Now only monitoring, press CTRL-C to stop.\n"));
875 quiet =
876 0; /* does not make sense to stay quiet in monitor mode at this time */
877 return; /* done with tasks, just monitor */
878 }
879 break;
880
881 default: /* last phase */
883 return;
884 }
885 }
886}
887
888
896static void
897srv_status (void *cls,
898 const char *service,
900{
901 const char *msg;
902
903 (void) cls;
904 switch (status)
905 {
907 return; /* this should be done silently */
908
910 msg = _ ("Stopped %s.\n");
911 break;
912
914 msg = _ ("Starting %s...\n");
915 break;
916
918 msg = _ ("Stopping %s...\n");
919 break;
920
921 default:
922 msg = NULL;
923 break;
924 }
925 if (! quiet)
926 {
927 if (NULL != msg)
928 fprintf (stderr,
929 msg,
930 service);
931 else
932 fprintf (stderr,
933 _ ("Unknown status %u for service %s.\n"),
934 status,
935 service);
936 }
938 "Got service %s status %d\n",
939 service,
940 (int) status);
941}
942
943
947static void
949{
950 (void) cls;
951 timeout_task = NULL;
952 ret = 2;
954}
955
956
965static void
966run (void *cls,
967 char *const *args,
968 const char *cfgfile,
969 const struct GNUNET_CONFIGURATION_Handle *c)
970{
971 (void) cls;
972 (void) args;
973 (void) cfgfile;
975 if (GNUNET_OK !=
977 "PATHS",
978 "GNUNET_HOME",
979 &dir))
980 {
982 "PATHS",
983 "GNUNET_HOME");
984 return;
985 }
987 "arm",
988 "CONFIG",
989 &config_file);
990 if (NULL == (h = GNUNET_ARM_connect (cfg,
992 NULL)))
993 return;
994 if (monitor)
996 &srv_status,
997 NULL);
999 NULL);
1001 NULL);
1002 if (0 != timeout.rel_value_us)
1003 timeout_task =
1006 NULL);
1007}
1008
1009
1018int
1019main (int argc, char *const *argv)
1020{
1023 "end",
1024 gettext_noop ("stop all GNUnet services"),
1025 &end),
1027 "init",
1028 "SERVICE",
1029 gettext_noop ("start a particular service"),
1030 &init),
1032 "kill",
1033 "SERVICE",
1034 gettext_noop ("stop a particular service"),
1035 &term),
1037 "all",
1038 gettext_noop (
1039 "also show stopped services (used with -I)"),
1040 &show_all),
1042 "start",
1043 gettext_noop (
1044 "start all GNUnet default services"),
1045 &start),
1047 "restart",
1048 gettext_noop (
1049 "stop and start all GNUnet default services"),
1050 &restart),
1052 "delete",
1053 gettext_noop (
1054 "delete config file and directory on exit"),
1055 &delete),
1057 "monitor",
1058 gettext_noop ("monitor ARM activities"),
1059 &monitor),
1061 "quiet",
1062 gettext_noop ("don't print status messages"),
1063 &quiet),
1065 'T',
1066 "timeout",
1067 "DELAY",
1068 gettext_noop (
1069 "exit with error status if operation does not finish after DELAY"),
1070 &timeout),
1072 "info",
1073 gettext_noop (
1074 "list currently running services"),
1075 &list),
1077 'O',
1078 "no-stdout",
1079 gettext_noop ("don't let gnunet-service-arm inherit standard output"),
1080 &no_stdout),
1082 'E',
1083 "no-stderr",
1084 gettext_noop ("don't let gnunet-service-arm inherit standard error"),
1085 &no_stderr),
1087 };
1088 int lret;
1089
1090 if (GNUNET_OK ==
1091 (lret = GNUNET_PROGRAM_run (
1093 argc,
1094 argv,
1095 "gnunet-arm",
1096 gettext_noop (
1097 "Control services and the Automated Restart Manager (ARM)"),
1098 options,
1099 &run,
1100 NULL)))
1101 {
1102 return ret;
1103 }
1104 return lret;
1105}
1106
1107
1108/* end of gnunet-arm.c */
struct GNUNET_GETOPT_CommandLineOption options[]
Definition 002.c:5
struct GNUNET_MessageHeader * msg
Definition 005.c:2
int main()
Program to simulate results from GCP_get_desirability_of_path() for various plausible inputs.
#define gettext_noop(String)
Definition gettext.h:74
static int no_stdout
Do we want to give our stdout to gnunet-service-arm?
Definition gnunet-arm.c:128
static void timeout_task_cb(void *cls)
Task run on timeout (if -T is given).
Definition gnunet-arm.c:948
static struct GNUNET_ARM_Operation * op
Current operation.
Definition gnunet-arm.c:143
static const char * req_string(enum GNUNET_ARM_RequestStatus rs)
Returns a string interpretation of rs.
Definition gnunet-arm.c:223
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
Definition gnunet-arm.c:103
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition gnunet-arm.c:98
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:495
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:151
static int start
Set if we are to start default services (including ARM).
Definition gnunet-arm.c:38
static int monitor
Monitor ARM activity.
Definition gnunet-arm.c:63
static int show_all
Set if we should print all services, including stopped ones.
Definition gnunet-arm.c:58
static int list
Set if we should print a list of currently running services.
Definition gnunet-arm.c:68
static int quiet
Set if we should not print status messages.
Definition gnunet-arm.c:53
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:391
static int ret
Final status code.
Definition gnunet-arm.c:93
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition gnunet-arm.c:108
static char * dir
Set to the directory where runtime files are stored.
Definition gnunet-arm.c:88
static char * term
Set to the name of a service to kill.
Definition gnunet-arm.c:78
static char * init
Set to the name of a service to start.
Definition gnunet-arm.c:73
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:966
static void action_loop(void *cls)
Main task that runs our various operations in order.
Definition gnunet-arm.c:746
static int restart
Set if we are to stop/start default services (including ARM).
Definition gnunet-arm.c:43
static const char * ret_string(enum GNUNET_ARM_Result result)
Returns a string interpretation of the result.
Definition gnunet-arm.c:244
static void conn_status(void *cls, int connected)
Function called whenever we connect to or disconnect from ARM.
Definition gnunet-arm.c:318
static struct GNUNET_TIME_Relative timeout
User defined timestamp for completing operations.
Definition gnunet-arm.c:118
static void list_callback(void *cls, enum GNUNET_ARM_RequestStatus rs, unsigned int count, const struct GNUNET_ARM_ServiceInfo *service_info)
Function called with the list of running services.
Definition gnunet-arm.c:548
static unsigned int phase
Processing stage that we are in.
Definition gnunet-arm.c:113
static struct GNUNET_SCHEDULER_Task * al_task
Handle for the task running the action_loop().
Definition gnunet-arm.c:138
static void srv_status(void *cls, const char *service, enum GNUNET_ARM_ServiceMonitorStatus status)
Function called when a service starts or stops.
Definition gnunet-arm.c:897
static int end
Set if we are to shutdown all services (including ARM).
Definition gnunet-arm.c:33
static char * config_file
Set to the name of the config file used.
Definition gnunet-arm.c:83
static struct GNUNET_SCHEDULER_Task * timeout_task
Task to be run on timeout.
Definition gnunet-arm.c:123
static int no_stderr
Do we want to give our stderr to gnunet-service-arm?
Definition gnunet-arm.c:133
static bool arm_is_running(void)
Check if the ARM service is (likely) running.
Definition gnunet-arm.c:291
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:448
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:348
struct GNUNET_SCHEDULER_Task * shutdown_task
static char * name
Name (label) of the records to list.
static int status
The program status; 0 for success.
Definition gnunet-nse.c:39
static int once
Option -i.
Definition gnunet-pils.c:39
static int result
Global testing status.
static struct GNUNET_SERVICE_Handle * service
Handle to our service instance.
GNUNET_ARM_ServiceMonitorStatus
Statuses of services.
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:577
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:919
struct GNUNET_ARM_MonitorHandle * GNUNET_ARM_monitor_start(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_ARM_ServiceMonitorCallback cont, void *cont_cls)
Setup a context for monitoring ARM, then start connecting to the ARM service for monitoring using tha...
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:1069
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:1033
void GNUNET_ARM_monitor_stop(struct GNUNET_ARM_MonitorHandle *h)
Disconnect from the ARM service and destroy the handle.
void GNUNET_ARM_disconnect(struct GNUNET_ARM_Handle *h)
Disconnect from the ARM service and destroy the handle.
Definition arm_api.c:603
GNUNET_ARM_Result
Replies to ARM requests.
GNUNET_ARM_RequestStatus
Statuses of the requests that client can send to ARM.
void GNUNET_ARM_operation_cancel(struct GNUNET_ARM_Operation *op)
Abort an operation.
Definition arm_api.c:778
@ GNUNET_ARM_SERVICE_STATUS_FINISHED
The service was started, but then exited normally.
@ GNUNET_ARM_SERVICE_STATUS_FAILED
The service has previously failed, and will be restarted.
@ GNUNET_ARM_SERVICE_STATUS_STOPPED
Service is stopped.
@ GNUNET_ARM_SERVICE_STATUS_STOPPING
The service was started, and we're currently waiting for it to be stopped.
@ GNUNET_ARM_SERVICE_STATUS_STARTED
Service has been started and is currently running.
@ GNUNET_ARM_SERVICE_STOPPING
Service stopping was initiated.
@ GNUNET_ARM_SERVICE_STOPPED
Service was stopped.
@ GNUNET_ARM_SERVICE_STARTING
Service starting was initiated.
@ GNUNET_ARM_SERVICE_MONITORING_STARTED
Dummy message.
@ GNUNET_ARM_RESULT_IS_NOT_KNOWN
Asked to start or stop a service, but it's not known.
@ GNUNET_ARM_RESULT_IS_STARTING_ALREADY
Asked to start it, but it's already starting.
@ GNUNET_ARM_RESULT_IS_STOPPED_ALREADY
Asked to stop it, but it's already stopped.
@ GNUNET_ARM_RESULT_STARTING
Service starting was initiated.
@ GNUNET_ARM_RESULT_IS_STARTED_ALREADY
Asked to start it, but it's already started.
@ GNUNET_ARM_RESULT_STOPPING
ARM stopping was initiated (there's no "stopped" for ARM itself).
@ GNUNET_ARM_RESULT_IS_STOPPING_ALREADY
Asked to stop it, but it's already stopping.
@ GNUNET_ARM_RESULT_STOPPED
Service was stopped (never sent for ARM itself).
@ GNUNET_ARM_RESULT_START_FAILED
Tried to start a service, but that failed for some reason.
@ GNUNET_ARM_RESULT_IN_SHUTDOWN
Asked to start something, but ARM is shutting down and can't comply.
@ GNUNET_ARM_REQUEST_DISCONNECTED
We disconnected from ARM, and request was not sent.
@ GNUNET_ARM_REQUEST_SENT_OK
Message was sent successfully.
enum GNUNET_GenericReturnValue GNUNET_CLIENT_test(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name)
Test if the port or UNIXPATH of the given service_name is in use and thus (most likely) the respectiv...
Definition client.c:1006
enum GNUNET_GenericReturnValue 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.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_dup(const struct GNUNET_CONFIGURATION_Handle *cfg)
Duplicate an existing configuration object.
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
enum GNUNET_GenericReturnValue 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.
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_remove(const char *filename)
Remove all files in a directory (rm -rf).
Definition disk.c:1140
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).
#define GNUNET_GETOPT_OPTION_END
Marker for the end of the list of options.
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.
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 GNUNET_log(kind,...)
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_SYSERR
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
void GNUNET_log_config_missing(enum GNUNET_ErrorType kind, const char *section, const char *option)
Log error message about missing configuration option.
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_free(ptr)
Wrapper around free.
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_gnunet(void)
Return default project data used by 'libgnunetutil' for GNUnet.
@ GNUNET_OS_INHERIT_STD_OUT
When this flag is set, the child process will inherit stdout of the parent.
@ GNUNET_OS_INHERIT_STD_ERR
When this flag is set, the child process will inherit stderr of the parent.
@ GNUNET_OS_INHERIT_STD_NONE
No standard streams should be inherited.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(const struct GNUNET_OS_ProjectData *pd, 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,...
Definition program.c:406
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition scheduler.c:572
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,...
Definition scheduler.c:1345
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition scheduler.c:986
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:1310
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:1283
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_remaining(struct GNUNET_TIME_Absolute future)
Given a timestamp in the future, how much time remains until then?
Definition time.c:406
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
Definition strings.c:610
#define _(String)
GNU gettext support macro.
Definition platform.h:179
Handle for interacting with ARM.
Definition arm_api.c:103
Handle for interacting with ARM.
Entry in a doubly-linked list of operations awaiting for replies (in-order) from the ARM service.
Definition arm_api.c:41
Information about a service managed by ARM.
Definition of a command line option.
Entry in list of pending tasks.
Definition scheduler.c:141
Time for relative time used by GNUnet, in microseconds.
uint64_t rel_value_us
The actual value.