Defines the functionality associated with a DNS cache.
More...
#include <dnscache.h>
|
| | Cache () |
| | Default constructor. More...
|
| |
| | ~Cache () |
| | Class destructor. More...
|
| |
| Void | addNamedServer (const char *address, int udp_port=53, int tcp_port=53) |
| | Adds a named server to this DNS cache object. More...
|
| |
| Void | removeNamedServer (const char *address) |
| | Removes the specified named server from this DNS cache. More...
|
| |
| Void | applyNamedServers () |
| | Updates the named servers as a set in the underlying c-ares library. More...
|
| |
| QueryPtr | query (ns_type rtype, const std::string &domain, Bool &cacheHit, Bool ignorecache=false) |
| | Performs a DNS query synchronously. More...
|
| |
| Void | query (ns_type rtype, const std::string &domain, CachedDNSQueryCallback cb, const Void *data=NULL, Bool ignorecache=false) |
| | Performs a DNS query asynchronously. More...
|
| |
| Void | loadQueries (const char *qfn) |
| | Executes the DNS queries at startup from the suppoied file. More...
|
| |
| Void | loadQueries (const std::string &qfn) |
| | Executes the DNS queries at startup from the suppoied file. More...
|
| |
| Void | initSaveQueries (const char *qfn, long qsf) |
| | Initializes the settings used to save queries. More...
|
| |
| Void | saveQueries () |
| | Saves the DNS queries that are part of the cache. More...
|
| |
| Void | forceRefresh () |
| | Forces a refresh of the DNS cache. More...
|
| |
| namedserverid_t | getNamedServerId () |
| | Retrieves the named server ID associated with this DNS cache. More...
|
| |
| long | resetNewQueryCount () |
| | Resets the number of new queries (not saved) to zero. More...
|
| |
Defines the functionality associated with a DNS cache.
◆ Cache()
◆ ~Cache()
◆ addNamedServer()
| Void DNS::Cache::addNamedServer |
( |
const char * |
address, |
|
|
int |
udp_port = 53, |
|
|
int |
tcp_port = 53 |
|
) |
| |
Adds a named server to this DNS cache object.
- Parameters
-
| address | the address of the named server. |
| udp_port | the UDP port to communicate with the DNS server on. |
| tcp_port | the TCP port to communicate with the DNS server on. |
◆ applyNamedServers()
| Void DNS::Cache::applyNamedServers |
( |
| ) |
|
Updates the named servers as a set in the underlying c-ares library.
◆ forceRefresh()
| Void DNS::Cache::forceRefresh |
( |
| ) |
|
Forces a refresh of the DNS cache.
◆ getInstance() [1/2]
| static Cache& DNS::Cache::getInstance |
( |
| ) |
|
|
inlinestatic |
Retrieves/creates the default Cache instance.
- Returns
- a reference to the Cache object.
◆ getInstance() [2/2]
| Cache & DNS::Cache::getInstance |
( |
namedserverid_t |
nsid | ) |
|
|
static |
Retrieves/creates the Cache instance associated with the named server ID.
- Parameters
-
- Returns
- a reference to the Cache object.
◆ getNamedServerId()
| namedserverid_t DNS::Cache::getNamedServerId |
( |
| ) |
|
|
inline |
Retrieves the named server ID associated with this DNS cache.
- Returns
- the named server ID associated with this DNS cache.
◆ getRefeshInterval()
| static long DNS::Cache::getRefeshInterval |
( |
| ) |
|
|
inlinestatic |
Retrieves the refresh interval.
- Returns
- the refresh interval.
◆ getRefreshConcurrent()
| static unsigned int DNS::Cache::getRefreshConcurrent |
( |
| ) |
|
|
inlinestatic |
Retrieves the current setting of the maximum number of conncurrent DNS queries that can be performed while refreshing the DNS cache.
◆ getRefreshPercent()
| static int DNS::Cache::getRefreshPercent |
( |
| ) |
|
|
inlinestatic |
Retrieves the current refresh percentage value.
- Returns
- the current refresh percenting value.
◆ initSaveQueries()
| Void DNS::Cache::initSaveQueries |
( |
const char * |
qfn, |
|
|
long |
qsf |
|
) |
| |
Initializes the settings used to save queries.
- Parameters
-
| qfn | the file name to save the DNS queries to. |
| qsf | the frequency in milliseconds to save the DNS queries. |
◆ loadQueries() [1/2]
| Void DNS::Cache::loadQueries |
( |
const char * |
qfn | ) |
|
Executes the DNS queries at startup from the suppoied file.
- Parameters
-
| qfn | the DNS query file name to load. |
◆ loadQueries() [2/2]
| Void DNS::Cache::loadQueries |
( |
const std::string & |
qfn | ) |
|
|
inline |
Executes the DNS queries at startup from the suppoied file.
- Parameters
-
| qfn | the DNS query file name to load. |
◆ query() [1/2]
| QueryPtr DNS::Cache::query |
( |
ns_type |
rtype, |
|
|
const std::string & |
domain, |
|
|
Bool & |
cacheHit, |
|
|
Bool |
ignorecache = false |
|
) |
| |
Performs a DNS query synchronously.
- Parameters
-
| rtype | the named server type of the query. |
| domain | the domain name of the query. |
| cacheHit | updated with an indication if the result came from the local DNS cache. |
| ignorecache | directs the query to optionally ignore any results in the local DNS cache. |
- Returns
- a QueryPtr with the DNS query results.
◆ query() [2/2]
| Void DNS::Cache::query |
( |
ns_type |
rtype, |
|
|
const std::string & |
domain, |
|
|
CachedDNSQueryCallback |
cb, |
|
|
const Void * |
data = NULL, |
|
|
Bool |
ignorecache = false |
|
) |
| |
Performs a DNS query asynchronously.
- Parameters
-
| rtype | the named server type of the query. |
| domain | the domain name of the query. |
| cb | a callback function pointer that will be called when the query is complete. |
| data | a Void pointer that will be passed to the callback function when the query is complete. |
| ignorecache | directs the query to optionally ignore any results in the local DNS cache. |
◆ removeNamedServer()
| Void DNS::Cache::removeNamedServer |
( |
const char * |
address | ) |
|
Removes the specified named server from this DNS cache.
- Parameters
-
| address | the address of the named server to remove. |
◆ resetNewQueryCount()
| long DNS::Cache::resetNewQueryCount |
( |
| ) |
|
|
inline |
Resets the number of new queries (not saved) to zero.
- Returns
- the previous the number of new queries (not saved).
◆ saveQueries()
| Void DNS::Cache::saveQueries |
( |
| ) |
|
Saves the DNS queries that are part of the cache.
◆ setRefreshConcurrent()
| static unsigned int DNS::Cache::setRefreshConcurrent |
( |
unsigned int |
concur | ) |
|
|
inlinestatic |
Sets the maximum number of conncurrent DNS queries that can be performed while refreshing the DNS cache.
- Parameters
-
| concur | the maximum number of concurrent DNS queries. |
- Returns
- the current maximum number of concurrent DNS queries.
◆ setRefreshInterval()
| static long DNS::Cache::setRefreshInterval |
( |
long |
interval | ) |
|
|
inlinestatic |
Assigns the refresh interval.
- Parameters
-
| interval | the new refresh interval. |
- Returns
- the refresh interval.
◆ setRefreshPercent()
| static int DNS::Cache::setRefreshPercent |
( |
int |
percent | ) |
|
|
inlinestatic |
Assigns the refresh percentage value.
- Parameters
-
| percent | the refresh percentage value. |
- Returns
- the refresh percenting value.
The documentation for this class was generated from the following files: