ncache.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004-2010, 2013  Internet Systems Consortium, Inc. ("ISC")
00003  * Copyright (C) 1999-2002  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: ncache.h,v 1.29 2010/05/14 23:50:40 tbox Exp $ */
00019 
00020 #ifndef DNS_NCACHE_H
00021 #define DNS_NCACHE_H 1
00022 
00023 /*****
00024  ***** Module Info
00025  *****/
00026 
00027 /*! \file dns/ncache.h
00028  *\brief
00029  * DNS Ncache
00030  *
00031  * XXX TBS XXX
00032  *
00033  * MP:
00034  *\li   The caller must ensure any required synchronization.
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   RFC2308
00047  */
00048 
00049 #include <isc/lang.h>
00050 #include <isc/stdtime.h>
00051 
00052 #include <dns/types.h>
00053 
00054 ISC_LANG_BEGINDECLS
00055 
00056 /*%
00057  * _OMITDNSSEC:
00058  *      Omit DNSSEC records when rendering.
00059  */
00060 #define DNS_NCACHETOWIRE_OMITDNSSEC   0x0001
00061 
00062 isc_result_t
00063 dns_ncache_add(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
00064                dns_rdatatype_t covers, isc_stdtime_t now, dns_ttl_t maxttl,
00065                dns_rdataset_t *addedrdataset);
00066 isc_result_t
00067 dns_ncache_addoptout(dns_message_t *message, dns_db_t *cache,
00068                      dns_dbnode_t *node, dns_rdatatype_t covers,
00069                      isc_stdtime_t now, dns_ttl_t maxttl,
00070                      isc_boolean_t optout, dns_rdataset_t *addedrdataset);
00071 /*%<
00072  * Convert the authority data from 'message' into a negative cache
00073  * rdataset, and store it in 'cache' at 'node' with a TTL limited to
00074  * 'maxttl'.
00075  *
00076  * \li dns_ncache_add produces a negative cache entry with a trust of no
00077  *     more than answer
00078  * \li dns_ncache_addoptout produces a negative cache entry which will have
00079  *     a trust of secure if all the records that make up the entry are secure.
00080  *
00081  * The 'covers' argument is the RR type whose nonexistence we are caching,
00082  * or dns_rdatatype_any when caching a NXDOMAIN response.
00083  *
00084  * 'optout' indicates a DNS_RDATASETATTR_OPTOUT should be set.
00085  *
00086  * Note:
00087  *\li   If 'addedrdataset' is not NULL, then it will be attached to the added
00088  *      rdataset.  See dns_db_addrdataset() for more details.
00089  *
00090  * Requires:
00091  *\li   'message' is a valid message with a properly formatting negative cache
00092  *      authority section.
00093  *
00094  *\li   The requirements of dns_db_addrdataset() apply to 'cache', 'node',
00095  *      'now', and 'addedrdataset'.
00096  *
00097  * Returns:
00098  *\li   #ISC_R_SUCCESS
00099  *\li   #ISC_R_NOSPACE
00100  *
00101  *\li   Any result code of dns_db_addrdataset() is a possible result code
00102  *      of dns_ncache_add().
00103  */
00104 
00105 isc_result_t
00106 dns_ncache_towire(dns_rdataset_t *rdataset, dns_compress_t *cctx,
00107                   isc_buffer_t *target, unsigned int options,
00108                   unsigned int *countp);
00109 /*%<
00110  * Convert the negative caching rdataset 'rdataset' to wire format,
00111  * compressing names as specified in 'cctx', and storing the result in
00112  * 'target'.  If 'omit_dnssec' is set, DNSSEC records will not
00113  * be added to 'target'.
00114  *
00115  * Notes:
00116  *\li   The number of RRs added to target will be added to *countp.
00117  *
00118  * Requires:
00119  *\li   'rdataset' is a valid negative caching rdataset.
00120  *
00121  *\li   'rdataset' is not empty.
00122  *
00123  *\li   'countp' is a valid pointer.
00124  *
00125  * Ensures:
00126  *\li   On a return of ISC_R_SUCCESS, 'target' contains a wire format
00127  *      for the data contained in 'rdataset'.  Any error return leaves
00128  *      the buffer unchanged.
00129  *
00130  *\li   *countp has been incremented by the number of RRs added to
00131  *      target.
00132  *
00133  * Returns:
00134  *\li   #ISC_R_SUCCESS          - all ok
00135  *\li   #ISC_R_NOSPACE          - 'target' doesn't have enough room
00136  *
00137  *\li   Any error returned by dns_rdata_towire(), dns_rdataset_next(),
00138  *      dns_name_towire().
00139  */
00140 
00141 isc_result_t
00142 dns_ncache_getrdataset(dns_rdataset_t *ncacherdataset, dns_name_t *name,
00143                        dns_rdatatype_t type, dns_rdataset_t *rdataset);
00144 /*%<
00145  * Search the negative caching rdataset for an rdataset with the
00146  * specified name and type.
00147  *
00148  * Requires:
00149  *\li   'ncacherdataset' is a valid negative caching rdataset.
00150  *
00151  *\li   'ncacherdataset' is not empty.
00152  *
00153  *\li   'name' is a valid name.
00154  *
00155  *\li   'type' is not SIG, or a meta-RR type.
00156  *
00157  *\li   'rdataset' is a valid disassociated rdataset.
00158  *
00159  * Ensures:
00160  *\li   On a return of ISC_R_SUCCESS, 'rdataset' is bound to the found
00161  *      rdataset.
00162  *
00163  * Returns:
00164  *\li   #ISC_R_SUCCESS          - the rdataset was found.
00165  *\li   #ISC_R_NOTFOUND         - the rdataset was not found.
00166  *
00167  */
00168 
00169 isc_result_t
00170 dns_ncache_getsigrdataset(dns_rdataset_t *ncacherdataset, dns_name_t *name,
00171                           dns_rdatatype_t covers, dns_rdataset_t *rdataset);
00172 /*%<
00173  * Similar to dns_ncache_getrdataset() but get the rrsig that matches.
00174  */
00175 
00176 void
00177 dns_ncache_current(dns_rdataset_t *ncacherdataset, dns_name_t *found,
00178                    dns_rdataset_t *rdataset);
00179 
00180 /*%<
00181  * Extract the current rdataset and name from a ncache entry.
00182  *
00183  * Requires:
00184  * \li  'ncacherdataset' to be valid and to be a negative cache entry
00185  * \li  'found' to be valid.
00186  * \li  'rdataset' to be unassociated.
00187  */
00188 
00189 ISC_LANG_ENDDECLS
00190 
00191 #endif /* DNS_NCACHE_H */

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