1135446Strhodes/* 2193149Sdougb * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") 3135446Strhodes * Copyright (C) 2000-2003 Internet Software Consortium. 4135446Strhodes * 5193149Sdougb * Permission to use, copy, modify, and/or distribute this software for any 6135446Strhodes * purpose with or without fee is hereby granted, provided that the above 7135446Strhodes * copyright notice and this permission notice appear in all copies. 8135446Strhodes * 9135446Strhodes * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 10135446Strhodes * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 11135446Strhodes * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 12135446Strhodes * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13135446Strhodes * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 14135446Strhodes * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15135446Strhodes * PERFORMANCE OF THIS SOFTWARE. 16135446Strhodes */ 17135446Strhodes 18234010Sdougb/* $Id: byaddr.h,v 1.22 2007/06/19 23:47:16 tbox Exp $ */ 19135446Strhodes 20135446Strhodes#ifndef DNS_BYADDR_H 21135446Strhodes#define DNS_BYADDR_H 1 22135446Strhodes 23135446Strhodes/***** 24135446Strhodes ***** Module Info 25135446Strhodes *****/ 26135446Strhodes 27193149Sdougb/*! \file dns/byaddr.h 28170222Sdougb * \brief 29135446Strhodes * The byaddr module provides reverse lookup services for IPv4 and IPv6 30135446Strhodes * addresses. 31135446Strhodes * 32135446Strhodes * MP: 33170222Sdougb *\li The module ensures appropriate synchronization of data structures it 34135446Strhodes * creates and manipulates. 35135446Strhodes * 36135446Strhodes * Reliability: 37170222Sdougb *\li No anticipated impact. 38135446Strhodes * 39135446Strhodes * Resources: 40170222Sdougb *\li TBS 41135446Strhodes * 42135446Strhodes * Security: 43170222Sdougb *\li No anticipated impact. 44135446Strhodes * 45135446Strhodes * Standards: 46170222Sdougb *\li RFCs: 1034, 1035, 2181, TBS 47170222Sdougb *\li Drafts: TBS 48135446Strhodes */ 49135446Strhodes 50135446Strhodes#include <isc/lang.h> 51135446Strhodes#include <isc/event.h> 52135446Strhodes 53135446Strhodes#include <dns/types.h> 54135446Strhodes 55135446StrhodesISC_LANG_BEGINDECLS 56135446Strhodes 57170222Sdougb/*% 58135446Strhodes * A 'dns_byaddrevent_t' is returned when a byaddr completes. 59135446Strhodes * The sender field will be set to the byaddr that completed. If 'result' 60135446Strhodes * is ISC_R_SUCCESS, then 'names' will contain a list of names associated 61135446Strhodes * with the address. The recipient of the event must not change the list 62135446Strhodes * and must not refer to any of the name data after the event is freed. 63135446Strhodes */ 64135446Strhodestypedef struct dns_byaddrevent { 65135446Strhodes ISC_EVENT_COMMON(struct dns_byaddrevent); 66135446Strhodes isc_result_t result; 67135446Strhodes dns_namelist_t names; 68135446Strhodes} dns_byaddrevent_t; 69135446Strhodes 70135446Strhodes/* 71135446Strhodes * This option is deprecated since we now only consider nibbles. 72135446Strhodes#define DNS_BYADDROPT_IPV6NIBBLE 0x0001 73135446Strhodes */ 74170222Sdougb/*% Note DNS_BYADDROPT_IPV6NIBBLE is now deprecated. */ 75135446Strhodes#define DNS_BYADDROPT_IPV6INT 0x0002 76135446Strhodes 77135446Strhodesisc_result_t 78135446Strhodesdns_byaddr_create(isc_mem_t *mctx, isc_netaddr_t *address, dns_view_t *view, 79135446Strhodes unsigned int options, isc_task_t *task, 80135446Strhodes isc_taskaction_t action, void *arg, dns_byaddr_t **byaddrp); 81170222Sdougb/*%< 82135446Strhodes * Find the domain name of 'address'. 83135446Strhodes * 84135446Strhodes * Notes: 85135446Strhodes * 86170222Sdougb *\li There is a reverse lookup format for IPv6 addresses, 'nibble' 87135446Strhodes * 88170222Sdougb *\li The 'nibble' format for that address is 89135446Strhodes * 90170222Sdougb * \code 91135446Strhodes * 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. 92170222Sdougb * \endcode 93135446Strhodes * 94170222Sdougb *\li #DNS_BYADDROPT_IPV6INT can be used to get nibble lookups under ip6.int. 95135446Strhodes * 96135446Strhodes * Requires: 97135446Strhodes * 98170222Sdougb *\li 'mctx' is a valid mctx. 99135446Strhodes * 100170222Sdougb *\li 'address' is a valid IPv4 or IPv6 address. 101135446Strhodes * 102170222Sdougb *\li 'view' is a valid view which has a resolver. 103135446Strhodes * 104170222Sdougb *\li 'task' is a valid task. 105135446Strhodes * 106170222Sdougb *\li byaddrp != NULL && *byaddrp == NULL 107135446Strhodes * 108135446Strhodes * Returns: 109135446Strhodes * 110170222Sdougb *\li #ISC_R_SUCCESS 111170222Sdougb *\li #ISC_R_NOMEMORY 112135446Strhodes * 113170222Sdougb *\li Any resolver-related error (e.g. #ISC_R_SHUTTINGDOWN) may also be 114135446Strhodes * returned. 115135446Strhodes */ 116135446Strhodes 117135446Strhodesvoid 118135446Strhodesdns_byaddr_cancel(dns_byaddr_t *byaddr); 119170222Sdougb/*%< 120135446Strhodes * Cancel 'byaddr'. 121135446Strhodes * 122135446Strhodes * Notes: 123135446Strhodes * 124193149Sdougb *\li If 'byaddr' has not completed, post its #DNS_EVENT_BYADDRDONE 125193149Sdougb * event with a result code of #ISC_R_CANCELED. 126135446Strhodes * 127135446Strhodes * Requires: 128135446Strhodes * 129170222Sdougb *\li 'byaddr' is a valid byaddr. 130135446Strhodes */ 131135446Strhodes 132135446Strhodesvoid 133135446Strhodesdns_byaddr_destroy(dns_byaddr_t **byaddrp); 134170222Sdougb/*%< 135135446Strhodes * Destroy 'byaddr'. 136135446Strhodes * 137135446Strhodes * Requires: 138135446Strhodes * 139170222Sdougb *\li '*byaddrp' is a valid byaddr. 140135446Strhodes * 141193149Sdougb *\li The caller has received the #DNS_EVENT_BYADDRDONE event (either because 142193149Sdougb * the byaddr completed or because dns_byaddr_cancel() was called). 143135446Strhodes * 144135446Strhodes * Ensures: 145135446Strhodes * 146170222Sdougb *\li *byaddrp == NULL. 147135446Strhodes */ 148135446Strhodes 149135446Strhodesisc_result_t 150135446Strhodesdns_byaddr_createptrname(isc_netaddr_t *address, isc_boolean_t nibble, 151135446Strhodes dns_name_t *name); 152135446Strhodes 153135446Strhodesisc_result_t 154135446Strhodesdns_byaddr_createptrname2(isc_netaddr_t *address, unsigned int options, 155135446Strhodes dns_name_t *name); 156170222Sdougb/*%< 157135446Strhodes * Creates a name that would be used in a PTR query for this address. The 158135446Strhodes * nibble flag indicates that the 'nibble' format is to be used if an IPv6 159135446Strhodes * address is provided, instead of the 'bitstring' format. Since we dropped 160135446Strhodes * the support of the bitstring labels, it is expected that the flag is always 161135446Strhodes * set. 'options' are the same as for dns_byaddr_create(). 162135446Strhodes * 163135446Strhodes * Requires: 164135446Strhodes * 165170222Sdougb * \li 'address' is a valid address. 166170222Sdougb * \li 'name' is a valid name with a dedicated buffer. 167135446Strhodes */ 168135446Strhodes 169135446StrhodesISC_LANG_ENDDECLS 170135446Strhodes 171135446Strhodes#endif /* DNS_BYADDR_H */ 172