Asynchronous standard DNS lookups. More...
Typedefs | |
| typedef void(* | GNUNET_RESOLVER_AddressCallback) (void *cls, const struct sockaddr *addr, socklen_t addrlen) |
| Function called by the resolver for each address obtained from DNS. | |
| typedef void(* | GNUNET_RESOLVER_HostnameCallback) (void *cls, const char *hostname) |
| Function called by the resolver for each hostname obtained from DNS. | |
Functions | |
| void | GNUNET_RESOLVER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) |
| Create the connection to the resolver service. | |
| void | GNUNET_RESOLVER_disconnect (void) |
| Destroy the connection to the resolver service. | |
| struct GNUNET_RESOLVER_RequestHandle * | GNUNET_RESOLVER_ip_get (const char *hostname, int af, struct GNUNET_TIME_Relative timeout, GNUNET_RESOLVER_AddressCallback callback, void *callback_cls) |
| Convert a string to one or more IP addresses. | |
| struct GNUNET_RESOLVER_RequestHandle * | GNUNET_RESOLVER_hostname_resolve (int af, struct GNUNET_TIME_Relative timeout, GNUNET_RESOLVER_AddressCallback callback, void *cls) |
| Resolve our hostname to an IP address. | |
| char * | GNUNET_RESOLVER_local_fqdn_get (void) |
| Get local fully qualified domain name. | |
| struct GNUNET_RESOLVER_RequestHandle * | GNUNET_RESOLVER_hostname_get (const struct sockaddr *sa, socklen_t salen, int do_resolve, struct GNUNET_TIME_Relative timeout, GNUNET_RESOLVER_HostnameCallback callback, void *cls) |
| Perform a reverse DNS lookup. | |
| void | GNUNET_RESOLVER_request_cancel (struct GNUNET_RESOLVER_RequestHandle *rh) |
| Cancel a request that is still pending with the resolver. | |
Asynchronous standard DNS lookups.
| typedef void(* GNUNET_RESOLVER_AddressCallback) (void *cls, const struct sockaddr *addr, socklen_t addrlen) |
Function called by the resolver for each address obtained from DNS.
| cls | closure |
| addr | one of the addresses of the host, NULL for the last address |
| addrlen | length of addr |
Definition at line 59 of file gnunet_resolver_service.h.
| typedef void(* GNUNET_RESOLVER_HostnameCallback) (void *cls, const char *hostname) |
Function called by the resolver for each hostname obtained from DNS.
| cls | closure |
| hostname | one of the names for the host, NULL on the last call to the callback |
Definition at line 128 of file gnunet_resolver_service.h.
| void GNUNET_RESOLVER_connect | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg | ) |
Create the connection to the resolver service.
| cfg | configuration to use |
Definition at line 258 of file resolver_api.c.
References backoff, cfg, GNUNET_assert, GNUNET_TIME_UNIT_MILLISECONDS, and resolver_cfg.
Referenced by GNUNET_PROGRAM_run2(), GNUNET_SERVICE_main(), GNUNET_SERVICE_run_(), program_main(), and reversal_test().
| void GNUNET_RESOLVER_disconnect | ( | void | ) |
Destroy the connection to the resolver service.
Definition at line 270 of file resolver_api.c.
References GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), GNUNET_SYSERR, LOG, mq, r_task, req_head, req_tail, s_task, and GNUNET_RESOLVER_RequestHandle::was_transmitted.
Referenced by shutdown_task().
| struct GNUNET_RESOLVER_RequestHandle * GNUNET_RESOLVER_ip_get | ( | const char * | hostname, |
| int | af, | ||
| struct GNUNET_TIME_Relative | timeout, | ||
| GNUNET_RESOLVER_AddressCallback | callback, | ||
| void * | callback_cls | ||
| ) |
Convert a string to one or more IP addresses.
| hostname | the hostname to resolve |
| af | AF_INET or AF_INET6; use AF_UNSPEC for "any" |
| callback | function to call with addresses |
| callback_cls | closure for callback |
| timeout | how long to try resolving |
Definition at line 940 of file resolver_api.c.
References GNUNET_RESOLVER_RequestHandle::addr_callback, GNUNET_RESOLVER_RequestHandle::af, check_config(), GNUNET_RESOLVER_RequestHandle::cls, GNUNET_RESOLVER_RequestHandle::data_len, GNUNET_RESOLVER_RequestHandle::direction, GNUNET_break, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_malloc, GNUNET_MAX_MESSAGE_SIZE, GNUNET_memcpy, GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_cancel(), GNUNET_TIME_relative_to_absolute(), GNUNET_YES, handle_lookup_timeout(), GNUNET_RESOLVER_RequestHandle::id, last_request_id, LOG, loopback, loopback_resolution(), numeric_resolution(), process_requests(), req_head, req_tail, s_task, GNUNET_RESOLVER_RequestHandle::task, timeout, GNUNET_RESOLVER_RequestHandle::timeout, and GNUNET_RESOLVER_RequestHandle::was_queued.
Referenced by dns_result_parser(), dyndns_lookup(), GNUNET_NAT_stun_make_request(), GNUNET_RESOLVER_hostname_resolve(), handle_gns_cname_result(), handle_gns_redirect_result(), recursive_gns2dns_resolution(), run(), run(), and start_connect().
| struct GNUNET_RESOLVER_RequestHandle * GNUNET_RESOLVER_hostname_resolve | ( | int | af, |
| struct GNUNET_TIME_Relative | timeout, | ||
| GNUNET_RESOLVER_AddressCallback | callback, | ||
| void * | cls | ||
| ) |
Resolve our hostname to an IP address.
| af | AF_INET or AF_INET6; use AF_UNSPEC for "any" |
| callback | function to call with addresses |
| cls | closure for callback |
| timeout | how long to try resolving |
Resolve our hostname to an IP address.
| af | AF_INET or AF_INET6; use AF_UNSPEC for "any" |
| timeout | how long to try resolving |
| callback | function to call with addresses |
| cls | closure for callback |
Definition at line 1235 of file resolver_api.c.
References GNUNET_RESOLVER_RequestHandle::af, GNUNET_RESOLVER_RequestHandle::cls, GNUNET_ERROR_TYPE_BULK, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_OS_get_hostname_max_length, GNUNET_RESOLVER_ip_get(), LOG, LOG_STRERROR, and timeout.
| char * GNUNET_RESOLVER_local_fqdn_get | ( | void | ) |
Get local fully qualified domain name.
Get local fully qualified domain name.
Definition at line 1149 of file resolver_api.c.
References _, ai, GNUNET_ERROR_TYPE_BULK, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_OS_get_hostname_max_length, GNUNET_strdup, LOG, LOG_STRERROR, and ret.
Referenced by GNUNET_HOSTLIST_server_start().
| struct GNUNET_RESOLVER_RequestHandle * GNUNET_RESOLVER_hostname_get | ( | const struct sockaddr * | sa, |
| socklen_t | salen, | ||
| int | do_resolve, | ||
| struct GNUNET_TIME_Relative | timeout, | ||
| GNUNET_RESOLVER_HostnameCallback | callback, | ||
| void * | cls | ||
| ) |
Perform a reverse DNS lookup.
| sa | host address |
| salen | length of sa |
| do_resolve | use GNUNET_NO to return numeric hostname |
| timeout | how long to try resolving |
| callback | function to call with hostnames |
| cls | closure for callback |
Perform a reverse DNS lookup.
| sa | host address |
| salen | length of host address in sa |
| do_resolve | use GNUNET_NO to return numeric hostname |
| timeout | how long to try resolving |
| callback | function to call with hostnames last callback is NULL when finished |
| cls | closure for callback |
Definition at line 1072 of file resolver_api.c.
References _, GNUNET_RESOLVER_RequestHandle::af, check_config(), GNUNET_RESOLVER_RequestHandle::cls, GNUNET_RESOLVER_RequestHandle::data_len, GNUNET_RESOLVER_RequestHandle::direction, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_ERROR, GNUNET_malloc, GNUNET_memcpy, GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_cancel(), GNUNET_TIME_relative_to_absolute(), GNUNET_YES, handle_lookup_timeout(), GNUNET_RESOLVER_RequestHandle::id, last_request_id, LOG, GNUNET_RESOLVER_RequestHandle::name_callback, numeric_reverse(), process_requests(), GNUNET_RESOLVER_RequestHandle::received_response, req_head, req_tail, s_task, GNUNET_RESOLVER_RequestHandle::task, timeout, GNUNET_RESOLVER_RequestHandle::timeout, and GNUNET_RESOLVER_RequestHandle::was_queued.
Referenced by run().
| void GNUNET_RESOLVER_request_cancel | ( | struct GNUNET_RESOLVER_RequestHandle * | rh | ) |
Cancel a request that is still pending with the resolver.
Note that a client MUST NOT cancel a request that has been completed (i.e, the callback has been called to signal timeout or the final result).
| rh | handle of request to cancel |
Definition at line 1268 of file resolver_api.c.
References check_disconnect(), GNUNET_RESOLVER_RequestHandle::direction, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_NO, GNUNET_SCHEDULER_cancel(), GNUNET_SYSERR, GNUNET_YES, LOG, req_head, req_tail, GNUNET_RESOLVER_RequestHandle::task, GNUNET_RESOLVER_RequestHandle::was_queued, and GNUNET_RESOLVER_RequestHandle::was_transmitted.
Referenced by client_disconnect_cb(), connection_client_destroy_impl(), dns_result_parser(), do_shutdown(), do_shutdown(), GNS_resolver_lookup_cancel(), GNUNET_NAT_stun_make_request_cancel(), handle_gns_redirect_result(), handle_lookup_timeout(), handle_response(), init_socket(), init_socket(), and nat_register().