68#define FQDN_LOW_WATER 90
71#define FQDN_HIGH_WATER 95
224 debugs(35, 9,
"fqdncache_purgelru: removed " << removed <<
" entries");
258 handlerData(nullptr),
259 error_message(nullptr),
320 const char *name = (
const char *)f->
hash.
key;
325 debugs(35, 3,
"fqdncacheParse: Lookup of '" << name <<
"' failed (" << error_message <<
")");
331 debugs(35, 3,
"fqdncacheParse: No DNS records for '" << name <<
"'");
336 debugs(35, 3,
"fqdncacheParse: " << nr <<
" answers for '" << name <<
"'");
339 for (k = 0; k < nr; ++k) {
344 if (!answers[k].rdata[0]) {
345 debugs(35, 2,
"fqdncacheParse: blank PTR record for '" << name <<
"'");
349 if (strchr(answers[k].rdata,
' ')) {
350 debugs(35, 2,
"fqdncacheParse: invalid PTR record '" << answers[k].rdata <<
"' for '" << name <<
"'");
359 if (ttl == 0 || (
int) answers[k].ttl < ttl)
360 ttl = answers[k].
ttl;
396 const int age = f->
age();
420 debugs(35, 4,
"fqdncache_nbgethostbyaddr: Name '" << name <<
"'.");
423 if (name[0] ==
'\0') {
424 debugs(35, 4,
"fqdncache_nbgethostbyaddr: Invalid name!");
427 handler(
nullptr, details, handlerData);
442 debugs(35, 4,
"fqdncache_nbgethostbyaddr: HIT for '" << name <<
"'");
458 debugs(35, 5,
"fqdncache_nbgethostbyaddr: MISS for '" << name <<
"'");
487 debugs(35, 7,
"nothing to lookup: " << addr);
501 debugs(35, 5,
"negative HIT: " << addr);
506 debugs(35, 5,
"HIT: " << addr);
514 debugs(35, 5,
"MISS: " << addr);
542 fqdncache_entry::UseCount());
562 "Address",
"Flg",
"TTL",
"Cnt",
"Hostnames");
586 if (f->
locks++ == 0) {
642 }
else if (fce->
locks > 0) {
643 debugs(35,
DBG_IMPORTANT,
"WARNING: can't add static entry for locked address '" << addr <<
"'");
653 for (
auto &h : hostnames) {
663 fce->
names[j] =
nullptr;
694 debugs(35, 3,
"Initializing FQDN Cache...");
#define cbdataReference(var)
#define cbdataReferenceValidDone(var, ptr)
encapsulates DNS lookup results
char * toStr(char *buf, const unsigned int blen, int force=AF_UNSPEC) const
struct SquidConfig::@87 fqdncache
struct StatCounters::@109 dns
struct fqdncache_entry::Flags flags
int age() const
time passed since request_time or -1 if unknown
struct timeval request_time
fqdncache_entry(const char *name)
MEMPROXY_CLASS(fqdncache_entry)
char * names[FQDN_MAX_NAMES+1]
#define debugs(SECTION, LEVEL, CONTENT)
#define FQDN_LOOKUP_IF_MISS
void dlinkDelete(dlink_node *m, dlink_list *list)
void dlinkAdd(void *data, dlink_node *m, dlink_list *list)
void IDNSCB(void *cbdata, const rfc1035_rr *answer, const int recordsInAnswer, const char *error, bool lastAnswer)
void idnsPTRLookup(const Ip::Address &, IDNSCB *, void *)
void eventAdd(const char *name, EVH *func, void *arg, double when, int weight, bool cbdata)
void fqdncacheAddEntryFromHosts(char *addr, SBufList &hostnames)
static IDNSCB fqdncacheHandleReply
void(const char *, const Dns::LookupDetails &, void *) FQDNH
variable_list * snmp_netFqdnFn(variable_list *Var, snint *ErrP)
void fqdncache_init(void)
void fqdncache_purgelru(void *)
static void purge_entries_fromhosts(void)
const char * fqdncache_gethostbyaddr(const Ip::Address &addr, int flags)
void fqdncache_nbgethostbyaddr(const Ip::Address &addr, FQDNH *handler, void *handlerData)
void fqdncache_restart(void)
static void fqdncacheAddEntry(fqdncache_entry *f)
static void fqdncacheRelease(fqdncache_entry *)
static hash_table * fqdn_table
static long fqdncache_low
static void fqdncacheRegisterWithCacheManager(void)
static void fqdncacheLockEntry(fqdncache_entry *f)
static int fqdncacheExpiredEntry(const fqdncache_entry *)
static long fqdncache_high
static fqdncache_entry * fqdncache_get(const char *)
static void fqdncacheUnlockEntry(fqdncache_entry *f)
static int fqdncacheParse(fqdncache_entry *, const rfc1035_rr *, int, const char *error_message)
void fqdnStats(StoreEntry *sentry)
static dlink_list lru_list
static struct _fqdn_cache_stats FqdncacheStats
static void fqdncacheCallback(fqdncache_entry *, int wait)
hash_link * hash_lookup(hash_table *, const void *)
hash_table * hash_create(HASHCMP *, int, HASHHASH *)
int HASHCMP(const void *, const void *)
hash_link * hash_next(hash_table *)
void hash_first(hash_table *)
void hash_join(hash_table *, hash_link *)
void hash_remove_link(hash_table *, hash_link *)
const char * hashKeyStr(const hash_link *)
#define MAX_IPSTRLEN
Length of buffer that needs to be allocated to old a null-terminated IP-string.
bool ResolveClientAddressesAsap
whether to do reverse DNS lookups for source IPs of accepted connections
void RegisterAction(char const *action, char const *desc, OBJH *handler, Protected, Atomic, Format)
#define RFC1035_TYPE_CNAME
std::list< SBuf > SBufList
const char * snmpDebugOid(oid *Name, snint Len, MemBuf &outbuf)
#define SNMP_ERR_NOSUCHNAME
struct variable_list * snmp_var_new_integer(oid *, int, int, unsigned char)
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
struct timeval current_time
the current UNIX time in timeval {seconds, microseconds} format
int tvSubMsec(struct timeval t1, struct timeval t2)