/**
* Has this request been transmitted to the service?
- * GNUNET_YES if transmitted
- * GNUNET_YES if not transmitted
- * GNUNET_SYSERR when request was canceled
+ * #GNUNET_YES if transmitted
+ * #GNUNET_YES if not transmitted
+ * #GNUNET_SYSERR when request was canceled
*/
int was_transmitted;
int direction;
/**
- * GNUNET_YES if a response was received
+ * #GNUNET_YES if a response was received
*/
int received_response;
GNUNET_assert (NULL == req_tail);
if (NULL != client)
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from DNS service\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Disconnecting from DNS service\n");
GNUNET_CLIENT_disconnect (client);
client = NULL;
}
if (NULL ==
inet_ntop (AF_INET, ip, buf, sizeof (buf)))
{
- LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "inet_ntop");
+ LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING,
+ "inet_ntop");
return NULL;
}
break;
if (NULL ==
inet_ntop (AF_INET6, ip, buf, sizeof (buf)))
{
- LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "inet_ntop");
+ LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING,
+ "inet_ntop");
return NULL;
}
break;
/**
* Process response with a hostname for a DNS lookup.
*
- * @param cls our "struct GNUNET_RESOLVER_RequestHandle" context
+ * @param cls our `struct GNUNET_RESOLVER_RequestHandle` context
* @param msg message with the hostname, NULL on error
*/
static void
-handle_response (void *cls, const struct GNUNET_MessageHeader *msg)
+handle_response (void *cls,
+ const struct GNUNET_MessageHeader *msg)
{
struct GNUNET_RESOLVER_RequestHandle *rh = cls;
uint16_t size;
+ char *nret;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"Receiving response from DNS service\n");
if (NULL == msg)
{
/* no reverse lookup was successful, return ip as string */
if (rh->received_response == GNUNET_NO)
{
- rh->name_callback (rh->cls, no_resolve (rh->af, &rh[1], rh->data_len));
+ nret = no_resolve (rh->af, &rh[1], rh->data_len);
+ rh->name_callback (rh->cls, nret);
+ GNUNET_free (nret);
rh->name_callback (rh->cls, NULL);
}
/* at least one reverse lookup was successful */
if (size == sizeof (struct GNUNET_MessageHeader))
{
/* check if request was canceled */
- if (rh->was_transmitted != GNUNET_SYSERR)
+ if (GNUNET_SYSERR != rh->was_transmitted)
{
if (NULL != rh->name_callback)
rh->name_callback (rh->cls, NULL);
reconnect ();
return;
}
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Resolver returns `%s' for IP `%s'.\n",
- hostname, GNUNET_a2s ((const void *) &rh[1], rh->data_len));
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Resolver returns `%s' for IP `%s'.\n",
+ hostname,
+ GNUNET_a2s ((const void *) &rh[1],
+ rh->data_len));
if (rh->was_transmitted != GNUNET_SYSERR)
rh->name_callback (rh->cls, hostname);
rh->received_response = GNUNET_YES;
* given a valid numeric string. Perform the callbacks for the
* numeric addresses.
*
- * @param cls struct GNUNET_RESOLVER_RequestHandle for the request
+ * @param cls `struct GNUNET_RESOLVER_RequestHandle` for the request
* @param tc unused scheduler context
*/
static void
-numeric_resolution (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+numeric_resolution (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct GNUNET_RESOLVER_RequestHandle *rh = cls;
struct sockaddr_in v4;
* given a variant of "loopback". Perform the callbacks for the
* respective loopback numeric addresses.
*
- * @param cls struct GNUNET_RESOLVER_RequestHandle for the request
+ * @param cls `struct GNUNET_RESOLVER_RequestHandle` for the request
* @param tc unused scheduler context
*/
static void
-loopback_resolution (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+loopback_resolution (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct GNUNET_RESOLVER_RequestHandle *rh = cls;
struct sockaddr_in v4;
* @param tc scheduler context
*/
static void
-reconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect_task (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
r_task = GNUNET_SCHEDULER_NO_TASK;
if (NULL == req_head)
* @param hostname the hostname to resolve
* @param af AF_INET or AF_INET6; use AF_UNSPEC for "any"
* @param callback function to call with addresses
- * @param callback_cls closure for callback
+ * @param callback_cls closure for @a callback
* @param timeout how long to try resolving
* @return handle that can be used to cancel the request, NULL on error
*/
* We've been asked to convert an address to a string without
* a reverse lookup. Do it.
*
- * @param cls struct GNUNET_RESOLVER_RequestHandle for the request
+ * @param cls `struct GNUNET_RESOLVER_RequestHandle` for the request
* @param tc unused scheduler context
*/
static void
-numeric_reverse (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+numeric_reverse (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct GNUNET_RESOLVER_RequestHandle *rh = cls;
char *result;
result = no_resolve (rh->af, &rh[1], rh->data_len);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Resolver returns `%s'.\n", result);
- if (result != NULL)
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Resolver returns `%s'.\n",
+ result);
+ if (NULL != result)
{
rh->name_callback (rh->cls, result);
GNUNET_free (result);
* Get an IP address as a string.
*
* @param sa host address
- * @param salen length of host address
- * @param do_resolve use GNUNET_NO to return numeric hostname
+ * @param salen length of host address in @a sa
+ * @param do_resolve use #GNUNET_NO to return numeric hostname
* @param timeout how long to try resolving
* @param callback function to call with hostnames
* last callback is NULL when finished
- * @param cls closure for callback
+ * @param cls closure for @a callback
* @return handle that can be used to cancel the request
*/
struct GNUNET_RESOLVER_RequestHandle *
-GNUNET_RESOLVER_hostname_get (const struct sockaddr *sa, socklen_t salen,
+GNUNET_RESOLVER_hostname_get (const struct sockaddr *sa,
+ socklen_t salen,
int do_resolve,
struct GNUNET_TIME_Relative timeout,
GNUNET_RESOLVER_HostnameCallback callback,
*
* @param af AF_INET or AF_INET6; use AF_UNSPEC for "any"
* @param callback function to call with addresses
- * @param cls closure for callback
+ * @param cls closure for @a callback
* @param timeout how long to try resolving
* @return handle that can be used to cancel the request, NULL on error
*/
return NULL;
}
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Resolving our hostname `%s'\n",
+ "Resolving our hostname `%s'\n",
hostname);
return GNUNET_RESOLVER_ip_get (hostname, af, timeout, callback, cls);
}