home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / dns / ncache.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-09-17  |  4.2 KB  |  160 lines

  1. /*
  2.  * Copyright (C) 2004, 2005  Internet Systems Consortium, Inc. ("ISC")
  3.  * Copyright (C) 1999-2002  Internet Software Consortium.
  4.  *
  5.  * Permission to use, copy, modify, and distribute this software for any
  6.  * purpose with or without fee is hereby granted, provided that the above
  7.  * copyright notice and this permission notice appear in all copies.
  8.  *
  9.  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  10.  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  11.  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  12.  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  13.  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  14.  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15.  * PERFORMANCE OF THIS SOFTWARE.
  16.  */
  17.  
  18. /* $Id: ncache.h,v 1.17.18.2 2005/04/29 00:16:16 marka Exp $ */
  19.  
  20. #ifndef DNS_NCACHE_H
  21. #define DNS_NCACHE_H 1
  22.  
  23. /*****
  24.  ***** Module Info
  25.  *****/
  26.  
  27. /*! \file
  28.  *\brief
  29.  * DNS Ncache
  30.  *
  31.  * XXX TBS XXX
  32.  *
  33.  * MP:
  34.  *\li    The caller must ensure any required synchronization.
  35.  *
  36.  * Reliability:
  37.  *\li    No anticipated impact.
  38.  *
  39.  * Resources:
  40.  *\li    TBS
  41.  *
  42.  * Security:
  43.  *\li    No anticipated impact.
  44.  *
  45.  * Standards:
  46.  *\li    RFC2308
  47.  */
  48.  
  49. #include <isc/lang.h>
  50. #include <isc/stdtime.h>
  51.  
  52. #include <dns/types.h>
  53.  
  54. ISC_LANG_BEGINDECLS
  55.  
  56. /*%
  57.  * _OMITDNSSEC:
  58.  *      Omit DNSSEC records when rendering.
  59.  */
  60. #define DNS_NCACHETOWIRE_OMITDNSSEC   0x0001
  61.  
  62. isc_result_t
  63. dns_ncache_add(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
  64.            dns_rdatatype_t covers, isc_stdtime_t now, dns_ttl_t maxttl,
  65.            dns_rdataset_t *addedrdataset);
  66. /*%<
  67.  * Convert the authority data from 'message' into a negative cache
  68.  * rdataset, and store it in 'cache' at 'node' with a TTL limited to
  69.  * 'maxttl'.
  70.  *
  71.  * The 'covers' argument is the RR type whose nonexistence we are caching,
  72.  * or dns_rdatatype_any when caching a NXDOMAIN response.
  73.  *
  74.  * Note:
  75.  *\li    If 'addedrdataset' is not NULL, then it will be attached to the added
  76.  *    rdataset.  See dns_db_addrdataset() for more details.
  77.  *
  78.  * Requires:
  79.  *\li    'message' is a valid message with a properly formatting negative cache
  80.  *    authority section.
  81.  *
  82.  *\li    The requirements of dns_db_addrdataset() apply to 'cache', 'node',
  83.  *    'now', and 'addedrdataset'.
  84.  *
  85.  * Returns:
  86.  *\li    #ISC_R_SUCCESS
  87.  *\li    #ISC_R_NOSPACE
  88.  *
  89.  *\li    Any result code of dns_db_addrdataset() is a possible result code
  90.  *    of dns_ncache_add().
  91.  */
  92.  
  93. isc_result_t
  94. dns_ncache_towire(dns_rdataset_t *rdataset, dns_compress_t *cctx,
  95.           isc_buffer_t *target, unsigned int options,
  96.           unsigned int *countp);
  97. /*%<
  98.  * Convert the negative caching rdataset 'rdataset' to wire format,
  99.  * compressing names as specified in 'cctx', and storing the result in
  100.  * 'target'.  If 'omit_dnssec' is set, DNSSEC records will not
  101.  * be added to 'target'.
  102.  *
  103.  * Notes:
  104.  *\li    The number of RRs added to target will be added to *countp.
  105.  *
  106.  * Requires:
  107.  *\li    'rdataset' is a valid negative caching rdataset.
  108.  *
  109.  *\li    'rdataset' is not empty.
  110.  *
  111.  *\li    'countp' is a valid pointer.
  112.  *
  113.  * Ensures:
  114.  *\li    On a return of ISC_R_SUCCESS, 'target' contains a wire format
  115.  *    for the data contained in 'rdataset'.  Any error return leaves
  116.  *    the buffer unchanged.
  117.  *
  118.  *\li    *countp has been incremented by the number of RRs added to
  119.  *    target.
  120.  *
  121.  * Returns:
  122.  *\li    #ISC_R_SUCCESS        - all ok
  123.  *\li    #ISC_R_NOSPACE        - 'target' doesn't have enough room
  124.  *
  125.  *\li    Any error returned by dns_rdata_towire(), dns_rdataset_next(),
  126.  *    dns_name_towire().
  127.  */
  128.  
  129. isc_result_t
  130. dns_ncache_getrdataset(dns_rdataset_t *ncacherdataset, dns_name_t *name,
  131.                dns_rdatatype_t type, dns_rdataset_t *rdataset);
  132. /*%<
  133.  * Search the negative caching rdataset for an rdataset with the
  134.  * specified name and type.
  135.  *
  136.  * Requires:
  137.  *\li    'ncacherdataset' is a valid negative caching rdataset.
  138.  *
  139.  *\li    'ncacherdataset' is not empty.
  140.  *
  141.  *\li    'name' is a valid name.
  142.  *
  143.  *\li    'type' is not SIG, or a meta-RR type.
  144.  *
  145.  *\li    'rdataset' is a valid disassociated rdataset.
  146.  *
  147.  * Ensures:
  148.  *\li    On a return of ISC_R_SUCCESS, 'rdataset' is bound to the found
  149.  *    rdataset.
  150.  *
  151.  * Returns:
  152.  *\li    #ISC_R_SUCCESS        - the rdataset was found.
  153.  *\li    #ISC_R_NOTFOUND        - the rdataset was not found.
  154.  *
  155.  */
  156.  
  157. ISC_LANG_ENDDECLS
  158.  
  159. #endif /* DNS_NCACHE_H */
  160.