116 "Unhandled state `%s'\n",
137 return "S_NOT_CONNECTED";
146 return "S_SYN_RECV_ATS";
149 return "S_SYN_RECV_ACK";
152 return "S_CONNECTED";
155 return "S_RECONNECT_ATS";
158 return "S_RECONNECT_SENT";
161 return "S_SWITCH_SYN_SENT";
164 return "S_DISCONNECT";
167 return "S_DISCONNECT_FINISHED";
249 size_t alen = ntohl (pir_msg->
addrlen);
250 size_t tlen = ntohl (pir_msg->
pluginlen);
252 const char *transport_name;
254 if (
size != tlen + alen)
259 if ((0 == tlen) && (0 == alen))
266 addr = (
const char *) &pir_msg[1];
267 transport_name = &addr[alen];
268 if (transport_name[tlen - 1] !=
'\0')
289 size_t alen = ntohl (pir_msg->
addrlen);
290 size_t tlen = ntohl (pir_msg->
pluginlen);
301 ntohl (pir_msg->
state),
305 addr = (
const char *) &pir_msg[1];
317 ntohl (pir_msg->
state),
381 if (NULL == pal_ctx->
mq)
398 void *peer_callback_cls)
403 pal_ctx->
cb = peer_callback;
404 pal_ctx->
cb_cls = peer_callback_cls;
410 if (NULL == pal_ctx->
mq)
434 if (NULL !=
pic->reconnect_task)
437 pic->reconnect_task = NULL;
struct GNUNET_MessageHeader * msg
struct GNUNET_MQ_Envelope * env
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
static struct GNUNET_CADET_MessageHandler handlers[]
Handlers, for diverse services.
static char * address
GNS address for this phone.
static struct MHD_Response * response
Our canonical response.
static struct GNUNET_PEERINFO_IteratorContext * pic
Current iterator context (if active, otherwise NULL).
enum State state
current state of profiling
Helper library for handling HELLOs.
Constants for network protocols.
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.
struct GNUNET_HELLO_Address * GNUNET_HELLO_address_allocate(const struct GNUNET_PeerIdentity *peer, const char *transport_name, const void *address, size_t address_length, enum GNUNET_HELLO_AddressInfo local_info)
Allocate an address struct.
#define GNUNET_HELLO_address_free(addr)
Free an address.
#define GNUNET_log(kind,...)
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_ERROR
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_MQ_Error
Error codes for the queue.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
#define GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_REQUEST
Request to monitor addresses used by a peer or all peers.
#define GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_RESPONSE
Response to GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_REQUEST request to iterate over all known addr...
#define GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_RESPONSE_END
Response to GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_RESPONSE_END terminating list of replies.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
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.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_ntoh(struct GNUNET_TIME_AbsoluteNBO a)
Convert absolute time from network byte order.
#define GNUNET_TIME_UNIT_ZERO_ABS
Absolute time zero.
#define GNUNET_TIME_STD_BACKOFF(r)
Perform our standard exponential back-off calculation, starting at 1 ms and then going by a factor of...
const char * GNUNET_TRANSPORT_ps2s(enum GNUNET_TRANSPORT_PeerState state)
Convert peer state to human-readable string.
void GNUNET_TRANSPORT_monitor_peers_cancel(struct GNUNET_TRANSPORT_PeerMonitoringContext *pic)
Cancel request to monitor peers.
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...
GNUNET_TRANSPORT_PeerState
Possible state of a neighbour.
void(* GNUNET_TRANSPORT_PeerIterateCallback)(void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Address *address, enum GNUNET_TRANSPORT_PeerState state, struct GNUNET_TIME_Absolute state_timeout)
Function to call with information about a peer.
int GNUNET_TRANSPORT_is_connected(enum GNUNET_TRANSPORT_PeerState state)
Check if a state is defined as connected.
@ GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED
We're finished with the disconnect; and are cleaning up the state now! We put the struct into this st...
@ GNUNET_TRANSPORT_PS_NOT_CONNECTED
Fresh peer or completely disconnected.
@ GNUNET_TRANSPORT_PS_INIT_ATS
Asked to initiate connection, trying to get address from ATS.
@ GNUNET_TRANSPORT_PS_SYN_RECV_ATS
Received a SYN, asking ATS about address suggestions.
@ GNUNET_TRANSPORT_PS_SYN_RECV_ACK
SYN request from other peer was SYN_ACK'ed, waiting for ACK.
@ GNUNET_TRANSPORT_PS_RECONNECT_SENT
Sent SYN over new address (either by ATS telling us to switch addresses or from RECONNECT_ATS); if th...
@ GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT
We have some primary connection, but ATS suggested we switch to some alternative; we now sent a SYN m...
@ GNUNET_TRANSPORT_PS_CONNECTED
Got our SYN_ACK/ACK, connection is up.
@ GNUNET_TRANSPORT_PS_SYN_SENT
Sent SYN message to other peer, waiting for SYN_ACK.
@ GNUNET_TRANSPORT_PS_RECONNECT_ATS
Connection got into trouble, rest of the system still believes it to be up, but we're getting a new a...
@ GNUNET_TRANSPORT_PS_DISCONNECT
Disconnect in progress (we're sending the DISCONNECT message to the other peer; after that is finishe...
static unsigned int size
Size of the "table".
An address for communicating with a peer.
const char * transport_name
Name of the transport plugin enabling the communication using this address.
Handle to a message queue.
Message handler for a specific message type.
The identity of the host (wraps the signing key of the peer).
Entry in list of pending tasks.
Time for relative time used by GNUnet, in microseconds.
Context for iterating validation entries.
struct GNUNET_SCHEDULER_Task * reconnect_task
Task ID for reconnect.
struct GNUNET_TIME_Relative backoff
Backoff for reconnect.
int one_shot
Was this a one-shot request?
struct GNUNET_MQ_Handle * mq
Connection to the service.
void * cb_cls
Closure for cb.
GNUNET_TRANSPORT_PeerIterateCallback cb
Function to call with the binary address.
struct GNUNET_PeerIdentity peer
Identity of the peer to monitor.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we use.
Message from the transport service to the library containing information about a peer.
uint32_t pluginlen
Length of the plugin name.
struct GNUNET_TIME_AbsoluteNBO state_timeout
Timeout for the state this peer is in.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_RESPONSE.
struct GNUNET_PeerIdentity peer
Peer identity.
uint32_t local_address_info
Local info about the address.
uint32_t state
State this peer is in as an enum GNUNET_TRANSPORT_PeerState
uint32_t addrlen
Address length.
Message from the library to the transport service asking for binary addresses known for a peer.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
common internal definitions for transport service
static int check_response(void *cls, const struct PeerIterateResponseMessage *pir_msg)
Function called to check responses from the service.
static void do_peer_connect(void *cls)
Task run to re-establish the connection.
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 void handle_response(void *cls, const struct PeerIterateResponseMessage *pir_msg)
Function called with responses from the service.
static void handle_response_end(void *cls, const struct GNUNET_MessageHeader *msg)
Function called with responses from the service.
static void reconnect_peer_ctx(struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx)
Cut the existing connection and reconnect.