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
261 (*GNUNET_ARM_ResultCallback) (void *cls,
262  enum GNUNET_ARM_RequestStatus rs,
264 
265 
277 typedef void
278 (*GNUNET_ARM_ServiceListCallback) (void *cls,
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 */
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:51
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:925
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:1037
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:1072
@ 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:69
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.