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