Automatic Restart Manager. More...
Data Structures | |
struct | GNUNET_ARM_ServiceInfo |
Information about a service managed by ARM. More... | |
Macros | |
#define | GNUNET_ARM_VERSION 0x00000003 |
Version of the arm API. More... | |
Typedefs | |
typedef void(* | GNUNET_ARM_ConnectionStatusCallback) (void *cls, enum GNUNET_GenericReturnValue connected) |
Function called whenever we connect to or disconnect from ARM. More... | |
typedef 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. More... | |
typedef 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. More... | |
typedef void(* | GNUNET_ARM_ServiceMonitorCallback) (void *cls, const char *service, enum GNUNET_ARM_ServiceMonitorStatus status) |
Function called in when a status update arrives. More... | |
Functions | |
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 context. More... | |
void | GNUNET_ARM_disconnect (struct GNUNET_ARM_Handle *h) |
Disconnect from the ARM service and destroy the handle. More... | |
void | GNUNET_ARM_operation_cancel (struct GNUNET_ARM_Operation *op) |
Abort an operation. More... | |
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. More... | |
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. More... | |
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. More... | |
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 that context. More... | |
void | GNUNET_ARM_monitor_stop (struct GNUNET_ARM_MonitorHandle *h) |
Disconnect from the ARM service and destroy the handle. More... | |
Automatic Restart Manager.
#define GNUNET_ARM_VERSION 0x00000003 |
Version of the arm API.
Definition at line 52 of file gnunet_arm_service.h.
typedef void(* GNUNET_ARM_ConnectionStatusCallback) (void *cls, enum GNUNET_GenericReturnValue connected) |
Function called whenever we connect to or disconnect from ARM.
cls | closure |
connected | GNUNET_YES if connected, GNUNET_NO if disconnected, GNUNET_SYSERR if there was an error. |
Definition at line 246 of file gnunet_arm_service.h.
typedef 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.
Will be called when request was not sent successfully, or when a reply comes. If the request was not sent successfully, rs will indicate that, and result will be undefined.
cls | closure |
rs | status of the request |
result | result of the operation |
Definition at line 262 of file gnunet_arm_service.h.
typedef 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.
Will be called when request was not sent successfully, or when a reply comes. If the request was not sent successfully, rs will indicate that, and count and list will be undefined.
cls | closure |
rs | status of the request |
count | number of strings in the list |
list | list of services managed by arm |
Definition at line 280 of file gnunet_arm_service.h.
typedef void(* GNUNET_ARM_ServiceMonitorCallback) (void *cls, const char *service, enum GNUNET_ARM_ServiceMonitorStatus status) |
Function called in when a status update arrives.
cls | closure |
service | service name |
status | status of the service |
Definition at line 396 of file gnunet_arm_service.h.
Statuses of the requests that client can send to ARM.
Enumerator | |
---|---|
GNUNET_ARM_REQUEST_SENT_OK | Message was sent successfully. |
GNUNET_ARM_REQUEST_DISCONNECTED | We disconnected from ARM, and request was not sent. |
Definition at line 58 of file gnunet_arm_service.h.
Statuses of services.
Definition at line 75 of file gnunet_arm_service.h.
enum GNUNET_ARM_Result |
Replies to ARM requests.
Definition at line 102 of file gnunet_arm_service.h.
Status of a service managed by ARM.
Definition at line 159 of file gnunet_arm_service.h.
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 context.
cfg | configuration to use (needed to contact ARM; the ARM service may internally use a different configuration to determine how to start the service). |
conn_status | will be called when connecting/disconnecting |
conn_status_cls | closure for conn_status |
Definition at line 577 of file arm_api.c.
References cfg, GNUNET_ARM_Handle::cfg, conn_status(), GNUNET_ARM_Handle::conn_status, GNUNET_ARM_Handle::conn_status_cls, GNUNET_free, GNUNET_new, GNUNET_OK, h, and reconnect_arm().
Referenced by run(), and start_peer_run().
void GNUNET_ARM_disconnect | ( | struct GNUNET_ARM_Handle * | h | ) |
Disconnect from the ARM service and destroy the handle.
[in] | h | the handle that was being used |
Disconnect from the ARM service and destroy the handle.
h | the handle that was being used |
Definition at line 603 of file arm_api.c.
References GNUNET_ARM_Operation::async, GNUNET_ARM_Operation::cont_cls, GNUNET_ARM_REQUEST_DISCONNECTED, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), h, GNUNET_ARM_Operation::list_cont, LOG, GNUNET_ARM_Handle::mq, op, GNUNET_ARM_Handle::operation_pending_head, GNUNET_ARM_Handle::operation_pending_tail, GNUNET_ARM_Handle::reconnect_task, and GNUNET_ARM_Operation::result_cont.
Referenced by shutdown_task(), and start_peer_cleanup().
void GNUNET_ARM_operation_cancel | ( | struct GNUNET_ARM_Operation * | op | ) |
Abort an operation.
Only prevents the callback from being called, the operation may still complete.
op | operation to cancel |
Definition at line 795 of file arm_api.c.
References GNUNET_ARM_Operation::async, GNUNET_CONTAINER_DLL_remove, GNUNET_DISK_file_close(), GNUNET_free, GNUNET_SCHEDULER_cancel(), h, GNUNET_ARM_Operation::h, op, GNUNET_ARM_Handle::operation_pending_head, GNUNET_ARM_Handle::operation_pending_tail, GNUNET_ARM_Operation::result_cont, GNUNET_ARM_Operation::rfd, and GNUNET_ARM_Handle::thm.
Referenced by handle_arm_list_result(), handle_arm_result(), reconnect_arm_later(), shutdown_task(), and stop_peer_cleanup().
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.
h | handle to ARM |
cont | callback to invoke after request is sent or is not sent |
cont_cls | closure for cont |
Definition at line 1086 of file arm_api.c.
References GNUNET_ARM_Operation::cont_cls, env, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_DEBUG, GNUNET_htonll(), GNUNET_MESSAGE_TYPE_ARM_LIST, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_new, h, GNUNET_ARM_Operation::h, GNUNET_ARM_Operation::id, GNUNET_ARM_Operation::list_cont, LOG, GNUNET_ARM_Handle::mq, msg, op, GNUNET_ARM_Handle::operation_pending_head, GNUNET_ARM_Handle::operation_pending_tail, and GNUNET_ARM_Handle::request_id_counter.
Referenced by action_loop().
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.
Stopping arm itself will not invalidate its handle, and ARM API will try to restore connection to the ARM service, even if ARM connection was lost because you asked for ARM to be stopped. Call GNUNET_ARM_disconnect() to free the handle and prevent further connection attempts.
h | handle to ARM |
service_name | name of the service |
cont | callback to invoke after request is sent or is not sent |
cont_cls | closure for cont |
Definition at line 1050 of file arm_api.c.
References change_service(), GNUNET_ARM_Operation::cont_cls, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_ARM_STOP, GNUNET_YES, h, GNUNET_ARM_Operation::is_arm_stop, LOG, op, and service_name.
Referenced by action_loop(), and stop_peer_run().
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.
h | handle to ARM |
service_name | name of the service |
std_inheritance | inheritance of std streams |
cont | callback to invoke after request is sent or not sent |
cont_cls | closure for cont |
Definition at line 936 of file arm_api.c.
References GNUNET_ARM_Operation::async, change_service(), GNUNET_ARM_Operation::cont_cls, GNUNET_ARM_Handle::currently_up, GNUNET_ARM_RESULT_START_FAILED, GNUNET_ARM_RESULT_STARTING, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_DISK_file_close(), GNUNET_DISK_PF_NONE, GNUNET_DISK_pipe(), GNUNET_DISK_pipe_close(), GNUNET_DISK_pipe_detach_end(), GNUNET_DISK_PIPE_END_READ, GNUNET_DISK_PIPE_END_WRITE, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_log_strerror, GNUNET_MESSAGE_TYPE_ARM_START, GNUNET_new, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_add_read_file(), GNUNET_TIME_UNIT_MINUTES, GNUNET_YES, h, GNUNET_ARM_Operation::h, LOG, notify_running(), notify_starting(), op, GNUNET_ARM_Handle::operation_pending_head, GNUNET_ARM_Handle::operation_pending_tail, reconnect_arm(), GNUNET_ARM_Operation::result_cont, ret, GNUNET_ARM_Operation::rfd, service_name, start_arm_service(), and GNUNET_ARM_Operation::starting_ret.
Referenced by action_loop().
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 that context.
cfg | configuration to use (needed to contact ARM; the ARM service may internally use a different configuration to determine how to start the service). |
cont | callback to invoke on status updates |
cont_cls | closure for cont |
Definition at line 233 of file arm_monitor_api.c.
References cfg, GNUNET_ARM_Handle::cfg, GNUNET_free, GNUNET_new, GNUNET_OK, h, and reconnect_arm_monitor().
Referenced by run().
void GNUNET_ARM_monitor_stop | ( | struct GNUNET_ARM_MonitorHandle * | h | ) |
Disconnect from the ARM service and destroy the handle.
h | the handle that was being used |
Disconnect from the ARM service and destroy the handle.
h | the handle that was being used |
Definition at line 258 of file arm_monitor_api.c.
References GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), h, GNUNET_ARM_Handle::mq, and GNUNET_ARM_Handle::reconnect_task.
Referenced by shutdown_task().