GNUnet  0.11.x
gnunet_arm_service.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2009, 2016 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 
35 #ifndef GNUNET_ARM_SERVICE_H
36 #define GNUNET_ARM_SERVICE_H
37 
38 #ifdef __cplusplus
39 extern "C"
40 {
41 #if 0 /* keep Emacsens' auto-indent happy */
42 }
43 #endif
44 #endif
45 
46 #include "gnunet_util_lib.h"
47 
51 #define GNUNET_ARM_VERSION 0x00000003
52 
53 
58 {
63 
68 };
69 
70 
75 {
80 
85 
90 
95 };
96 
97 
102 {
107 
112 
117 
122 
127 
132 
137 
142 
147 
152 };
153 
154 
159 {
164 
169 
175 
180 
186 };
187 
188 
193 {
198 
202  const char *name;
203 
207  const char *binary;
208 
214 
219 
224 };
225 
226 
230 struct GNUNET_ARM_Handle;
231 
235 struct GNUNET_ARM_Operation;
236 
237 
245 typedef void
247  int connected);
248 
249 
260 typedef void
262  enum GNUNET_ARM_RequestStatus rs,
264 
265 
277 typedef void
279  enum GNUNET_ARM_RequestStatus rs,
280  unsigned int count,
281  const struct GNUNET_ARM_ServiceInfo *list);
282 
283 
295 struct GNUNET_ARM_Handle *
298  void *conn_status_cls);
299 
300 
306 void
308 
309 
316 void
318 
319 
328 struct GNUNET_ARM_Operation *
331  void *cont_cls);
332 
333 
348 struct GNUNET_ARM_Operation *
350  const char *service_name,
352  void *cont_cls);
353 
354 
365 struct GNUNET_ARM_Operation *
367  const char *service_name,
369  std_inheritance,
371  void *cont_cls);
372 
373 
378 
379 
387 typedef void
389  const char *service,
391  status);
392 
393 
408  void *cont_cls);
409 
410 
416 void
418 
419 #if 0 /* keep Emacsens' auto-indent happy */
420 {
421 #endif
422 #ifdef __cplusplus
423 }
424 #endif
425 
426 #endif
427  /* end of group */
void(* GNUNET_ARM_ServiceListCallback)(void *cls, enum GNUNET_ARM_RequestStatus rs, unsigned int count, const struct GNUNET_ARM_ServiceInfo *list)
Callback function invoked when list operation is complete.
The service has previously failed, and will be restarted.
GNUNET_OS_InheritStdioFlags
Flags that determine which of the standard streams should be inherited by the child process...
Definition: gnunet_os_lib.h:68
ARM stopping was initiated (there&#39;s no "stopped" for ARM itself).
Service stopping was initiated.
static struct GNUNET_SERVICE_Handle * service
Handle to our service instance.
void(* GNUNET_ARM_ServiceMonitorCallback)(void *cls, const char *service, enum GNUNET_ARM_ServiceMonitorStatus status)
Function called in when a status update arrives.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
The service was started, but then exited normally.
Asked to stop it, but it&#39;s already stopping.
enum GNUNET_ARM_ServiceStatus status
The current status of the service.
Entry in a doubly-linked list of operations awaiting for replies (in-order) from the ARM service...
Definition: arm_api.c:40
We disconnected from ARM, and request was not sent.
Handle for interacting with ARM.
Definition: arm_api.c:102
void GNUNET_ARM_operation_cancel(struct GNUNET_ARM_Operation *op)
Abort an operation.
Definition: arm_api.c:794
GNUNET_ARM_Result
Replies to ARM requests.
Handle for interacting with ARM.
void * cont_cls
Closure for result_cont or list_cont.
Definition: arm_api.c:70
Asked to start it, but it&#39;s already started.
void GNUNET_ARM_disconnect(struct GNUNET_ARM_Handle *h)
Disconnect from the ARM service and destroy the handle.
Definition: arm_api.c:604
The service was started, and we&#39;re currently waiting for it to be stopped.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
Tried to start a service, but that failed for some reason.
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:1039
Service starting was initiated.
struct GNUNET_TIME_Absolute last_started_at
Time when the sevice was first started, if applicable.
static void conn_status(void *cls, int connected)
Function called whenever we connect to or disconnect from ARM.
Definition: gnunet-arm.c:302
static char * service_name
Option -s: service name (hash to get service descriptor)
Definition: gnunet-vpn.c:51
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:1074
Asked to start it, but it&#39;s already starting.
static int result
Global testing status.
void(* GNUNET_ARM_ConnectionStatusCallback)(void *cls, int connected)
Function called whenever we connect to or disconnect from ARM.
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:579
const char * name
The name of the service.
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...
Asked to start something, but ARM is shutting down and can&#39;t comply.
void(* GNUNET_ARM_ResultCallback)(void *cls, enum GNUNET_ARM_RequestStatus rs, enum GNUNET_ARM_Result result)
Function called in response to a start/stop request.
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:930
Service was stopped.
Service has been started and is currently running.
Service starting was initiated.
Asked to stop it, but it&#39;s already stopped.
void * conn_status_cls
Closure for conn_status.
Definition: arm_api.c:132
void GNUNET_ARM_monitor_stop(struct GNUNET_ARM_MonitorHandle *h)
Disconnect from the ARM service and destroy the handle.
Message was sent successfully.
GNUNET_ARM_ServiceStatus
Status of a service managed by ARM.
int last_exit_status
Last process exit status.
GNUNET_ARM_RequestStatus
Statuses of the requests that client can send to ARM.
configuration data
Definition: configuration.c:85
Information about a service managed by ARM.
Asked to start or stop a service, but it&#39;s not known.
GNUNET_ARM_ServiceMonitorStatus
Statuses of services.
Time for absolute times used by GNUnet, in microseconds.
struct GNUNET_TIME_Absolute restart_at
Time when the sevice will be restarted, if applicable to the current status.
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
const char * binary
The binary used to execute the service.
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:69