unbound 0.1
cachedb.h File Reference

This file contains a module that uses an external database to cache dns responses. More...

#include "util/module.h"

Data Structures

struct  cachedb_env
 The global variable environment contents for the cachedb Shared between threads, this represents long term information. More...
struct  cachedb_qstate
 Per query state for the cachedb module. More...
struct  cachedb_backend
 Backend call routines. More...

Macros

#define CACHEDB_HASHSIZE   256

Functions

int cachedb_init (struct module_env *env, int id)
 Init the cachedb module.
void cachedb_deinit (struct module_env *env, int id)
 Deinit the cachedb module.
void cachedb_operate (struct module_qstate *qstate, enum module_ev event, int id, struct outbound_entry *outbound)
 Operate on an event on a query (in qstate).
void cachedb_inform_super (struct module_qstate *qstate, int id, struct module_qstate *super)
 Subordinate query done, inform this super request of its conclusion.
void cachedb_clear (struct module_qstate *qstate, int id)
 clear the cachedb query-specific contents out of qstate
size_t cachedb_get_mem (struct module_env *env, int id)
 return memory estimate for cachedb module
struct module_func_block * cachedb_get_funcblock (void)
 Get the function block with pointers to the cachedb functions.
int cachedb_is_enabled (struct module_stack *mods, struct module_env *env)
 See if the cachedb is enabled.
void cachedb_msg_remove (struct module_qstate *qstate)
 Remove a message from the global cache.
void cachedb_msg_remove_qinfo (struct module_env *env, struct query_info *qinfo)
 Remove message from the cachedb cache, by query info.

Detailed Description

This file contains a module that uses an external database to cache dns responses.

Function Documentation

◆ cachedb_init()

int cachedb_init ( struct module_env * env,
int id )

Init the cachedb module.

References cachedb_init().

Referenced by cachedb_init(), and fptr_whitelist_mod_init().

◆ cachedb_deinit()

void cachedb_deinit ( struct module_env * env,
int id )

Deinit the cachedb module.

References cachedb_deinit().

Referenced by cachedb_deinit(), and fptr_whitelist_mod_deinit().

◆ cachedb_operate()

void cachedb_operate ( struct module_qstate * qstate,
enum module_ev event,
int id,
struct outbound_entry * outbound )

Operate on an event on a query (in qstate).

References cachedb_operate().

Referenced by cachedb_operate(), and fptr_whitelist_mod_operate().

◆ cachedb_inform_super()

void cachedb_inform_super ( struct module_qstate * qstate,
int id,
struct module_qstate * super )

Subordinate query done, inform this super request of its conclusion.

References cachedb_inform_super().

Referenced by cachedb_inform_super(), and fptr_whitelist_mod_inform_super().

◆ cachedb_clear()

void cachedb_clear ( struct module_qstate * qstate,
int id )

clear the cachedb query-specific contents out of qstate

References cachedb_clear().

Referenced by cachedb_clear(), and fptr_whitelist_mod_clear().

◆ cachedb_get_mem()

size_t cachedb_get_mem ( struct module_env * env,
int id )

return memory estimate for cachedb module

References cachedb_get_mem().

Referenced by cachedb_get_mem(), and fptr_whitelist_mod_get_mem().

◆ cachedb_get_funcblock()

struct module_func_block * cachedb_get_funcblock ( void )

Get the function block with pointers to the cachedb functions.

Returns
the function block for "cachedb".

References cachedb_get_funcblock().

Referenced by cachedb_get_funcblock(), and module_funcs_avail().

◆ cachedb_is_enabled()

int cachedb_is_enabled ( struct module_stack * mods,
struct module_env * env )

See if the cachedb is enabled.

Parameters
modsmodule stack. It finds the cachedb module environment.
envmodule environment.
Returns
true if exists and enabled.

References cachedb_is_enabled().

Referenced by cachedb_is_enabled(), daemon_fork(), and fr_reload_config().

◆ cachedb_msg_remove()

void cachedb_msg_remove ( struct module_qstate * qstate)

Remove a message from the global cache.

Because edns subnet has a more specific entry, and if not removed when everything expires, the global entry is used, instead of a fresh lookup of the edns subnet entry.

Parameters
qstatequery state.

References cachedb_msg_remove().

Referenced by cachedb_msg_remove().

◆ cachedb_msg_remove_qinfo()

void cachedb_msg_remove_qinfo ( struct module_env * env,
struct query_info * qinfo )

Remove message from the cachedb cache, by query info.

Parameters
envmodule environment to look up cachedb state.
qinfothe message to remove.

References cachedb_msg_remove_qinfo().

Referenced by bogus_del_msg(), cachedb_msg_remove_qinfo(), do_cache_remove(), negative_del_msg(), and zone_del_msg().