|
Squid Web Cache master
|
Modules | |
| IP Cache Internals | |
Classes | |
| class | ipcache_entry |
Functions | |
| void | ipcache_purgelru (void *) |
| void | ipcache_nbgethostbyname (const char *name, IPH *handler, void *handlerData) |
| void | ipcache_init (void) |
| const ipcache_addrs * | ipcache_gethostbyname (const char *name, int flags) |
| void | ipcacheInvalidate (const char *name) |
| void | ipcacheInvalidateNegative (const char *name) |
| static const Dns::CachedIps * | ipcacheCheckNumeric (const char *name) |
| void | ipcacheMarkGoodAddr (const char *name, const Ip::Address &addr) |
| void | ipcache_restart (void) |
| int | ipcacheAddEntryFromHosts (const char *name, const char *ipaddr) |
| variable_list * | snmp_netIpFn (variable_list *Var, snint *ErrP) |
| const ipcache_addrs * ipcache_gethostbyname | ( | const char * | name, |
| int | flags | ||
| ) |
Is different from ipcache_nbgethostbyname in that it only checks if an entry exists in the cache and does not by default contact the DNS, unless this is requested, by setting the flags.
| name | Host name to resolve. |
| flags | Default is NULL, set to IP_LOOKUP_IF_MISS to explicitly perform DNS lookups. |
| NULL | An error occurred during lookup |
| NULL | No results available in cache and no lookup specified |
| * | Pointer to the ipcahce_addrs structure containing the lookup results |
Definition at line 729 of file ipcache.cc.
References ipcache_entry::addrs, asHex(), assert, debugs, ipcache_entry::flags, _ipcache_stats::hits, IP_LOOKUP_IF_MISS, ipcache_get(), ipcache_nbgethostbyname(), ipcacheCheckNumeric(), ipcacheExpiredEntry(), ipcacheRelease(), IpcacheStats, ipcache_entry::lastref, _ipcache_stats::misses, _ipcache_stats::negative_hits, ipcache_entry::Flags::negcached, _ipcache_stats::numeric_hits, _ipcache_stats::requests, and squid_curtime.
Referenced by ACLDestinationIP::match(), and netdbClosestParent().
| void ipcache_init | ( | void | ) |
Initialize the ipcache. Is called from mainInitialize() after disk initialization and prior to the reverse FQDNCache initialization
Definition at line 696 of file ipcache.cc.
References Config, debugs, hash4, hash_create(), hashPrime(), SquidConfig::high, Important, ip_table, SquidConfig::ipcache, ipcache_high, ipcache_low, ipcacheRegisterWithCacheManager(), IpcacheStats, SquidConfig::low, lru_list, and SquidConfig::size.
Referenced by mainInitialize().
| void ipcache_nbgethostbyname | ( | const char * | name, |
| IPH * | handler, | ||
| void * | handlerData | ||
| ) |
| name | Host to resolve. |
| handler | Pointer to the function to be called when the reply from the IP cache (or the DNS if the IP cache misses) |
| handlerData | Information that is passed to the handler and does not affect the IP cache. |
XXX: on hits and some errors, the handler is called immediately instead of scheduling an async call. This reentrant behavior means that the user job must be extra careful after calling ipcache_nbgethostbyname, especially if the handler destroys the job. Moreover, the job has no way of knowing whether the reentrant call happened. Comm::Connection setup usually protects the job by scheduling an async call, but some user code calls ipcache_nbgethostbyname directly.
Definition at line 609 of file ipcache.cc.
References debugs, and ipcache_nbgethostbyname_().
Referenced by ClientRequestContext::hostHeaderVerify(), icpIncomingConnectionOpened(), ipcache_gethostbyname(), netdbPingSite(), Adaptation::Icap::Xaction::openConnection(), peerAlive(), peerDnsRefreshStart(), and ACLDestinationIP::StartLookup().
| void ipcache_purgelru | ( | void * | ) |
Definition at line 353 of file ipcache.cc.
References dlink_node::data, debugs, eventAdd(), ipcache_low, ipcache_purgelru(), ipcacheCount(), ipcacheRelease(), ipcache_entry::locks, lru_list, dlink_node::prev, and dlink_list::tail.
Referenced by ipcache_purgelru(), and mainInitialize().
| void ipcache_restart | ( | void | ) |
Recalculate IP cache size upon reconfigure. Is called to clear the IPCache's data structures, cancel all pending requests.
Definition at line 1105 of file ipcache.cc.
References Config, SquidConfig::high, SquidConfig::ipcache, ipcache_high, ipcache_low, SquidConfig::low, purge_entries_fromhosts(), and SquidConfig::size.
Referenced by mainReconfigureFinish().
| int ipcacheAddEntryFromHosts | ( | const char * | name, |
| const char * | ipaddr | ||
| ) |
Adds a "static" entry from /etc/hosts
| name | Hostname to be linked with IP |
| ipaddr | IP Address to be cached. |
| 0 | Success. |
| 1 | IP address is invalid or other error. |
Definition at line 1126 of file ipcache.cc.
References ipcache_entry::addrs, DBG_IMPORTANT, debugs, ipcache_entry::flags, ipcache_entry::Flags::fromhosts, ipcache_get(), ipcacheAddEntry(), ipcacheLockEntry(), ipcacheRelease(), ipcacheUnlockEntry(), Ip::Address::isIPv6(), ipcache_entry::locks, and Dns::CachedIps::pushUnique().
Referenced by parseEtcHosts().
|
static |
Definition at line 900 of file ipcache.cc.
References debugs, Ip::Address::fromHost(), and Dns::CachedIps::reset().
Referenced by ipcache_gethostbyname(), and ipcache_nbgethostbyname_().
| void ipcacheInvalidate | ( | const char * | name | ) |
Definition at line 865 of file ipcache.cc.
References ipcache_entry::expires, ipcache_get(), and squid_curtime.
Referenced by clientReplyContext::purgeRequest().
| void ipcacheInvalidateNegative | ( | const char * | name | ) |
Definition at line 882 of file ipcache.cc.
References ipcache_entry::expires, ipcache_entry::flags, ipcache_get(), ipcache_entry::Flags::negcached, and squid_curtime.
Referenced by clientReplyContext::identifyFoundObject().
| void ipcacheMarkGoodAddr | ( | const char * | name, |
| const Ip::Address & | addr | ||
| ) |
Definition at line 1077 of file ipcache.cc.
References ipcache_get().
Referenced by Comm::ConnOpener::sendAnswer().
| variable_list * snmp_netIpFn | ( | variable_list * | Var, |
| snint * | ErrP | ||
| ) |
The function to return the ip cache statistics to via SNMP
Definition at line 1173 of file ipcache.cc.
References assert, debugs, _ipcache_stats::hits, IP_ENT, IP_GHBN, IP_HITS, IP_LOC, IP_MISS, IP_NEGHIT, IP_PENDHIT, IP_REQ, ipcacheCount(), IpcacheStats, LEN_SQ_NET, _ipcache_stats::misses, variable_list::name, variable_list::name_length, _ipcache_stats::negative_hits, _ipcache_stats::requests, SMI_COUNTER32, SMI_GAUGE32, SNMP_ERR_NOERROR, SNMP_ERR_NOSUCHNAME, snmp_var_new_integer(), and snmpDebugOid().
Referenced by snmpInit().