![](group__IPCacheInternal.png)
Classes | |
struct | _ipcache_stats |
Functions | |
int | ipcacheCount () |
static void | ipcacheRelease (ipcache_entry *, bool dofree=true) |
static ipcache_entry * | ipcache_get (const char *) |
static int | ipcacheExpiredEntry (ipcache_entry *) |
static void | purge_entries_fromhosts (void) |
static void | ipcacheAddEntry (ipcache_entry *i) |
static void | ipcacheCallback (ipcache_entry *i, const bool hit, const int wait) |
static void | ipcacheHandleReply (void *data, const rfc1035_rr *answers, int na, const char *error_message, const bool lastAnswer) |
static void | ipcacheRegisterWithCacheManager (void) |
static void | ipcacheStatPrint (ipcache_entry *, StoreEntry *) |
static void | stat_ipcache_get (StoreEntry *) |
static void | ipcacheLockEntry (ipcache_entry *) |
static void | ipcacheUnlockEntry (ipcache_entry *) |
static void | ipcacheFreeEntry (void *data) |
Variables | |
static struct _ipcache_stats | IpcacheStats |
static dlink_list | lru_list |
static hash_table * | ip_table = nullptr |
static long | ipcache_low = 180 |
static long | ipcache_high = 200 |
Detailed Description
- Note
- when IP cache is provided as a class. These sub-groups will be obsolete for now they are used to separate the public and private functions. with the private ones all being in IPCachInternal and public in IPCacheAPI
Internal Operation
Internally, the execution flow is as follows: On a miss, ipcache_getnbhostbyname checks whether a request for this name is already pending, and if positive, it creates a new entry using ipcacheAddNew with the IP_PENDING flag set . Then it calls ipcacheAddPending to add a request to the queue together with data and handler. Else, ipcache_dnsDispatch() is called to directly create a DNS query or to ipcacheEnqueue() if all no DNS port is free. ipcache_call_pending() is called regularly to walk down the pending list and call handlers. LRU clean-up is performed through ipcache_purgelru() according to the ipcache_high threshold.
Function Documentation
◆ ipcache_get()
|
static |
Definition at line 324 of file ipcache.cc.
References hash_lookup(), and ip_table.
Referenced by ipcache_gethostbyname(), ipcache_nbgethostbyname_(), ipcacheAddEntryFromHosts(), ipcacheInvalidate(), ipcacheInvalidateNegative(), ipcacheMarkBadAddr(), and ipcacheMarkGoodAddr().
◆ ipcacheAddEntry()
|
static |
Definition at line 422 of file ipcache.cc.
References dlinkAdd(), ipcache_entry::hash, hash_join(), hash_lookup(), ip_table, ipcacheRelease(), hash_link::key, ipcache_entry::lastref, ipcache_entry::lru, lru_list, and squid_curtime.
Referenced by ipcacheAddEntryFromHosts(), and ipcacheHandleReply().
◆ ipcacheCallback()
|
static |
walks down the pending list, calling handlers
Definition at line 443 of file ipcache.cc.
References ipcache_entry::addrs, ipcache_entry::error_message, IpCacheLookupForwarder::finalCallback(), IpCacheLookupForwarder::forwardHits(), ipcache_entry::handler, ipcacheLockEntry(), ipcacheUnlockEntry(), ipcache_entry::lastref, and squid_curtime.
Referenced by ipcache_nbgethostbyname_(), and ipcacheHandleReply().
◆ ipcacheCount()
|
inline |
Definition at line 294 of file ipcache.cc.
References hash_table::count, and ip_table.
Referenced by ipcache_purgelru(), snmp_netIpFn(), and stat_ipcache_get().
◆ ipcacheExpiredEntry()
|
static |
Definition at line 334 of file ipcache.cc.
References ipcache_entry::addrs, ipcache_entry::expires, ipcache_entry::flags, ipcache_entry::locks, ipcache_entry::Flags::negcached, and squid_curtime.
Referenced by ipcache_gethostbyname(), ipcache_nbgethostbyname_(), and ipcacheUnlockEntry().
◆ ipcacheFreeEntry()
|
static |
Definition at line 1085 of file ipcache.cc.
◆ ipcacheHandleReply()
|
static |
Definition at line 562 of file ipcache.cc.
References ipcache_entry::addrs, _ipcache_stats::cname_only, Config, StatHist::count(), debugs, StatCounters::dns, ipcache_entry::error_message, ipcache_entry::expires, ipcache_entry::flags, IpCacheLookupForwarder::forwardLookup(), ipcache_entry::handler, ipcacheAddEntry(), ipcacheCallback(), ipcacheParse(), IpcacheStats, ipcache_entry::latestError(), ipcache_entry::name(), SquidConfig::negativeDnsTtl, ipcache_entry::Flags::negcached, _ipcache_stats::replies, ipcache_entry::sawCname, squid_curtime, statCounter, StatCounters::svcTime, and IpCacheLookupForwarder::totalResponseTime().
◆ ipcacheLockEntry()
|
static |
Definition at line 914 of file ipcache.cc.
References dlinkAdd(), dlinkDelete(), ipcache_entry::locks, ipcache_entry::lru, and lru_list.
Referenced by ipcacheAddEntryFromHosts(), and ipcacheCallback().
◆ ipcacheRegisterWithCacheManager()
|
static |
Definition at line 681 of file ipcache.cc.
References Mgr::RegisterAction(), and stat_ipcache_get().
Referenced by ipcache_init().
◆ ipcacheRelease()
|
static |
removes the given ipcache entry
Definition at line 302 of file ipcache.cc.
References DBG_CRITICAL, debugs, dlinkDelete(), ipcache_entry::hash, hash_remove_link(), ip_table, ipcacheFreeEntry, hash_link::key, and lru_list.
Referenced by ipcache_gethostbyname(), ipcache_nbgethostbyname_(), ipcache_purgelru(), ipcacheAddEntry(), ipcacheAddEntryFromHosts(), ipcacheUnlockEntry(), and purge_entries_fromhosts().
◆ ipcacheStatPrint()
|
static |
- Negative-cached entries have no IPs listed.
- Cached entries have IPs listed with a BNF of: ip-address '-' ('OK'|'BAD')
Definition at line 770 of file ipcache.cc.
References ipcache_entry::addrs, DBG_CRITICAL, debugs, ipcache_entry::expires, ipcache_entry::flags, ipcache_entry::Flags::fromhosts, ipcache_entry::hash, hashKeyStr(), ipcache_entry::lastref, MAX_IPSTRLEN, ipcache_entry::Flags::negcached, squid_curtime, and storeAppendPrintf().
Referenced by stat_ipcache_get().
◆ ipcacheUnlockEntry()
|
static |
Definition at line 924 of file ipcache.cc.
References DBG_IMPORTANT, debugs, ipcacheExpiredEntry(), ipcacheRelease(), and ipcache_entry::locks.
Referenced by ipcacheAddEntryFromHosts(), and ipcacheCallback().
◆ purge_entries_fromhosts()
|
static |
purges entries added from /etc/hosts (or whatever).
Definition at line 386 of file ipcache.cc.
References dlink_node::data, dlink_list::head, ipcacheRelease(), lru_list, and dlink_node::next.
Referenced by ipcache_restart().
◆ stat_ipcache_get()
|
static |
process objects list
Definition at line 821 of file ipcache.cc.
References assert, _ipcache_stats::cname_only, dlink_node::data, dlink_list::head, _ipcache_stats::hits, _ipcache_stats::invalid, ip_table, ipcacheCount(), ipcacheStatPrint(), IpcacheStats, lru_list, _ipcache_stats::misses, _ipcache_stats::negative_hits, dlink_node::next, _ipcache_stats::numeric_hits, _ipcache_stats::requests, _ipcache_stats::rr_a, _ipcache_stats::rr_aaaa, _ipcache_stats::rr_cname, and storeAppendPrintf().
Referenced by ipcacheRegisterWithCacheManager().
Variable Documentation
◆ ip_table
|
static |
Definition at line 207 of file ipcache.cc.
Referenced by ipcache_get(), ipcache_init(), ipcacheAddEntry(), ipcacheCount(), ipcacheRelease(), and stat_ipcache_get().
◆ ipcache_high
|
static |
Definition at line 212 of file ipcache.cc.
Referenced by ipcache_init(), and ipcache_restart().
◆ ipcache_low
|
static |
Definition at line 210 of file ipcache.cc.
Referenced by ipcache_init(), ipcache_purgelru(), and ipcache_restart().
◆ IpcacheStats
|
static |
◆ lru_list
|
static |
Definition at line 190 of file ipcache.cc.
Referenced by ipcache_init(), ipcache_purgelru(), ipcacheAddEntry(), ipcacheLockEntry(), ipcacheRelease(), purge_entries_fromhosts(), and stat_ipcache_get().
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