#include <ipcache.h>
![Collaboration graph](classDns_1_1CachedIps__coll__graph.png)
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 |
IpsSelector< GoodIpsIterator > | good () const |
good IPs More... | |
IpsSelector< IpsIterator > | goodAndBad () const |
all IPs More... | |
void | markAsBad (const char *name, const Ip::Address &ip) |
void | forgetMarking (const char *name, const Ip::Address &ip) |
undo successful markAsBad() More... | |
void | pushUnique (const Ip::Address &ip) |
void | reset (const Ip::Address &ip) |
replace all info with the given (presumed good) IP address More... | |
void | reportCurrent (std::ostream &os) const |
prints current IP and other debugging information More... | |
Private Member Functions | |
bool | seekNewGood (const char *name) |
void | restoreGoodness (const char *name) |
makes current() calls possible after a successful markAsBad() More... | |
Private Attributes | |
Storage | ips |
good and bad IPs More... | |
size_t | goodPosition = 0 |
position of the IP returned by current() More... | |
size_t | badCount_ = 0 |
number of IPs that are currently marked as bad More... | |
Friends | |
template<class Iterator > | |
class | IpsSelector |
Detailed Description
A small container of IP addresses with a "current good address" getter API. Ignores Ip::Address port.
Member Typedef Documentation
◆ Storage
typedef std::vector<CachedIp> Dns::CachedIps::Storage |
Member Function Documentation
◆ current()
|
inline |
- Returns
- a good address does not auto-rotate IPs but calling markAsBad() may change the answer
Definition at line 59 of file ipcache.h.
References goodPosition, and ips.
Referenced by icapLookupDnsResults(), netdbClosestParent(), and netdbSendPing().
◆ forgetMarking()
void Dns::CachedIps::forgetMarking | ( | const char * | name, |
const Ip::Address & | ip | ||
) |
Definition at line 1042 of file ipcache.cc.
◆ good()
|
inline |
Definition at line 243 of file ipcache.h.
Referenced by IpCacheLookupForwarder::forwardHits().
◆ goodAndBad()
|
inline |
Definition at line 249 of file ipcache.h.
Referenced by Acl::DestinationAsnCheck::match(), ACLDestinationIP::match(), mcastJoinGroups(), and peerDNSConfigure().
◆ have()
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().
◆ markAsBad()
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.
◆ pushUnique()
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().
◆ reportCurrent()
void Dns::CachedIps::reportCurrent | ( | std::ostream & | os | ) | const |
◆ reset()
void Dns::CachedIps::reset | ( | const Ip::Address & | ip | ) |
Definition at line 957 of file ipcache.cc.
Referenced by ipcacheCheckNumeric().
◆ restoreGoodness()
|
private |
Definition at line 969 of file ipcache.cc.
◆ seekNewGood()
|
private |
find the next good IP, wrapping if needed
- Returns
- whether the search was successful
Definition at line 940 of file ipcache.cc.
References debugs, goodPosition, and ips.
Friends And Related Function Documentation
◆ IpsSelector
|
friend |
Member Data Documentation
◆ badCount_
◆ goodPosition
|
private |
Definition at line 100 of file ipcache.h.
Referenced by Dns::IpsSelector< Iterator >::cbegin(), current(), and seekNewGood().
◆ ips
|
private |
Definition at line 97 of file ipcache.h.
Referenced by current(), and seekNewGood().
The documentation for this class was generated from the following files:
- src/ipcache.h
- src/ipcache.cc
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