1 /*
2  * Copyright (C) 1996-2021 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 #ifndef _SQUID_IPCACHE_H
10 #define _SQUID_IPCACHE_H
11 
12 #include "dns/forward.h"
13 #include "ip/forward.h"
14 
15 class ipcache_addrs
16 {
17 public:
ipcache_addrs()18     ipcache_addrs() : in_addrs(nullptr), bad_mask(nullptr), count(0), cur(0), badcount(0) {}
19 
20     Ip::Address *in_addrs;
21     unsigned char *bad_mask;
22     unsigned char count;
23     unsigned char cur;
24     unsigned char badcount;
25 };
26 
27 typedef void IPH(const ipcache_addrs *, const Dns::LookupDetails &details, void *);
28 
29 void ipcache_purgelru(void *);
30 void ipcache_nbgethostbyname(const char *name, IPH * handler, void *handlerData);
31 const ipcache_addrs *ipcache_gethostbyname(const char *, int flags);
32 void ipcacheInvalidate(const char *);
33 void ipcacheInvalidateNegative(const char *);
34 void ipcache_init(void);
35 void ipcacheCycleAddr(const char *name, ipcache_addrs *);
36 void ipcacheMarkBadAddr(const char *name, const Ip::Address &);
37 void ipcacheMarkGoodAddr(const char *name, const Ip::Address &);
38 void ipcacheMarkAllGood(const char *name);
39 void ipcacheFreeMemory(void);
40 ipcache_addrs *ipcacheCheckNumeric(const char *name);
41 void ipcache_restart(void);
42 int ipcacheAddEntryFromHosts(const char *name, const char *ipaddr);
43 
44 #endif /* _SQUID_IPCACHE_H */
45 
46