"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.16.7/lib/dns/include/dns/badcache.h" (4 Sep 2020, 3386 Bytes) of package /linux/misc/dns/bind9/9.16.7/bind-9.16.7.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "badcache.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
    3  *
    4  * This Source Code Form is subject to the terms of the Mozilla Public
    5  * License, v. 2.0. If a copy of the MPL was not distributed with this
    6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    7  *
    8  * See the COPYRIGHT file distributed with this work for additional
    9  * information regarding copyright ownership.
   10  */
   11 
   12 #ifndef DNS_BADCACHE_H
   13 #define DNS_BADCACHE_H 1
   14 
   15 /*****
   16 ***** Module Info
   17 *****/
   18 
   19 /*! \file dns/badcache.h
   20  * \brief
   21  * Defines dns_badcache_t, the "bad cache" object.
   22  *
   23  * Notes:
   24  *\li   A bad cache object is a hash table of name/type tuples,
   25  *  indicating whether a given tuple known to be "bad" in some
   26  *  sense (e.g., queries for that name and type have been
   27  *  returning SERVFAIL). This is used for both the "bad server
   28  *  cache" in the resolver and for the "servfail cache" in
   29  *  the view.
   30  *
   31  * Reliability:
   32  *
   33  * Resources:
   34  *
   35  * Security:
   36  *
   37  * Standards:
   38  */
   39 
   40 /***
   41  ***    Imports
   42  ***/
   43 
   44 #include <inttypes.h>
   45 #include <stdbool.h>
   46 
   47 #include <dns/types.h>
   48 
   49 ISC_LANG_BEGINDECLS
   50 
   51 /***
   52  ***    Functions
   53  ***/
   54 
   55 isc_result_t
   56 dns_badcache_init(isc_mem_t *mctx, unsigned int size, dns_badcache_t **bcp);
   57 /*%
   58  * Allocate and initialize a badcache and store it in '*bcp'.
   59  *
   60  * Requires:
   61  * \li  mctx != NULL
   62  * \li  bcp != NULL
   63  * \li  *bcp == NULL
   64  */
   65 
   66 void
   67 dns_badcache_destroy(dns_badcache_t **bcp);
   68 /*%
   69  * Flush and then free badcache in 'bcp'. '*bcp' is set to NULL on return.
   70  *
   71  * Requires:
   72  * \li  '*bcp' to be a valid badcache
   73  */
   74 
   75 void
   76 dns_badcache_add(dns_badcache_t *bc, const dns_name_t *name,
   77          dns_rdatatype_t type, bool update, uint32_t flags,
   78          isc_time_t *expire);
   79 /*%
   80  * Adds a badcache entry to the badcache 'bc' for name 'name' and
   81  * type 'type'.  If an entry already exists, then it will be updated if
   82  * 'update' is true.  The entry will be stored with flags 'flags'
   83  * and expiration date 'expire'.
   84  *
   85  * Requires:
   86  * \li  bc to be a valid badcache.
   87  * \li  name != NULL
   88  * \li  expire != NULL
   89  */
   90 
   91 bool
   92 dns_badcache_find(dns_badcache_t *bc, const dns_name_t *name,
   93           dns_rdatatype_t type, uint32_t *flagp, isc_time_t *now);
   94 /*%
   95  * Returns true if a record is found in the badcache 'bc' matching
   96  * 'name' and 'type', with an expiration date later than 'now'.
   97  * If 'flagp' is not NULL, then '*flagp' is updated to the flags
   98  * that were stored in the badcache entry.  Returns false if
   99  * no matching record is found.
  100  *
  101  * Requires:
  102  * \li  bc to be a valid badcache.
  103  * \li  name != NULL
  104  * \li  now != NULL
  105  */
  106 
  107 void
  108 dns_badcache_flush(dns_badcache_t *bc);
  109 /*%
  110  * Flush the entire bad cache.
  111  *
  112  * Requires:
  113  * \li  bc to be a valid badcache
  114  */
  115 
  116 void
  117 dns_badcache_flushname(dns_badcache_t *bc, const dns_name_t *name);
  118 /*%
  119  * Flush the bad cache of all entries at 'name'.
  120  *
  121  * Requires:
  122  * \li  bc to be a valid badcache
  123  * \li  name != NULL
  124  */
  125 
  126 void
  127 dns_badcache_flushtree(dns_badcache_t *bc, const dns_name_t *name);
  128 /*%
  129  * Flush the bad cache of all entries at or below 'name'.
  130  *
  131  * Requires:
  132  * \li  bc to be a valid badcache
  133  * \li  name != NULL
  134  */
  135 
  136 void
  137 dns_badcache_print(dns_badcache_t *bc, const char *cachename, FILE *fp);
  138 /*%
  139  * Print the contents of badcache 'bc' (headed by the title 'cachename')
  140  * to file pointer 'fp'.
  141  *
  142  * Requires:
  143  * \li  bc to be a valid badcache
  144  * \li  cachename != NULL
  145  * \li  fp != NULL
  146  */
  147 
  148 ISC_LANG_ENDDECLS
  149 
  150 #endif /* DNS_BADCACHE_H */