2013-12-09 18:28:09 -06:00
. \" The "BSD-New" License
. \"
2014-02-19 17:18:52 -06:00
. \" Copyright (c) 2013, NLNet Labs, Verisign, Inc.
2013-12-09 18:28:09 -06:00
. \" All rights reserved.
. \"
. \" Redistribution and use in source and binary forms, with or without
. \" modification, are permitted provided that the following conditions are met:
. \" * Redistributions of source code must retain the above copyright
. \" notice, this list of conditions and the following disclaimer.
. \" * Redistributions in binary form must reproduce the above copyright
. \" notice, this list of conditions and the following disclaimer in the
. \" documentation and/or other materials provided with the distribution.
2014-02-25 07:23:19 -06:00
. \" * Neither the names of the copyright holders nor the
2013-12-09 18:28:09 -06:00
. \" names of its contributors may be used to endorse or promote products
. \" derived from this software without specific prior written permission.
. \"
. \" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
. \" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
. \" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
. \" DISCLAIMED. IN NO EVENT SHALL Verisign, Inc. BE LIABLE FOR ANY
. \" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
. \" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
. \" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
. \" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
. \" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
. \" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
. \"
2013-12-10 04:44:36 -06:00
.TH getdns_address 3 "@date@" "getdns @version@" getdns
2013-11-04 17:37:54 -06:00
.SH NAME
2013-12-09 18:28:09 -06:00
.B getdns_address,
.B getdns_address_sync
2014-11-10 08:50:45 -06:00
-- get ip address(es) for a name
2013-12-09 18:28:09 -06:00
2013-11-04 17:37:54 -06:00
.SH LIBRARY
DNS Resolver library (libgetdns, -lgetdns)
.SH SYNOPSIS
#include <getdns.h>
getdns_return_t
.br
.B getdns_address
2014-02-20 16:29:39 -06:00
(getdns_context *context,
2013-12-09 18:28:09 -06:00
.RS 3
const char *name,
.br
2014-02-20 16:29:39 -06:00
getdns_dict *extensions,
2013-12-09 18:28:09 -06:00
.br
void *userarg,
.br
getdns_transaction_t *transaction_id,
.br
getdns_callback_t callbackfn)
.RE
getdns_return_t
.br
.B getdns_address_sync
2014-02-20 16:29:39 -06:00
(getdns_context *context,
2013-12-09 18:28:09 -06:00
.RS 3
const char *name,
.br
2014-02-20 16:29:39 -06:00
getdns_dict *extensions,
2013-12-09 18:28:09 -06:00
.br
2014-02-20 16:29:39 -06:00
getdns_dict **response)
2013-12-09 18:28:09 -06:00
.RE
2013-11-04 17:37:54 -06:00
.SH DESCRIPTION
.LP
2014-03-10 17:19:28 -05:00
The getdns_address(3) and getdns_address_sync functions provide public entry points into the getdns API library to retrieve the address given a host name. They always returns both IPv4 and IPv6 addresses. This function will use all of the namespaces from the context (to better emulate getaddrinfo (3)).
2013-12-09 18:28:09 -06:00
.HP 3
.I context
2014-03-10 17:19:28 -05:00
A pointer to the previously created DNS context that is to be used with this DNS request. see getdns_context (3)
2013-12-09 18:28:09 -06:00
.HP 3
.I name
the host name to resolve to an address (note that an IP address is considered invalid)
.HP 3
.I extensions
extensions for this request, NULL if no extensions, see libgetdns (3) for a detailed description of extensions
.HP 3
.I userarg
returned to the callback function untouched, can be NULL
.HP 3
.I transaction_id
populated by the API and used to identify the callback (for example to getdns_cancel_callback), can be NULL, set to 0 if the function fails
.HP 3
.I callbackfn
2014-03-10 17:19:28 -05:00
non-NULL pointer to a callback function defined by the application, typically
used to process the response. Only the asynchronous signature accepts a
callback function, the synchronous signature does not include a callback. See
libgetdns (3) for a more detailed discussion of callback functions.
2013-12-09 18:28:09 -06:00
.HP 3
.I response
A getdns_dict type is returned in response and always contains at least three names: replies_full (a list containing the DNS response as binary data), replies_tree (a list containing the parsed DNS response data) and status (an int). The storage associated with this must be freed by a call to getdns_free_sync_request_memory (3).
.HP
.SH "RETURN VALUES"
Upon successful completion the functions return
.B GETDNS_RETURN_GOOD
, otherwise the following error values are returned:
.LP
.B GETDNS_RETURN_BAD_CONTEXT
2014-03-10 17:19:28 -05:00
if the context pointer is invalid or the context has internal deficiencies
2014-02-20 16:29:39 -06:00
.LP
2013-12-09 18:28:09 -06:00
.B GETDNS_RETURN_BAD_DOMAIN_NAME
if the domain name passed to the function is invalid
.LP
.B GETDNS_RETURN_EXTENSION_MISFORMAT
if the data type specified in one or more of the extensions does not match the specifications
.LP
2014-02-20 16:29:39 -06:00
.B GETDNS_RETURN_GENERIC_ERROR
2014-03-10 17:19:28 -05:00
if some problem was encountered in the function not addressed by one of the more
2014-02-20 16:29:39 -06:00
specific return codes
2014-03-10 17:19:28 -05:00
.LP
.B GETDNS_RETURN_INVALID PARAMETER
if one or more parameters has an invalid value
.LP
.B GETDNS_RETURN_MEMORY_ERROR
if unable to allocate the memory required
.LP
.B GETDNS_RETURN_NO_SUCH_EXTENSION
if one or more of the strings specified in the extensions are not valid
2013-12-09 18:28:09 -06:00
2014-03-10 17:19:28 -05:00
The values of status included in the response parameter are:
2013-11-04 17:37:54 -06:00
.LP
2013-12-09 18:28:09 -06:00
.B GETDNS_RESPSTATUS_GOOD
2014-03-10 17:19:28 -05:00
if at least one response was returned
2013-12-09 18:28:09 -06:00
.LP
.B GETDNS_RESPSTATUS_NO_NAME
2014-03-10 17:19:28 -05:00
if queries for the name yielded all negative responses
2013-12-09 18:28:09 -06:00
.LP
.B GETDNS_RESPSTATUS_ALL_TIMEOUT
2014-03-10 17:19:28 -05:00
if all queries for the name timed out
2013-12-09 18:28:09 -06:00
.LP
.B GETDNS_RESPSTATUS_NO_SECURE_ANSWERS
2014-03-10 17:19:28 -05:00
if only secure replies accepted (per context) and at least one response was received but no DNS responses were secure through DNSSEC
2013-11-04 17:37:54 -06:00
2013-12-09 18:28:09 -06:00
.LP
For a more detailed explanation of the response object see
.I libgetdns
(3)
2013-11-04 17:37:54 -06:00
.SH EXAMPLES
TBD
2013-12-09 18:28:09 -06:00
.SH FILES
.br
/etc/hosts
.br
/etc/resolv.conf
2013-11-04 17:37:54 -06:00
.SH SEE ALSO
2014-02-20 16:29:39 -06:00
.BR libgetdns (3),
.BR getdns_context (3),
.BR getdns_free_sync_request_memory (3),
.BR getdns_general (3),
.BR getdns_general_sync (3),
.BR getdns_hostname (3),
.BR getdns_hostname_sync (3),
.BR getdns_service (3),
.BR getdns_service_sync (3)
2013-11-04 17:37:54 -06:00