2 This file is part of GNUnet.
3 (C) 2009, 2011 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file util/resolver_api.c
23 * @brief resolver for writing a tool
24 * @author Christian Grothoff
27 #include "gnunet_getopt_lib.h"
28 #include "gnunet_os_lib.h"
29 #include "gnunet_client_lib.h"
30 #include "gnunet_container_lib.h"
31 #include "gnunet_protocols.h"
32 #include "gnunet_resolver_service.h"
33 #include "gnunet_server_lib.h"
37 * Maximum supported length for a hostname
39 #define MAX_HOSTNAME 1024
43 * Possible hostnames for "loopback".
45 static const char *loopback[] = {
55 static const struct GNUNET_CONFIGURATION_Handle *cfg;
58 * Our connection to the resolver service, created on-demand, but then
59 * persists until error or shutdown.
61 static struct GNUNET_CLIENT_Connection *client;
64 * Head of DLL of requests.
66 static struct GNUNET_RESOLVER_RequestHandle *req_head;
69 * Tail of DLL of requests.
71 static struct GNUNET_RESOLVER_RequestHandle *req_tail;
74 * How long should we wait to reconnect?
76 static struct GNUNET_TIME_Relative backoff;
79 * Task for reconnecting.
81 static GNUNET_SCHEDULER_TaskIdentifier r_task;
84 * Task ID of shutdown task; only present while we have a
85 * connection to the resolver service.
87 static GNUNET_SCHEDULER_TaskIdentifier s_task;
91 * Handle to a request given to the resolver. Can be used to cancel
92 * the request prior to the timeout or successful execution. Also
93 * used to track our internal state for the request.
95 struct GNUNET_RESOLVER_RequestHandle
99 * Next entry in DLL of requests.
101 struct GNUNET_RESOLVER_RequestHandle *next;
104 * Previous entry in DLL of requests.
106 struct GNUNET_RESOLVER_RequestHandle *prev;
109 * Callback if this is an name resolution request,
112 GNUNET_RESOLVER_AddressCallback addr_callback;
115 * Callback if this is a reverse lookup request,
118 GNUNET_RESOLVER_HostnameCallback name_callback;
121 * Closure for the respective "callback".
126 * When should this request time out?
128 struct GNUNET_TIME_Absolute timeout;
131 * Task handle for numeric lookups.
133 GNUNET_SCHEDULER_TaskIdentifier task;
136 * Desired address family.
141 * Has this request been transmitted to the service?
146 * Did we add this request to the queue?
151 * Desired direction (IP to name or name to IP)
156 * Length of the data that follows this struct.
163 * Check that the resolver service runs on localhost
167 check_config (const struct GNUNET_CONFIGURATION_Handle *cfg)
171 struct sockaddr_in v4;
172 struct sockaddr_in6 v6;
174 memset (&v4, 0, sizeof (v4));
175 v4.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
176 v4.sin_family = AF_INET;
177 #if HAVE_SOCKADDR_IN_SIN_LEN
178 v4.sin_len = sizeof (v4);
180 memset (&v6, 0, sizeof (v6));
181 v6.sin6_family = AF_INET6;
182 #if HAVE_SOCKADDR_IN_SIN_LEN
183 v6.sin6_len = sizeof (v6);
186 GNUNET_CONFIGURATION_get_value_string (cfg,
188 "HOSTNAME", &hostname))
190 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
191 _("Must specify `%s' for `%s' in configuration!\n"),
192 "HOSTNAME", "resolver");
195 if ((1 != inet_pton (AF_INET,
197 &v4)) || (1 != inet_pton (AF_INET6, hostname, &v6)))
199 GNUNET_free (hostname);
203 while (loopback[i] != NULL)
204 if (0 == strcasecmp (loopback[i++], hostname))
206 GNUNET_free (hostname);
209 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
211 ("Must specify `%s' or numeric IP address for `%s' of `%s' in configuration!\n"),
212 "localhost", "HOSTNAME", "resolver");
213 GNUNET_free (hostname);
219 * Create the connection to the resolver service.
221 * @param c configuration to use
224 GNUNET_RESOLVER_connect (const struct GNUNET_CONFIGURATION_Handle *c)
226 GNUNET_assert (NULL != c);
228 backoff = GNUNET_TIME_UNIT_MILLISECONDS;
234 * Destroy the connection to the resolver service.
237 GNUNET_RESOLVER_disconnect ()
239 GNUNET_assert (NULL == req_head);
240 GNUNET_assert (NULL == req_tail);
244 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
245 "Disconnecting from DNS service\n");
247 GNUNET_CLIENT_disconnect (client, GNUNET_NO);
250 if (r_task != GNUNET_SCHEDULER_NO_TASK)
252 GNUNET_SCHEDULER_cancel (r_task);
253 r_task = GNUNET_SCHEDULER_NO_TASK;
255 if (s_task != GNUNET_SCHEDULER_NO_TASK)
257 GNUNET_SCHEDULER_cancel (s_task);
258 s_task = GNUNET_SCHEDULER_NO_TASK;
264 * Convert IP address to string without DNS resolution.
266 * @param sa the address
267 * @param salen number of bytes in sa
268 * @return address as a string, NULL on error
271 no_resolve (const struct sockaddr *sa, socklen_t salen)
274 char inet4[INET_ADDRSTRLEN];
275 char inet6[INET6_ADDRSTRLEN];
277 if (salen < sizeof (struct sockaddr))
279 switch (sa->sa_family)
282 if (salen != sizeof (struct sockaddr_in))
286 &((struct sockaddr_in *) sa)->sin_addr,
287 inet4, INET_ADDRSTRLEN))
289 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "inet_ntop");
292 ret = GNUNET_strdup (inet4);
295 if (salen != sizeof (struct sockaddr_in6))
299 &((struct sockaddr_in6 *) sa)->sin6_addr,
300 inet6, INET6_ADDRSTRLEN))
302 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "inet_ntop");
305 ret = GNUNET_strdup (inet6);
316 * Adjust exponential back-off and reconnect to the service.
323 * Process pending requests to the resolver.
325 * @param h handle to the resolver
332 * Process response with a hostname for a DNS lookup.
334 * @param cls our "struct GNUNET_RESOLVER_RequestHandle" context
335 * @param msg message with the hostname, NULL on error
338 handle_response (void *cls,
339 const struct GNUNET_MessageHeader *msg)
341 struct GNUNET_RESOLVER_RequestHandle *rh = cls;
343 const char *hostname;
344 const struct sockaddr *sa;
348 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
349 "Receiving response from DNS service\n");
353 if (NULL != rh->name_callback)
354 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
355 _("Timeout trying to resolve IP address `%s'.\n"),
356 GNUNET_a2s ((const void*) &rh[1], rh->data_len));
358 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
359 _("Timeout trying to resolve hostname `%s'.\n"),
360 (const char *) &rh[1]);
361 if (rh->was_transmitted != GNUNET_SYSERR)
363 if (NULL != rh->name_callback)
364 rh->name_callback (rh->cls, NULL);
365 if (NULL != rh->addr_callback)
366 rh->addr_callback (rh->cls, NULL, 0);
368 GNUNET_CONTAINER_DLL_remove (req_head,
372 GNUNET_CLIENT_disconnect (client, GNUNET_NO);
377 if (GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE != ntohs (msg->type))
380 GNUNET_CLIENT_disconnect (client, GNUNET_NO);
385 size = ntohs (msg->size);
386 if (size == sizeof (struct GNUNET_MessageHeader))
388 if (rh->was_transmitted != GNUNET_SYSERR)
390 if (NULL != rh->name_callback)
391 rh->name_callback (rh->cls, NULL);
392 if (NULL != rh->addr_callback)
393 rh->addr_callback (rh->cls, NULL, 0);
395 GNUNET_CONTAINER_DLL_remove (req_head,
402 if (NULL != rh->name_callback)
404 hostname = (const char *) &msg[1];
405 if (hostname[size - sizeof (struct GNUNET_MessageHeader) - 1] != '\0')
408 if (rh->was_transmitted != GNUNET_SYSERR)
409 rh->name_callback (rh->cls, NULL);
410 GNUNET_CONTAINER_DLL_remove (req_head,
414 GNUNET_CLIENT_disconnect (client, GNUNET_NO);
420 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
421 _("Resolver returns `%s' for IP `%s'.\n"),
423 GNUNET_a2s ((const void*) &rh[1], rh->data_len));
425 if (rh->was_transmitted != GNUNET_SYSERR)
426 rh->name_callback (rh->cls, hostname);
427 GNUNET_CLIENT_receive (client,
430 GNUNET_TIME_absolute_get_remaining (rh->timeout));
432 if (NULL != rh->addr_callback)
434 sa = (const struct sockaddr *) &msg[1];
435 salen = size - sizeof (struct GNUNET_MessageHeader);
436 if (salen < sizeof (struct sockaddr))
439 if (rh->was_transmitted != GNUNET_SYSERR)
440 rh->addr_callback (rh->cls, NULL, 0);
441 GNUNET_CONTAINER_DLL_remove (req_head,
445 GNUNET_CLIENT_disconnect (client, GNUNET_NO);
452 char *ips = no_resolve (sa, salen);
453 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
454 "Resolver returns `%s' for `%s'.\n",
456 (const char*) &rh[1]);
460 rh->addr_callback (rh->cls, sa, salen);
461 GNUNET_CLIENT_receive (client,
464 GNUNET_TIME_absolute_get_remaining (rh->timeout));
470 * We've been asked to lookup the address for a hostname and were
471 * given a valid numeric string. Perform the callbacks for the
474 * @param cls struct GNUNET_RESOLVER_RequestHandle for the request
475 * @param tc unused scheduler context
478 numeric_resolution (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
480 struct GNUNET_RESOLVER_RequestHandle *rh = cls;
481 struct sockaddr_in v4;
482 struct sockaddr_in6 v6;
483 const char *hostname;
485 memset (&v4, 0, sizeof (v4));
486 v4.sin_family = AF_INET;
487 #if HAVE_SOCKADDR_IN_SIN_LEN
488 v4.sin_len = sizeof (v4);
490 memset (&v6, 0, sizeof (v6));
491 v6.sin6_family = AF_INET6;
492 #if HAVE_SOCKADDR_IN_SIN_LEN
493 v6.sin6_len = sizeof (v6);
495 hostname = (const char*) &rh[1];
496 if (((rh->domain == AF_UNSPEC) || (rh->domain == AF_INET)) &&
497 (1 == inet_pton (AF_INET, hostname, &v4.sin_addr)))
499 rh->addr_callback (rh->cls, (const struct sockaddr *) &v4, sizeof (v4));
500 if ((rh->domain == AF_UNSPEC) &&
501 (1 == inet_pton (AF_INET6, hostname, &v6.sin6_addr)))
503 /* this can happen on some systems IF "hostname" is "localhost" */
504 rh->addr_callback (rh->cls,
505 (const struct sockaddr *) &v6, sizeof (v6));
507 rh->addr_callback (rh->cls, NULL, 0);
511 if (((rh->domain == AF_UNSPEC) || (rh->domain == AF_INET6)) &&
512 (1 == inet_pton (AF_INET6, hostname, &v6.sin6_addr)))
514 rh->addr_callback (rh->cls, (const struct sockaddr *) &v6, sizeof (v6));
515 rh->addr_callback (rh->cls, NULL, 0);
519 /* why are we here? this task should not have been scheduled! */
526 * We've been asked to lookup the address for a hostname and were
527 * given a variant of "loopback". Perform the callbacks for the
528 * respective loopback numeric addresses.
530 * @param cls struct GNUNET_RESOLVER_RequestHandle for the request
531 * @param tc unused scheduler context
534 loopback_resolution (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
536 struct GNUNET_RESOLVER_RequestHandle *rh = cls;
537 struct sockaddr_in v4;
538 struct sockaddr_in6 v6;
540 memset (&v4, 0, sizeof (v4));
541 v4.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
542 v4.sin_family = AF_INET;
543 #if HAVE_SOCKADDR_IN_SIN_LEN
544 v4.sin_len = sizeof (v4);
546 memset (&v6, 0, sizeof (v6));
547 v6.sin6_family = AF_INET6;
548 #if HAVE_SOCKADDR_IN_SIN_LEN
549 v6.sin6_len = sizeof (v6);
551 v6.sin6_addr = in6addr_loopback;
555 rh->addr_callback (rh->cls, (const struct sockaddr *) &v4, sizeof (v4));
558 rh->addr_callback (rh->cls, (const struct sockaddr *) &v6, sizeof (v6));
561 rh->addr_callback (rh->cls, (const struct sockaddr *) &v6, sizeof (v6));
562 rh->addr_callback (rh->cls, (const struct sockaddr *) &v4, sizeof (v4));
568 rh->addr_callback (rh->cls, NULL, 0);
574 * Task executed on system shutdown.
577 shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
579 s_task = GNUNET_SCHEDULER_NO_TASK;
580 GNUNET_RESOLVER_disconnect ();
585 * Process pending requests to the resolver.
587 * @param h handle to the resolver
592 struct GNUNET_RESOLVER_GetMessage *msg;
593 char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1];
594 struct GNUNET_RESOLVER_RequestHandle *rh;
604 /* nothing to do, release socket really soon if there is nothing
606 s_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS,
607 &shutdown_task, NULL);
610 if (GNUNET_YES == rh->was_transmitted)
611 return; /* waiting for reply */
612 msg = (struct GNUNET_RESOLVER_GetMessage *) buf;
614 htons (sizeof (struct GNUNET_RESOLVER_GetMessage) + rh->data_len);
615 msg->header.type = htons (GNUNET_MESSAGE_TYPE_RESOLVER_REQUEST);
616 msg->direction = htonl (rh->direction);
617 msg->domain = htonl (rh->domain);
618 memcpy (&msg[1], &rh[1], rh->data_len);
620 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
621 "Transmitting DNS resolution request to DNS service\n");
624 GNUNET_CLIENT_transmit_and_get_response (client,
626 GNUNET_TIME_absolute_get_remaining (rh->timeout),
628 &handle_response, rh))
630 GNUNET_CLIENT_disconnect (client, GNUNET_NO);
635 rh->was_transmitted = GNUNET_YES;
640 * Now try to reconnect to the resolver service.
643 * @param tc scheduler context
646 reconnect_task (void *cls,
647 const struct GNUNET_SCHEDULER_TaskContext *tc)
649 r_task = GNUNET_SCHEDULER_NO_TASK;
650 if (NULL == req_head)
651 return; /* no work pending */
652 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
655 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
656 "Trying to connect to DNS service\n");
658 client = GNUNET_CLIENT_connect ("resolver", cfg);
661 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
662 "Failed to connect, will try again later\n");
671 * Adjust exponential back-off and reconnect to the service.
676 struct GNUNET_RESOLVER_RequestHandle *rh;
678 if (GNUNET_SCHEDULER_NO_TASK != r_task)
680 GNUNET_assert (NULL == client);
681 if (NULL != (rh = req_head))
683 switch (rh->was_transmitted)
686 /* nothing more to do */
689 /* disconnected, transmit again! */
690 rh->was_transmitted = GNUNET_NO;
693 /* request was cancelled, remove entirely */
694 GNUNET_CONTAINER_DLL_remove (req_head,
705 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
706 "Will try to connect to DNS service in %llu ms\n",
707 (unsigned long long) backoff.rel_value);
709 GNUNET_assert (NULL != cfg);
710 r_task = GNUNET_SCHEDULER_add_delayed (backoff,
713 backoff = GNUNET_TIME_relative_multiply (backoff, 2);
718 * Convert a string to one or more IP addresses.
720 * @param hostname the hostname to resolve
721 * @param domain AF_INET or AF_INET6; use AF_UNSPEC for "any"
722 * @param callback function to call with addresses
723 * @param callback_cls closure for callback
724 * @param timeout how long to try resolving
725 * @return handle that can be used to cancel the request, NULL on error
727 struct GNUNET_RESOLVER_RequestHandle *
728 GNUNET_RESOLVER_ip_get (const char *hostname,
730 struct GNUNET_TIME_Relative timeout,
731 GNUNET_RESOLVER_AddressCallback callback,
734 struct GNUNET_RESOLVER_RequestHandle *rh;
740 slen = strlen (hostname) + 1;
741 if (slen + sizeof (struct GNUNET_RESOLVER_GetMessage) >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
746 rh = GNUNET_malloc (sizeof (struct GNUNET_RESOLVER_RequestHandle) + slen);
748 rh->addr_callback = callback;
749 rh->cls = callback_cls;
750 memcpy (&rh[1], hostname, slen);
752 rh->timeout = GNUNET_TIME_relative_to_absolute (timeout);
753 rh->direction = GNUNET_NO;
754 /* first, check if this is a numeric address */
755 if (((1 == inet_pton (AF_INET,
758 ((domain == AF_INET) || (domain == AF_UNSPEC))) ||
759 ((1 == inet_pton (AF_INET6,
762 ((domain == AF_INET6) || (domain == AF_UNSPEC))))
764 rh->task = GNUNET_SCHEDULER_add_now (&numeric_resolution, rh);
767 /* then, check if this is a loopback address */
769 while (loopback[i] != NULL)
770 if (0 == strcasecmp (loopback[i++], hostname))
772 rh->task = GNUNET_SCHEDULER_add_now (&loopback_resolution, rh);
775 GNUNET_CONTAINER_DLL_insert_tail (req_head,
778 rh->was_queued = GNUNET_YES;
779 if (s_task != GNUNET_SCHEDULER_NO_TASK)
781 GNUNET_SCHEDULER_cancel (s_task);
782 s_task = GNUNET_SCHEDULER_NO_TASK;
790 * We've been asked to convert an address to a string without
791 * a reverse lookup. Do it.
793 * @param cls struct GNUNET_RESOLVER_RequestHandle for the request
794 * @param tc unused scheduler context
797 numeric_reverse (void *cls,
798 const struct GNUNET_SCHEDULER_TaskContext *tc)
800 struct GNUNET_RESOLVER_RequestHandle *rh = cls;
803 result = no_resolve ((const struct sockaddr *) &rh[1], rh->data_len);
805 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Resolver returns `%s'.\n"), result);
809 rh->name_callback (rh->cls, result);
810 GNUNET_free (result);
812 rh->name_callback (rh->cls, NULL);
818 * Get an IP address as a string.
820 * @param sa host address
821 * @param salen length of host address
822 * @param do_resolve use GNUNET_NO to return numeric hostname
823 * @param timeout how long to try resolving
824 * @param callback function to call with hostnames
825 * @param cls closure for callback
826 * @return handle that can be used to cancel the request
828 struct GNUNET_RESOLVER_RequestHandle *
829 GNUNET_RESOLVER_hostname_get (const struct sockaddr *sa,
832 struct GNUNET_TIME_Relative timeout,
833 GNUNET_RESOLVER_HostnameCallback callback,
836 struct GNUNET_RESOLVER_RequestHandle *rh;
839 rh = GNUNET_malloc (sizeof (struct GNUNET_RESOLVER_RequestHandle) + salen);
840 rh->name_callback = callback;
842 rh->timeout = GNUNET_TIME_relative_to_absolute (timeout);
843 memcpy (&rh[1], sa, salen);
844 rh->data_len = salen;
845 rh->direction = GNUNET_YES;
846 if (GNUNET_NO == do_resolve)
848 rh->task = GNUNET_SCHEDULER_add_now (&numeric_reverse, rh);
851 if (salen + sizeof (struct GNUNET_RESOLVER_GetMessage) >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
857 GNUNET_CONTAINER_DLL_insert_tail (req_head,
860 rh->was_queued = GNUNET_YES;
861 if (s_task != GNUNET_SCHEDULER_NO_TASK)
863 GNUNET_SCHEDULER_cancel (s_task);
864 s_task = GNUNET_SCHEDULER_NO_TASK;
872 * Get local fully qualified domain name
877 GNUNET_RESOLVER_local_fqdn_get ()
879 struct hostent *host;
880 char hostname[GNUNET_OS_get_hostname_max_length() + 1];
882 if (0 != gethostname (hostname, sizeof (hostname) - 1))
884 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR |
885 GNUNET_ERROR_TYPE_BULK, "gethostname");
889 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
890 _("Resolving our FQDN `%s'\n"), hostname);
892 host = gethostbyname (hostname);
895 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
896 _("Could not resolve our FQDN : %s\n"),
897 hstrerror (h_errno));
900 return GNUNET_strdup (host->h_name);
905 * Looking our own hostname.
907 * @param domain AF_INET or AF_INET6; use AF_UNSPEC for "any"
908 * @param callback function to call with addresses
909 * @param cls closure for callback
910 * @param timeout how long to try resolving
911 * @return handle that can be used to cancel the request, NULL on error
913 struct GNUNET_RESOLVER_RequestHandle *
914 GNUNET_RESOLVER_hostname_resolve (int domain,
915 struct GNUNET_TIME_Relative timeout,
916 GNUNET_RESOLVER_AddressCallback callback,
919 char hostname[GNUNET_OS_get_hostname_max_length() + 1];
921 if (0 != gethostname (hostname, sizeof (hostname) - 1))
923 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR |
924 GNUNET_ERROR_TYPE_BULK, "gethostname");
928 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
929 _("Resolving our hostname `%s'\n"), hostname);
931 return GNUNET_RESOLVER_ip_get (hostname,
939 * Cancel a request that is still pending with the resolver.
940 * Note that a client MUST NOT cancel a request that has
941 * been completed (i.e, the callback has been called to
942 * signal timeout or the final result).
944 * @param rh handle of request to cancel
947 GNUNET_RESOLVER_request_cancel (struct GNUNET_RESOLVER_RequestHandle *rh)
949 if (rh->task != GNUNET_SCHEDULER_NO_TASK)
951 GNUNET_SCHEDULER_cancel (rh->task);
952 rh->task = GNUNET_SCHEDULER_NO_TASK;
954 if (rh->was_transmitted == GNUNET_NO)
956 if (rh->was_queued == GNUNET_YES)
957 GNUNET_CONTAINER_DLL_remove (req_head,
963 GNUNET_assert (rh->was_transmitted == GNUNET_YES);
964 rh->was_transmitted = GNUNET_SYSERR; /* mark as cancelled */
968 /* end of resolver_api.c */