#include <config.h>
#include <isc/mem.h>
#include <isc/netaddr.h>
#include <isc/print.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/util.h>
#include <dns/byaddr.h>
#include <dns/db.h>
#include <dns/events.h>
#include <dns/lookup.h>
#include <dns/rdata.h>
#include <dns/rdataset.h>
#include <dns/rdatastruct.h>
#include <dns/resolver.h>
#include <dns/result.h>
#include <dns/view.h>
Go to the source code of this file.
Data Structures | |
struct | dns_byaddr |
Defines | |
#define | BYADDR_MAGIC ISC_MAGIC('B', 'y', 'A', 'd') |
#define | VALID_BYADDR(b) ISC_MAGIC_VALID(b, BYADDR_MAGIC) |
#define | MAX_RESTARTS 16 |
Functions | |
isc_result_t | dns_byaddr_createptrname (isc_netaddr_t *address, isc_boolean_t nibble, dns_name_t *name) |
isc_result_t | dns_byaddr_createptrname2 (isc_netaddr_t *address, unsigned int options, dns_name_t *name) |
Creates a name that would be used in a PTR query for this address. The nibble flag indicates that the 'nibble' format is to be used if an IPv6 address is provided, instead of the 'bitstring' format. Since we dropped the support of the bitstring labels, it is expected that the flag is always set. 'options' are the same as for dns_byaddr_create(). | |
static isc_result_t | copy_ptr_targets (dns_byaddr_t *byaddr, dns_rdataset_t *rdataset) |
static void | lookup_done (isc_task_t *task, isc_event_t *event) |
static void | bevent_destroy (isc_event_t *event) |
isc_result_t | dns_byaddr_create (isc_mem_t *mctx, isc_netaddr_t *address, dns_view_t *view, unsigned int options, isc_task_t *task, isc_taskaction_t action, void *arg, dns_byaddr_t **byaddrp) |
Find the domain name of 'address'. | |
void | dns_byaddr_cancel (dns_byaddr_t *byaddr) |
Cancel 'byaddr'. | |
void | dns_byaddr_destroy (dns_byaddr_t **byaddrp) |
Destroy 'byaddr'. | |
Variables | |
static char | hex_digits [] |
Definition in file byaddr.c.
#define BYADDR_MAGIC ISC_MAGIC('B', 'y', 'A', 'd') |
#define VALID_BYADDR | ( | b | ) | ISC_MAGIC_VALID(b, BYADDR_MAGIC) |
Definition at line 127 of file byaddr.c.
Referenced by dns_byaddr_cancel(), dns_byaddr_destroy(), and lookup_done().
#define MAX_RESTARTS 16 |
Definition at line 129 of file byaddr.c.
Referenced by client_resfind(), lookup_find(), and query_find().
isc_result_t dns_byaddr_createptrname | ( | isc_netaddr_t * | address, | |
isc_boolean_t | nibble, | |||
dns_name_t * | name | |||
) |
Definition at line 52 of file byaddr.c.
References dns_byaddr_createptrname2(), DNS_BYADDROPT_IPV6INT, and UNUSED.
isc_result_t dns_byaddr_createptrname2 | ( | isc_netaddr_t * | address, | |
unsigned int | options, | |||
dns_name_t * | name | |||
) |
Creates a name that would be used in a PTR query for this address. The nibble flag indicates that the 'nibble' format is to be used if an IPv6 address is provided, instead of the 'bitstring' format. Since we dropped the support of the bitstring labels, it is expected that the flag is always set. 'options' are the same as for dns_byaddr_create().
Requires:
Definition at line 65 of file byaddr.c.
References AF_INET6, buffer, DNS_BYADDROPT_IPV6INT, dns_name_fromtext(), dns_rootname, isc_netaddr::family, hex_digits, isc_buffer_add, isc_buffer_init, ISC_R_NOTIMPLEMENTED, REQUIRE, and isc_netaddr::type.
Referenced by dns_byaddr_create(), dns_byaddr_createptrname(), and get_reverse().
static isc_result_t copy_ptr_targets | ( | dns_byaddr_t * | byaddr, | |
dns_rdataset_t * | rdataset | |||
) | [inline, static] |
Definition at line 132 of file byaddr.c.
References dns_name_dup(), dns_name_init(), dns_rdata_freestruct(), DNS_RDATA_INIT, dns_rdata_reset(), dns_rdata_tostruct(), dns_rdataset_current(), dns_rdataset_first(), dns_rdataset_next(), dns_byaddr::event, ISC_LIST_APPEND, isc_mem_get, isc_mem_put, ISC_R_NOMEMORY, ISC_R_NOMORE, ISC_R_SUCCESS, dns_byaddr::mctx, and name.
Referenced by lookup_done().
static void lookup_done | ( | isc_task_t * | task, | |
isc_event_t * | event | |||
) | [static] |
Definition at line 171 of file byaddr.c.
References copy_ptr_targets(), DNS_EVENT_LOOKUPDONE, dns_byaddr::event, isc_event_free(), ISC_R_SUCCESS, isc_task_sendanddetach(), REQUIRE, dns_byaddr::task, UNUSED, and VALID_BYADDR.
Referenced by dns_byaddr_create(), and start_lookup().
static void bevent_destroy | ( | isc_event_t * | event | ) | [static] |
Definition at line 194 of file byaddr.c.
References DNS_EVENT_BYADDRDONE, dns_name_free(), ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_LIST_UNLINK, isc_mem_put, mctx, name, and REQUIRE.
Referenced by dns_byaddr_create().
isc_result_t dns_byaddr_create | ( | isc_mem_t * | mctx, | |
isc_netaddr_t * | address, | |||
dns_view_t * | view, | |||
unsigned int | options, | |||
isc_task_t * | task, | |||
isc_taskaction_t | action, | |||
void * | arg, | |||
dns_byaddr_t ** | byaddrp | |||
) |
Find the domain name of 'address'.
Notes:
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa.
Definition at line 215 of file byaddr.c.
References bevent_destroy(), BYADDR_MAGIC, dns_byaddr::canceled, DESTROYLOCK, dns_byaddr_createptrname2(), DNS_EVENT_BYADDRDONE, dns_fixedname_init, dns_fixedname_name, dns_lookup_create(), dns_byaddr::event, isc_event_free(), ISC_EVENT_INIT, ISC_FALSE, ISC_LIST_INIT, isc_mem_attach(), isc_mem_get, isc_mem_putanddetach, isc_mutex_init, ISC_R_FAILURE, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_task_attach(), isc_task_detach(), dns_byaddr::lock, dns_byaddr::lookup, lookup_done(), dns_byaddr::magic, dns_byaddr::mctx, dns_byaddr::name, dns_byaddr::options, and dns_byaddr::task.
Referenced by start_byaddr().
void dns_byaddr_cancel | ( | dns_byaddr_t * | byaddr | ) |
Cancel 'byaddr'.
Notes:
Definition at line 286 of file byaddr.c.
References dns_byaddr::canceled, dns_lookup_cancel(), ISC_TRUE, dns_byaddr::lock, LOCK, dns_byaddr::lookup, REQUIRE, UNLOCK, and VALID_BYADDR.
void dns_byaddr_destroy | ( | dns_byaddr_t ** | byaddrp | ) |
Destroy 'byaddr'.
Requires:
Definition at line 301 of file byaddr.c.
References DESTROYLOCK, dns_lookup_destroy(), dns_byaddr::event, isc_mem_putanddetach, dns_byaddr::lock, dns_byaddr::lookup, dns_byaddr::magic, dns_byaddr::mctx, REQUIRE, dns_byaddr::task, and VALID_BYADDR.
Referenced by byaddr_done().
char hex_digits[] [static] |
Initial value:
{ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }
Definition at line 46 of file byaddr.c.
Referenced by dns_byaddr_createptrname2().