|
Squid Web Cache master
|
#include <ipcache.h>
Public Types | |
| typedef std::vector< CachedIp > | Storage |
Public Member Functions | |
| bool | have (const Ip::Address &ip, size_t *position=nullptr) const |
| const Ip::Address & | current () const |
| bool | empty () const noexcept |
| whether we cached no IPs at all | |
| size_t | size () const noexcept |
| all cached IPs | |
| size_t | badCount () const noexcept |
| bad IPs | |
| IpsSelector< GoodIpsIterator > | good () const |
| good IPs | |
| IpsSelector< IpsIterator > | goodAndBad () const |
| all IPs | |
| const Storage & | raw () const |
| all cached entries | |
| void | markAsBad (const char *name, const Ip::Address &ip) |
| void | forgetMarking (const char *name, const Ip::Address &ip) |
| undo successful markAsBad() | |
| void | pushUnique (const Ip::Address &ip) |
| void | reset (const Ip::Address &ip) |
| replace all info with the given (presumed good) IP address | |
| void | reportCurrent (std::ostream &os) const |
| prints current IP and other debugging information | |
Private Member Functions | |
| bool | seekNewGood (const char *name) |
| void | restoreGoodness (const char *name) |
| makes current() calls possible after a successful markAsBad() | |
Private Attributes | |
| Storage | ips |
| good and bad IPs | |
| size_t | goodPosition = 0 |
| position of the IP returned by current() | |
| size_t | badCount_ = 0 |
| number of IPs that are currently marked as bad | |
Friends | |
| template<class Iterator > | |
| class | IpsSelector |
A small container of IP addresses with a "current good address" getter API. Ignores Ip::Address port.
| typedef std::vector<CachedIp> Dns::CachedIps::Storage |
|
inlinenoexcept |
|
inline |
Definition at line 59 of file ipcache.h.
References goodPosition, and ips.
Referenced by icapLookupDnsResults(), netdbClosestParent(), and netdbSendPing().
|
inlinenoexcept |
Definition at line 61 of file ipcache.h.
References ips.
Referenced by IpCacheLookupForwarder::finalCallback(), ipcacheExpiredEntry(), ipcacheHandleReply(), and peerDNSConfigure().
| void Dns::CachedIps::forgetMarking | ( | const char * | name, |
| const Ip::Address & | ip | ||
| ) |
Definition at line 1042 of file ipcache.cc.
|
inline |
Definition at line 243 of file ipcache.h.
Referenced by IpCacheLookupForwarder::forwardHits().
|
inline |
Definition at line 249 of file ipcache.h.
Referenced by ACLDestinationIP::match(), mcastJoinGroups(), and peerDNSConfigure().
| bool Dns::CachedIps::have | ( | const Ip::Address & | ip, |
| size_t * | position = nullptr |
||
| ) | const |
whether we have at least one of the given IP addresses (ignoring ports) upon success, also sets *position if the position is not nil
Definition at line 984 of file ipcache.cc.
References debugs.
Referenced by ipcache_entry::addGood(), and ClientRequestContext::hostHeaderIpVerify().
| void Dns::CachedIps::markAsBad | ( | const char * | name, |
| const Ip::Address & | ip | ||
| ) |
Finds and marks the given address as bad, adjusting current() if needed. Has no effect if the search fails or the found address is already bad. XXX: An attempt to mark the last good address erases all marks instead. XXX: It is impossible to successfully mark a single address as bad.
Definition at line 1022 of file ipcache.cc.
References debugs.
| void Dns::CachedIps::pushUnique | ( | const Ip::Address & | ip | ) |
appends an IP address if we do not have() it already invalidates all iterators
Definition at line 1003 of file ipcache.cc.
References assert.
Referenced by ipcache_entry::addGood(), and ipcacheAddEntryFromHosts().
|
inline |
Definition at line 69 of file ipcache.h.
References ips.
Referenced by ipcache_entry::addGood(), Dns::IpsSelector< Iterator >::cbegin(), Dns::IpsSelector< Iterator >::cend(), and ipcacheStatPrint().
| void Dns::CachedIps::reportCurrent | ( | std::ostream & | os | ) | const |
| void Dns::CachedIps::reset | ( | const Ip::Address & | ip | ) |
Definition at line 957 of file ipcache.cc.
Referenced by ipcacheCheckNumeric().
|
private |
Definition at line 969 of file ipcache.cc.
|
private |
find the next good IP, wrapping if needed
Definition at line 940 of file ipcache.cc.
References debugs, goodPosition, and ips.
|
inlinenoexcept |
Definition at line 62 of file ipcache.h.
References ips.
Referenced by ipcache_entry::addGood(), ipcacheStatPrint(), peerDNSConfigure(), and ipcache_entry::updateTtl().
|
friend |
|
private |
Definition at line 101 of file ipcache.h.
Referenced by badCount().
|
private |
Definition at line 100 of file ipcache.h.
Referenced by Dns::IpsSelector< Iterator >::cbegin(), current(), and seekNewGood().
|
private |