return;
}
GNUNET_break (ntohs (msg->type) ==
- GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_REPLY);
+ GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY);
size = ntohs (msg->size);
if (size == sizeof (struct GNUNET_MessageHeader))
{
*
* @param cfg configuration to use
* @param address address to convert (binary format)
- * @param addressLen number of bytes in address
* @param numeric should (IP) addresses be displayed in numeric form
* (otherwise do reverse DNS lookup)
- * @param nameTrans name of the transport to which the address belongs
* @param timeout how long is the lookup allowed to take at most
* @param aluc function to call with the results
* @param aluc_cls closure for aluc
* @return handle to cancel the operation, NULL on error
*/
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)
+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)
{
size_t len;
size_t alen;
+ size_t slen;
struct AddressLookupMessage *msg;
struct GNUNET_TRANSPORT_AddressToStringContext *alc;
struct GNUNET_CLIENT_Connection *client;
char *addrbuf;
- alen = GNUNET_HELLO_address_get_size (address);
- len = sizeof (struct AddressLookupMessage) + alen;
+ GNUNET_assert (address != NULL);
+ alen = address->address_length;
+ slen = strlen (address->transport_name) + 1;
+ len = sizeof (struct AddressLookupMessage) + alen + slen;
if (len >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
{
GNUNET_break (0);
return NULL;
}
+
client = GNUNET_CLIENT_connect ("transport", cfg);
if (client == NULL)
return NULL;
msg = GNUNET_malloc (len);
msg->header.size = htons (len);
- msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_LOOKUP);
- msg->numeric_only = htonl (numeric);
+ msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING);
+ msg->numeric_only = htons ((int16_t) numeric);
+ msg->addrlen = htons ((uint16_t) alen);
msg->timeout = GNUNET_TIME_relative_hton (timeout);
- msg->addrlen = htonl (alen);
addrbuf = (char *) &msg[1];
- memcpy (addrbuf, address, alen);
+ memcpy (addrbuf, address->address, alen);
+ memcpy (&addrbuf[alen], address->transport_name, slen);
+
alc = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_AddressToStringContext));
alc->cb = aluc;
alc->cb_cls = aluc_cls;
*/
void
GNUNET_TRANSPORT_address_to_string_cancel (struct
- GNUNET_TRANSPORT_AddressToStringContext
- *alc)
+ GNUNET_TRANSPORT_AddressToStringContext
+ *alc)
{
GNUNET_CLIENT_disconnect (alc->client, GNUNET_NO);
GNUNET_free (alc);
-/* end of transport_api_address_lookup.c */
+/* end of transport_api_address_to_string.c */