byaddr.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
00003  * Copyright (C) 2000-2003  Internet Software Consortium.
00004  *
00005  * Permission to use, copy, modify, and/or distribute this software for any
00006  * purpose with or without fee is hereby granted, provided that the above
00007  * copyright notice and this permission notice appear in all copies.
00008  *
00009  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
00010  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00011  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
00012  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00013  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00014  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00015  * PERFORMANCE OF THIS SOFTWARE.
00016  */
00017 
00018 /* $Id: byaddr.h,v 1.22 2007/06/19 23:47:16 tbox Exp $ */
00019 
00020 #ifndef DNS_BYADDR_H
00021 #define DNS_BYADDR_H 1
00022 
00023 /*****
00024  ***** Module Info
00025  *****/
00026 
00027 /*! \file dns/byaddr.h
00028  * \brief
00029  * The byaddr module provides reverse lookup services for IPv4 and IPv6
00030  * addresses.
00031  *
00032  * MP:
00033  *\li   The module ensures appropriate synchronization of data structures it
00034  *      creates and manipulates.
00035  *
00036  * Reliability:
00037  *\li   No anticipated impact.
00038  *
00039  * Resources:
00040  *\li   TBS
00041  *
00042  * Security:
00043  *\li   No anticipated impact.
00044  *
00045  * Standards:
00046  *\li   RFCs:   1034, 1035, 2181, TBS
00047  *\li   Drafts: TBS
00048  */
00049 
00050 #include <isc/lang.h>
00051 #include <isc/event.h>
00052 
00053 #include <dns/types.h>
00054 
00055 ISC_LANG_BEGINDECLS
00056 
00057 /*%
00058  * A 'dns_byaddrevent_t' is returned when a byaddr completes.
00059  * The sender field will be set to the byaddr that completed.  If 'result'
00060  * is ISC_R_SUCCESS, then 'names' will contain a list of names associated
00061  * with the address.  The recipient of the event must not change the list
00062  * and must not refer to any of the name data after the event is freed.
00063  */
00064 typedef struct dns_byaddrevent {
00065         ISC_EVENT_COMMON(struct dns_byaddrevent);
00066         isc_result_t                    result;
00067         dns_namelist_t                  names;
00068 } dns_byaddrevent_t;
00069 
00070 /*
00071  * This option is deprecated since we now only consider nibbles.
00072 #define DNS_BYADDROPT_IPV6NIBBLE        0x0001
00073  */
00074 /*% Note DNS_BYADDROPT_IPV6NIBBLE is now deprecated. */
00075 #define DNS_BYADDROPT_IPV6INT           0x0002
00076 
00077 isc_result_t
00078 dns_byaddr_create(isc_mem_t *mctx, isc_netaddr_t *address, dns_view_t *view,
00079                   unsigned int options, isc_task_t *task,
00080                   isc_taskaction_t action, void *arg, dns_byaddr_t **byaddrp);
00081 /*%<
00082  * Find the domain name of 'address'.
00083  *
00084  * Notes:
00085  *
00086  *\li   There is a reverse lookup format for IPv6 addresses, 'nibble'
00087  *
00088  *\li   The 'nibble' format for that address is
00089  *
00090  * \code
00091  *   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.
00092  * \endcode
00093  *
00094  *\li   #DNS_BYADDROPT_IPV6INT can be used to get nibble lookups under ip6.int.
00095  *
00096  * Requires:
00097  *
00098  *\li   'mctx' is a valid mctx.
00099  *
00100  *\li   'address' is a valid IPv4 or IPv6 address.
00101  *
00102  *\li   'view' is a valid view which has a resolver.
00103  *
00104  *\li   'task' is a valid task.
00105  *
00106  *\li   byaddrp != NULL && *byaddrp == NULL
00107  *
00108  * Returns:
00109  *
00110  *\li   #ISC_R_SUCCESS
00111  *\li   #ISC_R_NOMEMORY
00112  *
00113  *\li   Any resolver-related error (e.g. #ISC_R_SHUTTINGDOWN) may also be
00114  *      returned.
00115  */
00116 
00117 void
00118 dns_byaddr_cancel(dns_byaddr_t *byaddr);
00119 /*%<
00120  * Cancel 'byaddr'.
00121  *
00122  * Notes:
00123  *
00124  *\li   If 'byaddr' has not completed, post its #DNS_EVENT_BYADDRDONE
00125  *      event with a result code of #ISC_R_CANCELED.
00126  *
00127  * Requires:
00128  *
00129  *\li   'byaddr' is a valid byaddr.
00130  */
00131 
00132 void
00133 dns_byaddr_destroy(dns_byaddr_t **byaddrp);
00134 /*%<
00135  * Destroy 'byaddr'.
00136  *
00137  * Requires:
00138  *
00139  *\li   '*byaddrp' is a valid byaddr.
00140  *
00141  *\li   The caller has received the #DNS_EVENT_BYADDRDONE event (either because
00142  *      the byaddr completed or because dns_byaddr_cancel() was called).
00143  *
00144  * Ensures:
00145  *
00146  *\li   *byaddrp == NULL.
00147  */
00148 
00149 isc_result_t
00150 dns_byaddr_createptrname(isc_netaddr_t *address, isc_boolean_t nibble,
00151                          dns_name_t *name);
00152 
00153 isc_result_t
00154 dns_byaddr_createptrname2(isc_netaddr_t *address, unsigned int options,
00155                           dns_name_t *name);
00156 /*%<
00157  * Creates a name that would be used in a PTR query for this address.  The
00158  * nibble flag indicates that the 'nibble' format is to be used if an IPv6
00159  * address is provided, instead of the 'bitstring' format.  Since we dropped
00160  * the support of the bitstring labels, it is expected that the flag is always
00161  * set.  'options' are the same as for dns_byaddr_create().
00162  *
00163  * Requires:
00164  * 
00165  * \li  'address' is a valid address.
00166  * \li  'name' is a valid name with a dedicated buffer.
00167  */
00168 
00169 ISC_LANG_ENDDECLS
00170 
00171 #endif /* DNS_BYADDR_H */

Generated on Tue Apr 28 17:40:57 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha