montoring api for transport peer 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_PeerMonitoringContext |
Context for iterating validation entries. More... | |
Functions | |
int | GNUNET_TRANSPORT_is_connected (enum GNUNET_TRANSPORT_PeerState state) |
Check if a state is defined as connected. More... | |
const char * | GNUNET_TRANSPORT_ps2s (enum GNUNET_TRANSPORT_PeerState state) |
Convert peer state to human-readable string. More... | |
static void | do_peer_connect (void *cls) |
Task run to re-establish the connection. More... | |
static void | reconnect_peer_ctx (struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx) |
Cut the existing connection and reconnect. More... | |
static void | handle_response_end (void *cls, const struct GNUNET_MessageHeader *msg) |
Function called with responses from the service. More... | |
static int | check_response (void *cls, const struct PeerIterateResponseMessage *pir_msg) |
Function called to check responses from the service. More... | |
static void | handle_response (void *cls, const struct PeerIterateResponseMessage *pir_msg) |
Function called with 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_PeerMonitoringContext * | GNUNET_TRANSPORT_monitor_peers (const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_PeerIdentity *peer, int one_shot, GNUNET_TRANSPORT_PeerIterateCallback peer_callback, void *peer_callback_cls) |
Return information about a specific peer or all peers currently known to transport service once or in monitoring mode. More... | |
void | GNUNET_TRANSPORT_monitor_peers_cancel (struct GNUNET_TRANSPORT_PeerMonitoringContext *pic) |
Cancel request to monitor peers. More... | |
montoring api for transport peer status
This api provides the ability to query the transport service about the connection status of a specific or all peers.
Calls back with information about peer(s) including address used, state and state timeout for peer requests.
Definition in file transport_api_monitor_peers.c.
|
static |
Task run to re-establish the connection.
cls | our struct GNUNET_TRANSPORT_PeerMonitoringContext * |
Definition at line 358 of file transport_api_monitor_peers.c.
References GNUNET_TRANSPORT_PeerMonitoringContext::cfg, env, GNUNET_CLIENT_connect(), GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_REQUEST, GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_RESPONSE, GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_RESPONSE_END, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg, GNUNET_MQ_send(), handlers, GNUNET_TRANSPORT_PeerMonitoringContext::mq, mq_error_handler(), msg, GNUNET_TRANSPORT_PeerMonitoringContext::one_shot, GNUNET_TRANSPORT_PeerMonitoringContext::peer, GNUNET_TRANSPORT_PeerMonitoringContext::reconnect_task, and response.
Referenced by GNUNET_TRANSPORT_monitor_peers(), and reconnect_peer_ctx().
|
static |
Cut the existing connection and reconnect.
pal_ctx | our context |
Definition at line 191 of file transport_api_monitor_peers.c.
References GNUNET_TRANSPORT_PeerMonitoringContext::backoff, GNUNET_TRANSPORT_PeerMonitoringContext::cb, GNUNET_TRANSPORT_PeerMonitoringContext::cb_cls, do_peer_connect(), GNUNET_assert, GNUNET_MQ_destroy(), GNUNET_NO, GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_STD_BACKOFF, GNUNET_TIME_UNIT_ZERO_ABS, GNUNET_TRANSPORT_PS_NOT_CONNECTED, GNUNET_TRANSPORT_PeerMonitoringContext::mq, GNUNET_TRANSPORT_PeerMonitoringContext::one_shot, and GNUNET_TRANSPORT_PeerMonitoringContext::reconnect_task.
Referenced by handle_response_end(), and mq_error_handler().
|
static |
Function called with responses from the service.
cls | our struct GNUNET_TRANSPORT_PeerMonitoringContext * |
msg | message from service |
Definition at line 215 of file transport_api_monitor_peers.c.
References GNUNET_TRANSPORT_PeerMonitoringContext::cb, GNUNET_TRANSPORT_PeerMonitoringContext::cb_cls, GNUNET_break, GNUNET_TIME_UNIT_ZERO_ABS, GNUNET_TRANSPORT_monitor_peers_cancel(), GNUNET_TRANSPORT_PS_NOT_CONNECTED, GNUNET_TRANSPORT_PeerMonitoringContext::one_shot, and reconnect_peer_ctx().
|
static |
Function called to check responses from the service.
cls | our struct GNUNET_TRANSPORT_PeerMonitoringContext * |
pir_msg | message with the human-readable address |
Definition at line 245 of file transport_api_monitor_peers.c.
References PeerIterateResponseMessage::addrlen, GNUNET_break, GNUNET_OK, GNUNET_SYSERR, PeerIterateResponseMessage::header, PeerIterateResponseMessage::pluginlen, GNUNET_MessageHeader::size, and size.
|
static |
Function called with responses from the service.
cls | our struct GNUNET_TRANSPORT_PeerMonitoringContext * |
msg | message with the human-readable address |
Definition at line 284 of file transport_api_monitor_peers.c.
References address, PeerIterateResponseMessage::addrlen, GNUNET_TRANSPORT_PeerMonitoringContext::cb, GNUNET_TRANSPORT_PeerMonitoringContext::cb_cls, GNUNET_HELLO_address_allocate(), GNUNET_HELLO_address_free, GNUNET_TIME_absolute_ntoh(), PeerIterateResponseMessage::local_address_info, PeerIterateResponseMessage::peer, PeerIterateResponseMessage::pluginlen, PeerIterateResponseMessage::state, PeerIterateResponseMessage::state_timeout, and GNUNET_HELLO_Address::transport_name.
|
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_TRANSPORT_PeerMonitoringContext * |
error | error code |
Definition at line 332 of file transport_api_monitor_peers.c.
References GNUNET_TRANSPORT_PeerMonitoringContext::cb, GNUNET_TRANSPORT_PeerMonitoringContext::cb_cls, GNUNET_TIME_UNIT_ZERO_ABS, GNUNET_TRANSPORT_monitor_peers_cancel(), GNUNET_TRANSPORT_PS_NOT_CONNECTED, GNUNET_TRANSPORT_PeerMonitoringContext::one_shot, and reconnect_peer_ctx().
Referenced by do_peer_connect().