#include <dns/types.h>
Go to the source code of this file.
Defines | |
#define | DNS_BADCACHE_H 1 |
Functions | |
ISC_LANG_BEGINDECLS isc_result_t | dns_badcache_init (isc_mem_t *mctx, unsigned int size, dns_badcache_t **bcp) |
void | dns_badcache_destroy (dns_badcache_t **bcp) |
Allocate and initialize a badcache and store it in '*bcp'. | |
void | dns_badcache_add (dns_badcache_t *bc, dns_name_t *name, dns_rdatatype_t type, isc_boolean_t update, isc_uint32_t flags, isc_time_t *expire) |
Flush and then free badcache in 'bcp'. '*bcp' is set to NULL on return. | |
isc_boolean_t | dns_badcache_find (dns_badcache_t *bc, dns_name_t *name, dns_rdatatype_t type, isc_uint32_t *flagp, isc_time_t *now) |
Adds a badcache entry to the badcache 'bc' for name 'name' and type 'type'. If an entry already exists, then it will be updated if 'update' is ISC_TRUE. The entry will be stored with flags 'flags' and expiration date 'expire'. | |
void | dns_badcache_flush (dns_badcache_t *bc) |
Returns ISC_TRUE if a record is found in the badcache 'bc' matching 'name' and 'type', with an expiration date later than 'now'. If 'flagp' is not NULL, then '*flagp' is updated to the flags that were stored in the badcache entry. Returns ISC_FALSE if no matching record is found. | |
void | dns_badcache_flushname (dns_badcache_t *bc, dns_name_t *name) |
Flush the entire bad cache. | |
void | dns_badcache_flushtree (dns_badcache_t *bc, dns_name_t *name) |
Flush the bad cache of all entries at 'name'. | |
void | dns_badcache_print (dns_badcache_t *bc, const char *cachename, FILE *fp) |
Flush the bad cache of all entries at or below 'name'. |
Notes:
Resources:
Security:
Standards:
Definition in file badcache.h.
#define DNS_BADCACHE_H 1 |
Definition at line 18 of file badcache.h.
ISC_LANG_BEGINDECLS isc_result_t dns_badcache_init | ( | isc_mem_t * | mctx, | |
unsigned int | size, | |||
dns_badcache_t ** | bcp | |||
) |
Definition at line 67 of file badcache.c.
References BADCACHE_MAGIC, cleanup(), dns_badcache::count, DESTROYLOCK, isc_mem_attach(), isc_mem_get, isc_mem_putanddetach, isc_mutex_init, ISC_R_NOMEMORY, ISC_R_SUCCESS, dns_badcache::lock, dns_badcache::magic, dns_badcache::mctx, dns_badcache::minsize, REQUIRE, dns_badcache::size, dns_badcache::sweep, and dns_badcache::table.
Referenced by dns_resolver_create(), and dns_view_create().
void dns_badcache_destroy | ( | dns_badcache_t ** | bcp | ) |
Allocate and initialize a badcache and store it in '*bcp'.
Requires:
Definition at line 108 of file badcache.c.
References DESTROYLOCK, dns_badcache_flush(), isc_mem_put, isc_mem_putanddetach, dns_badcache::lock, dns_badcache::magic, dns_badcache::mctx, REQUIRE, dns_badcache::size, and dns_badcache::table.
Referenced by destroy().
void dns_badcache_add | ( | dns_badcache_t * | bc, | |
dns_name_t * | name, | |||
dns_rdatatype_t | type, | |||
isc_boolean_t | update, | |||
isc_uint32_t | flags, | |||
isc_time_t * | expire | |||
) |
Flush and then free badcache in 'bcp'. '*bcp' is set to NULL on return.
Requires:
Definition at line 161 of file badcache.c.
References badcache_resize(), buffer, cleanup(), dns_badcache::count, dns_name_copy(), dns_name_equal(), dns_name_hash(), dns_name_init(), dns_bcentry::expire, dns_bcentry::flags, dns_bcentry::hashval, isc_buffer_init, ISC_FALSE, isc_mem_get, isc_mem_put, ISC_R_SUCCESS, isc_time_compare(), isc_time_now(), isc_time_settoepoch(), ISC_TRUE, dns_name::length, dns_badcache::lock, LOCK, dns_badcache::mctx, dns_badcache::minsize, dns_bcentry::name, dns_bcentry::next, now, REQUIRE, dns_badcache::size, dns_badcache::table, dns_bcentry::type, UNLOCK, and VALID_BADCACHE.
Referenced by dns_resolver_addbadcache(), and ns_client_error().
isc_boolean_t dns_badcache_find | ( | dns_badcache_t * | bc, | |
dns_name_t * | name, | |||
dns_rdatatype_t | type, | |||
isc_uint32_t * | flagp, | |||
isc_time_t * | now | |||
) |
Adds a badcache entry to the badcache 'bc' for name 'name' and type 'type'. If an entry already exists, then it will be updated if 'update' is ISC_TRUE. The entry will be stored with flags 'flags' and expiration date 'expire'.
Requires:
Definition at line 231 of file badcache.c.
References answer, dns_badcache::count, dns_name_equal(), dns_name_hash(), dns_bcentry::expire, dns_bcentry::flags, ISC_FALSE, isc_mem_put, isc_time_compare(), ISC_TRUE, dns_name::length, dns_badcache::lock, LOCK, dns_badcache::mctx, dns_bcentry::name, dns_bcentry::next, REQUIRE, dns_badcache::size, dns_badcache::sweep, dns_badcache::table, dns_bcentry::type, UNLOCK, and VALID_BADCACHE.
Referenced by dns_resolver_getbadcache(), and query_find().
void dns_badcache_flush | ( | dns_badcache_t * | bc | ) |
Returns ISC_TRUE if a record is found in the badcache 'bc' matching 'name' and 'type', with an expiration date later than 'now'. If 'flagp' is not NULL, then '*flagp' is updated to the flags that were stored in the badcache entry. Returns ISC_FALSE if no matching record is found.
Requires:
Definition at line 292 of file badcache.c.
References dns_badcache::count, isc_mem_put, dns_name::length, dns_badcache::mctx, dns_bcentry::name, dns_bcentry::next, REQUIRE, dns_badcache::size, dns_badcache::table, and VALID_BADCACHE.
Referenced by dns_badcache_destroy(), dns_resolver_flushbadcache(), and dns_view_flushcache2().
void dns_badcache_flushname | ( | dns_badcache_t * | bc, | |
dns_name_t * | name | |||
) |
Flush the entire bad cache.
Requires:
Definition at line 310 of file badcache.c.
References dns_badcache::count, dns_name_equal(), dns_name_hash(), dns_bcentry::expire, ISC_FALSE, isc_mem_put, ISC_R_SUCCESS, isc_time_compare(), isc_time_now(), isc_time_settoepoch(), dns_name::length, dns_badcache::lock, LOCK, dns_badcache::mctx, dns_bcentry::name, dns_bcentry::next, now, REQUIRE, dns_badcache::size, dns_badcache::table, UNLOCK, and VALID_BADCACHE.
Referenced by dns_resolver_flushbadcache(), and dns_view_flushnode().
void dns_badcache_flushtree | ( | dns_badcache_t * | bc, | |
dns_name_t * | name | |||
) |
Flush the bad cache of all entries at 'name'.
Requires:
Definition at line 347 of file badcache.c.
References dns_badcache::count, dns_name_issubdomain(), dns_bcentry::expire, isc_mem_put, ISC_R_SUCCESS, isc_time_compare(), isc_time_now(), isc_time_settoepoch(), dns_name::length, dns_badcache::lock, LOCK, dns_badcache::mctx, dns_bcentry::name, dns_bcentry::next, now, REQUIRE, dns_badcache::size, dns_badcache::table, UNLOCK, and VALID_BADCACHE.
Referenced by dns_resolver_flushbadnames(), and dns_view_flushnode().
void dns_badcache_print | ( | dns_badcache_t * | bc, | |
const char * | cachename, | |||
FILE * | fp | |||
) |
Flush the bad cache of all entries at or below 'name'.
Requires:
Definition at line 387 of file badcache.c.
References dns_badcache::count, dns_name_format(), DNS_NAME_FORMATSIZE, dns_rdatatype_format(), DNS_RDATATYPE_FORMATSIZE, dns_bcentry::expire, isc_mem_put, ISC_PLATFORM_QUADFORMAT, isc_time_compare(), isc_time_microdiff(), dns_name::length, dns_badcache::lock, LOCK, dns_badcache::mctx, dns_bcentry::name, namebuf, dns_bcentry::next, now, REQUIRE, dns_badcache::size, dns_badcache::table, TIME_NOW, dns_bcentry::type, UNLOCK, and VALID_BADCACHE.
Referenced by dns_resolver_printbadcache(), dns_view_dumpdbtostream(), and dumpdone().