GNUnet  0.20.0
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 
47 #include "gnunet_util_lib.h"
48 
52 #define GNUNET_ARM_VERSION 0x00000003
53 
54 
59 {
64 
69 };
70 
71 
76 {
81 
86 
91 
96 };
97 
98 
103 {
108 
113 
118 
123 
128 
133 
138 
143 
148 
153 };
154 
155 
160 {
165 
170 
176 
181 
187 };
188 
189 
194 {
199 
203  const char *name;
204 
208  const char *binary;
209 
215 
220 
225 };
226 
227 
231 struct GNUNET_ARM_Handle;
232 
236 struct GNUNET_ARM_Operation;
237 
238 
246 typedef void
248  int connected);
249 
250 
261 typedef void
262 (*GNUNET_ARM_ResultCallback) (void *cls,
263  enum GNUNET_ARM_RequestStatus rs,
265 
266 
278 typedef void
279 (*GNUNET_ARM_ServiceListCallback) (void *cls,
280  enum GNUNET_ARM_RequestStatus rs,
281  unsigned int count,
282  const struct GNUNET_ARM_ServiceInfo *list);
283 
284 
296 struct GNUNET_ARM_Handle *
299  void *conn_status_cls);
300 
301 
307 void
309 
310 
317 void
319 
320 
329 struct GNUNET_ARM_Operation *
332  void *cont_cls);
333 
334 
349 struct GNUNET_ARM_Operation *
351  const char *service_name,
353  void *cont_cls);
354 
355 
366 struct GNUNET_ARM_Operation *
368  const char *service_name,
370  std_inheritance,
372  void *cont_cls);
373 
374 
379 
380 
388 typedef void
390  const char *service,
392  status);
393 
394 
409  void *cont_cls);
410 
411 
417 void
419 
420 #if 0 /* keep Emacsens' auto-indent happy */
421 {
422 #endif
423 #ifdef __cplusplus
424 }
425 #endif
426 
427 #endif
428  /* end of group */
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
static int list
Set if we should print a list of currently running services.
Definition: gnunet-arm.c:69
static void conn_status(void *cls, int connected)
Function called whenever we connect to or disconnect from ARM.
Definition: gnunet-arm.c:302
uint16_t status
See PRISM_STATUS_*-constants.
static int result
Global testing status.
static struct GNUNET_SERVICE_Handle * service
Handle to our service instance.
static char * service_name
Option -s: service name (hash to get service descriptor)
Definition: gnunet-vpn.c:50
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.
GNUNET_ARM_ServiceStatus
Status of a service managed by ARM.
GNUNET_ARM_ServiceMonitorStatus
Statuses of services.
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:926
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
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.
void GNUNET_ARM_monitor_stop(struct GNUNET_ARM_MonitorHandle *h)
Disconnect from the ARM service and destroy the handle.
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:1038
void GNUNET_ARM_disconnect(struct GNUNET_ARM_Handle *h)
Disconnect from the ARM service and destroy the handle.
Definition: arm_api.c:602
GNUNET_ARM_Result
Replies to ARM requests.
GNUNET_ARM_RequestStatus
Statuses of the requests that client can send to ARM.
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...
void(* GNUNET_ARM_ServiceMonitorCallback)(void *cls, const char *service, enum GNUNET_ARM_ServiceMonitorStatus status)
Function called in when a status update arrives.
void(* GNUNET_ARM_ConnectionStatusCallback)(void *cls, int connected)
Function called whenever we connect to or disconnect from ARM.
void GNUNET_ARM_operation_cancel(struct GNUNET_ARM_Operation *op)
Abort an operation.
Definition: arm_api.c:789
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:1073
@ 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.
GNUNET_OS_InheritStdioFlags
Flags that determine which of the standard streams should be inherited by the child process.
Definition: gnunet_os_lib.h:73
Handle for interacting with ARM.
Definition: arm_api.c:103
void * conn_status_cls
Closure for conn_status.
Definition: arm_api.c:132
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
void * cont_cls
Closure for result_cont or list_cont.
Definition: arm_api.c:70
Information about a service managed by ARM.
const char * name
The name of the service.
struct GNUNET_TIME_Absolute last_started_at
Time when the service was first started, if applicable.
enum GNUNET_ARM_ServiceStatus status
The current status of the service.
struct GNUNET_TIME_Absolute restart_at
Time when the service will be restarted, if applicable to the current status.
int last_exit_status
Last process exit status.
const char * binary
The binary used to execute the service.
Time for absolute times used by GNUnet, in microseconds.