montoring api for transport plugin session status More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_arm_service.h"
#include "gnunet_hello_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_transport_service.h"
#include "transport.h"
Go to the source code of this file.
Data Structures | |
struct | GNUNET_TRANSPORT_PluginMonitor |
Handle for a plugin session state monitor. More... | |
struct | GNUNET_TRANSPORT_PluginSession |
Abstract representation of a plugin's session. More... | |
struct | SearchContext |
Context information to be used while searching for operation contexts. More... | |
Functions | |
static void | do_plugin_connect (void *cls) |
Task run to re-establish the connection. More... | |
static int | free_entry (void *cls, uint32_t key, void *value) |
Free the session entry and notify the callback about its demise. More... | |
static void | reconnect_plugin_ctx (struct GNUNET_TRANSPORT_PluginMonitor *pm) |
Cut the existing connection and reconnect. More... | |
static uint32_t | wrap_id (uint64_t id) |
Convert 64-bit session ID to 32-bit index for hash map. More... | |
static int | locate_by_id (void *cls, uint32_t key, void *value) |
Locate a session entry. More... | |
static int | check_event (void *cls, const struct TransportPluginMonitorMessage *tpmm) |
Function called with responses from the service. More... | |
static void | handle_event (void *cls, const struct TransportPluginMonitorMessage *tpmm) |
Function called with responses from the service. More... | |
static void | handle_sync (void *cls, const struct GNUNET_MessageHeader *msg) |
Function called with sync responses from the service. 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_TRANSPORT_PluginMonitor * | GNUNET_TRANSPORT_monitor_plugins (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_TRANSPORT_SessionMonitorCallback cb, void *cb_cls) |
Install a plugin session state monitor callback. More... | |
void | GNUNET_TRANSPORT_monitor_plugins_cancel (struct GNUNET_TRANSPORT_PluginMonitor *pm) |
Cancel monitoring the plugin session state. More... | |
montoring api for transport plugin session status
Definition in file transport_api_monitor_plugins.c.
|
static |
Task run to re-establish the connection.
cls | our struct GNUNET_TRANSPORT_PluginMonitor * |
Definition at line 370 of file transport_api_monitor_plugins.c.
References GNUNET_TRANSPORT_PluginMonitor::cfg, env, GNUNET_CLIENT_connect(), GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_EVENT, GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_START, GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_SYNC, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg, GNUNET_MQ_send(), handlers, GNUNET_TRANSPORT_PluginMonitor::mq, mq_error_handler(), msg, pm, and GNUNET_TRANSPORT_PluginMonitor::reconnect_task.
Referenced by GNUNET_TRANSPORT_monitor_plugins(), and reconnect_plugin_ctx().
|
static |
Free the session entry and notify the callback about its demise.
cls | our struct GNUNET_TRANSPORT_PluginMonitor |
key | key of the session in the map |
value | the session to free |
Definition at line 114 of file transport_api_monitor_plugins.c.
References GNUNET_TRANSPORT_PluginMonitor::cb, GNUNET_TRANSPORT_PluginMonitor::cb_cls, GNUNET_TRANSPORT_PluginSession::client_ctx, GNUNET_break, GNUNET_CONTAINER_multihashmap32_remove(), GNUNET_free, GNUNET_OK, GNUNET_YES, key, pm, GNUNET_TRANSPORT_PluginMonitor::sessions, and value.
Referenced by GNUNET_TRANSPORT_monitor_plugins_cancel(), and reconnect_plugin_ctx().
|
static |
Cut the existing connection and reconnect.
pm | our context |
Definition at line 141 of file transport_api_monitor_plugins.c.
References GNUNET_TRANSPORT_PluginMonitor::backoff, do_plugin_connect(), free_entry(), GNUNET_CONTAINER_multihashmap32_iterate(), GNUNET_MQ_destroy(), GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_STD_BACKOFF, GNUNET_TRANSPORT_PluginMonitor::mq, pm, GNUNET_TRANSPORT_PluginMonitor::reconnect_task, and GNUNET_TRANSPORT_PluginMonitor::sessions.
Referenced by handle_event(), and mq_error_handler().
|
static |
Convert 64-bit session ID to 32-bit index for hash map.
id | 64-bit session ID |
Definition at line 162 of file transport_api_monitor_plugins.c.
Referenced by handle_event().
|
static |
Locate a session entry.
cls | our struct SearchContext |
key | key of the session in the map |
value | a session |
Definition at line 194 of file transport_api_monitor_plugins.c.
References GNUNET_OK, GNUNET_SYSERR, sc, GNUNET_TRANSPORT_PluginSession::session_id, and value.
Referenced by handle_event().
|
static |
Function called with responses from the service.
cls | our struct GNUNET_TRANSPORT_PluginMonitor * |
tpmm | message with event data |
Definition at line 218 of file transport_api_monitor_plugins.c.
References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, TransportPluginMonitorMessage::header, TransportPluginMonitorMessage::plugin_address_len, TransportPluginMonitorMessage::plugin_name_len, and GNUNET_MessageHeader::size.
|
static |
Function called with responses from the service.
cls | our struct GNUNET_TRANSPORT_PluginMonitor * |
tpmm | message with event data |
Definition at line 249 of file transport_api_monitor_plugins.c.
References GNUNET_HELLO_Address::address, GNUNET_HELLO_Address::address_length, TransportPluginMonitorMessage::bytes_pending, GNUNET_TRANSPORT_PluginMonitor::cb, GNUNET_TRANSPORT_PluginMonitor::cb_cls, GNUNET_TRANSPORT_PluginSession::client_ctx, TransportPluginMonitorMessage::delay, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_multihashmap32_get_multiple(), GNUNET_CONTAINER_multihashmap32_put(), GNUNET_CONTAINER_multihashmap32_remove(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_free, GNUNET_HELLO_ADDRESS_INFO_NONE, GNUNET_new, GNUNET_TIME_absolute_ntoh(), GNUNET_TRANSPORT_SS_DONE, GNUNET_TRANSPORT_SS_INIT, GNUNET_YES, info, TransportPluginMonitorMessage::is_inbound, GNUNET_HELLO_Address::local_info, locate_by_id(), TransportPluginMonitorMessage::msgs_pending, GNUNET_HELLO_Address::peer, TransportPluginMonitorMessage::peer, TransportPluginMonitorMessage::plugin_address_len, TransportPluginMonitorMessage::plugin_name_len, pm, SearchContext::ps, reconnect_plugin_ctx(), TransportPluginMonitorMessage::session_id, GNUNET_TRANSPORT_PluginSession::session_id, SearchContext::session_id, TransportPluginMonitorMessage::session_state, GNUNET_TRANSPORT_PluginMonitor::sessions, TransportPluginMonitorMessage::timeout, GNUNET_HELLO_Address::transport_name, and wrap_id().
|
static |
Function called with sync responses from the service.
cls | our struct GNUNET_TRANSPORT_PluginMonitor * |
msg | message from the service |
Definition at line 332 of file transport_api_monitor_plugins.c.
References GNUNET_TRANSPORT_PluginMonitor::cb, GNUNET_TRANSPORT_PluginMonitor::cb_cls, and pm.
|
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_NSE_Handle * |
error | error code |
Definition at line 355 of file transport_api_monitor_plugins.c.
References pm, and reconnect_plugin_ctx().
Referenced by do_plugin_connect().