![](group__IPCacheAPI.png)
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) |
Detailed Description
Introduction
- The IP cache is a built-in component of squid providing Hostname to IP-Number translation functionality and managing the involved data-structures. Efficiency concerns require mechanisms that allow non-blocking access to these mappings. The IP cache usually doesn't block on a request except for special cases where this is desired (see below).
Function Documentation
◆ ipcache_gethostbyname()
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.
- Parameters
-
name Host name to resolve. flags Default is NULL, set to IP_LOOKUP_IF_MISS to explicitly perform DNS lookups.
- Return values
-
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 Acl::DestinationAsnCheck::match(), ACLDestinationIP::match(), and netdbClosestParent().
◆ ipcache_init()
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().
◆ ipcache_nbgethostbyname()
void ipcache_nbgethostbyname | ( | const char * | name, |
IPH * | handler, | ||
void * | handlerData | ||
) |
- Parameters
-
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().
◆ ipcache_purgelru()
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().
◆ ipcache_restart()
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().
◆ ipcacheAddEntryFromHosts()
int ipcacheAddEntryFromHosts | ( | const char * | name, |
const char * | ipaddr | ||
) |
Adds a "static" entry from /etc/hosts
- Parameters
-
name Hostname to be linked with IP ipaddr IP Address to be cached.
- Return values
-
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, Ip::EnableIpv6, 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().
◆ ipcacheCheckNumeric()
|
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_().
◆ ipcacheInvalidate()
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().
◆ ipcacheInvalidateNegative()
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().
◆ ipcacheMarkGoodAddr()
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().
◆ snmp_netIpFn()
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().
Introduction
- About Squid
- Why Squid?
- Squid Developers
- How to Donate
- How to Help Out
- Getting Squid
- Squid Source Packages
- Squid Deployment Case-Studies
- Squid Software Foundation
Documentation
- Quick Setup
- Configuration:
- FAQ and Wiki
- Guide Books:
- Non-English
- More...
Support
- Security Advisories
- Bugzilla Database
- Mailing lists
- Contacting us
- Commercial services
- Project Sponsors
- Squid-based products