fqdncache.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 /* DEBUG: section 35 FQDN Cache */
10 
11 #include "squid.h"
12 #include "cbdata.h"
13 #include "dns/forward.h"
14 #include "dns/LookupDetails.h"
15 #include "dns/rfc1035.h"
16 #include "event.h"
17 #include "fqdncache.h"
18 #include "helper.h"
19 #include "mgr/Registration.h"
20 #include "snmp_agent.h"
21 #include "SquidConfig.h"
22 #include "StatCounters.h"
23 #include "Store.h"
24 #include "util.h"
25 
26 #if SQUID_SNMP
27 #include "snmp_core.h"
28 #endif
29 
31 
68 #define FQDN_LOW_WATER 90
69 
71 #define FQDN_HIGH_WATER 95
72 
80 {
82 
83 public:
84  fqdncache_entry(const char *name);
86 
87  hash_link hash; /* must be first */
88  time_t lastref;
89  time_t expires;
90  unsigned char name_count;
91  char *names[FQDN_MAX_NAMES + 1];
93  void *handlerData;
95 
96  struct timeval request_time;
98  unsigned short locks;
99 
100  struct Flags {
102 
103  bool negcached;
104  bool fromhosts;
105  } flags;
106 
107  int age() const;
108 };
109 
111 static struct _fqdn_cache_stats {
112  int requests;
113  int replies;
114  int hits;
115  int misses;
118 
121 
123 static int fqdncacheParse(fqdncache_entry *, const rfc1035_rr *, int, const char *error_message);
124 static void fqdncacheRelease(fqdncache_entry *);
125 static void fqdncacheCallback(fqdncache_entry *, int wait);
126 static fqdncache_entry *fqdncache_get(const char *);
127 static int fqdncacheExpiredEntry(const fqdncache_entry *);
128 static void fqdncacheLockEntry(fqdncache_entry * f);
129 static void fqdncacheUnlockEntry(fqdncache_entry * f);
131 static void fqdncacheAddEntry(fqdncache_entry * f);
132 
134 static hash_table *fqdn_table = nullptr;
135 
137 static long fqdncache_low = 180;
138 
140 static long fqdncache_high = 200;
141 
143 inline int fqdncacheCount() { return fqdn_table ? fqdn_table->count : 0; }
144 
145 int
147 {
148  return request_time.tv_sec ? tvSubMsec(request_time, current_time) : -1;
149 }
150 
155 static void
157 {
159  debugs(35, 5, "fqdncacheRelease: Released FQDN record for '" << hashKeyStr(&f->hash) << "'.");
160  dlinkDelete(&f->lru, &lru_list);
161  delete f;
162 }
163 
169 static fqdncache_entry *
170 fqdncache_get(const char *name)
171 {
172  hash_link *e;
173  static fqdncache_entry *f;
174  f = nullptr;
175 
176  if (fqdn_table) {
177  if ((e = (hash_link *)hash_lookup(fqdn_table, name)) != nullptr)
178  f = (fqdncache_entry *) e;
179  }
180 
181  return f;
182 }
183 
185 static int
187 {
188  /* all static entries are locked, so this takes care of them too */
189 
190  if (f->locks != 0)
191  return 0;
192 
193  if (f->expires > squid_curtime)
194  return 0;
195 
196  return 1;
197 }
198 
200 void
202 {
203  dlink_node *m;
204  dlink_node *prev = nullptr;
205  fqdncache_entry *f;
206  int removed = 0;
207  eventAdd("fqdncache_purgelru", fqdncache_purgelru, nullptr, 10.0, 1);
208 
209  for (m = lru_list.tail; m; m = prev) {
211  break;
212 
213  prev = m->prev;
214 
215  f = (fqdncache_entry *)m->data;
216 
217  if (f->locks != 0)
218  continue;
219 
220  fqdncacheRelease(f);
221 
222  ++removed;
223  }
224 
225  debugs(35, 9, "fqdncache_purgelru: removed " << removed << " entries");
226 }
227 
229 static void
231 {
232  dlink_node *m = lru_list.head;
233  fqdncache_entry *i = nullptr;
234  fqdncache_entry *t;
235 
236  while (m) {
237  if (i != nullptr) { /* need to delay deletion */
238  fqdncacheRelease(i); /* we just override locks */
239  i = nullptr;
240  }
241 
242  t = (fqdncache_entry *)m->data;
243 
244  if (t->flags.fromhosts)
245  i = t;
246 
247  m = m->next;
248  }
249 
250  if (i != nullptr)
251  fqdncacheRelease(i);
252 }
253 
255  lastref(0),
256  expires(squid_curtime + Config.negativeDnsTtl),
257  name_count(0),
258  handler(nullptr),
259  handlerData(nullptr),
260  error_message(nullptr),
261  locks(0) // XXX: use Lock
262 {
263  hash.key = xstrdup(name);
264 
265  memset(&request_time, 0, sizeof(request_time));
266  memset(&names, 0, sizeof(names));
267 }
268 
270 static void
272 {
274 
275  if (nullptr != e) {
276  /* avoid collision */
277  fqdncache_entry *q = (fqdncache_entry *) e;
278  fqdncacheRelease(q);
279  }
280 
281  hash_join(fqdn_table, &f->hash);
282  dlinkAdd(f, &f->lru, &lru_list);
283  f->lastref = squid_curtime;
284 }
285 
291 static void
293 {
294  FQDNH *callback;
295  void *cbdata;
296  f->lastref = squid_curtime;
297 
298  if (!f->handler)
299  return;
300 
302 
303  callback = f->handler;
304 
305  f->handler = nullptr;
306 
308  const Dns::LookupDetails details(f->error_message, wait);
309  callback(f->name_count ? f->names[0] : nullptr, details, cbdata);
310  }
311 
313 }
314 
316 static int
317 fqdncacheParse(fqdncache_entry *f, const rfc1035_rr * answers, int nr, const char *error_message)
318 {
319  int k;
320  int ttl = 0;
321  const char *name = (const char *)f->hash.key;
323  f->flags.negcached = true;
324 
325  if (nr < 0) {
326  debugs(35, 3, "fqdncacheParse: Lookup of '" << name << "' failed (" << error_message << ")");
327  f->error_message = xstrdup(error_message);
328  return -1;
329  }
330 
331  if (nr == 0) {
332  debugs(35, 3, "fqdncacheParse: No DNS records for '" << name << "'");
333  f->error_message = xstrdup("No DNS records");
334  return 0;
335  }
336 
337  debugs(35, 3, "fqdncacheParse: " << nr << " answers for '" << name << "'");
338  assert(answers);
339 
340  for (k = 0; k < nr; ++k) {
341  if (answers[k]._class != RFC1035_CLASS_IN)
342  continue;
343 
344  if (answers[k].type == RFC1035_TYPE_PTR) {
345  if (!answers[k].rdata[0]) {
346  debugs(35, 2, "fqdncacheParse: blank PTR record for '" << name << "'");
347  continue;
348  }
349 
350  if (strchr(answers[k].rdata, ' ')) {
351  debugs(35, 2, "fqdncacheParse: invalid PTR record '" << answers[k].rdata << "' for '" << name << "'");
352  continue;
353  }
354 
355  f->names[f->name_count] = xstrdup(answers[k].rdata);
356  ++ f->name_count;
357  } else if (answers[k].type != RFC1035_TYPE_CNAME)
358  continue;
359 
360  if (ttl == 0 || (int) answers[k].ttl < ttl)
361  ttl = answers[k].ttl;
362 
363  if (f->name_count >= FQDN_MAX_NAMES)
364  break;
365  }
366 
367  if (f->name_count == 0) {
368  debugs(35, DBG_IMPORTANT, "fqdncacheParse: No PTR record for '" << name << "'");
369  return 0;
370  }
371 
372  if (ttl > Config.positiveDnsTtl)
373  ttl = Config.positiveDnsTtl;
374 
375  if (ttl < Config.negativeDnsTtl)
376  ttl = Config.negativeDnsTtl;
377 
378  f->expires = squid_curtime + ttl;
379 
380  f->flags.negcached = false;
381 
382  return f->name_count;
383 }
384 
390 static void
391 fqdncacheHandleReply(void *data, const rfc1035_rr * answers, int na, const char *error_message, const bool lastAnswer)
392 {
393  assert(lastAnswer); // reverse DNS lookups do not generate multiple queries
394  fqdncache_entry *f;
395  static_cast<generic_cbdata *>(data)->unwrap(&f);
397  const int age = f->age();
399  fqdncacheParse(f, answers, na, error_message);
401  fqdncacheCallback(f, age);
402 }
403 
414 void
415 fqdncache_nbgethostbyaddr(const Ip::Address &addr, FQDNH * handler, void *handlerData)
416 {
417  fqdncache_entry *f = nullptr;
418  char name[MAX_IPSTRLEN];
419  generic_cbdata *c;
420  addr.toStr(name,MAX_IPSTRLEN);
421  debugs(35, 4, "fqdncache_nbgethostbyaddr: Name '" << name << "'.");
423 
424  if (name[0] == '\0') {
425  debugs(35, 4, "fqdncache_nbgethostbyaddr: Invalid name!");
426  const Dns::LookupDetails details("Invalid hostname", -1); // error, no lookup
427  if (handler)
428  handler(nullptr, details, handlerData);
429  return;
430  }
431 
432  f = fqdncache_get(name);
433 
434  if (nullptr == f) {
435  /* miss */
436  (void) 0;
437  } else if (fqdncacheExpiredEntry(f)) {
438  /* hit, but expired -- bummer */
439  fqdncacheRelease(f);
440  f = nullptr;
441  } else {
442  /* hit */
443  debugs(35, 4, "fqdncache_nbgethostbyaddr: HIT for '" << name << "'");
444 
445  if (f->flags.negcached)
447  else
448  ++ FqdncacheStats.hits;
449 
450  f->handler = handler;
451 
452  f->handlerData = cbdataReference(handlerData);
453 
454  fqdncacheCallback(f, -1); // no lookup
455 
456  return;
457  }
458 
459  debugs(35, 5, "fqdncache_nbgethostbyaddr: MISS for '" << name << "'");
461  f = new fqdncache_entry(name);
462  f->handler = handler;
463  f->handlerData = cbdataReference(handlerData);
465  c = new generic_cbdata(f);
467 }
468 
481 const char *
482 fqdncache_gethostbyaddr(const Ip::Address &addr, int flags)
483 {
484  char name[MAX_IPSTRLEN];
485  fqdncache_entry *f = nullptr;
486 
487  if (addr.isAnyAddr() || addr.isNoAddr()) {
488  debugs(35, 7, "nothing to lookup: " << addr);
489  return nullptr;
490  }
491 
492  addr.toStr(name,MAX_IPSTRLEN);
494  f = fqdncache_get(name);
495 
496  if (nullptr == f) {
497  (void) 0;
498  } else if (fqdncacheExpiredEntry(f)) {
499  fqdncacheRelease(f);
500  f = nullptr;
501  } else if (f->flags.negcached) {
502  debugs(35, 5, "negative HIT: " << addr);
504  // ignore f->error_message: the caller just checks FQDN cache presence
505  return nullptr;
506  } else {
507  debugs(35, 5, "HIT: " << addr);
508  ++ FqdncacheStats.hits;
509  f->lastref = squid_curtime;
510  // ignore f->error_message: the caller just checks FQDN cache presence
511  return f->names[0];
512  }
513 
514  /* no entry [any more] */
515  debugs(35, 5, "MISS: " << addr);
517 
518  if (flags & FQDN_LOOKUP_IF_MISS) {
519  fqdncache_nbgethostbyaddr(addr, nullptr, nullptr);
520  }
521 
522  return nullptr;
523 }
524 
530 void
532 {
533  fqdncache_entry *f = nullptr;
534  int k;
535  int ttl;
536 
537  if (fqdn_table == nullptr)
538  return;
539 
540  storeAppendPrintf(sentry, "FQDN Cache Statistics:\n");
541 
542  storeAppendPrintf(sentry, "FQDNcache Entries In Use: %d\n",
543  fqdncache_entry::UseCount());
544 
545  storeAppendPrintf(sentry, "FQDNcache Entries Cached: %d\n",
546  fqdncacheCount());
547 
548  storeAppendPrintf(sentry, "FQDNcache Requests: %d\n",
550 
551  storeAppendPrintf(sentry, "FQDNcache Hits: %d\n",
553 
554  storeAppendPrintf(sentry, "FQDNcache Negative Hits: %d\n",
556 
557  storeAppendPrintf(sentry, "FQDNcache Misses: %d\n",
559 
560  storeAppendPrintf(sentry, "FQDN Cache Contents:\n\n");
561 
562  storeAppendPrintf(sentry, "%-45.45s %3s %3s %3s %s\n",
563  "Address", "Flg", "TTL", "Cnt", "Hostnames");
564 
566 
567  while ((f = (fqdncache_entry *) hash_next(fqdn_table))) {
568  ttl = (f->flags.fromhosts ? -1 : (f->expires - squid_curtime));
569  storeAppendPrintf(sentry, "%-45.45s %c%c %3.3d % 3d",
570  hashKeyStr(&f->hash),
571  f->flags.negcached ? 'N' : ' ',
572  f->flags.fromhosts ? 'H' : ' ',
573  ttl,
574  (int) f->name_count);
575 
576  for (k = 0; k < (int) f->name_count; ++k)
577  storeAppendPrintf(sentry, " %s", f->names[k]);
578 
579  storeAppendPrintf(sentry, "\n");
580  }
581 }
582 
584 static void
586 {
587  if (f->locks++ == 0) {
588  dlinkDelete(&f->lru, &lru_list);
589  dlinkAdd(f, &f->lru, &lru_list);
590  }
591 }
592 
594 static void
596 {
597  assert(f->locks > 0);
598  -- f->locks;
599 
600  if (fqdncacheExpiredEntry(f))
601  fqdncacheRelease(f);
602 }
603 
605 static void
607 {
608  fqdncache_entry *f = (fqdncache_entry *)data;
609  delete f;
610 }
611 
613 {
614  for (int k = 0; k < (int)name_count; ++k)
615  xfree(names[k]);
616 
617  xfree(hash.key);
619 }
620 
622 void
624 {
627  fqdn_table = nullptr;
628 }
629 
637 void
639 {
640  fqdncache_high = (long) (((float) Config.fqdncache.size *
641  (float) FQDN_HIGH_WATER) / (float) 100);
642  fqdncache_low = (long) (((float) Config.fqdncache.size *
643  (float) FQDN_LOW_WATER) / (float) 100);
645 }
646 
653 void
654 fqdncacheAddEntryFromHosts(char *addr, SBufList &hostnames)
655 {
656  fqdncache_entry *fce= fqdncache_get(addr);
657  if (fce) {
658  if (1 == fce->flags.fromhosts) {
660  } else if (fce->locks > 0) {
661  debugs(35, DBG_IMPORTANT, "WARNING: can't add static entry for locked address '" << addr << "'");
662  return;
663  } else {
664  fqdncacheRelease(fce);
665  }
666  }
667 
668  fce = new fqdncache_entry(addr);
669 
670  int j = 0;
671  for (auto &h : hostnames) {
672  fce->names[j] = xstrdup(h.c_str());
673  Tolower(fce->names[j]);
674  ++j;
675 
676  if (j >= FQDN_MAX_NAMES)
677  break;
678  }
679 
680  fce->name_count = j;
681  fce->names[j] = nullptr; /* it's safe */
682  fce->flags.fromhosts = true;
683  fqdncacheAddEntry(fce);
684  fqdncacheLockEntry(fce);
685 }
686 
688 static void
690 {
691  Mgr::RegisterAction("fqdncache", "FQDN Cache Stats and Contents",
692  fqdnStats, 0, 1);
693 
694 }
695 
702 void
704 {
705  int n;
706 
708 
709  if (fqdn_table)
710  return;
711 
712  debugs(35, 3, "Initializing FQDN Cache...");
713 
714  memset(&FqdncacheStats, '\0', sizeof(FqdncacheStats));
715  lru_list = dlink_list();
716 
717  fqdncache_high = (long) (((float) Config.fqdncache.size *
718  (float) FQDN_HIGH_WATER) / (float) 100);
719 
720  fqdncache_low = (long) (((float) Config.fqdncache.size *
721  (float) FQDN_LOW_WATER) / (float) 100);
722 
723  n = hashPrime(fqdncache_high / 4);
724 
725  fqdn_table = hash_create((HASHCMP *) strcmp, n, hash4);
726 }
727 
728 #if SQUID_SNMP
735 {
736  variable_list *Answer = nullptr;
737  MemBuf tmp;
738  debugs(49, 5, "snmp_netFqdnFn: Processing request:" << snmpDebugOid(Var->name, Var->name_length, tmp));
739  *ErrP = SNMP_ERR_NOERROR;
740 
741  switch (Var->name[LEN_SQ_NET + 1]) {
742 
743  case FQDN_ENT:
744  Answer = snmp_var_new_integer(Var->name, Var->name_length,
745  fqdncacheCount(),
746  SMI_GAUGE32);
747  break;
748 
749  case FQDN_REQ:
750  Answer = snmp_var_new_integer(Var->name, Var->name_length,
752  SMI_COUNTER32);
753  break;
754 
755  case FQDN_HITS:
756  Answer = snmp_var_new_integer(Var->name, Var->name_length,
758  SMI_COUNTER32);
759  break;
760 
761  case FQDN_PENDHIT:
762  /* this is now worthless */
763  Answer = snmp_var_new_integer(Var->name, Var->name_length,
764  0,
765  SMI_GAUGE32);
766  break;
767 
768  case FQDN_NEGHIT:
769  Answer = snmp_var_new_integer(Var->name, Var->name_length,
771  SMI_COUNTER32);
772  break;
773 
774  case FQDN_MISS:
775  Answer = snmp_var_new_integer(Var->name, Var->name_length,
777  SMI_COUNTER32);
778  break;
779 
780  case FQDN_GHBN:
781  Answer = snmp_var_new_integer(Var->name, Var->name_length,
782  0, /* deprecated */
783  SMI_COUNTER32);
784  break;
785 
786  default:
787  *ErrP = SNMP_ERR_NOSUCHNAME;
788  break;
789  }
790 
791  return Answer;
792 }
793 
794 #endif /*SQUID_SNMP */
795 
#define false
Definition: GnuRegex.c:240
time_t squid_curtime
Definition: stub_libtime.cc:20
class SquidConfig Config
Definition: SquidConfig.cc:12
StatCounters statCounter
Definition: StatCounters.cc:12
#define assert(EX)
Definition: assert.h:19
#define LEN_SQ_NET
Definition: cache_snmp.h:49
int64_t snint
Definition: cache_snmp.h:14
@ FQDN_PENDHIT
Definition: cache_snmp.h:206
@ FQDN_NEGHIT
Definition: cache_snmp.h:207
@ FQDN_GHBN
Definition: cache_snmp.h:209
@ FQDN_HITS
Definition: cache_snmp.h:205
@ FQDN_MISS
Definition: cache_snmp.h:208
@ FQDN_ENT
Definition: cache_snmp.h:203
@ FQDN_REQ
Definition: cache_snmp.h:204
#define cbdataReference(var)
Definition: cbdata.h:341
#define cbdataReferenceValidDone(var, ptr)
Definition: cbdata.h:256
encapsulates DNS lookup results
Definition: LookupDetails.h:21
char * toStr(char *buf, const unsigned int blen, int force=AF_UNSPEC) const
Definition: Address.cc:792
bool isNoAddr() const
Definition: Address.cc:284
bool isAnyAddr() const
Definition: Address.cc:170
Definition: MemBuf.h:24
time_t negativeDnsTtl
Definition: SquidConfig.h:103
struct SquidConfig::@107 fqdncache
time_t positiveDnsTtl
Definition: SquidConfig.h:104
struct StatCounters::@132 dns
StatHist svcTime
Definition: StatCounters.h:98
void count(double val)
Definition: StatHist.cc:55
Definition: cbdata.cc:60
Definition: fqdncache.cc:80
unsigned char name_count
Definition: fqdncache.cc:90
struct fqdncache_entry::Flags flags
dlink_node lru
Definition: fqdncache.cc:97
~fqdncache_entry()
Definition: fqdncache.cc:612
int age() const
time passed since request_time or -1 if unknown
Definition: fqdncache.cc:146
struct timeval request_time
Definition: fqdncache.cc:96
unsigned short locks
Definition: fqdncache.cc:98
void * handlerData
Definition: fqdncache.cc:93
time_t expires
Definition: fqdncache.cc:89
fqdncache_entry(const char *name)
Definition: fqdncache.cc:254
FQDNH * handler
Definition: fqdncache.cc:92
char * error_message
Definition: fqdncache.cc:94
hash_link hash
Definition: fqdncache.cc:87
time_t lastref
Definition: fqdncache.cc:88
MEMPROXY_CLASS(fqdncache_entry)
char * names[FQDN_MAX_NAMES+1]
Definition: fqdncache.cc:91
int count
Definition: hash.h:31
unsigned int ttl
Definition: rfc1035.h:42
#define DBG_IMPORTANT
Definition: Stream.h:41
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:196
#define FQDN_LOOKUP_IF_MISS
Definition: defines.h:34
#define FQDN_MAX_NAMES
Definition: defines.h:35
void IDNSCB(void *cbdata, const rfc1035_rr *answer, const int recordsInAnswer, const char *error, bool lastAnswer)
Definition: forward.h:16
void idnsPTRLookup(const Ip::Address &, IDNSCB *, void *)
int type
Definition: errorpage.cc:152
void eventAdd(const char *name, EVH *func, void *arg, double when, int weight, bool cbdata)
Definition: event.cc:107
void fqdncacheAddEntryFromHosts(char *addr, SBufList &hostnames)
Definition: fqdncache.cc:654
static IDNSCB fqdncacheHandleReply
Definition: fqdncache.cc:122
static FREE fqdncacheFreeEntry
Definition: fqdncache.cc:130
void FQDNH(const char *, const Dns::LookupDetails &details, void *)
Definition: fqdncache.h:26
void fqdncacheFreeMemory(void)
Definition: fqdncache.cc:623
void fqdncache_init(void)
Definition: fqdncache.cc:703
void fqdncache_purgelru(void *)
Definition: fqdncache.cc:201
variable_list * snmp_netFqdnFn(variable_list *Var, snint *ErrP)
Definition: fqdncache.cc:734
const char * fqdncache_gethostbyaddr(const Ip::Address &addr, int flags)
Definition: fqdncache.cc:482
static void purge_entries_fromhosts(void)
Definition: fqdncache.cc:230
void fqdncache_nbgethostbyaddr(const Ip::Address &addr, FQDNH *handler, void *handlerData)
Definition: fqdncache.cc:415
void fqdncache_restart(void)
Definition: fqdncache.cc:638
static void fqdncacheAddEntry(fqdncache_entry *f)
Definition: fqdncache.cc:271
static void fqdncacheRelease(fqdncache_entry *)
Definition: fqdncache.cc:156
static hash_table * fqdn_table
Definition: fqdncache.cc:134
static long fqdncache_low
Definition: fqdncache.cc:137
static void fqdncacheRegisterWithCacheManager(void)
Definition: fqdncache.cc:689
#define FQDN_LOW_WATER
Definition: fqdncache.cc:68
static void fqdncacheLockEntry(fqdncache_entry *f)
Definition: fqdncache.cc:585
static int fqdncacheExpiredEntry(const fqdncache_entry *)
Definition: fqdncache.cc:186
static long fqdncache_high
Definition: fqdncache.cc:140
static fqdncache_entry * fqdncache_get(const char *)
Definition: fqdncache.cc:170
static void fqdncacheUnlockEntry(fqdncache_entry *f)
Definition: fqdncache.cc:595
static int fqdncacheParse(fqdncache_entry *, const rfc1035_rr *, int, const char *error_message)
Definition: fqdncache.cc:317
void fqdnStats(StoreEntry *sentry)
Definition: fqdncache.cc:531
#define FQDN_HIGH_WATER
Definition: fqdncache.cc:71
int fqdncacheCount()
Definition: fqdncache.cc:143
static dlink_list lru_list
Definition: fqdncache.cc:120
static struct _fqdn_cache_stats FqdncacheStats
static void fqdncacheCallback(fqdncache_entry *, int wait)
Definition: fqdncache.cc:292
SQUIDCEXTERN void hashFreeItems(hash_table *, HASHFREE *)
Definition: hash.cc:252
SQUIDCEXTERN void hash_join(hash_table *, hash_link *)
Definition: hash.cc:131
SQUIDCEXTERN void hash_first(hash_table *)
Definition: hash.cc:172
SQUIDCEXTERN int hashPrime(int n)
Definition: hash.cc:293
int HASHCMP(const void *, const void *)
Definition: hash.h:13
SQUIDCEXTERN void hashFreeMemory(hash_table *)
Definition: hash.cc:268
SQUIDCEXTERN hash_link * hash_lookup(hash_table *, const void *)
Definition: hash.cc:146
SQUIDCEXTERN void hash_remove_link(hash_table *, hash_link *)
Definition: hash.cc:220
SQUIDCEXTERN HASHHASH hash4
Definition: hash.h:46
SQUIDCEXTERN hash_link * hash_next(hash_table *)
Definition: hash.cc:188
SQUIDCEXTERN const char * hashKeyStr(const hash_link *)
Definition: hash.cc:313
SQUIDCEXTERN hash_table * hash_create(HASHCMP *, int, HASHHASH *)
Definition: hash.cc:108
#define MAX_IPSTRLEN
Length of buffer that needs to be allocated to old a null-terminated IP-string.
Definition: forward.h:25
void FREE(void *)
Definition: forward.h:36
bool ResolveClientAddressesAsap
whether to do reverse DNS lookups for source IPs of accepted connections
Definition: fqdncache.cc:30
void RegisterAction(char const *action, char const *desc, OBJH *handler, int pw_req_flag, int atomic)
Definition: Registration.cc:16
#define xfree
#define xstrdup
static void handler(int signo)
Definition: purge.cc:854
#define RFC1035_TYPE_PTR
Definition: rfc1035.h:95
#define RFC1035_CLASS_IN
Definition: rfc1035.h:96
#define RFC1035_TYPE_CNAME
Definition: rfc1035.h:94
std::list< SBuf > SBufList
Definition: forward.h:22
const char * snmpDebugOid(oid *Name, snint Len, MemBuf &outbuf)
Definition: snmp_core.cc:1052
#define SNMP_ERR_NOERROR
Definition: snmp_error.h:42
#define SNMP_ERR_NOSUCHNAME
Definition: snmp_error.h:44
#define SMI_GAUGE32
Definition: snmp_vars.h:77
#define SMI_COUNTER32
Definition: snmp_vars.h:76
struct variable_list * snmp_var_new_integer(oid *, int, int, unsigned char)
Definition: snmp_vars.c:151
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
Definition: store.cc:830
Definition: fqdncache.cc:100
bool negcached
Definition: fqdncache.cc:103
bool fromhosts
Definition: fqdncache.cc:104
Flags()
Definition: fqdncache.cc:101
int name_length
Definition: snmp_vars.h:47
oid * name
Definition: snmp_vars.h:46
int unsigned int
Definition: stub_fd.cc:19
struct timeval current_time
the current UNIX time in timeval {seconds, microseconds} format
Definition: gadgets.cc:17
int tvSubMsec(struct timeval t1, struct timeval t2)
Definition: gadgets.cc:51
SQUIDCEXTERN void Tolower(char *)
Definition: util.c:28

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors