badcache.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2014  Internet Systems Consortium, Inc. ("ISC")
00003  *
00004  * Permission to use, copy, modify, and/or distribute this software for any
00005  * purpose with or without fee is hereby granted, provided that the above
00006  * copyright notice and this permission notice appear in all copies.
00007  *
00008  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
00009  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00010  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
00011  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00012  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00013  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00014  * PERFORMANCE OF THIS SOFTWARE.
00015  */
00016 
00017 #ifndef DNS_BADCACHE_H
00018 #define DNS_BADCACHE_H 1
00019 
00020 /*****
00021  ***** Module Info
00022  *****/
00023 
00024 /*! \file dns/badcache.h
00025  * \brief
00026  * Defines dns_badcache_t, the "bad cache" object.
00027  *
00028  * Notes:
00029  *\li   A bad cache object is a hash table of name/type tuples,
00030  *      indicating whether a given tuple known to be "bad" in some
00031  *      sense (e.g., queries for that name and type have been
00032  *      returning SERVFAIL). This is used for both the "bad server
00033  *      cache" in the resolver and for the "servfail cache" in
00034  *      the view.
00035  *
00036  * Reliability:
00037  *
00038  * Resources:
00039  *
00040  * Security:
00041  *
00042  * Standards:
00043  */
00044 
00045 /***
00046  ***    Imports
00047  ***/
00048 
00049 #include <dns/types.h>
00050 
00051 ISC_LANG_BEGINDECLS
00052 
00053 /***
00054  ***    Functions
00055  ***/
00056 
00057 isc_result_t
00058 dns_badcache_init(isc_mem_t *mctx, unsigned int size, dns_badcache_t **bcp);
00059 /*%
00060  * Allocate and initialize a badcache and store it in '*bcp'.
00061  *
00062  * Requires:
00063  * \li  mctx != NULL
00064  * \li  bcp != NULL
00065  * \li  *bcp == NULL
00066  */
00067 
00068 void
00069 dns_badcache_destroy(dns_badcache_t **bcp);
00070 /*%
00071  * Flush and then free badcache in 'bcp'. '*bcp' is set to NULL on return.
00072  *
00073  * Requires:
00074  * \li  '*bcp' to be a valid badcache
00075  */
00076 
00077 void
00078 dns_badcache_add(dns_badcache_t *bc, dns_name_t *name,
00079                  dns_rdatatype_t type, isc_boolean_t update,
00080                  isc_uint32_t flags, isc_time_t *expire);
00081 /*%
00082  * Adds a badcache entry to the badcache 'bc' for name 'name' and
00083  * type 'type'.  If an entry already exists, then it will be updated if
00084  * 'update' is ISC_TRUE.  The entry will be stored with flags 'flags'
00085  * and expiration date 'expire'.
00086  *
00087  * Requires:
00088  * \li  bc to be a valid badcache.
00089  * \li  name != NULL
00090  * \li  expire != NULL
00091  */
00092 
00093 isc_boolean_t
00094 dns_badcache_find(dns_badcache_t *bc, dns_name_t *name,
00095                   dns_rdatatype_t type, isc_uint32_t *flagp,
00096                   isc_time_t *now);
00097 /*%
00098  * Returns ISC_TRUE if a record is found in the badcache 'bc' matching
00099  * 'name' and 'type', with an expiration date later than 'now'.
00100  * If 'flagp' is not NULL, then '*flagp' is updated to the flags
00101  * that were stored in the badcache entry.  Returns ISC_FALSE if
00102  * no matching record is found.
00103  *
00104  * Requires:
00105  * \li  bc to be a valid badcache.
00106  * \li  name != NULL
00107  * \li  now != NULL
00108  */
00109 
00110 void
00111 dns_badcache_flush(dns_badcache_t *bc);
00112 /*%
00113  * Flush the entire bad cache.
00114  *
00115  * Requires:
00116  * \li  bc to be a valid badcache
00117  */
00118 
00119 void
00120 dns_badcache_flushname(dns_badcache_t *bc, dns_name_t *name);
00121 /*%
00122  * Flush the bad cache of all entries at 'name'.
00123  *
00124  * Requires:
00125  * \li  bc to be a valid badcache
00126  * \li  name != NULL
00127  */
00128 
00129 void
00130 dns_badcache_flushtree(dns_badcache_t *bc, dns_name_t *name);
00131 /*%
00132  * Flush the bad cache of all entries at or below 'name'.
00133  *
00134  * Requires:
00135  * \li  bc to be a valid badcache
00136  * \li  name != NULL
00137  */
00138 
00139 void
00140 dns_badcache_print(dns_badcache_t *bc, const char *cachename, FILE *fp);
00141 /*%
00142  * Print the contents of badcache 'bc' (headed by the title 'cachename')
00143  * to file pointer 'fp'.
00144  *
00145  * Requires:
00146  * \li  bc to be a valid badcache
00147  * \li  cachename != NULL
00148  * \li  fp != NULL
00149  */
00150 
00151 ISC_LANG_ENDDECLS
00152 
00153 #endif /* DNS_BADCACHE_H */

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