From: Francesco Chemolli Date: Sun, 19 Aug 2012 21:32:32 +0000 (+0200) Subject: Moved Cache Digest functions to CacheDigest.h X-Git-Tag: sourceformat-review-1~91 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b814e8d45d73c77aee6863d335d82fd56c373c0a;p=thirdparty%2Fsquid.git Moved Cache Digest functions to CacheDigest.h --- diff --git a/src/CacheDigest.cc b/src/CacheDigest.cc index 47b6788d7e..420b3a4716 100644 --- a/src/CacheDigest.cc +++ b/src/CacheDigest.cc @@ -41,6 +41,9 @@ #if USE_CACHE_DIGESTS +#include "CacheDigest.h" +#include "structs.h" + /* local types */ typedef struct { diff --git a/src/CacheDigest.h b/src/CacheDigest.h new file mode 100644 index 0000000000..b9f1304b77 --- /dev/null +++ b/src/CacheDigest.h @@ -0,0 +1,55 @@ +/* + * DEBUG: section 70 Cache Digest + * AUTHOR: Alex Rousskov + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. + * + */ + +#ifndef SQUID_CACHEDIGEST_H_ +#define SQUID_CACHEDIGEST_H_ + +#include "typedefs.h" +class CacheDigestGuessStats; +class StoreEntry; + +extern CacheDigest *cacheDigestCreate(int capacity, int bpe); +extern void cacheDigestDestroy(CacheDigest * cd); +extern CacheDigest *cacheDigestClone(const CacheDigest * cd); +extern void cacheDigestClear(CacheDigest * cd); +extern void cacheDigestChangeCap(CacheDigest * cd, int new_cap); +extern int cacheDigestTest(const CacheDigest * cd, const cache_key * key); +extern void cacheDigestAdd(CacheDigest * cd, const cache_key * key); +extern void cacheDigestDel(CacheDigest * cd, const cache_key * key); +extern size_t cacheDigestCalcMaskSize(int cap, int bpe); +extern int cacheDigestBitUtil(const CacheDigest * cd); +extern void cacheDigestGuessStatsUpdate(CacheDigestGuessStats * stats, int real_hit, int guess_hit); +extern void cacheDigestGuessStatsReport(const CacheDigestGuessStats * stats, StoreEntry * sentry, const char *label); +extern void cacheDigestReport(CacheDigest * cd, const char *label, StoreEntry * e); + + +#endif /* SQUID_CACHEDIGEST_H_ */ diff --git a/src/Makefile.am b/src/Makefile.am index 3236db25cf..bce5b68773 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -264,6 +264,7 @@ squid_SOURCES = \ AsyncEngine.cc \ AsyncEngine.h \ cache_cf.cc \ + CacheDigest.h \ CacheDigest.cc \ cache_manager.cc \ CacheManager.h \ @@ -1302,6 +1303,7 @@ tests_testCacheManager_SOURCES = \ BodyPipe.cc \ cache_manager.cc \ cache_cf.cc \ + CacheDigest.h \ CacheDigest.cc \ carp.cc \ cbdata.cc \ @@ -1480,6 +1482,7 @@ tests_testCacheManager_DEPENDENCIES = \ $(SQUID_CPPUNIT_LA) tests_testDiskIO_SOURCES = \ + CacheDigest.h \ CacheDigest.cc \ cbdata.cc \ client_db.h \ @@ -1634,6 +1637,7 @@ tests_testEvent_SOURCES = \ AccessLogEntry.cc \ $(ACL_REGISTRATION_SOURCES) \ BodyPipe.cc \ + CacheDigest.h \ CacheDigest.cc \ cache_cf.cc \ cache_manager.cc \ @@ -1834,6 +1838,7 @@ tests_testEventLoop_SOURCES = \ AccessLogEntry.cc \ $(ACL_REGISTRATION_SOURCES) \ BodyPipe.cc \ + CacheDigest.h \ CacheDigest.cc \ cache_manager.cc \ cache_cf.cc \ @@ -2034,6 +2039,7 @@ tests_test_http_range_SOURCES = \ BodyPipe.cc \ cache_cf.cc \ cache_manager.cc \ + CacheDigest.h \ CacheDigest.cc \ carp.cc \ cbdata.cc \ @@ -2281,6 +2287,7 @@ tests_testHttpRequest_SOURCES = \ cache_manager.cc \ cache_cf.cc \ debug.cc \ + CacheDigest.h \ CacheDigest.cc \ carp.cc \ cbdata.cc \ @@ -2454,6 +2461,7 @@ tests_testHttpRequest_DEPENDENCIES = \ ## why so many sources? well httpHeaderTools requites ACLChecklist & friends. ## first line - what we are testing. tests_testStore_SOURCES= \ + CacheDigest.h \ CacheDigest.cc \ cbdata.cc \ ClientInfo.h \ @@ -2696,6 +2704,7 @@ tests_testUfs_SOURCES = \ $(WIN32_SOURCE) \ event.cc \ $(DELAY_POOL_SOURCE) \ + CacheDigest.h \ CacheDigest.cc \ ConfigParser.cc \ EventLoop.cc \ @@ -2799,6 +2808,7 @@ tests_testUfs_DEPENDENCIES = \ tests_testRock_SOURCES = \ cbdata.cc \ + CacheDigest.h \ CacheDigest.cc \ ConfigOption.cc \ ConfigParser.cc \ @@ -2971,6 +2981,7 @@ tests_testCoss_SOURCES = \ $(WIN32_SOURCE) \ event.cc \ $(DELAY_POOL_SOURCE) \ + CacheDigest.h \ CacheDigest.cc \ ConfigParser.cc \ EventLoop.cc \ @@ -3107,6 +3118,7 @@ tests_testNull_SOURCES = \ $(WIN32_SOURCE) \ event.cc \ $(DELAY_POOL_SOURCE) \ + CacheDigest.h \ CacheDigest.cc \ ConfigParser.cc \ EventLoop.cc \ @@ -3206,6 +3218,7 @@ tests_testURL_SOURCES = \ BodyPipe.cc \ cache_cf.cc \ cache_manager.cc \ + CacheDigest.h \ CacheDigest.cc \ carp.cc \ cbdata.cc \ diff --git a/src/neighbors.cc b/src/neighbors.cc index 9f64003c7e..7a27933301 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -33,6 +33,7 @@ #include "squid.h" #include "acl/FilledChecklist.h" #include "anyp/PortCfg.h" +#include "CacheDigest.h" #include "comm/Connection.h" #include "comm/ConnOpener.h" #include "event.h" diff --git a/src/peer_digest.cc b/src/peer_digest.cc index b66000e96d..6319f74a1e 100644 --- a/src/peer_digest.cc +++ b/src/peer_digest.cc @@ -35,6 +35,7 @@ #include "squid.h" #if USE_CACHE_DIGESTS +#include "CacheDigest.h" #include "event.h" #include "forward.h" #include "HttpReply.h" diff --git a/src/protos.h b/src/protos.h index 1263abfdad..b56e64e3cf 100644 --- a/src/protos.h +++ b/src/protos.h @@ -468,22 +468,6 @@ SQUIDCEXTERN pid_t ipcCreate(int type, int *wfd, void **hIpc); -class CacheDigestGuessStats; -/* CacheDigest */ -SQUIDCEXTERN CacheDigest *cacheDigestCreate(int capacity, int bpe); -SQUIDCEXTERN void cacheDigestDestroy(CacheDigest * cd); -SQUIDCEXTERN CacheDigest *cacheDigestClone(const CacheDigest * cd); -SQUIDCEXTERN void cacheDigestClear(CacheDigest * cd); -SQUIDCEXTERN void cacheDigestChangeCap(CacheDigest * cd, int new_cap); -SQUIDCEXTERN int cacheDigestTest(const CacheDigest * cd, const cache_key * key); -SQUIDCEXTERN void cacheDigestAdd(CacheDigest * cd, const cache_key * key); -SQUIDCEXTERN void cacheDigestDel(CacheDigest * cd, const cache_key * key); -SQUIDCEXTERN size_t cacheDigestCalcMaskSize(int cap, int bpe); -SQUIDCEXTERN int cacheDigestBitUtil(const CacheDigest * cd); -SQUIDCEXTERN void cacheDigestGuessStatsUpdate(CacheDigestGuessStats * stats, int real_hit, int guess_hit); -SQUIDCEXTERN void cacheDigestGuessStatsReport(const CacheDigestGuessStats * stats, StoreEntry * sentry, const char *label); -SQUIDCEXTERN void cacheDigestReport(CacheDigest * cd, const char *label, StoreEntry * e); - SQUIDCEXTERN void internalStart(const Comm::ConnectionPointer &clientConn, HttpRequest *, StoreEntry *); SQUIDCEXTERN int internalCheck(const char *urlpath); SQUIDCEXTERN int internalStaticCheck(const char *urlpath); diff --git a/src/stat.cc b/src/stat.cc index 9614495acf..1ce9875b90 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -33,6 +33,7 @@ */ #include "squid.h" +#include "CacheDigest.h" #include "client_side_request.h" #include "client_side.h" #include "comm/Connection.h" diff --git a/src/store.cc b/src/store.cc index fdbead6f35..77d4e3f2c6 100644 --- a/src/store.cc +++ b/src/store.cc @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "CacheDigest.h" #include "CacheManager.h" #include "comm/Connection.h" #include "ETag.h" diff --git a/src/store_digest.cc b/src/store_digest.cc index 6f2efc0259..d2ff1eeb22 100644 --- a/src/store_digest.cc +++ b/src/store_digest.cc @@ -46,8 +46,9 @@ #include "globals.h" #include "mgr/Registration.h" #include "protos.h" -#if USE_CACHE_DIGESTS +#if USE_CACHE_DIGESTS +#include "CacheDigest.h" #include "HttpReply.h" #include "HttpRequest.h" #include "MemObject.h" diff --git a/src/test_cache_digest.cc b/src/test_cache_digest.cc index 017ef0db59..31109e3dc4 100644 --- a/src/test_cache_digest.cc +++ b/src/test_cache_digest.cc @@ -37,6 +37,7 @@ */ #include "squid.h" +#include "CacheDigest.h" #if HAVE_ERRNO_H #include