84 address = (
const char *) &atsm[1];
85 if ((addr_len >
size) ||
86 (
address[addr_len - 1] !=
'\0'))
117 "Address resolution failed\n");
132 address = (
const char *) &atsm[1];
156 "Disconnected from transport, address resolution failed\n");
201 alen =
address->address_length;
202 slen = strlen (
address->transport_name) + 1;
226 "Client tries to resolve for peer `%s' address plugin %s len %u\n",
229 (
unsigned int)
address->address_length);
233 msg->numeric_only = htons ((int16_t)
numeric);
234 msg->addrlen = htons ((uint16_t) alen);
236 addrbuf = (
char *) &
msg[1];
struct GNUNET_MessageHeader * msg
struct GNUNET_MQ_Envelope * env
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
static struct GNUNET_TIME_Relative timeout
Desired timeout for the lookup (default is no timeout).
static struct GNUNET_CADET_MessageHandler handlers[]
Handlers, for diverse services.
static char * address
GNS address for this phone.
static int result
Global testing status.
static int numeric
Option -n.
Helper library for handling HELLOs.
Constants for network protocols.
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message,...
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.
#define GNUNET_log(kind,...)
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_DEBUG
#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_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
#define GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY
Response to the address lookup request.
#define GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING
Request to look addresses of peers in server.
struct GNUNET_TIME_RelativeNBO GNUNET_TIME_relative_hton(struct GNUNET_TIME_Relative a)
Convert relative time to network byte order.
void(* GNUNET_TRANSPORT_AddressToStringCallback)(void *cls, const char *address, int res)
Function to call with a textual representation of an address.
struct GNUNET_TRANSPORT_AddressToStringContext * GNUNET_TRANSPORT_address_to_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_HELLO_Address *address, int numeric, struct GNUNET_TIME_Relative timeout, GNUNET_TRANSPORT_AddressToStringCallback aluc, void *aluc_cls)
Convert a binary address into a human readable address.
void GNUNET_TRANSPORT_address_to_string_cancel(struct GNUNET_TRANSPORT_AddressToStringContext *alc)
Cancel request for address conversion.
static unsigned int size
Size of the "table".
Message from the library to the transport service asking for converting a transport address to a huma...
Message used to notify the transport API about an address to string conversion.
uint32_t addr_len
Length of the following string, zero if is GNUNET_SYSERR.
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY.
uint32_t res
GNUNET_OK if the conversion succeeded, GNUNET_SYSERR if it failed
An address for communicating with a peer.
Handle to a message queue.
Message handler for a specific message type.
Time for relative time used by GNUnet, in microseconds.
Context for the address lookup.
GNUNET_TRANSPORT_AddressToStringCallback cb
Function to call with the human-readable address.
struct GNUNET_MQ_Handle * mq
Connection to the service.
void * cb_cls
Closure for cb.
common internal definitions for transport service
static void handle_reply(void *cls, const struct AddressToStringResultMessage *atsm)
Function called with responses from the service.
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 int check_reply(void *cls, const struct AddressToStringResultMessage *atsm)
Function called with responses from the service.