API for monitoring the ARM service. More...
#include "platform.h"
#include "gnunet_arm_service.h"
#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
#include "arm.h"
Go to the source code of this file.
Data Structures | |
struct | GNUNET_ARM_MonitorHandle |
Handle for interacting with ARM. More... | |
Macros | |
#define | INIT_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) |
#define | LOG(kind, ...) GNUNET_log_from (kind, "arm-monitor-api", __VA_ARGS__) |
Functions | |
static int | reconnect_arm_monitor (struct GNUNET_ARM_MonitorHandle *h) |
Connect to the ARM service for monitoring. More... | |
static void | reconnect_arm_monitor_task (void *cls) |
Task scheduled to try to re-connect to arm. More... | |
static void | reconnect_arm_monitor_later (struct GNUNET_ARM_MonitorHandle *h) |
Close down any existing connection to the ARM service and try re-establishing it later. More... | |
static int | check_monitor_notify (void *cls, const struct GNUNET_ARM_StatusMessage *msg) |
Check notification messages received from ARM is well-formed. More... | |
static void | handle_monitor_notify (void *cls, const struct GNUNET_ARM_StatusMessage *res) |
Handler for notification messages received from ARM. More... | |
static void | mq_error_handler (void *cls, enum GNUNET_MQ_Error error) |
Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue. 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 (if connected) and destroy the context. More... | |
API for monitoring the ARM service.
Definition in file arm_monitor_api.c.
#define INIT_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) |
Definition at line 33 of file arm_monitor_api.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "arm-monitor-api", __VA_ARGS__) |
Definition at line 35 of file arm_monitor_api.c.
|
static |
Connect to the ARM service for monitoring.
h | handle to connect |
Definition at line 194 of file arm_monitor_api.c.
References GNUNET_ARM_Handle::cfg, env, GNUNET_ARM_SERVICE_STOPPED, GNUNET_assert, GNUNET_CLIENT_connect(), GNUNET_MESSAGE_TYPE_ARM_MONITOR, GNUNET_MESSAGE_TYPE_ARM_STATUS, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_OK, GNUNET_SYSERR, h, handlers, GNUNET_ARM_Handle::mq, mq_error_handler(), and msg.
Referenced by GNUNET_ARM_monitor_start(), and reconnect_arm_monitor_task().
|
static |
Task scheduled to try to re-connect to arm.
cls | the struct GNUNET_ARM_MonitorHandle |
Definition at line 90 of file arm_monitor_api.c.
References GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_OK, h, LOG, reconnect_arm_monitor(), and GNUNET_ARM_Handle::reconnect_task.
Referenced by reconnect_arm_monitor_later().
|
static |
Close down any existing connection to the ARM service and try re-establishing it later.
h | our handle |
Definition at line 108 of file arm_monitor_api.c.
References GNUNET_assert, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_STD_BACKOFF, h, GNUNET_ARM_Handle::mq, reconnect_arm_monitor_task(), GNUNET_ARM_Handle::reconnect_task, and GNUNET_ARM_Handle::retry_backoff.
Referenced by mq_error_handler().
|
static |
Check notification messages received from ARM is well-formed.
cls | our struct GNUNET_ARM_MonitorHandle |
msg | the message received from the arm service |
Definition at line 131 of file arm_monitor_api.c.
References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, msg, name, and GNUNET_MessageHeader::size.
|
static |
Handler for notification messages received from ARM.
cls | our struct GNUNET_ARM_MonitorHandle |
res | the message received from the arm service |
Definition at line 154 of file arm_monitor_api.c.
References GNUNET_ERROR_TYPE_DEBUG, h, LOG, res, and status.
|
static |
Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue.
Not every message queue implementation supports an error handler.
cls | closure with the struct GNUNET_ARM_MonitorHandle * |
error | error code |
Definition at line 178 of file arm_monitor_api.c.
References h, and reconnect_arm_monitor_later().
Referenced by reconnect_arm_monitor().