164 return ((uint32_t)
id) ^ ((uint32_t) (
id >> 32));
225 pname = (
const char *) &tpmm[1];
233 (
'\0' != pname[pname_len - 1])))
263 pname = (
const char *) &tpmm[1];
266 paddr = &pname[pname_len];
303 addr.
address = (0 == paddr_len) ? NULL : paddr;
uint64_t session_id
Unique session identifier.
size_t address_length
Number of bytes in address.
Session is being torn down and about to disappear.
enum GNUNET_HELLO_AddressInfo local_info
Extended information about address.
uint32_t num_bytes_pending
Number of bytes pending transmission for this session.
struct GNUNET_MessageHeader * msg
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_ntoh(struct GNUNET_TIME_AbsoluteNBO a)
Convert absolute time from network byte order.
static int free_entry(void *cls, uint32_t key, void *value)
Free the session entry and notify the callback about its demise.
const struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
const void * address
Binary representation of the address (plugin-specific).
#define GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_EVENT
Monitoring event about the connection state of plugins, generated in response to a subscription initi...
struct GNUNET_SCHEDULER_Task * reconnect_task
Task ID for reconnect.
common internal definitions for transport service
struct GNUNET_MQ_Handle * GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls)
Create a message queue to connect to a GNUnet service.
static void handle_event(void *cls, const struct TransportPluginMonitorMessage *tpmm)
Function called with responses from the service.
GNUNET_MQ_Error
Error codes for the queue.
int16_t is_inbound
GNUNET_YES if this is an inbound connection, GNUNET_NO if this is an outbound connection, GNUNET_SYSERR if connections of this plugin are so fundamentally bidirectional that they have no 'initiator' Value given in NBO.
int GNUNET_CONTAINER_multihashmap32_iterate(struct GNUNET_CONTAINER_MultiHashMap32 *map, GNUNET_CONTAINER_MulitHashMapIterator32Callback it, void *it_cls)
Iterate over all entries in the map.
int is_inbound
GNUNET_YES if this is an inbound connection, GNUNET_NO if this is an outbound connection, GNUNET_SYSERR if connections of this plugin are so fundamentally bidirectional that they have no 'initiator'
struct GNUNET_PeerIdentity peer
Which peer is this connection for?
enum GNUNET_TRANSPORT_SessionState state
New state of the session.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_MQ_Handle * mq
Connection to the service.
Abstract representation of a plugin's session.
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Handle for a plugin session state monitor.
GNUNET_TRANSPORT_SessionMonitorCallback cb
Callback to call.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
int GNUNET_CONTAINER_multihashmap32_get_multiple(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, GNUNET_CONTAINER_MulitHashMapIterator32Callback it, void *it_cls)
Iterate over all entries in the map that match a particular key.
const struct GNUNET_HELLO_Address * address
Address used by the session.
int GNUNET_CONTAINER_multihashmap32_put(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
uint32_t num_msg_pending
Number of messages pending transmission for this session.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_TIME_Absolute receive_delay
Until when does this plugin refuse to receive to manage staying within the inbound quota...
static int locate_by_id(void *cls, uint32_t key, void *value)
Locate a session entry.
Information about a plugin's session.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
int GNUNET_CONTAINER_multihashmap32_remove(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, const void *value)
Remove the given key-value pair from the map.
static char * value
Value of the record to add/remove.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
uint16_t plugin_name_len
Length of the plugin name in bytes, including 0-termination.
uint16_t plugin_address_len
Length of the plugin address in bytes.
const char * transport_name
Name of the transport plugin enabling the communication using this address.
struct GNUNET_TRANSPORT_PluginSession * ps
Result.
uint32_t msgs_pending
Number of messages waiting transmission.
struct GNUNET_TIME_Absolute session_timeout
At what time will this session timeout (unless activity happens)?
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.
Internal representation of the hash map.
#define GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_START
Request to start monitoring the connection state of plugins.
Message handler for a specific message type.
struct GNUNET_CONTAINER_MultiHashMap32 * GNUNET_CONTAINER_multihashmap32_create(unsigned int len)
Create a 32-bit key multi hash map.
struct GNUNET_TIME_AbsoluteNBO timeout
When will this transport plugin session time out?
void GNUNET_CONTAINER_multihashmap32_destroy(struct GNUNET_CONTAINER_MultiHashMap32 *map)
Destroy a 32-bit key hash map.
#define GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_SYNC
Monitoring event notifying client that the initial iteration is now completed and we are in sync with...
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 c...
static uint32_t wrap_id(uint64_t id)
Convert 64-bit session ID to 32-bit index for hash map.
struct GNUNET_HashCode key
The key used in the DHT.
struct GNUNET_TIME_Relative backoff
Backoff for reconnect.
Transport-level connection status update.
struct GNUNET_MQ_Envelope * env
static struct GNUNET_FS_SearchContext * sc
uint32_t bytes_pending
Number of bytes waiting for transmission.
#define GNUNET_TIME_STD_BACKOFF(r)
Perform our standard exponential back-off calculation, starting at 1 ms and then going by a factor of...
struct GNUNET_PeerIdentity peer
For which peer is this an address?
void * cb_cls
Closure for cb.
Allow multiple values with the same key.
Handle to a message queue.
void(* GNUNET_TRANSPORT_SessionMonitorCallback)(void *cls, struct GNUNET_TRANSPORT_PluginSession *session, void **session_ctx, const struct GNUNET_TRANSPORT_SessionInfo *info)
Function called by the plugin with information about the current sessions managed by the plugin (for ...
uint64_t session_id
Unique identifier for the session.
No additional information.
Context information to be used while searching for operation contexts.
uint16_t session_state
An enum GNUNET_TRANSPORT_SessionState in NBO.
struct GNUNET_TIME_AbsoluteNBO delay
Until how long is this plugin currently blocked from reading?
void * client_ctx
Location for the client to store "data".
An address for communicating with a peer.
uint64_t session_id
ID to locate.
static int check_event(void *cls, const struct TransportPluginMonitorMessage *tpmm)
Function called with responses from the service.
The session was created (first call for each session object).
Entry in list of pending tasks.
void GNUNET_TRANSPORT_monitor_plugins_cancel(struct GNUNET_TRANSPORT_PluginMonitor *pm)
Cancel monitoring the plugin session state.
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
static void do_plugin_connect(void *cls)
Task run to re-establish the connection.
GNUNET_TRANSPORT_SessionState
Possible states of a session in a plugin.
static void handle_sync(void *cls, const struct GNUNET_MessageHeader *msg)
Function called with sync responses from the service.
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_free(ptr)
Wrapper around free.
Time for relative time used by GNUnet, in microseconds.
static struct GNUNET_TRANSPORT_PluginMonitor * pm
Handle if we are monitoring plugin session activity.
struct GNUNET_CONTAINER_MultiHashMap32 * sessions
Map of session_ids (reduced to 32-bits) to struct GNUNET_TRANSPORT_PluginSession objects.
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_EVENT.
static void reconnect_plugin_ctx(struct GNUNET_TRANSPORT_PluginMonitor *pm)
Cut the existing connection and reconnect.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.