From: robertc <> Date: Mon, 29 May 2006 06:14:59 +0000 (+0000) Subject: Add a CacheManager class which provides the cachemanager menu registration facility... X-Git-Tag: SQUID_3_0_PRE4~80 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=62ee09caffb37a5dc57b76490399f9299f669f35;p=thirdparty%2Fsquid.git Add a CacheManager class which provides the cachemanager menu registration facility, and remove all compile time dependencies upon cachemgrRegister from squid outside of main.cc. This allows much simpler tests, as modules exporting cache mgr information no longer drag in all of squid via cache_manager.cc. --- diff --git a/include/profiling.h b/include/profiling.h index 1be3c3a186..68986f12af 100644 --- a/include/profiling.h +++ b/include/profiling.h @@ -4,6 +4,12 @@ #include "config.h" +/* forward decls (C++ only) */ +#if __cplusplus + +class CacheManager; +#endif + #ifdef USE_XPROF_STATS #if !defined(_SQUID_SOLARIS_) @@ -158,6 +164,9 @@ SQUIDCEXTERN int xprof_nesting; SQUIDCEXTERN void xprof_start(xprof_type type, const char *timer); SQUIDCEXTERN void xprof_stop(xprof_type type, const char *timer); SQUIDCEXTERN void xprof_event(void *data); +#if __cplusplus +extern void xprofRegisterWithCacheManager(CacheManager & manager); +#endif #define PROF_start(type) xprof_start(XPROF_##type, #type) #define PROF_stop(type) xprof_stop(XPROF_##type, #type) diff --git a/src/ACLASN.h b/src/ACLASN.h index 02da65a86a..ff1b0b08a3 100644 --- a/src/ACLASN.h +++ b/src/ACLASN.h @@ -1,6 +1,6 @@ /* - * $Id: ACLASN.h,v 1.7 2005/05/08 09:15:39 serassio Exp $ + * $Id: ACLASN.h,v 1.8 2006/05/29 00:14:59 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -40,8 +40,13 @@ #include "ACLStrategised.h" #include "ACLChecklist.h" +/* forward decls */ + +class CacheManager; + SQUIDCEXTERN int asnMatchIp(List *, struct IN_ADDR); SQUIDCEXTERN void asnInit(void); +extern void asnRegisterWithCacheManager(CacheManager & manager); SQUIDCEXTERN void asnFreeMemory(void); class ACLASN : public ACLData diff --git a/src/AccessLogEntry.h b/src/AccessLogEntry.h index e0ea912868..661c139e47 100644 --- a/src/AccessLogEntry.h +++ b/src/AccessLogEntry.h @@ -1,6 +1,6 @@ /* - * $Id: AccessLogEntry.h,v 1.4 2005/04/18 21:52:41 hno Exp $ + * $Id: AccessLogEntry.h,v 1.5 2006/05/29 00:14:59 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -38,6 +38,10 @@ #include "HttpVersion.h" #include "HierarchyLogEntry.h" +/* forward decls */ + +class CacheManager; + class AccessLogEntry { @@ -136,14 +140,15 @@ public: }; /* Should be in 'AccessLog.h' as the driver */ -SQUIDCEXTERN void accessLogLog(AccessLogEntry *, ACLChecklist * checklist); -SQUIDCEXTERN void accessLogRotate(void); -SQUIDCEXTERN void accessLogClose(void); -SQUIDCEXTERN void accessLogInit(void); -SQUIDCEXTERN void accessLogFreeMemory(AccessLogEntry * aLogEntry); -SQUIDCEXTERN const char *accessLogTime(time_t); -SQUIDCEXTERN int accessLogParseLogFormat(logformat_token ** fmt, char *def); -SQUIDCEXTERN void accessLogDumpLogFormat(StoreEntry * entry, const char *name, logformat * definitions); -SQUIDCEXTERN void accessLogFreeLogFormat(logformat_token ** fmt); +extern void accessLogLog(AccessLogEntry *, ACLChecklist * checklist); +extern void accessLogRotate(void); +extern void accessLogClose(void); +extern void accessLogInit(void); +extern void accessLogRegisterWithCacheManager(CacheManager & manager); +extern void accessLogFreeMemory(AccessLogEntry * aLogEntry); +extern const char *accessLogTime(time_t); +extern int accessLogParseLogFormat(logformat_token ** fmt, char *def); +extern void accessLogDumpLogFormat(StoreEntry * entry, const char *name, logformat * definitions); +extern void accessLogFreeLogFormat(logformat_token ** fmt); #endif /* SQUID_HTTPACCESSLOGENTRY_H */ diff --git a/src/AuthConfig.cc b/src/AuthConfig.cc index 6761ea8255..361c1b14e2 100644 --- a/src/AuthConfig.cc +++ b/src/AuthConfig.cc @@ -1,6 +1,6 @@ /* - * $Id: AuthConfig.cc,v 1.1 2004/08/30 03:28:56 robertc Exp $ + * $Id: AuthConfig.cc,v 1.2 2006/05/29 00:14:59 robertc Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Robert Collins @@ -76,3 +76,8 @@ AuthConfig::Find(const char *proxy_auth) return NULL; } + +/* Default behaviour is to expose nothing */ +void +AuthConfig::registerWithCacheManager(CacheManager & manager) +{} diff --git a/src/AuthConfig.h b/src/AuthConfig.h index 7658212afb..9e75c3a3c7 100644 --- a/src/AuthConfig.h +++ b/src/AuthConfig.h @@ -1,6 +1,6 @@ /* - * $Id: AuthConfig.h,v 1.1 2004/08/30 03:28:56 robertc Exp $ + * $Id: AuthConfig.h,v 1.2 2006/05/29 00:14:59 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -74,6 +74,8 @@ public: virtual void fixHeader(auth_user_request_t *, HttpReply *, http_hdr_type, HttpRequest *) = 0; /* prepare to handle requests */ virtual void init(AuthConfig *) = 0; + /* expose any/all statistics to a CacheManager */ + virtual void registerWithCacheManager(CacheManager & manager); /* parse config options */ virtual void parse(AuthConfig *, int, char *) = 0; /* the http string id */ diff --git a/src/CacheManager.h b/src/CacheManager.h new file mode 100644 index 0000000000..2864212942 --- /dev/null +++ b/src/CacheManager.h @@ -0,0 +1,94 @@ + +/* + * $Id: CacheManager.h,v 1.1 2006/05/29 00:14:59 robertc Exp $ + * + * + * 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_CACHEMANAGER_H +#define SQUID_CACHEMANAGER_H + +#include "squid.h" + + +extern void cachemgrStart(int fd, HttpRequest * request, StoreEntry * entry); + +/* + * A single menu item in the cache manager - an 'action'. + */ + +class CacheManagerAction +{ + +public: + char *action; + char *desc; + OBJH *handler; + + struct + { + +unsigned int pw_req: + 1; + +unsigned int atomic: + 1; + } + + flags; + + CacheManagerAction *next; +}; + + +/* + * a CacheManager - the menu system for interacting with squid. + * This is currently just an adapter to the global cachemgr* routines to + * provide looser coupling between modules, but once fully transitioned, + * an instance of this class will represent a single independent manager. + */ + +class CacheManager +{ + +public: + CacheManager(); + /* the holy trinity - assignment, copy cons, destructor */ + /* unimplemented - prevents bugs from synthetic */ + CacheManager & operator = (CacheManager &); + /* unimplemented - prevents bugs from synthetic */ + CacheManager(CacheManager const &); + /* inline so that we dont need to link in cachemgr.cc at all in tests */ + virtual ~CacheManager() {} + + virtual void registerAction(char const * action, char const * desc, OBJH * handler, int pw_req_flag, int atomic); + virtual CacheManagerAction * findAction(char const * action); +}; + +#endif /* SQUID_CACHEMANAGER_H */ diff --git a/src/ConfigParser.h b/src/ConfigParser.h index 3ecfae2a8b..fde3c4b442 100644 --- a/src/ConfigParser.h +++ b/src/ConfigParser.h @@ -1,6 +1,6 @@ /* - * $Id: ConfigParser.h,v 1.5 2006/04/28 05:13:20 wessels Exp $ + * $Id: ConfigParser.h,v 1.6 2006/05/29 00:14:59 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -38,6 +38,10 @@ #include "squid.h" +/* forward decls */ + +class CacheManager; + /* * A configuration file Parser. Instances of this class track * parsing state and perform tokenisation. Syntax is currently @@ -62,4 +66,6 @@ public: static char * strtokFile(); }; +extern int parseConfigFile(const char *file_name, CacheManager & manager); + #endif /* SQUID_CONFIGPARSER_H */ diff --git a/src/DelayPools.h b/src/DelayPools.h index 8e94af3a51..c1148762ba 100644 --- a/src/DelayPools.h +++ b/src/DelayPools.h @@ -1,6 +1,6 @@ /* - * $Id: DelayPools.h,v 1.3 2003/03/04 01:40:25 robertc Exp $ + * $Id: DelayPools.h,v 1.4 2006/05/29 00:14:59 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -36,6 +36,10 @@ #ifndef SQUID_DELAYPOOLS_H #define SQUID_DELAYPOOLS_H +/* forward decls */ + +class CacheManager; + #include "Array.h" class Updateable @@ -54,6 +58,7 @@ class DelayPools public: static void Init(); + static void RegisterWithCacheManager(CacheManager & manager); static void Update(void *); static unsigned short pools(); static void pools (u_short pools); diff --git a/src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.cc b/src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.cc index 4cdc6d2330..bd34d0c59a 100644 --- a/src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.cc +++ b/src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.cc @@ -1,6 +1,6 @@ /* - * $Id: DiskDaemonDiskIOModule.cc,v 1.2 2005/05/01 10:49:03 serassio Exp $ + * $Id: DiskDaemonDiskIOModule.cc,v 1.3 2006/05/29 00:15:03 robertc Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -33,6 +33,7 @@ #include "squid.h" #include "DiskDaemonDiskIOModule.h" +#include "CacheManager.h" #include "DiskdIOStrategy.h" #include "Store.h" @@ -58,12 +59,16 @@ DiskDaemonDiskIOModule::init() */ assert(!initialised); memset(&diskd_stats, '\0', sizeof(diskd_stats)); - cachemgrRegister("diskd", "DISKD Stats", Stats, 0, 1); - - debug(47, 1) ("diskd started\n"); + debugs(47, 1, "diskd started"); initialised = true; } +void +DiskDaemonDiskIOModule::registerWithCacheManager(CacheManager & manager) +{ + manager.registerAction("diskd", "DISKD Stats", Stats, 0, 1); +} + void DiskDaemonDiskIOModule::shutdown() { diff --git a/src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.h b/src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.h index dc9b1e3605..233812cd43 100644 --- a/src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.h +++ b/src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.h @@ -1,6 +1,6 @@ /* - * $Id: DiskDaemonDiskIOModule.h,v 1.1 2004/12/20 16:30:38 robertc Exp $ + * $Id: DiskDaemonDiskIOModule.h,v 1.2 2006/05/29 00:15:03 robertc Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -43,6 +43,7 @@ public: static DiskDaemonDiskIOModule &GetInstance(); DiskDaemonDiskIOModule(); virtual void init(); + virtual void registerWithCacheManager(CacheManager & manager); virtual void shutdown(); virtual char const *type () const; virtual DiskIOStrategy* createStrategy(); diff --git a/src/DiskIO/DiskIOModule.cc b/src/DiskIO/DiskIOModule.cc index 2a4190f871..fbabb84217 100644 --- a/src/DiskIO/DiskIOModule.cc +++ b/src/DiskIO/DiskIOModule.cc @@ -1,6 +1,6 @@ /* - * $Id: DiskIOModule.cc,v 1.1 2004/12/20 16:30:38 robertc Exp $ + * $Id: DiskIOModule.cc,v 1.2 2006/05/29 00:15:03 robertc Exp $ * * DEBUG: section 92 Storage File System * AUTHOR: Robert Collins @@ -48,6 +48,13 @@ DiskIOModule::DiskIOModule() */ } +void +DiskIOModule::RegisterAllModulesWithCacheManager(CacheManager & manager) +{ + for (iterator i = GetModules().begin(); i != GetModules().end(); ++i) + (*i)->registerWithCacheManager(manager); +} + void DiskIOModule::SetupAllModules() { @@ -107,3 +114,8 @@ DiskIOModule::Find(char const *type) return NULL; } + +/* disk modules dont export anything by default */ +void +DiskIOModule::registerWithCacheManager(CacheManager & manager) +{} diff --git a/src/DiskIO/DiskIOModule.h b/src/DiskIO/DiskIOModule.h index 1b7e9f6fa8..995b92607b 100644 --- a/src/DiskIO/DiskIOModule.h +++ b/src/DiskIO/DiskIOModule.h @@ -1,6 +1,6 @@ /* - * $Id: DiskIOModule.h,v 1.1 2004/12/20 16:30:38 robertc Exp $ + * $Id: DiskIOModule.h,v 1.2 2006/05/29 00:15:03 robertc Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -37,12 +37,17 @@ #include "squid.h" #include "Array.h" +/* forward decls */ + +class CacheManager; + class DiskIOStrategy; class DiskIOModule { public: + static void RegisterAllModulesWithCacheManager(CacheManager & manager); static void SetupAllModules(); static void ModuleAdd(DiskIOModule &); static void FreeAllModules(); @@ -54,6 +59,7 @@ public: virtual ~DiskIOModule(){} virtual void init() = 0; + virtual void registerWithCacheManager(CacheManager & manager); virtual void shutdown() = 0; virtual DiskIOStrategy *createStrategy() = 0; diff --git a/src/DiskIO/DiskThreads/DiskThreadsDiskIOModule.cc b/src/DiskIO/DiskThreads/DiskThreadsDiskIOModule.cc index 564018a9b9..4fc53ba089 100644 --- a/src/DiskIO/DiskThreads/DiskThreadsDiskIOModule.cc +++ b/src/DiskIO/DiskThreads/DiskThreadsDiskIOModule.cc @@ -1,6 +1,6 @@ /* - * $Id: DiskThreadsDiskIOModule.cc,v 1.1 2004/12/20 16:30:38 robertc Exp $ + * $Id: DiskThreadsDiskIOModule.cc,v 1.2 2006/05/29 00:15:03 robertc Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -53,6 +53,12 @@ DiskThreadsDiskIOModule::init() DiskThreadsIOStrategy::Instance.init(); } +void +DiskThreadsDiskIOModule::registerWithCacheManager(CacheManager & manager) +{ + DiskThreadsIOStrategy::Instance.registerWithCacheManager(manager); +} + void DiskThreadsDiskIOModule::shutdown() { diff --git a/src/DiskIO/DiskThreads/DiskThreadsDiskIOModule.h b/src/DiskIO/DiskThreads/DiskThreadsDiskIOModule.h index a5fe10ca34..6386e1a4ae 100644 --- a/src/DiskIO/DiskThreads/DiskThreadsDiskIOModule.h +++ b/src/DiskIO/DiskThreads/DiskThreadsDiskIOModule.h @@ -1,6 +1,6 @@ /* - * $Id: DiskThreadsDiskIOModule.h,v 1.1 2004/12/20 16:30:38 robertc Exp $ + * $Id: DiskThreadsDiskIOModule.h,v 1.2 2006/05/29 00:15:03 robertc Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -43,6 +43,7 @@ public: static DiskThreadsDiskIOModule &GetInstance(); DiskThreadsDiskIOModule(); virtual void init(); + virtual void registerWithCacheManager(CacheManager & manager); virtual void shutdown(); virtual char const *type () const; virtual DiskIOStrategy* createStrategy(); diff --git a/src/DiskIO/DiskThreads/DiskThreadsIOStrategy.cc b/src/DiskIO/DiskThreads/DiskThreadsIOStrategy.cc index 3938012f63..e0446a6190 100644 --- a/src/DiskIO/DiskThreads/DiskThreadsIOStrategy.cc +++ b/src/DiskIO/DiskThreads/DiskThreadsIOStrategy.cc @@ -1,6 +1,6 @@ /* - * $Id: DiskThreadsIOStrategy.cc,v 1.5 2006/05/23 18:24:41 wessels Exp $ + * $Id: DiskThreadsIOStrategy.cc,v 1.6 2006/05/29 00:15:03 robertc Exp $ * * DEBUG: section 79 Squid-side Disk I/O functions. * AUTHOR: Robert Collins @@ -36,6 +36,7 @@ #include "squid.h" +#include "CacheManager.h" #include "DiskThreadsIOStrategy.h" #include "DiskThreadsDiskFile.h" /* for statfs */ @@ -52,9 +53,6 @@ DiskThreadsIOStrategy::init(void) squidaio_ctrl_pool = new MemAllocatorProxy("aio_ctrl", sizeof(squidaio_ctrl_t)); - cachemgrRegister("squidaio_counts", "Async IO Function Counters", - aioStats, 0, 1); - initialised = true; /* @@ -64,6 +62,13 @@ DiskThreadsIOStrategy::init(void) */ } +void +DiskThreadsIOStrategy::registerWithCacheManager(CacheManager & manager) +{ + manager.registerAction("squidaio_counts", "Async IO Function Counters", + aioStats, 0, 1); +} + void DiskThreadsIOStrategy::done(void) { diff --git a/src/DiskIO/DiskThreads/DiskThreadsIOStrategy.h b/src/DiskIO/DiskThreads/DiskThreadsIOStrategy.h index 83f47f8cf4..56e8199fe6 100644 --- a/src/DiskIO/DiskThreads/DiskThreadsIOStrategy.h +++ b/src/DiskIO/DiskThreads/DiskThreadsIOStrategy.h @@ -1,6 +1,6 @@ /* - * $Id: DiskThreadsIOStrategy.h,v 1.2 2005/04/01 21:11:28 serassio Exp $ + * $Id: DiskThreadsIOStrategy.h,v 1.3 2006/05/29 00:15:03 robertc Exp $ * * DEBUG: section 79 Squid-side Disk I/O functions. * AUTHOR: Robert Collins @@ -59,6 +59,7 @@ public: virtual int callback(); virtual void sync(); virtual void init(); + virtual void registerWithCacheManager(CacheManager & manager); void done(); /* Todo: add access limitations */ bool initialised; diff --git a/src/ExternalACL.h b/src/ExternalACL.h index 3a06392214..0c1fa11333 100644 --- a/src/ExternalACL.h +++ b/src/ExternalACL.h @@ -1,6 +1,6 @@ /* - * $Id: ExternalACL.h,v 1.8 2005/05/06 01:57:55 hno Exp $ + * $Id: ExternalACL.h,v 1.9 2006/05/29 00:14:59 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -91,4 +91,6 @@ protected: MEMPROXY_CLASS_INLINE(ACLExternal) +extern void externalAclRegisterWithCacheManager(CacheManager & manager); + #endif /* SQUID_EXTERNALACL_H */ diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc index c9fd4f5daf..c9e34c8b5a 100644 --- a/src/HttpHeader.cc +++ b/src/HttpHeader.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpHeader.cc,v 1.120 2006/05/09 21:48:51 wessels Exp $ + * $Id: HttpHeader.cc,v 1.121 2006/05/29 00:15:00 robertc Exp $ * * DEBUG: section 55 HTTP Header * AUTHOR: Alex Rousskov @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "CacheManager.h" #include "Store.h" #include "HttpHeader.h" #include "HttpHdrContRange.h" @@ -313,10 +314,15 @@ httpHeaderInitModule(void) httpHdrCcInitModule(); httpHdrScInitModule(); +} +void +httpHeaderRegisterWithCacheManager(CacheManager & manager) +{ /* register with cache manager */ - cachemgrRegister("http_headers", - "HTTP Header Statistics", httpHeaderStoreReport, 0, 1); + manager.registerAction("http_headers", + "HTTP Header Statistics", + httpHeaderStoreReport, 0, 1); } void diff --git a/src/HttpHeader.h b/src/HttpHeader.h index 6c34deef5e..2f6abe6d5a 100644 --- a/src/HttpHeader.h +++ b/src/HttpHeader.h @@ -1,6 +1,6 @@ /* - * $Id: HttpHeader.h,v 1.15 2006/05/23 20:30:48 hno Exp $ + * $Id: HttpHeader.h,v 1.16 2006/05/29 00:15:00 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -34,6 +34,9 @@ #ifndef SQUID_HTTPHEADER_H #define SQUID_HTTPHEADER_H +/* forward decls */ + +class CacheManager; /* because we pass a spec by value */ #include "HttpHeaderRange.h" /* HttpHeader holds a HttpHeaderMask */ @@ -248,6 +251,8 @@ private: //const HttpHeader operator=(const HttpHeader &); }; + +extern void httpHeaderRegisterWithCacheManager(CacheManager & manager); extern int httpHeaderParseQuotedString (const char *start, String *val); SQUIDCEXTERN int httpHeaderHasByNameListMember(const HttpHeader * hdr, const char *name, const char *member, const char separator); SQUIDCEXTERN void httpHeaderUpdate(HttpHeader * old, const HttpHeader * fresh, const HttpHeaderMask * denied_mask); diff --git a/src/LeakFinder.cc b/src/LeakFinder.cc index 38990f18fa..f4bcb8b213 100644 --- a/src/LeakFinder.cc +++ b/src/LeakFinder.cc @@ -1,6 +1,6 @@ /* - * $Id: LeakFinder.cc,v 1.3 2006/05/09 15:47:45 wessels Exp $ + * $Id: LeakFinder.cc,v 1.4 2006/05/29 00:15:00 robertc Exp $ * * DEBUG: section 45 Callback Data Registry * AUTHOR: Duane Wessels @@ -59,7 +59,9 @@ LeakFinder::LeakFinder() debug(45, 3) ("LeakFinder constructed\n"); table = hash_create(cmp, 1 << 8, hash); #if 0 - + /* if this is desired to reinstate, add a + * RegisterWithCacheManager method + */ cachemgrRegister("leaks", "Memory Leak Tracking", cachemgr_dump, 0, 1); diff --git a/src/Makefile.am b/src/Makefile.am index 4e7dbe5d13..e90cf676a2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.am,v 1.147 2006/05/27 00:58:16 hno Exp $ +# $Id: Makefile.am,v 1.148 2006/05/29 00:15:00 robertc Exp $ # # Uncomment and customize the following to suit your needs: # @@ -369,6 +369,7 @@ squid_SOURCES = \ cache_cf.cc \ CacheDigest.cc \ cache_manager.cc \ + CacheManager.h \ carp.cc \ cbdata.cc \ client_db.cc \ @@ -1038,6 +1039,7 @@ check_PROGRAMS+= \ tests/testAuth \ tests/testACLMaxUserIP \ tests/testBoilerplate \ + tests/testCacheManager \ tests/testHeaders \ tests/test_http_range \ tests/testHttpRequest \ @@ -1050,7 +1052,7 @@ tests_testAuth_SOURCES= tests/testAuth.cc tests/testMain.cc tests/testAuth.h $( authenticate.cc \ ConfigParser.cc \ tests/stub_acl.cc tests/stub_cache_cf.cc \ - tests/stub_helper.cc cbdata.cc String.cc tests/stub_cache_manager.cc \ + tests/stub_helper.cc cbdata.cc String.cc \ tests/stub_store.cc HttpHeaderTools.cc HttpHeader.cc acl.cc event.cc mem.cc \ MemBuf.cc HttpHdrContRange.cc Packer.cc ACLChecklist.cc HttpHdrCc.cc HttpHdrSc.cc \ HttpHdrScTarget.cc url.cc ACLProxyAuth.cc ACLRegexData.cc ACLUserData.cc \ @@ -1129,7 +1131,6 @@ tests_testACLMaxUserIP_SOURCES= \ StatHist.cc \ stmem.cc \ String.cc \ - tests/stub_cache_manager.cc \ tests/stub_comm.cc \ tests/stub_DelayId.cc \ tests/stub_MemObject.cc \ @@ -1169,6 +1170,154 @@ tests_testBoilerplate_LDFLAGS = $(LIBADD_DL) tests_testBoilerplate_DEPENDENCIES = \ @SQUID_CPPUNIT_LA@ +## Tests of the CacheManager module. +tests_testCacheManager_SOURCES = \ + debug.cc \ + globals.cc \ + HttpRequest.cc \ + HttpRequestMethod.cc \ + mem.cc \ + String.cc \ + tests/testCacheManager.cc \ + tests/testMain.cc \ + time.cc \ + access_log.cc \ + acl.cc \ + acl_noncore.cc \ + ACLChecklist.cc \ + ACLProxyAuth.cc \ + ACLStringData.cc \ + ACLRegexData.cc \ + ACLUserData.cc \ + authenticate.cc \ + BodyReader.cc \ + cache_manager.cc \ + cache_cf.cc \ + CacheDigest.cc \ + carp.cc \ + cbdata.cc \ + client_db.cc \ + client_side.cc \ + client_side_reply.cc \ + client_side_request.cc \ + clientStream.cc \ + comm_select.cc \ + comm_poll.cc \ + comm_epoll.cc \ + comm_kqueue.cc \ + ConfigOption.cc \ + ConfigParser.cc \ + $(DELAY_POOL_SOURCE) \ + disk.cc \ + $(DNSSOURCE) \ + event.cc \ + errorpage.cc \ + $(ESI_SOURCE) \ + ETag.cc \ + external_acl.cc \ + ExternalACLEntry.cc \ + fd.cc \ + fde.cc \ + forward.cc \ + fqdncache.cc \ + ftp.cc \ + gopher.cc \ + helper.cc \ + $(HTCPSOURCE) \ + http.cc \ + HttpBody.cc \ + HttpHeader.cc \ + HttpHeaderTools.cc \ + HttpHdrCc.cc \ + HttpHdrContRange.cc \ + HttpHdrRange.cc \ + HttpHdrSc.cc \ + HttpHdrScTarget.cc \ + HttpMsg.cc \ + HttpReply.cc \ + HttpStatusLine.cc \ + icmp.cc \ + icp_v2.cc \ + icp_v3.cc \ + $(IDENT_SOURCE) \ + ipc.cc \ + ipcache.cc \ + int.cc \ + internal.cc \ + list.cc \ + logfile.cc \ + multicast.cc \ + mem_node.cc \ + MemBuf.cc \ + MemObject.cc \ + mime.cc \ + neighbors.cc \ + net_db.cc \ + Packer.cc \ + Parsing.cc \ + pconn.cc \ + peer_digest.cc \ + peer_select.cc \ + redirect.cc \ + referer.cc \ + refresh.cc \ + Server.cc \ + $(SNMP_SOURCE) \ + $(SSL_SOURCE) \ + stat.cc \ + StatHist.cc \ + stmem.cc \ + store.cc \ + store_client.cc \ + store_digest.cc \ + store_dir.cc \ + store_io.cc \ + store_key_md5.cc \ + store_log.cc \ + store_rebuild.cc \ + store_swapin.cc \ + store_swapmeta.cc \ + store_swapout.cc \ + StoreFileSystem.cc \ + StoreIOState.cc \ + StoreMeta.cc \ + StoreMetaMD5.cc \ + StoreMetaSTD.cc \ + StoreMetaUnpacker.cc \ + StoreMetaURL.cc \ + StoreMetaVary.cc \ + StoreSwapLogData.cc \ + tools.cc \ + tunnel.cc \ + SwapDir.cc \ + url.cc \ + URLScheme.cc \ + urn.cc \ + useragent.cc \ + wais.cc \ + whois.cc \ + wordlist.cc +nodist_tests_testCacheManager_SOURCES = \ + repl_modules.cc \ + string_arrays.c +tests_testCacheManager_LDADD = \ + libsquid.la \ + libauth.la \ + @REPL_OBJS@ \ + @ICAP_LIBS@ \ + @REGEXLIB@ \ + @SSLLIB@ \ + -L../lib -lmiscutil \ + @XTRA_LIBS@ \ + @SQUID_CPPUNIT_LA@ \ + @SNMPLIB@ +tests_testCacheManager_LDFLAGS = $(LIBADD_DL) +tests_testCacheManager_DEPENDENCIES = $(top_builddir)/lib/libmiscutil.a \ + @REPL_OBJS@ \ + @SQUID_CPPUNIT_LA@ \ + @ICAP_LIBS@ + + ## test headers checks that individual headers can be parsed with no dependencies. ## as such, it needs a new .cc file for each header it parses, so that they ## can be #included with no baggage. If the binary links, the test passed. @@ -1506,7 +1655,7 @@ STORE_TEST_SOURCES=\ SwapDir.cc \ authenticate.cc \ tests/stub_acl.cc tests/stub_cache_cf.cc \ - tests/stub_helper.cc cbdata.cc String.cc tests/stub_cache_manager.cc \ + tests/stub_helper.cc cbdata.cc String.cc \ tests/stub_comm.cc \ tests/stub_client_side_request.cc \ tests/stub_http.cc \ @@ -1557,11 +1706,10 @@ tests_testStore_LDFLAGS = $(LIBADD_DL) tests_testStore_DEPENDENCIES = $(top_builddir)/lib/libmiscutil.a \ @SQUID_CPPUNIT_LA@ -# string needs mem.cc. mem.cc wants cache_manage +# string needs mem.cc. tests_testString_SOURCES= \ mem.cc \ String.cc \ - tests/stub_cache_manager.cc \ tests/testMain.cc \ tests/testString.cc \ tests/testString.h \ diff --git a/src/Mem.h b/src/Mem.h index ab234f0446..22f7d44c7b 100644 --- a/src/Mem.h +++ b/src/Mem.h @@ -1,6 +1,6 @@ /* - * $Id: Mem.h,v 1.3 2006/05/03 14:04:44 robertc Exp $ + * $Id: Mem.h,v 1.4 2006/05/29 00:15:01 robertc Exp $ * * DEBUG: section 13 High Level Memory Pool Management * AUTHOR: Harvest Derived @@ -36,6 +36,10 @@ #ifndef SQUID_MEM #define SQUID_MEM +/* forward decls */ + +class CacheManager; + #include class Mem @@ -43,6 +47,7 @@ class Mem public: static void Init(); + static void RegisterWithCacheManager(CacheManager & manager); static void Stats(StoreEntry *); static void CleanIdlePools(void *unused); static void Report(std::ostream &); diff --git a/src/ProfStats.cc b/src/ProfStats.cc index 99643e8c13..1e593ea2fb 100644 --- a/src/ProfStats.cc +++ b/src/ProfStats.cc @@ -1,6 +1,6 @@ /* - * $Id: ProfStats.cc,v 1.6 2005/06/03 15:00:55 serassio Exp $ + * $Id: ProfStats.cc,v 1.7 2006/05/29 00:15:01 robertc Exp $ * * DEBUG: section 81 CPU Profiling Routines * AUTHOR: Andres Kroonmaa @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "CacheManager.h" #ifdef USE_XPROF_STATS #include "Store.h" @@ -273,8 +274,12 @@ xprof_Init(void) xprof_delta = xprof_verystart = xprof_start_t = now; xprof_inited = 1; +} - cachemgrRegister("cpu_profile", "CPU Profiling Stats", xprof_summary, 0, 1); +void +xprofRegisterWithCacheManager(CacheManager & manager) +{ + manager.registerAction("cpu_profile", "CPU Profiling Stats", xprof_summary, 0, 1); } void diff --git a/src/SquidString.h b/src/SquidString.h index dd50269c82..9dfaeb49b5 100644 --- a/src/SquidString.h +++ b/src/SquidString.h @@ -1,6 +1,6 @@ /* - * $Id: SquidString.h,v 1.7 2006/05/03 14:04:44 robertc Exp $ + * $Id: SquidString.h,v 1.8 2006/05/29 00:15:01 robertc Exp $ * * DEBUG: section 67 String * AUTHOR: Duane Wessels @@ -36,6 +36,10 @@ #ifndef SQUID_STRING_H #define SQUID_STRING_H +/* forward decls */ + +class CacheManager; + #define DEBUGSTRINGS 0 #if DEBUGSTRINGS #include "splay.h" @@ -46,13 +50,13 @@ class StringRegistry { public: - StringRegistry() : registered(false) {} - static StringRegistry &Instance(); void add (String const *); + void registerWithCacheManager(CacheManager & manager); + void remove (String const *); @@ -67,7 +71,6 @@ private: bool registered; - void registerMe(); }; class StoreEntry; diff --git a/src/Store.h b/src/Store.h index 14f32837c3..247bdd1605 100644 --- a/src/Store.h +++ b/src/Store.h @@ -1,6 +1,6 @@ /* - * $Id: Store.h,v 1.23 2006/05/19 20:22:56 wessels Exp $ + * $Id: Store.h,v 1.24 2006/05/29 00:15:01 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -282,6 +282,7 @@ SQUIDCEXTERN StoreEntry *storeCreateEntry(const char *, const char *, request_fl SQUIDCEXTERN void storeSetPublicKey(StoreEntry *); SQUIDCEXTERN void storeCreateMemObject(StoreEntry *, const char *, const char *); SQUIDCEXTERN void storeInit(void); +extern void storeRegisterWithCacheManager(CacheManager & manager); SQUIDCEXTERN void storeAbort(StoreEntry *); SQUIDCEXTERN void storeAppend(StoreEntry *, const char *, int); SQUIDCEXTERN void storeExpireNow(StoreEntry *); diff --git a/src/StoreFileSystem.cc b/src/StoreFileSystem.cc index 5f516ac912..e25e3ff32c 100644 --- a/src/StoreFileSystem.cc +++ b/src/StoreFileSystem.cc @@ -1,6 +1,6 @@ /* - * $Id: StoreFileSystem.cc,v 1.1 2003/07/22 15:23:01 robertc Exp $ + * $Id: StoreFileSystem.cc,v 1.2 2006/05/29 00:15:01 robertc Exp $ * * DEBUG: section 92 Storage File System * AUTHOR: Robert Collins @@ -39,6 +39,13 @@ Vector *StoreFileSystem::_FileSystems = NULL; +void +StoreFileSystem::RegisterAllFsWithCacheManager(CacheManager & manager) +{ + for (iterator i = GetFileSystems().begin(); i != GetFileSystems().end(); ++i) + (*i)->registerWithCacheManager(manager); +} + void StoreFileSystem::SetupAllFs() { @@ -89,3 +96,7 @@ StoreFileSystem::FreeAllFs() } } +/* no filesystem is required to export statistics */ +void +StoreFileSystem::registerWithCacheManager(CacheManager & manager) +{} diff --git a/src/StoreFileSystem.h b/src/StoreFileSystem.h index 3be1789379..aa4d5193ab 100644 --- a/src/StoreFileSystem.h +++ b/src/StoreFileSystem.h @@ -1,6 +1,6 @@ /* - * $Id: StoreFileSystem.h,v 1.1 2003/07/22 15:23:01 robertc Exp $ + * $Id: StoreFileSystem.h,v 1.2 2006/05/29 00:15:01 robertc Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -37,10 +37,15 @@ #include "squid.h" #include "Array.h" +/* forward decls */ + +class CacheManager; + class StoreFileSystem { public: + static void RegisterAllFsWithCacheManager(CacheManager & manager); static void SetupAllFs(); static void FsAdd(StoreFileSystem &); static void FreeAllFs(); @@ -54,6 +59,7 @@ public: virtual char const *type () const = 0; virtual SwapDir *createSwapDir() = 0; virtual void done() = 0; + virtual void registerWithCacheManager(CacheManager & manager); virtual void setup() = 0; // Not implemented StoreFileSystem(StoreFileSystem const &); diff --git a/src/String.cc b/src/String.cc index ee115e37d2..cb991407ad 100644 --- a/src/String.cc +++ b/src/String.cc @@ -1,6 +1,6 @@ /* - * $Id: String.cc,v 1.20 2005/09/27 20:37:42 wessels Exp $ + * $Id: String.cc,v 1.21 2006/05/29 00:15:01 robertc Exp $ * * DEBUG: section 67 String * AUTHOR: Duane Wessels @@ -239,11 +239,10 @@ ptrcmp(C const &lhs, C const &rhs) } void -StringRegistry::registerMe() +StringRegistry::registerWithCacheManager(CacheManager & manager) { - registered = true; - cachemgrRegister("strings", - "Strings in use in squid", Stat, 0, 1); + manager.registerAction("strings", + "Strings in use in squid", Stat, 0, 1); } void @@ -251,9 +250,6 @@ void StringRegistry::add (String const *entry) { - if (!registered) - registerMe(); - entries.insert(entry, ptrcmp); } diff --git a/src/access_log.cc b/src/access_log.cc index 402288c62b..23957eb18f 100644 --- a/src/access_log.cc +++ b/src/access_log.cc @@ -1,6 +1,6 @@ /* - * $Id: access_log.cc,v 1.112 2006/05/08 23:38:33 robertc Exp $ + * $Id: access_log.cc,v 1.113 2006/05/29 00:15:01 robertc Exp $ * * DEBUG: section 46 Access Log * AUTHOR: Duane Wessels @@ -100,7 +100,7 @@ typedef struct fvdb_entry; static hash_table *via_table = NULL; static hash_table *forw_table = NULL; -static void fvdbInit(void); +static void fvdbInit(CacheManager *); static void fvdbDumpTable(StoreEntry * e, hash_table * hash); static void fvdbCount(hash_table * hash, const char *key); static OBJH fvdbDumpVia; @@ -1529,11 +1529,6 @@ accessLogInit(void) assert(NULL != headerslog); -#endif -#if FORW_VIA_DB - - fvdbInit(); - #endif #if MULTICAST_MISS_STREAM @@ -1561,6 +1556,21 @@ accessLogInit(void) fatal("mcast_encode_key is too short, must be 16 characters"); } +#endif +#if FORW_VIA_DB + + fvdbInit(); + +#endif +} + +void +accessLogRegisterWithCacheManager(CacheManager & manager) +{ +#if FORW_VIA_DB + + fvdbRegisterWithCacheManager(manager); + #endif } @@ -1589,9 +1599,14 @@ fvdbInit(void) { via_table = hash_create((HASHCMP *) strcmp, 977, hash4); forw_table = hash_create((HASHCMP *) strcmp, 977, hash4); - cachemgrRegister("via_headers", "Via Request Headers", fvdbDumpVia, 0, 1); - cachemgrRegister("forw_headers", "X-Forwarded-For Request Headers", - fvdbDumpForw, 0, 1); +} + +static void +fvdbRegisterWithCacheManager(CacheManager & manager) +{ + manager.registerAction("via_headers", "Via Request Headers", fvdbDumpVia, 0, 1); + manager.registerAction("forw_headers", "X-Forwarded-For Request Headers", + fvdbDumpForw, 0, 1); } static void diff --git a/src/asn.cc b/src/asn.cc index 248c608c98..eff7653555 100644 --- a/src/asn.cc +++ b/src/asn.cc @@ -1,6 +1,6 @@ /* - * $Id: asn.cc,v 1.107 2006/05/19 17:19:09 wessels Exp $ + * $Id: asn.cc,v 1.108 2006/05/29 00:15:01 robertc Exp $ * * DEBUG: section 53 AS Number handling * AUTHOR: Duane Wessels, Kostas Anagnostakis @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "CacheManager.h" #include "radix.h" #include "HttpRequest.h" #include "StoreClient.h" @@ -201,8 +202,12 @@ asnInit(void) squid_rn_init(); squid_rn_inithead(&AS_tree_head, 8); +} - cachemgrRegister("asndb", "AS Number Database", asnStats, 0, 1); +void +asnRegisterWithCacheManager(CacheManager & manager) +{ + manager.registerAction("asndb", "AS Number Database", asnStats, 0, 1); } void diff --git a/src/auth/basic/auth_basic.cc b/src/auth/basic/auth_basic.cc index f55fe929bc..d838c630f3 100644 --- a/src/auth/basic/auth_basic.cc +++ b/src/auth/basic/auth_basic.cc @@ -1,5 +1,5 @@ /* - * $Id: auth_basic.cc,v 1.41 2006/05/08 23:38:35 robertc Exp $ + * $Id: auth_basic.cc,v 1.42 2006/05/29 00:15:03 robertc Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Duane Wessels @@ -40,6 +40,7 @@ #include "squid.h" #include "auth_basic.h" #include "authenticate.h" +#include "CacheManager.h" #include "Store.h" #include "HttpReply.h" #include "basicScheme.h" @@ -584,8 +585,6 @@ AuthBasicConfig::decode(char const *proxy_auth) void AuthBasicConfig::init(AuthConfig * scheme) { - static int init = 0; - if (authenticate) { authbasic_initialised = 1; @@ -602,17 +601,18 @@ AuthBasicConfig::init(AuthConfig * scheme) helperOpenServers(basicauthenticators); - if (!init) { - cachemgrRegister("basicauthenticator", - "Basic User Authenticator Stats", - authenticateBasicStats, 0, 1); - init++; - } - CBDATA_INIT_TYPE(AuthenticateStateData); } } +void +AuthBasicConfig::registerWithCacheManager(CacheManager & manager) +{ + manager.registerAction("basicauthenticator", + "Basic User Authenticator Stats", + authenticateBasicStats, 0, 1); +} + void BasicUser::queueRequest(auth_user_request_t * auth_user_request, RH * handler, void *data) { diff --git a/src/auth/basic/auth_basic.h b/src/auth/basic/auth_basic.h index 77ddfdb87d..6dff777b01 100644 --- a/src/auth/basic/auth_basic.h +++ b/src/auth/basic/auth_basic.h @@ -124,6 +124,7 @@ public: virtual void fixHeader(auth_user_request_t *, HttpReply *, http_hdr_type, HttpRequest *); virtual void init(AuthConfig *); virtual void parse(AuthConfig *, int, char *); + virtual void registerWithCacheManager(CacheManager & manager); virtual const char * type() const; int authenticateChildren; int authenticateConcurrency; diff --git a/src/auth/digest/auth_digest.cc b/src/auth/digest/auth_digest.cc index 9fed8f294d..abe4f4955c 100644 --- a/src/auth/digest/auth_digest.cc +++ b/src/auth/digest/auth_digest.cc @@ -1,6 +1,6 @@ /* - * $Id: auth_digest.cc,v 1.45 2006/05/06 22:13:19 wessels Exp $ + * $Id: auth_digest.cc,v 1.46 2006/05/29 00:15:05 robertc Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Robert Collins @@ -42,6 +42,7 @@ #include "rfc2617.h" #include "auth_digest.h" #include "authenticate.h" +#include "CacheManager.h" #include "Store.h" #include "HttpRequest.h" #include "HttpReply.h" @@ -861,8 +862,6 @@ authenticateDigestHandleReply(void *data, char *reply) void AuthDigestConfig::init(AuthConfig * scheme) { - static int init = 0; - if (authenticate) { authenticateDigestNonceSetup(); authdigest_initialised = 1; @@ -878,16 +877,17 @@ AuthDigestConfig::init(AuthConfig * scheme) helperOpenServers(digestauthenticators); - if (!init) { - cachemgrRegister("digestauthenticator", "Digest User Authenticator Stats", - authenticateDigestStats, 0, 1); - init++; - } - CBDATA_INIT_TYPE(DigestAuthenticateStateData); } } +void +AuthDigestConfig::registerWithCacheManager(CacheManager & manager) +{ + manager.registerAction("digestauthenticator", + "Digest User Authenticator Stats", + authenticateDigestStats, 0, 1); +} /* free any allocated configuration details */ void diff --git a/src/auth/digest/auth_digest.h b/src/auth/digest/auth_digest.h index cbf3e256f1..4cd6d059db 100644 --- a/src/auth/digest/auth_digest.h +++ b/src/auth/digest/auth_digest.h @@ -165,6 +165,7 @@ public: virtual void fixHeader(auth_user_request_t *, HttpReply *, http_hdr_type, HttpRequest *); virtual void init(AuthConfig *); virtual void parse(AuthConfig *, int, char *); + virtual void registerWithCacheManager(CacheManager & manager); virtual const char * type() const; int authenticateChildren; char *digestAuthRealm; diff --git a/src/auth/negotiate/auth_negotiate.cc b/src/auth/negotiate/auth_negotiate.cc index 36bd4cc07e..9815b2b97b 100644 --- a/src/auth/negotiate/auth_negotiate.cc +++ b/src/auth/negotiate/auth_negotiate.cc @@ -1,6 +1,6 @@ /* - * $Id: auth_negotiate.cc,v 1.8 2006/05/06 22:13:19 wessels Exp $ + * $Id: auth_negotiate.cc,v 1.9 2006/05/29 00:15:06 robertc Exp $ * * DEBUG: section 29 Negotiate Authenticator * AUTHOR: Robert Collins, Henrik Nordstrom, Francesco Chemolli @@ -41,6 +41,7 @@ #include "squid.h" #include "auth_negotiate.h" #include "authenticate.h" +#include "CacheManager.h" #include "Store.h" #include "client_side.h" #include "HttpReply.h" @@ -173,8 +174,6 @@ AuthNegotiateConfig::type() const void AuthNegotiateConfig::init(AuthConfig * scheme) { - static unsigned char negotiate_was_already_initialised = 0; - if (authenticate) { #if PLACEHOLDER @@ -202,17 +201,18 @@ AuthNegotiateConfig::init(AuthConfig * scheme) helperStatefulOpenServers(negotiateauthenticators); - if (!negotiate_was_already_initialised) { - cachemgrRegister("negotiateauthenticator", - "Negotiate User Authenticator Stats", - authenticateNegotiateStats, 0, 1); - negotiate_was_already_initialised++; - } - CBDATA_INIT_TYPE(authenticateStateData); } } +void +AuthNegotiateConfig::registerWithCacheManager(CacheManager & manager) +{ + manager.registerAction("negotiateauthenticator", + "Negotiate User Authenticator Stats", + authenticateNegotiateStats, 0, 1); +} + bool AuthNegotiateConfig::active() const { diff --git a/src/auth/negotiate/auth_negotiate.h b/src/auth/negotiate/auth_negotiate.h index c88dedc5ea..e02ab1a82c 100644 --- a/src/auth/negotiate/auth_negotiate.h +++ b/src/auth/negotiate/auth_negotiate.h @@ -111,6 +111,7 @@ public: virtual void fixHeader(auth_user_request_t *, HttpReply *, http_hdr_type, HttpRequest *); virtual void init(AuthConfig *); virtual void parse(AuthConfig *, int, char *); + virtual void registerWithCacheManager(CacheManager & manager); virtual const char * type() const; int authenticateChildren; int keep_alive; diff --git a/src/auth/ntlm/auth_ntlm.cc b/src/auth/ntlm/auth_ntlm.cc index d194986f47..20f063bb19 100644 --- a/src/auth/ntlm/auth_ntlm.cc +++ b/src/auth/ntlm/auth_ntlm.cc @@ -1,6 +1,6 @@ /* - * $Id: auth_ntlm.cc,v 1.57 2006/05/06 22:13:19 wessels Exp $ + * $Id: auth_ntlm.cc,v 1.58 2006/05/29 00:15:07 robertc Exp $ * * DEBUG: section 29 NTLM Authenticator * AUTHOR: Robert Collins, Henrik Nordstrom, Francesco Chemolli @@ -41,6 +41,7 @@ #include "squid.h" #include "auth_ntlm.h" #include "authenticate.h" +#include "CacheManager.h" #include "Store.h" #include "client_side.h" #include "HttpReply.h" @@ -173,8 +174,6 @@ AuthNTLMConfig::type() const void AuthNTLMConfig::init(AuthConfig * scheme) { - static unsigned char ntlm_was_already_initialised = 0; - if (authenticate) { #if PLACEHOLDER @@ -202,17 +201,18 @@ AuthNTLMConfig::init(AuthConfig * scheme) helperStatefulOpenServers(ntlmauthenticators); - if (!ntlm_was_already_initialised) { - cachemgrRegister("ntlmauthenticator", - "NTLM User Authenticator Stats", - authenticateNTLMStats, 0, 1); - ntlm_was_already_initialised++; - } - CBDATA_INIT_TYPE(authenticateStateData); } } +void +AuthNTLMConfig::registerWithCacheManager(CacheManager & manager) +{ + manager.registerAction("ntlmauthenticator", + "NTLM User Authenticator Stats", + authenticateNTLMStats, 0, 1); +} + bool AuthNTLMConfig::active() const { diff --git a/src/auth/ntlm/auth_ntlm.h b/src/auth/ntlm/auth_ntlm.h index 4df71aa456..332cc5b04b 100644 --- a/src/auth/ntlm/auth_ntlm.h +++ b/src/auth/ntlm/auth_ntlm.h @@ -109,6 +109,7 @@ public: virtual void fixHeader(auth_user_request_t *, HttpReply *, http_hdr_type, HttpRequest *); virtual void init(AuthConfig *); virtual void parse(AuthConfig *, int, char *); + virtual void registerWithCacheManager(CacheManager & manager); virtual const char * type() const; int authenticateChildren; int keep_alive; diff --git a/src/authenticate.cc b/src/authenticate.cc index 5cbd8ef420..8343eb0a2c 100644 --- a/src/authenticate.cc +++ b/src/authenticate.cc @@ -1,6 +1,6 @@ /* - * $Id: authenticate.cc,v 1.66 2004/08/30 05:12:31 robertc Exp $ + * $Id: authenticate.cc,v 1.67 2006/05/29 00:15:01 robertc Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Robert Collins @@ -89,6 +89,15 @@ authenticateInit(authConfig * config) AuthUser::CachedACLsReset(); } +void +authenticateRegisterWithCacheManager(authConfig * config, CacheManager & manager) +{ + for (authConfig::iterator i = config->begin(); i != config->end(); ++i) { + AuthConfig *scheme = *i; + scheme->registerWithCacheManager(manager); + } +} + void authenticateShutdown(void) { diff --git a/src/authenticate.h b/src/authenticate.h index 7c51e09818..0ac032709f 100644 --- a/src/authenticate.h +++ b/src/authenticate.h @@ -1,6 +1,6 @@ /* - * $Id: authenticate.h,v 1.15 2004/08/30 05:12:31 robertc Exp $ + * $Id: authenticate.h,v 1.16 2006/05/29 00:15:01 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -68,6 +68,7 @@ typedef void AUTHSSTATS(StoreEntry *); extern void authenticateAuthUserMerge(auth_user_t *, auth_user_t *); extern void authenticateInit(authConfig *); +extern void authenticateRegisterWithCacheManager(authConfig * config, CacheManager & manager); extern void authenticateShutdown(void); extern int authenticateAuthUserInuse(auth_user_t * auth_user); diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 9578b1e05d..3f0d8c0c51 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.496 2006/05/14 10:19:40 serassio Exp $ + * $Id: cache_cf.cc,v 1.497 2006/05/29 00:15:01 robertc Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -37,6 +37,7 @@ #include "authenticate.h" #include "AuthConfig.h" #include "AuthScheme.h" +#include "CacheManager.h" #include "Store.h" #include "SwapDir.h" #include "ConfigParser.h" @@ -206,7 +207,7 @@ SetConfigFilename(char const *file_name, bool is_pipe) } int -parseConfigFile(const char *file_name) +parseConfigFile(const char *file_name, CacheManager & manager) { FILE *fp = NULL; char *token = NULL; @@ -339,10 +340,10 @@ parseConfigFile(const char *file_name) configDoConfigure(); if (opt_send_signal == -1) { - cachemgrRegister("config", - "Current Squid Configuration", - dump_config, - 1, 1); + manager.registerAction("config", + "Current Squid Configuration", + dump_config, + 1, 1); } return err_count; diff --git a/src/cache_manager.cc b/src/cache_manager.cc index 8c29a0c3dc..6ca762ff15 100644 --- a/src/cache_manager.cc +++ b/src/cache_manager.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_manager.cc,v 1.42 2006/05/19 17:19:09 wessels Exp $ + * $Id: cache_manager.cc,v 1.43 2006/05/29 00:15:01 robertc Exp $ * * DEBUG: section 16 Cache Manager Objects * AUTHOR: Duane Wessels @@ -33,7 +33,7 @@ * */ -#include "squid.h" +#include "CacheManager.h" #include "HttpReply.h" #include "HttpRequest.h" #include "Store.h" @@ -53,55 +53,44 @@ typedef struct cachemgrStateData; -typedef struct _action_table -{ - char *action; - char *desc; - OBJH *handler; - - struct - { - -unsigned int pw_req: - 1; - -unsigned int atomic: - 1; - } - - flags; - - struct _action_table *next; -} - -action_table; -static action_table *cachemgrFindAction(const char *action); +static CacheManagerAction *cachemgrFindAction(const char *action); static cachemgrStateData *cachemgrParseUrl(const char *url); static void cachemgrParseHeaders(cachemgrStateData * mgr, const HttpRequest * request); static int cachemgrCheckPassword(cachemgrStateData *); static void cachemgrStateFree(cachemgrStateData * mgr); static char *cachemgrPasswdGet(cachemgr_passwd *, const char *); -static const char *cachemgrActionProtection(const action_table * at); +static const char *cachemgrActionProtection(const CacheManagerAction * at); static OBJH cachemgrShutdown; static OBJH cachemgrMenu; static OBJH cachemgrOfflineToggle; -action_table *ActionTable = NULL; +CacheManagerAction *ActionTable = NULL; + +CacheManager::CacheManager() +{ + registerAction("menu", "This Cachemanager Menu", cachemgrMenu, 0, 1); + registerAction("shutdown", + "Shut Down the Squid Process", + cachemgrShutdown, 1, 1); + registerAction("offline_toggle", + "Toggle offline_mode setting", + cachemgrOfflineToggle, 1, 1); +} void -cachemgrRegister(const char *action, const char *desc, OBJH * handler, int pw_req_flag, int atomic) +CacheManager::registerAction(char const * action, char const * desc, OBJH * handler, int pw_req_flag, int atomic) { - action_table *a; - action_table **A; + CacheManagerAction *a; + CacheManagerAction **A; - if (cachemgrFindAction(action) != NULL) { - debug(16, 3) ("cachemgrRegister: Duplicate '%s'\n", action); + if (findAction(action) != NULL) { + debugs(16, 3, "CacheManager::registerAction: Duplicate '" << action << "'"); return; } assert (strstr (" ", action) == NULL); - a = (action_table *)xcalloc(1, sizeof(action_table)); + a = (CacheManagerAction *)xcalloc(1, sizeof(CacheManagerAction)); a->action = xstrdup(action); a->desc = xstrdup(desc); a->handler = handler; @@ -113,13 +102,19 @@ cachemgrRegister(const char *action, const char *desc, OBJH * handler, int pw_re ; *A = a; - debug(16, 3) ("cachemgrRegister: registered %s\n", action); + debugs(16, 3, "CacheManager::registerAction: registered " << action); +} + +CacheManagerAction * +CacheManager::findAction(char const * action) +{ + return cachemgrFindAction(action); } -static action_table * +static CacheManagerAction * cachemgrFindAction(const char *action) { - action_table *a; + CacheManagerAction *a; for (a = ActionTable; a != NULL; a = a->next) { if (0 == strcmp(a->action, action)) @@ -136,7 +131,7 @@ cachemgrParseUrl(const char *url) LOCAL_ARRAY(char, host, MAX_URL); LOCAL_ARRAY(char, request, MAX_URL); LOCAL_ARRAY(char, password, MAX_URL); - action_table *a; + CacheManagerAction *a; cachemgrStateData *mgr = NULL; const char *prot; t = sscanf(url, "cache_object://%[^/]/%[^@]@%s", host, request, password); @@ -214,7 +209,7 @@ static int cachemgrCheckPassword(cachemgrStateData * mgr) { char *pwd = cachemgrPasswdGet(Config.passwd_list, mgr->action); - action_table *a = cachemgrFindAction(mgr->action); + CacheManagerAction *a = cachemgrFindAction(mgr->action); assert(a != NULL); if (pwd == NULL) @@ -247,7 +242,7 @@ cachemgrStart(int fd, HttpRequest * request, StoreEntry * entry) { cachemgrStateData *mgr = NULL; ErrorState *err = NULL; - action_table *a; + CacheManagerAction *a; debug(16, 3) ("objectcacheStart: '%s'\n", storeUrl(entry)); if ((mgr = cachemgrParseUrl(storeUrl(entry))) == NULL) { @@ -364,7 +359,7 @@ cachemgrOfflineToggle(StoreEntry * sentry) } static const char * -cachemgrActionProtection(const action_table * at) +cachemgrActionProtection(const CacheManagerAction * at) { char *pwd; assert(at); @@ -385,7 +380,7 @@ cachemgrActionProtection(const action_table * at) static void cachemgrMenu(StoreEntry * sentry) { - action_table *a; + CacheManagerAction *a; for (a = ActionTable; a != NULL; a = a->next) { storeAppendPrintf(sentry, " %-22s\t%s\t%s\n", @@ -412,17 +407,3 @@ cachemgrPasswdGet(cachemgr_passwd * a, const char *action) return NULL; } - -void -cachemgrInit(void) -{ - cachemgrRegister("menu", - "This Cachemanager Menu", - cachemgrMenu, 0, 1); - cachemgrRegister("shutdown", - "Shut Down the Squid Process", - cachemgrShutdown, 1, 1); - cachemgrRegister("offline_toggle", - "Toggle offline_mode setting", - cachemgrOfflineToggle, 1, 1); -} diff --git a/src/carp.cc b/src/carp.cc index ef383fda84..d41ac55e80 100644 --- a/src/carp.cc +++ b/src/carp.cc @@ -1,6 +1,6 @@ /* - * $Id: carp.cc,v 1.24 2003/08/10 11:00:42 robertc Exp $ + * $Id: carp.cc,v 1.25 2006/05/29 00:15:01 robertc Exp $ * * DEBUG: section 39 Cache Array Routing Protocol * AUTHOR: Henrik Nordstrom @@ -35,6 +35,7 @@ */ #include "squid.h" +#include "CacheManager.h" #include "Store.h" #if USE_CARP @@ -149,8 +150,12 @@ carpInit(void) X_last = p->carp.load_multiplier; P_last = p->carp.load_factor; } +} - cachemgrRegister("carp", "CARP information", carpCachemgr, 0, 1); +void +carpRegisterWithCacheManager(CacheManager & manager) +{ + manager.registerAction("carp", "CARP information", carpCachemgr, 0, 1); } peer * diff --git a/src/cbdata.cc b/src/cbdata.cc index ac051cb2b1..91b7cc6a59 100644 --- a/src/cbdata.cc +++ b/src/cbdata.cc @@ -1,6 +1,6 @@ /* - * $Id: cbdata.cc,v 1.70 2006/02/18 00:09:35 wessels Exp $ + * $Id: cbdata.cc,v 1.71 2006/05/29 00:15:01 robertc Exp $ * * DEBUG: section 45 Callback Data Registry * ORIGINAL AUTHOR: Duane Wessels @@ -46,6 +46,7 @@ */ #include "squid.h" +#include "CacheManager.h" #include "Store.h" #if CBDATA_DEBUG #include "Stack.h" @@ -224,15 +225,6 @@ void cbdataInit(void) { debug(45, 3) ("cbdataInit\n"); - cachemgrRegister("cbdata", - "Callback Data Registry Contents", - cbdataDump, 0, 1); -#if CBDATA_DEBUG - - cachemgrRegister("cbdatahistory", - "Detailed call history for all current cbdata contents", - cbdataDumpHistory, 0, 1); -#endif #define CREATE_CBDATA(type) cbdataInternalInitType(CBDATA_##type, #type, sizeof(type), NULL) #define CREATE_CBDATA_FREE(type, free_func) cbdataInternalInitType(CBDATA_##type, #type, sizeof(type), free_func) /* XXX @@ -250,6 +242,20 @@ cbdataInit(void) CREATE_CBDATA(RemovalPurgeWalker); } +void +cbdataRegisterWithCacheManager(CacheManager & manager) +{ + manager.registerAction("cbdata", + "Callback Data Registry Contents", + cbdataDump, 0, 1); +#if CBDATA_DEBUG + + manager.registerAction("cbdatahistory", + "Detailed call history for all current cbdata contents", + cbdataDumpHistory, 0, 1); +#endif +} + void * #if CBDATA_DEBUG cbdataInternalAllocDbg(cbdata_type type, const char *file, int line) diff --git a/src/client_db.cc b/src/client_db.cc index b8f2b25a7d..77193d9569 100644 --- a/src/client_db.cc +++ b/src/client_db.cc @@ -1,6 +1,6 @@ /* - * $Id: client_db.cc,v 1.65 2006/05/08 23:38:33 robertc Exp $ + * $Id: client_db.cc,v 1.66 2006/05/29 00:15:01 robertc Exp $ * * DEBUG: section 0 Client Database * AUTHOR: Duane Wessels @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "CacheManager.h" #include "SquidTime.h" #include "Store.h" @@ -79,11 +80,15 @@ clientdbInit(void) return; client_table = hash_create((HASHCMP *) strcmp, CLIENT_DB_HASH_SIZE, hash_string); +} - cachemgrRegister("client_list", - "Cache Client List", - clientdbDump, - 0, 1); +void +clientdbRegisterWithCacheManager(CacheManager & manager) +{ + manager.registerAction("client_list", + "Cache Client List", + clientdbDump, + 0, 1); } void diff --git a/src/comm_epoll.cc b/src/comm_epoll.cc index 1a26b2bd99..81f9abd66f 100644 --- a/src/comm_epoll.cc +++ b/src/comm_epoll.cc @@ -1,6 +1,6 @@ /* - * $Id: comm_epoll.cc,v 1.9 2006/05/11 01:14:58 hno Exp $ + * $Id: comm_epoll.cc,v 1.10 2006/05/29 00:15:01 robertc Exp $ * * DEBUG: section 5 Socket functions * @@ -53,6 +53,8 @@ */ #include "squid.h" +#include "comm_epoll.h" +#include "CacheManager.h" #include "Store.h" #include "fde.h" #include "SquidTime.h" diff --git a/src/comm_epoll.h b/src/comm_epoll.h new file mode 100644 index 0000000000..9df46272ef --- /dev/null +++ b/src/comm_epoll.h @@ -0,0 +1,43 @@ + +/* + * $Id: comm_epoll.h,v 1.1 2006/05/29 00:15:02 robertc Exp $ + * + * + * 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_COMM_EPOLL_H +#define SQUID_COMM_EPOLL_H + +/* forward decls */ + +class CacheManager; + +extern void commEPollRegisterWithCacheManager(CacheManager & manager); + +#endif /* SQUID_COMM_EPOLL_H */ diff --git a/src/comm_kqueue.cc b/src/comm_kqueue.cc index abdc4acfd4..8835839852 100644 --- a/src/comm_kqueue.cc +++ b/src/comm_kqueue.cc @@ -1,6 +1,6 @@ /* - * $Id: comm_kqueue.cc,v 1.10 2006/05/09 15:47:45 wessels Exp $ + * $Id: comm_kqueue.cc,v 1.11 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 5 Socket functions * @@ -54,6 +54,8 @@ */ #include "squid.h" +#include "comm_kqueue.h" +#include "CacheManager.h" #include "Store.h" #include "fde.h" #include "SquidTime.h" diff --git a/src/comm_kqueue.h b/src/comm_kqueue.h new file mode 100644 index 0000000000..d726b29cd9 --- /dev/null +++ b/src/comm_kqueue.h @@ -0,0 +1,43 @@ + +/* + * $Id: comm_kqueue.h,v 1.1 2006/05/29 00:15:02 robertc Exp $ + * + * + * 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_COMM_KQUEUE_H +#define SQUID_COMM_KQUEUE_H + +/* forward decls */ + +class CacheManager; + +extern void commKQueueRegisterWithCacheManager(CacheManager & manager); + +#endif /* SQUID_COMM_KQUEUE_H */ diff --git a/src/comm_poll.cc b/src/comm_poll.cc index 0643c16902..086dd990df 100644 --- a/src/comm_poll.cc +++ b/src/comm_poll.cc @@ -1,6 +1,6 @@ /* - * $Id: comm_poll.cc,v 1.15 2006/05/08 23:38:33 robertc Exp $ + * $Id: comm_poll.cc,v 1.16 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 5 Socket Functions * @@ -33,6 +33,8 @@ */ #include "squid.h" +#include "comm_poll.h" +#include "CacheManager.h" #include "SquidTime.h" #include "Store.h" #include "fde.h" @@ -93,7 +95,7 @@ static void comm_poll_dns_incoming(void); * a histogram of 'incoming_events' by asking the cache manager * for 'comm_incoming', e.g.: * - * % ./client mgr:comm_incoming + * % ./client mgr:comm_poll_incoming * * Caveats: * @@ -671,10 +673,14 @@ comm_poll_dns_incoming(void) void comm_select_init(void) +{} + +void +commPollRegisterWithCacheManager(CacheManager & manager) { - cachemgrRegister("comm_incoming", - "comm_incoming() stats", - commIncomingStats, 0, 1); + manager.registerAction("comm_poll_incoming", + "comm_incoming() stats", + commIncomingStats, 0, 1); } diff --git a/src/comm_poll.h b/src/comm_poll.h new file mode 100644 index 0000000000..3c0f69321e --- /dev/null +++ b/src/comm_poll.h @@ -0,0 +1,43 @@ + +/* + * $Id: comm_poll.h,v 1.1 2006/05/29 00:15:02 robertc Exp $ + * + * + * 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_COMM_POLL_H +#define SQUID_COMM_POLL_H + +/* forward decls */ + +class CacheManager; + +extern void commPollRegisterWithCacheManager(CacheManager & manager); + +#endif /* SQUID_COMM_POLL_H */ diff --git a/src/comm_select.cc b/src/comm_select.cc index 2227181e5d..6cf9f9f04a 100644 --- a/src/comm_select.cc +++ b/src/comm_select.cc @@ -1,6 +1,6 @@ /* - * $Id: comm_select.cc,v 1.75 2006/05/14 16:42:43 serassio Exp $ + * $Id: comm_select.cc,v 1.76 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 5 Socket Functions * @@ -33,6 +33,8 @@ */ #include "squid.h" +#include "comm_select.h" +#include "CacheManager.h" #include "SquidTime.h" #ifdef USE_SELECT @@ -739,14 +741,19 @@ comm_select_init(void) { zero_tv.tv_sec = 0; zero_tv.tv_usec = 0; - cachemgrRegister("comm_incoming", - "comm_incoming() stats", - commIncomingStats, 0, 1); FD_ZERO(&global_readfds); FD_ZERO(&global_writefds); nreadfds = nwritefds = 0; } +void +commSelectRegisterWithCacheManager(CacheManager & manager) +{ + manager.registerAction("comm_select_incoming", + "comm_incoming() stats", + commIncomingStats, 0, 1); +} + /* * examine_select - debug routine. * diff --git a/src/comm_select.h b/src/comm_select.h new file mode 100644 index 0000000000..ac9d37dfe5 --- /dev/null +++ b/src/comm_select.h @@ -0,0 +1,43 @@ + +/* + * $Id: comm_select.h,v 1.1 2006/05/29 00:15:02 robertc Exp $ + * + * + * 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_COMM_SELECT_H +#define SQUID_COMM_SELECT_H + +/* forward decls */ + +class CacheManager; + +extern void commSelectRegisterWithCacheManager(CacheManager & manager); + +#endif /* SQUID_COMM_SELECT_H */ diff --git a/src/delay_pools.cc b/src/delay_pools.cc index 10e9d97e63..8ef73b5f9f 100644 --- a/src/delay_pools.cc +++ b/src/delay_pools.cc @@ -1,6 +1,6 @@ /* - * $Id: delay_pools.cc,v 1.45 2006/05/08 23:38:33 robertc Exp $ + * $Id: delay_pools.cc,v 1.46 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 77 Delay Pools * AUTHOR: Robert Collins @@ -41,6 +41,7 @@ #if DELAY_POOLS #include "squid.h" +#include "CacheManager.h" #include "DelaySpec.h" #include "DelayPools.h" #include "StoreClient.h" @@ -537,7 +538,12 @@ void DelayPools::Init() { LastUpdate = getCurrentTime(); - cachemgrRegister("delay", "Delay Pool Levels", Stats, 0, 1); +} + +void +DelayPools::RegisterWithCacheManager(CacheManager & manager) +{ + manager.registerAction("delay", "Delay Pool Levels", Stats, 0, 1); } void diff --git a/src/dns.cc b/src/dns.cc index bac4f3e23e..6c2d161154 100644 --- a/src/dns.cc +++ b/src/dns.cc @@ -1,6 +1,6 @@ /* - * $Id: dns.cc,v 1.95 2006/05/09 15:47:45 wessels Exp $ + * $Id: dns.cc,v 1.96 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 34 Dnsserver interface * AUTHOR: Harvest Derived @@ -55,7 +55,6 @@ dnsStats(StoreEntry * sentry) void dnsInit(void) { - static int init = 0; wordlist *w; if (!Config.Program.dnsserver) @@ -81,13 +80,14 @@ dnsInit(void) } helperOpenServers(dnsservers); +} - if (!init) { - cachemgrRegister("dns", - "Dnsserver Statistics", - dnsStats, 0, 1); - init = 1; - } +void +dnsRegisterWithCacheManager(CacheManager & manager) +{ + manager.registerAction("dns", + "Dnsserver Statistics", + dnsStats, 0, 1); } void diff --git a/src/dns_internal.cc b/src/dns_internal.cc index a21576371f..43eecd322d 100644 --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@ -1,6 +1,6 @@ /* - * $Id: dns_internal.cc,v 1.88 2006/05/08 23:38:33 robertc Exp $ + * $Id: dns_internal.cc,v 1.89 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 78 DNS lookups; interacts with lib/rfc1035.c * AUTHOR: Duane Wessels @@ -35,6 +35,7 @@ #include "config.h" #include "squid.h" +#include "CacheManager.h" #include "SquidTime.h" #include "Store.h" #include "comm.h" @@ -1242,15 +1243,18 @@ idnsInit(void) if (!init) { memDataInit(MEM_IDNS_QUERY, "idns_query", sizeof(idns_query), 0); - cachemgrRegister("idns", - "Internal DNS Statistics", - idnsStats, 0, 1); memset(RcodeMatrix, '\0', sizeof(RcodeMatrix)); idns_lookup_hash = hash_create((HASHCMP *) strcmp, 103, hash_string); init++; } } +void +idnsRegisterWithCacheManager(CacheManager & manager) +{ + manager.registerAction("idns", "Internal DNS Statistics", idnsStats, 0, 1); +} + void idnsShutdown(void) { diff --git a/src/enums.h b/src/enums.h index 7f694af08c..3e0924d0b1 100644 --- a/src/enums.h +++ b/src/enums.h @@ -1,6 +1,6 @@ /* - * $Id: enums.h,v 1.250 2006/05/08 23:38:33 robertc Exp $ + * $Id: enums.h,v 1.251 2006/05/29 00:15:02 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -425,7 +425,6 @@ typedef enum { #if !USE_DNSSERVERS MEM_IDNS_QUERY, #endif - MEM_EVENT, MEM_MAX } mem_type; diff --git a/src/event.cc b/src/event.cc index 89fe23b82e..82a93d179a 100644 --- a/src/event.cc +++ b/src/event.cc @@ -1,6 +1,6 @@ /* - * $Id: event.cc,v 1.38 2003/06/24 12:42:25 robertc Exp $ + * $Id: event.cc,v 1.39 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 41 Event Processing * AUTHOR: Henrik Nordstrom @@ -34,12 +34,16 @@ */ #include "squid.h" +#include "CacheManager.h" #include "Store.h" /* The list of event processes */ -struct ev_entry +class ev_entry { + +public: + MEMPROXY_CLASS(ev_entry); EVH *func; void *arg; const char *name; @@ -51,6 +55,8 @@ struct ev_entry bool cbdata; }; +MEMPROXY_CLASS_INLINE(ev_entry); + static struct ev_entry *tasks = NULL; static OBJH eventDump; static int run_id = 0; @@ -60,7 +66,7 @@ void eventAdd(const char *name, EVH * func, void *arg, double when, int weight, bool cbdata) { - struct ev_entry *event = (ev_entry *)memAllocate(MEM_EVENT); + struct ev_entry *event = new ev_entry; struct ev_entry **E; event->func = func; @@ -118,7 +124,7 @@ eventDelete(EVH * func, void *arg) if (event->cbdata) cbdataReferenceDone(event->arg); - memFree(event, MEM_EVENT); + delete event; return; } @@ -173,7 +179,7 @@ eventRun(void) callback(cbdata); } - memFree(event, MEM_EVENT); + delete event; } PROF_stop(eventRun); @@ -189,13 +195,9 @@ eventNextTime(void) } void -eventInit(void) +eventInit(CacheManager &manager) { - - memDataInit(MEM_EVENT, "event", sizeof(struct ev_entry), 0); - cachemgrRegister("events", - "Event Queue", - eventDump, 0, 1); + manager.registerAction("events", "Event Queue", eventDump, 0, 1); } static void @@ -233,7 +235,7 @@ eventFreeMemory(void) if (event->cbdata) cbdataReferenceDone(event->arg); - memFree(event, MEM_EVENT); + delete event; } tasks = NULL; diff --git a/src/external_acl.cc b/src/external_acl.cc index 8e0aa3907d..76e289bf15 100644 --- a/src/external_acl.cc +++ b/src/external_acl.cc @@ -1,6 +1,6 @@ /* - * $Id: external_acl.cc,v 1.72 2006/05/18 20:31:12 wessels Exp $ + * $Id: external_acl.cc,v 1.73 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 82 External ACL * AUTHOR: Henrik Nordstrom, MARA Systems AB @@ -41,6 +41,7 @@ */ #include "squid.h" +#include "CacheManager.h" #include "ExternalACL.h" #include "ExternalACLEntry.h" #include "AuthUserRequest.h" @@ -1281,13 +1282,18 @@ externalAclInit(void) if (firstTimeInit) { firstTimeInit = 0; - cachemgrRegister("external_acl", - "External ACL stats", - externalAclStats, 0, 1); CBDATA_INIT_TYPE_FREECB(externalAclState, free_externalAclState); } } +void +externalAclRegisterWithCacheManager(CacheManager & manager) +{ + manager.registerAction("external_acl", + "External ACL stats", + externalAclStats, 0, 1); +} + void externalAclShutdown(void) { diff --git a/src/forward.cc b/src/forward.cc index 1eb90bfd21..8cb013696f 100644 --- a/src/forward.cc +++ b/src/forward.cc @@ -1,6 +1,6 @@ /* - * $Id: forward.cc,v 1.144 2006/05/19 17:19:09 wessels Exp $ + * $Id: forward.cc,v 1.145 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 17 Request Forwarding * AUTHOR: Duane Wessels @@ -35,6 +35,7 @@ #include "squid.h" +#include "CacheManager.h" #include "forward.h" #include "SquidTime.h" #include "Store.h" @@ -1030,9 +1031,6 @@ FwdState::pconnPush(int fd, const char *host, int port, const char *domain) void FwdState::initModule() { - cachemgrRegister("forward", - "Request Forwarding Statistics", - fwdStats, 0, 1); memDataInit(MEM_FWD_SERVER, "FwdServer", sizeof(FwdServer), 0); #if WIP_FWD_LOG @@ -1047,6 +1045,14 @@ FwdState::initModule() #endif } +void +FwdState::RegisterWithCacheManager(CacheManager & manager) +{ + manager.registerAction("forward", + "Request Forwarding Statistics", + fwdStats, 0, 1); +} + void FwdState::logReplyStatus(int tries, http_status status) { diff --git a/src/forward.h b/src/forward.h index 12866d0296..64b349623a 100644 --- a/src/forward.h +++ b/src/forward.h @@ -1,6 +1,10 @@ #ifndef SQUID_FORWARD_H #define SQUID_FORWARD_H +/* forward decls */ + +class CacheManager; + class FwdServer { @@ -18,6 +22,7 @@ public: FwdState(int fd, StoreEntry *, HttpRequest *); ~FwdState(); static void initModule(); + static void RegisterWithCacheManager(CacheManager & manager); static void fwdStart(int fd, StoreEntry *, HttpRequest *); void startComplete(FwdServer *); diff --git a/src/fqdncache.cc b/src/fqdncache.cc index ae6bcd6ffd..efa7e5192d 100644 --- a/src/fqdncache.cc +++ b/src/fqdncache.cc @@ -1,6 +1,6 @@ /* - * $Id: fqdncache.cc,v 1.167 2006/05/08 23:38:33 robertc Exp $ + * $Id: fqdncache.cc,v 1.168 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 35 FQDN Cache * AUTHOR: Harvest Derived @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "CacheManager.h" #include "SquidTime.h" #include "Store.h" #include "wordlist.h" @@ -529,14 +530,19 @@ fqdncache_init(void) fqdn_table = hash_create((HASHCMP *) strcmp, n, hash4); - cachemgrRegister("fqdncache", - "FQDN Cache Stats and Contents", - fqdnStats, 0, 1); - memDataInit(MEM_FQDNCACHE_ENTRY, "fqdncache_entry", sizeof(fqdncache_entry), 0); } +void +fqdncacheRegisterWithCacheManager(CacheManager & manager) +{ + manager.registerAction("fqdncache", + "FQDN Cache Stats and Contents", + fqdnStats, 0, 1); + +} + const char * fqdncache_gethostbyaddr(struct IN_ADDR addr, int flags) diff --git a/src/fs/coss/StoreFScoss.cc b/src/fs/coss/StoreFScoss.cc index d1dfe7579c..832edda8e3 100644 --- a/src/fs/coss/StoreFScoss.cc +++ b/src/fs/coss/StoreFScoss.cc @@ -1,6 +1,6 @@ /* - * $Id: StoreFScoss.cc,v 1.4 2004/12/20 16:30:41 robertc Exp $ + * $Id: StoreFScoss.cc,v 1.5 2006/05/29 00:15:09 robertc Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Robert Collins @@ -36,6 +36,7 @@ #include "StoreFileSystem.h" #include "StoreFScoss.h" +#include "CacheManager.h" #include "Store.h" #include "CossSwapDir.h" #include "store_coss.h" @@ -63,7 +64,6 @@ void StoreFScoss::done() { /* delete coss_index_pool;coss_index_pool = NULL; XXX Should be here? */ - cachemgrRegister("coss", "COSS Stats", Stats, 0, 1); initialised = false; } @@ -83,6 +83,12 @@ StoreFScoss::setup() initialised = true; } +void +StoreFScoss::registerWithCacheManager(CacheManager & manager) +{ + manager.registerAction("coss", "COSS Stats", Stats, 0, 1); +} + void StoreFScoss::Stats(StoreEntry * sentry) { diff --git a/src/fs/coss/StoreFScoss.h b/src/fs/coss/StoreFScoss.h index c289c3638b..56ce5d9488 100644 --- a/src/fs/coss/StoreFScoss.h +++ b/src/fs/coss/StoreFScoss.h @@ -1,6 +1,6 @@ /* - * $Id: StoreFScoss.h,v 1.2 2004/12/20 16:30:41 robertc Exp $ + * $Id: StoreFScoss.h,v 1.3 2006/05/29 00:15:09 robertc Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -78,6 +78,7 @@ public: virtual char const *type() const; virtual SwapDir *createSwapDir(); virtual void done(); + virtual void registerWithCacheManager(CacheManager & manager); virtual void setup(); /* Not implemented */ StoreFScoss (StoreFScoss const &); diff --git a/src/ipcache.cc b/src/ipcache.cc index 0202738c5f..41c47b0e57 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -1,6 +1,6 @@ /* - * $Id: ipcache.cc,v 1.254 2006/05/08 23:38:33 robertc Exp $ + * $Id: ipcache.cc,v 1.255 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 14 IP Cache * AUTHOR: Harvest Derived @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "CacheManager.h" #include "SquidTime.h" #include "Store.h" #include "wordlist.h" @@ -582,12 +583,17 @@ ipcache_init(void) (float) Config.ipcache.low) / (float) 100); n = hashPrime(ipcache_high / 4); ip_table = hash_create((HASHCMP *) strcmp, n, hash4); - cachemgrRegister("ipcache", - "IP Cache Stats and Contents", - stat_ipcache_get, 0, 1); memDataInit(MEM_IPCACHE_ENTRY, "ipcache_entry", sizeof(ipcache_entry), 0); } +void +ipcacheRegisterWithCacheManager(CacheManager & manager) +{ + manager.registerAction("ipcache", + "IP Cache Stats and Contents", + stat_ipcache_get, 0, 1); +} + const ipcache_addrs * ipcache_gethostbyname(const char *name, int flags) { diff --git a/src/main.cc b/src/main.cc index 2c8f8c42a8..23e052f96a 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,6 +1,6 @@ /* - * $Id: main.cc,v 1.422 2006/05/23 16:24:55 hno Exp $ + * $Id: main.cc,v 1.423 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -36,9 +36,13 @@ #include "squid.h" #include "AccessLogEntry.h" #include "authenticate.h" +#include "CacheManager.h" +#include "ConfigParser.h" +#include "ExternalACL.h" #include "Store.h" #include "ICP.h" #include "HttpReply.h" +#include "pconn.h" #include "Mem.h" #include "ACLASN.h" #include "ACL.h" @@ -46,6 +50,18 @@ #include "StoreFileSystem.h" #include "DiskIO/DiskIOModule.h" #include "comm.h" +#if USE_EPOLL +#include "comm_epoll.h" +#endif +#if USE_KQUEUE +#include "comm_kqueue.h" +#endif +#if USE_POLL +#include "comm_poll.h" +#endif +#if USE_SELECT +#include "comm_select.h" +#endif #include "SquidTime.h" #include "SwapDir.h" #include "forward.h" @@ -97,6 +113,8 @@ static EVH SquidShutdown; static void mainSetCwd(void); static int checkRunningPid(void); +static CacheManager manager; + #ifndef _SQUID_MSWIN_ static const char *squid_start_script = "squid_start"; #endif @@ -561,7 +579,7 @@ mainReconfigure(void) refererCloseLog(); errorClean(); enter_suid(); /* root to read config file */ - parseConfigFile(ConfigFile); + parseConfigFile(ConfigFile, manager); setEffectiveUser(); _db_init(Config.Log.log, Config.debugOptions); ipcache_restart(); /* clear stuck entries */ @@ -591,8 +609,10 @@ mainReconfigure(void) serverConnectionsOpen(); - if (theOutIcpConnection >= 0) + if (theOutIcpConnection >= 0) { neighbors_init(); + neighborsRegisterWithCacheManager(manager); + } storeDirOpenSwapLogs(); @@ -803,7 +823,6 @@ mainInitialize(void) #endif urlInitialize(); - cachemgrInit(); statInit(); storeInit(); mainSetCwd(); @@ -817,6 +836,66 @@ mainInitialize(void) #endif FwdState::initModule(); + /* register the modules in the cache manager menus */ + accessLogRegisterWithCacheManager(manager); + asnRegisterWithCacheManager(manager); + authenticateRegisterWithCacheManager(&Config.authConfiguration, manager); +#if USE_CARP + + carpRegisterWithCacheManager(manager); +#endif + + cbdataRegisterWithCacheManager(manager); + /* These use separate calls so that the comm loops can eventually + * coexist. + */ +#ifdef USE_EPOLL + + commEPollRegisterWithCacheManager(manager); +#endif +#ifdef USE_KQUEUE + + commKQueueRegisterWithCacheManager(manager); +#endif +#ifdef USE_POLL + + commPollRegisterWithCacheManager(manager); +#endif +#ifdef USE_SELECT + + commSelectRegisterWithCacheManager(manager); +#endif + + clientdbRegisterWithCacheManager(manager); + DelayPools::RegisterWithCacheManager(manager); + DiskIOModule::RegisterAllModulesWithCacheManager(manager); +#if USE_DNSSERVERS + + dnsRegisterWithCacheManager(manager); +#endif + + eventInit(manager); + externalAclRegisterWithCacheManager(manager); + fqdncacheRegisterWithCacheManager(manager); + FwdState::RegisterWithCacheManager(manager); + httpHeaderRegisterWithCacheManager(manager); + idnsRegisterWithCacheManager(manager); + ipcacheRegisterWithCacheManager(manager); + Mem::RegisterWithCacheManager(manager); + netdbRegisterWitHCacheManager(manager); + PconnModule::GetInstance()->registerWithCacheManager(manager); + redirectRegisterWithCacheManager(manager); + refreshRegisterWithCacheManager(manager); + statRegisterWithCacheManager(manager); + storeDigestRegisterWithCacheManager(manager); + StoreFileSystem::RegisterAllFsWithCacheManager(manager); + storeRegisterWithCacheManager(manager); +#if DEBUGSTRINGS + + StringRegistry::Instance().registerWithCacheManager(manager); +#endif + + xprofRegisterWithCacheManager(manager); } #if USE_WCCP @@ -826,8 +905,10 @@ mainInitialize(void) serverConnectionsOpen(); - if (theOutIcpConnection >= 0) + if (theOutIcpConnection >= 0) { neighbors_init(); + neighborsRegisterWithCacheManager(manager); + } if (Config.chroot_dir) no_suid(); @@ -1027,8 +1108,6 @@ main(int argc, char **argv) cbdataInit(); - eventInit(); /* eventInit() is required for config parsing */ - storeFsInit(); /* required for config parsing */ /* May not be needed for parsing, have not audited for such */ @@ -1040,7 +1119,7 @@ main(int argc, char **argv) /* we may want the parsing process to set this up in the future */ Store::Root(new StoreController); - parse_err = parseConfigFile(ConfigFile); + parse_err = parseConfigFile(ConfigFile, manager); if (opt_parse_cfg_only) diff --git a/src/mem.cc b/src/mem.cc index a4a8b9e683..6cf6441559 100644 --- a/src/mem.cc +++ b/src/mem.cc @@ -1,6 +1,6 @@ /* - * $Id: mem.cc,v 1.97 2006/05/26 23:43:07 hno Exp $ + * $Id: mem.cc,v 1.98 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 13 High Level Memory Pool Management * AUTHOR: Harvest Derived @@ -38,6 +38,7 @@ #include #include +#include "CacheManager.h" #include "Mem.h" #include "memMeter.h" #include "Store.h" @@ -403,10 +404,14 @@ Mem::Init(void) if (StrPools[i].pool->objectSize() != StrPoolsAttrs[i].obj_size) debugs(13, 1, "Notice: " << StrPoolsAttrs[i].name << " is " << StrPools[i].pool->objectSize() << " bytes instead of requested " << StrPoolsAttrs[i].obj_size << " bytes"); } +} - cachemgrRegister("mem", - "Memory Utilization", - Mem::Stats, 0, 1); +void +Mem::RegisterWithCacheManager(CacheManager & manager) +{ + manager.registerAction("mem", + "Memory Utilization", + Mem::Stats, 0, 1); } mem_type &operator++ (mem_type &aMem) diff --git a/src/neighbors.cc b/src/neighbors.cc index 922a1d620c..607cb5a577 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,6 +1,6 @@ /* - * $Id: neighbors.cc,v 1.336 2006/05/19 17:05:18 wessels Exp $ + * $Id: neighbors.cc,v 1.337 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "CacheManager.h" #include "Store.h" #include "ICP.h" #include "HttpRequest.h" @@ -568,15 +569,28 @@ neighbors_init(void) } first_ping = Config.peers; - cachemgrRegister("server_list", - "Peer Cache Statistics", - neighborDumpPeers, 0, 1); +} + +void +neighborsRegisterWithCacheManager(CacheManager & manager) +{ + manager.registerAction("server_list", + "Peer Cache Statistics", + neighborDumpPeers, 0, 1); if (theInIcpConnection >= 0) { - cachemgrRegister("non_peers", - "List of Unknown sites sending ICP messages", - neighborDumpNonPeers, 0, 1); + manager.registerAction("non_peers", + "List of Unknown sites sending ICP messages", + neighborDumpNonPeers, 0, 1); } + + /* XXX FIXME: unregister if we were registered. Something like: + * else { + * CacheManagerAction * action = manager.findAction("non_peers"); + * if (action != NULL) + * manager.unregisterAction(action); + * } + */ } int diff --git a/src/net_db.cc b/src/net_db.cc index 752daf973a..7e83d727df 100644 --- a/src/net_db.cc +++ b/src/net_db.cc @@ -1,6 +1,6 @@ /* - * $Id: net_db.cc,v 1.188 2006/05/19 17:05:18 wessels Exp $ + * $Id: net_db.cc,v 1.189 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 38 Network Measurement Database * AUTHOR: Duane Wessels @@ -42,6 +42,7 @@ */ #include "squid.h" +#include "CacheManager.h" #include "Store.h" #include "SwapDir.h" #include "HttpRequest.h" @@ -901,9 +902,16 @@ netdbInit(void) netdbReloadState(); - cachemgrRegister("netdb", - "Network Measurement Database", - netdbDump, 0, 1); +#endif +} + +void +netdbRegisterWitHCacheManager(CacheManager & manager) +{ +#if USE_ICMP + manager.registerAction("netdb", + "Network Measurement Database", + netdbDump, 0, 1); #endif } diff --git a/src/pconn.cc b/src/pconn.cc index a0b56ae748..12da503f42 100644 --- a/src/pconn.cc +++ b/src/pconn.cc @@ -1,6 +1,6 @@ /* - * $Id: pconn.cc,v 1.45 2005/12/06 23:03:34 wessels Exp $ + * $Id: pconn.cc,v 1.46 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 48 Persistent Connections * AUTHOR: Duane Wessels @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "CacheManager.h" #include "Store.h" #include "comm.h" #include "pconn.h" @@ -41,9 +42,8 @@ #define PCONN_FDS_SZ 8 /* pconn set size, increase for better memcache hit rate */ -static PconnModule *ThePconnModule = NULL; static MemAllocator *pconn_fds_pool = NULL; -static OBJH PconnModuleDumpWrapper; +PconnModule * PconnModule::instance = NULL; CBDATA_CLASS_INIT(IdleConnList); /* ========== IdleConnList ============================================ */ @@ -217,10 +217,7 @@ PconnPool::PconnPool(const char *aDescr) : table(NULL), descr(aDescr) for (i = 0; i < PCONN_HIST_SZ; i++) hist[i] = 0; - if (ThePconnModule == NULL) - ThePconnModule = new PconnModule; - - ThePconnModule->add + PconnModule::GetInstance()->add (this); } @@ -306,13 +303,27 @@ PconnPool::count(int uses) PconnModule::PconnModule() : pools(NULL), poolCount(0) { pools = (PconnPool **) xcalloc(MAX_NUM_PCONN_POOLS, sizeof(*pools)); - cachemgrRegister("pconn", - "Persistent Connection Utilization Histograms", - PconnModuleDumpWrapper, 0, 1); pconn_fds_pool = MemPools::GetInstance().create("pconn_fds", PCONN_FDS_SZ * sizeof(int)); debug(48, 0) ("persistent connection module initialized\n"); } +PconnModule * +PconnModule::GetInstance() +{ + if (instance == NULL) + instance = new PconnModule; + + return instance; +} + +void +PconnModule::registerWithCacheManager(CacheManager & manager) +{ + manager.registerAction("pconn", + "Persistent Connection Utilization Histograms", + DumpWrapper, 0, 1); +} + void PconnModule::add @@ -333,8 +344,8 @@ PconnModule::dump(StoreEntry *e) } } -static void -PconnModuleDumpWrapper(StoreEntry *e) +void +PconnModule::DumpWrapper(StoreEntry *e) { - ThePconnModule->dump(e); + PconnModule::GetInstance()->dump(e); } diff --git a/src/pconn.h b/src/pconn.h index a8a08b556d..41a1584d7b 100644 --- a/src/pconn.h +++ b/src/pconn.h @@ -2,11 +2,15 @@ #ifndef SQUID_PCONN_H #define SQUID_PCONN_H -#define MAX_NUM_PCONN_POOLS 10 -#define PCONN_HIST_SZ (1<<16) +/* forward decls */ + +class CacheManager; class PconnPool; +#define MAX_NUM_PCONN_POOLS 10 +#define PCONN_HIST_SZ (1<<16) + class IdleConnList { @@ -64,7 +68,15 @@ class PconnModule { public: + /* the module is a singleton until we have instance based cachemanager + * management + */ + static PconnModule * GetInstance(); + /* A thunk to the still C like CacheManager callback api. */ + static void DumpWrapper(StoreEntry *e); + PconnModule(); + void registerWithCacheManager(CacheManager & manager); void add (PconnPool *); @@ -74,6 +86,8 @@ public: private: PconnPool **pools; + static PconnModule * instance; + int poolCount; }; diff --git a/src/protos.h b/src/protos.h index 371f11423d..b2d324f7e2 100644 --- a/src/protos.h +++ b/src/protos.h @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.532 2006/05/22 19:58:51 wessels Exp $ + * $Id: protos.h,v 1.533 2006/05/29 00:15:02 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -42,6 +42,9 @@ * grep for method_t in this file - if none found remove this include. */ #include "HttpRequestMethod.h" +/* for routines still in this file that take CacheManager parameters */ + +class CacheManager; #if FORW_VIA_DB SQUIDCEXTERN void fvdbCountVia(const char *key); @@ -56,7 +59,6 @@ SQUIDCEXTERN int logTypeIsATcpHit(log_type); /* * cache_cf.c */ -SQUIDCEXTERN int parseConfigFile(const char *file_name); SQUIDCEXTERN void configFreeMemory(void); SQUIDCEXTERN void wordlistCat(const wordlist *, MemBuf * mb); SQUIDCEXTERN void self_destruct(void); @@ -80,6 +82,7 @@ SQUIDCEXTERN void parse_sockaddr_in_list_token(sockaddr_in_list **, char *); * cbdata.c */ SQUIDCEXTERN void cbdataInit(void); +SQUIDCEXTERN void cbdataRegisterWithCacheManager(CacheManager & manager); #if CBDATA_DEBUG SQUIDCEXTERN void *cbdataInternalAllocDbg(cbdata_type type, const char *, int); SQUIDCEXTERN void *cbdataInternalFreeDbg(void *p, const char *, int); @@ -99,6 +102,7 @@ SQUIDCEXTERN cbdata_type cbdataInternalAddType(cbdata_type type, const char *lab /* client_side.c - FD related client side routines */ SQUIDCEXTERN void clientdbInit(void); +extern void clientdbRegisterWithCacheManager(CacheManager & manager); SQUIDCEXTERN void clientdbUpdate(struct IN_ADDR, log_type, protocol_t, size_t); @@ -199,11 +203,13 @@ SQUIDCEXTERN void disk_init(void); SQUIDCEXTERN void dnsShutdown(void); SQUIDCEXTERN void dnsInit(void); +extern void dnsRegisterWithCacheManager(CacheManager & manager); SQUIDCEXTERN void dnsSubmit(const char *lookup, HLPCB * callback, void *data); /* dns_internal.c */ SQUIDCEXTERN void idnsInit(void); SQUIDCEXTERN void idnsShutdown(void); +extern void idnsRegisterWithCacheManager(CacheManager & manager); SQUIDCEXTERN void idnsALookup(const char *, IDNSCB *, void *); SQUIDCEXTERN void idnsPTRLookup(const struct IN_ADDR, IDNSCB *, void *); @@ -213,7 +219,7 @@ SQUIDCEXTERN void eventAddIsh(const char *name, EVH * func, void *arg, double de SQUIDCEXTERN void eventRun(void); SQUIDCEXTERN int eventNextTime(void); SQUIDCEXTERN void eventDelete(EVH * func, void *arg); -SQUIDCEXTERN void eventInit(void); +SQUIDCEXTERN void eventInit(CacheManager &); SQUIDCEXTERN void eventFreeMemory(void); SQUIDCEXTERN int eventFind(EVH *, void *); @@ -239,6 +245,7 @@ SQUIDCEXTERN void fqdncache_nbgethostbyaddr(struct IN_ADDR, FQDNH *, void *); SQUIDCEXTERN const char *fqdncache_gethostbyaddr(struct IN_ADDR, int flags); SQUIDCEXTERN void fqdncache_init(void); +extern void fqdncacheRegisterWithCacheManager(CacheManager & manager); SQUIDCEXTERN void fqdnStats(StoreEntry *); SQUIDCEXTERN void fqdncacheReleaseInvalid(const char *); @@ -386,6 +393,7 @@ SQUIDCEXTERN const ipcache_addrs *ipcache_gethostbyname(const char *, int flags) SQUIDCEXTERN void ipcacheInvalidate(const char *); SQUIDCEXTERN void ipcacheInvalidateNegative(const char *); SQUIDCEXTERN void ipcache_init(void); +extern void ipcacheRegisterWithCacheManager(CacheManager & manager); SQUIDCEXTERN void stat_ipcache_get(StoreEntry *); SQUIDCEXTERN void ipcacheCycleAddr(const char *name, ipcache_addrs *); @@ -434,6 +442,7 @@ SQUIDCEXTERN void neighborAddAcl(const char *, const char *); SQUIDCEXTERN void neighborsUdpAck(const cache_key *, icp_common_t *, const struct sockaddr_in *); SQUIDCEXTERN void neighborAdd(const char *, const char *, int, int, int, int, int); SQUIDCEXTERN void neighbors_init(void); +extern void neighborsRegisterWithCacheManager(CacheManager & manager); SQUIDCEXTERN peer *peerFindByName(const char *); SQUIDCEXTERN peer *peerFindByNameAndPort(const char *, unsigned short); SQUIDCEXTERN peer *getDefaultParent(HttpRequest * request); @@ -457,6 +466,7 @@ SQUIDCEXTERN int peerHTTPOkay(const peer *, HttpRequest *); SQUIDCEXTERN peer *whichPeer(const struct sockaddr_in *from); SQUIDCEXTERN void netdbInit(void); +extern void netdbRegisterWitHCacheManager(CacheManager & manager); SQUIDCEXTERN void netdbHandlePingReply(const struct sockaddr_in *from, int hops, int rtt); SQUIDCEXTERN void netdbPingSite(const char *hostname); @@ -476,10 +486,6 @@ SQUIDCEXTERN void netdbExchangeUpdatePeer(struct IN_ADDR, peer *, double, double SQUIDCEXTERN peer *netdbClosestParent(HttpRequest *); SQUIDCEXTERN void netdbHostData(const char *host, int *samp, int *rtt, int *hops); -SQUIDCEXTERN void cachemgrStart(int fd, HttpRequest * request, StoreEntry * entry); -SQUIDCEXTERN void cachemgrRegister(const char *, const char *, OBJH *, int, int); -SQUIDCEXTERN void cachemgrInit(void); - SQUIDCEXTERN void peerSelect(HttpRequest *, StoreEntry *, PSC *, void *data); SQUIDCEXTERN void peerSelectInit(void); @@ -495,6 +501,7 @@ unsigned long getOutgoingTOS(HttpRequest * request); SQUIDCEXTERN void urnStart(HttpRequest *, StoreEntry *); SQUIDCEXTERN void redirectInit(void); +extern void redirectRegisterWithCacheManager(CacheManager & manager); SQUIDCEXTERN void redirectShutdown(void); extern void refreshAddToList(const char *, int, time_t, int, time_t); @@ -505,6 +512,7 @@ extern int refreshCheckHTCP(const StoreEntry *, HttpRequest *); extern int refreshCheckDigest(const StoreEntry *, time_t delta); extern time_t getMaxAge(const char *url); extern void refreshInit(void); +extern void refreshRegisterWithCacheManager(CacheManager & manager); extern const refresh_t *refreshLimits(const char *url); extern void serverConnectionsClose(void); @@ -525,6 +533,7 @@ SQUIDCEXTERN void identInit(void); #endif SQUIDCEXTERN void statInit(void); +extern void statRegisterWithCacheManager(CacheManager & manager); SQUIDCEXTERN void statFreeMemory(void); SQUIDCEXTERN double median_svc_get(int, int); SQUIDCEXTERN void pconnHistCount(int, int); @@ -608,6 +617,7 @@ SQUIDCEXTERN HASHCMP storeKeyHashCmp; * store_digest.c */ SQUIDCEXTERN void storeDigestInit(void); +extern void storeDigestRegisterWithCacheManager(CacheManager & manager); SQUIDCEXTERN void storeDigestNoteStoreReady(void); SQUIDCEXTERN void storeDigestScheduleRebuild(void); SQUIDCEXTERN void storeDigestDel(const StoreEntry * entry); @@ -785,6 +795,7 @@ SQUIDCEXTERN int internalHostnameIs(const char *); #if USE_CARP SQUIDCEXTERN void carpInit(void); +extern void carpRegisterWithCacheManager(CacheManager & manager); SQUIDCEXTERN peer *carpSelectParent(HttpRequest *); #endif diff --git a/src/redirect.cc b/src/redirect.cc index 56445ef0fe..145d7c6007 100644 --- a/src/redirect.cc +++ b/src/redirect.cc @@ -1,6 +1,6 @@ /* - * $Id: redirect.cc,v 1.111 2005/09/09 17:31:33 wessels Exp $ + * $Id: redirect.cc,v 1.112 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 61 Redirector * AUTHOR: Duane Wessels @@ -35,6 +35,7 @@ #include "squid.h" #include "AuthUserRequest.h" +#include "CacheManager.h" #include "Store.h" #include "client_side_request.h" #include "ACLChecklist.h" @@ -172,14 +173,19 @@ redirectInit(void) helperOpenServers(redirectors); if (!init) { - cachemgrRegister("redirector", - "URL Redirector Stats", - redirectStats, 0, 1); init = 1; CBDATA_INIT_TYPE(redirectStateData); } } +void +redirectRegisterWithCacheManager(CacheManager & manager) +{ + manager.registerAction("redirector", + "URL Redirector Stats", + redirectStats, 0, 1); +} + void redirectShutdown(void) { diff --git a/src/refresh.cc b/src/refresh.cc index a72ca5753d..98391dc15c 100644 --- a/src/refresh.cc +++ b/src/refresh.cc @@ -1,6 +1,6 @@ /* - * $Id: refresh.cc,v 1.71 2006/05/08 23:38:33 robertc Exp $ + * $Id: refresh.cc,v 1.72 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 22 Refresh Calculation * AUTHOR: Harvest Derived @@ -38,6 +38,7 @@ #endif #include "squid.h" +#include "CacheManager.h" #include "Store.h" #include "MemObject.h" #include "HttpRequest.h" @@ -583,14 +584,19 @@ refreshInit(void) refreshCounts[rcCDigest].proto = "Cache Digests"; #endif - cachemgrRegister("refresh", - "Refresh Algorithm Statistics", - refreshStats, - 0, - 1); memset(&DefaultRefresh, '\0', sizeof(DefaultRefresh)); DefaultRefresh.pattern = ""; DefaultRefresh.min = REFRESH_DEFAULT_MIN; DefaultRefresh.pct = REFRESH_DEFAULT_PCT; DefaultRefresh.max = REFRESH_DEFAULT_MAX; } + +void +refreshRegisterWithCacheManager(CacheManager & manager) +{ + manager.registerAction("refresh", + "Refresh Algorithm Statistics", + refreshStats, + 0, + 1); +} diff --git a/src/stat.cc b/src/stat.cc index 50cd5f255f..e8d89c99f0 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1,5 +1,5 @@ /* - * $Id: stat.cc,v 1.394 2006/05/19 17:19:10 wessels Exp $ + * $Id: stat.cc,v 1.395 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -35,6 +35,7 @@ #include "squid.h" #include "StoreClient.h" #include "AuthUserRequest.h" +#include "CacheManager.h" #include "Store.h" #include "HttpRequest.h" #include "MemObject.h" @@ -983,77 +984,81 @@ statInit(void) eventAdd("statAvgTick", statAvgTick, NULL, (double) COUNT_INTERVAL, 1); - cachemgrRegister("info", - "General Runtime Information", - info_get, 0, 1); + ClientActiveRequests.head = NULL; + + ClientActiveRequests.tail = NULL; +} - cachemgrRegister("filedescriptors", - "Process Filedescriptor Allocation", - fde::DumpStats, 0, 1); +void +statRegisterWithCacheManager(CacheManager & manager) +{ + manager.registerAction("info", + "General Runtime Information", + info_get, 0, 1); - cachemgrRegister("objects", - "All Cache Objects", - stat_objects_get, 0, 0); + manager.registerAction("filedescriptors", + "Process Filedescriptor Allocation", + fde::DumpStats, 0, 1); - cachemgrRegister("vm_objects", - "In-Memory and In-Transit Objects", - stat_vmobjects_get, 0, 0); + manager.registerAction("objects", + "All Cache Objects", + stat_objects_get, 0, 0); + + manager.registerAction("vm_objects", + "In-Memory and In-Transit Objects", + stat_vmobjects_get, 0, 0); #if DEBUG_OPENFD - cachemgrRegister("openfd_objects", - "Objects with Swapout files open", - statOpenfdObj, 0, 0); + manager.registerAction("openfd_objects", + "Objects with Swapout files open", + statOpenfdObj, 0, 0); #endif - cachemgrRegister("io", - "Server-side network read() size histograms", - stat_io_get, 0, 1); + manager.registerAction("io", + "Server-side network read() size histograms", + stat_io_get, 0, 1); - cachemgrRegister("counters", - "Traffic and Resource Counters", - statCountersDump, 0, 1); + manager.registerAction("counters", + "Traffic and Resource Counters", + statCountersDump, 0, 1); - cachemgrRegister("peer_select", - "Peer Selection Algorithms", - statPeerSelect, 0, 1); + manager.registerAction("peer_select", + "Peer Selection Algorithms", + statPeerSelect, 0, 1); - cachemgrRegister("digest_stats", - "Cache Digest and ICP blob", - statDigestBlob, 0, 1); + manager.registerAction("digest_stats", + "Cache Digest and ICP blob", + statDigestBlob, 0, 1); - cachemgrRegister("5min", - "5 Minute Average of Counters", - statAvg5min, 0, 1); + manager.registerAction("5min", + "5 Minute Average of Counters", + statAvg5min, 0, 1); - cachemgrRegister("60min", - "60 Minute Average of Counters", - statAvg60min, 0, 1); + manager.registerAction("60min", + "60 Minute Average of Counters", + statAvg60min, 0, 1); - cachemgrRegister("utilization", - "Cache Utilization", - statUtilization, 0, 1); + manager.registerAction("utilization", + "Cache Utilization", + statUtilization, 0, 1); #if STAT_GRAPHS - cachemgrRegister("graph_variables", - "Display cache metrics graphically", - statGraphDump, 0, 1); + manager.registerAction("graph_variables", + "Display cache metrics graphically", + statGraphDump, 0, 1); #endif - cachemgrRegister("histograms", - "Full Histogram Counts", - statCountersHistograms, 0, 1); - - ClientActiveRequests.head = NULL; - - ClientActiveRequests.tail = NULL; + manager.registerAction("histograms", + "Full Histogram Counts", + statCountersHistograms, 0, 1); - cachemgrRegister("active_requests", - "Client-side Active Requests", - statClientRequests, 0, 1); + manager.registerAction("active_requests", + "Client-side Active Requests", + statClientRequests, 0, 1); } static void diff --git a/src/store.cc b/src/store.cc index befe61ff39..3dba7b8820 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.595 2006/05/23 20:29:04 hno Exp $ + * $Id: store.cc,v 1.596 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -35,6 +35,7 @@ #include "squid.h" #include "Store.h" +#include "CacheManager.h" #include "StoreClient.h" #include "stmem.h" #include "HttpReply.h" @@ -1433,15 +1434,20 @@ storeInit(void) eventAdd("storeLateRelease", storeLateRelease, NULL, 1.0, 1); Store::Root().init(); storeRebuildStart(); - cachemgrRegister("storedir", - "Store Directory Stats", - Store::Stats, 0, 1); - cachemgrRegister("store_check_cachable_stats", - "storeCheckCachable() Stats", - storeCheckCachableStats, 0, 1); - cachemgrRegister("store_io", - "Store IO Interface Stats", - storeIOStats, 0, 1); +} + +void +storeRegisterWithCacheManager(CacheManager & manager) +{ + manager.registerAction("storedir", + "Store Directory Stats", + Store::Stats, 0, 1); + manager.registerAction("store_check_cachable_stats", + "storeCheckCachable() Stats", + storeCheckCachableStats, 0, 1); + manager.registerAction("store_io", + "Store IO Interface Stats", + storeIOStats, 0, 1); } void diff --git a/src/store_digest.cc b/src/store_digest.cc index 1561c5aeb1..6a2faa4875 100644 --- a/src/store_digest.cc +++ b/src/store_digest.cc @@ -1,6 +1,6 @@ /* - * $Id: store_digest.cc,v 1.66 2006/05/19 17:05:18 wessels Exp $ + * $Id: store_digest.cc,v 1.67 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 71 Store Digest Manager * AUTHOR: Alex Rousskov @@ -43,6 +43,7 @@ #include "squid.h" #if USE_CACHE_DIGESTS +#include "CacheManager.h" #include "Store.h" #include "HttpRequest.h" #include "HttpReply.h" @@ -120,8 +121,6 @@ storeDigestInit(void) debug(71, 1) ("Local cache digest enabled; rebuild/rewrite every %d/%d sec\n", (int) Config.digest.rebuild_period, (int) Config.digest.rewrite_period); memset(&sd_state, 0, sizeof(sd_state)); - cachemgrRegister("store_digest", "Store Digest", - storeDigestReport, 0, 1); #else store_digest = NULL; @@ -129,6 +128,13 @@ storeDigestInit(void) #endif } +void +storeDigestRegisterWithCacheManager(CacheManager & manager) +{ + manager.registerAction("store_digest", "Store Digest", + storeDigestReport, 0, 1); +} + /* called when store_rebuild completes */ void storeDigestNoteStoreReady(void) diff --git a/src/tests/testAuth.cc b/src/tests/testAuth.cc index 0436179137..722275959f 100644 --- a/src/tests/testAuth.cc +++ b/src/tests/testAuth.cc @@ -97,8 +97,6 @@ fake_auth_setup() cbdataInit(); - eventInit(); - Vector &config = Config.authConfiguration; char const *digest_parms[]= {"program /home/robertc/install/squid/libexec/digest_pw_auth /home/robertc/install/squid/etc/digest.pwd", diff --git a/src/tests/testCacheManager.cc b/src/tests/testCacheManager.cc new file mode 100644 index 0000000000..252f327f28 --- /dev/null +++ b/src/tests/testCacheManager.cc @@ -0,0 +1,55 @@ +#include "squid.h" +#include + +#include "Mem.h" +#include "testCacheManager.h" +#include "CacheManager.h" + + +CPPUNIT_TEST_SUITE_REGISTRATION( testCacheManager ); + +/* stub functions to link successfully */ +void +shut_down(int) +{} + +/* end stubs */ + +/* init memory pools */ + +struct Initer +{ + Initer() {Mem::Init();} +}; + +static Initer ensure_mempools; + +/* + * Test creating a CacheManager + */ +void +testCacheManager::testCreate() +{ + CacheManager(); +} + +/* an action to register */ +static void +dummy_action(StoreEntry * sentry) +{} + +/* + * registering an action makes it findable. + */ +void +testCacheManager::testRegister() +{ + CacheManager manager; + manager.registerAction("sample", "my sample", &dummy_action, false, false); + CacheManagerAction *anAction = manager.findAction("sample"); + CPPUNIT_ASSERT_EQUAL(String("sample"), String(anAction->action)); + CPPUNIT_ASSERT_EQUAL(String("my sample"), String(anAction->desc)); + CPPUNIT_ASSERT_EQUAL(&dummy_action, anAction->handler); + CPPUNIT_ASSERT_EQUAL(0, (int)anAction->flags.pw_req); + CPPUNIT_ASSERT_EQUAL(0, (int)anAction->flags.atomic); +} diff --git a/src/tests/testCacheManager.h b/src/tests/testCacheManager.h new file mode 100644 index 0000000000..ffc6e7fead --- /dev/null +++ b/src/tests/testCacheManager.h @@ -0,0 +1,26 @@ + +#ifndef SQUID_SRC_TEST_CACHEMANAGER_H +#define SQUID_SRC_TEST_CACHEMANAGER_H + +#include + +/* + * test the CacheManager implementation + */ + +class testCacheManager : public CPPUNIT_NS::TestFixture +{ + CPPUNIT_TEST_SUITE( testCacheManager ); + CPPUNIT_TEST( testCreate ); + CPPUNIT_TEST( testRegister ); + CPPUNIT_TEST_SUITE_END(); + +public: + +protected: + void testCreate(); + void testRegister(); +}; + +#endif + diff --git a/src/tests/testCoss.cc b/src/tests/testCoss.cc index e691581294..61b2911093 100644 --- a/src/tests/testCoss.cc +++ b/src/tests/testCoss.cc @@ -61,8 +61,6 @@ testCoss::commonInit() cbdataInit(); - eventInit(); /* eventInit() is required for config parsing */ - comm_init(); httpHeaderInitModule(); /* must go before any header processing (e.g. the one in errorInitialize) */ diff --git a/src/tests/testNull.cc b/src/tests/testNull.cc index 6a073e13ed..adfa19c91a 100644 --- a/src/tests/testNull.cc +++ b/src/tests/testNull.cc @@ -61,8 +61,6 @@ testNull::commonInit() cbdataInit(); - eventInit(); /* eventInit() is required for config parsing */ - comm_init(); httpHeaderInitModule(); /* must go before any header processing (e.g. the one in errorInitialize) */ diff --git a/src/tests/testUfs.cc b/src/tests/testUfs.cc index e916ae5d9e..2c1beb0b2f 100644 --- a/src/tests/testUfs.cc +++ b/src/tests/testUfs.cc @@ -78,8 +78,6 @@ testUfs::testUfsSearch() cbdataInit(); - eventInit(); /* eventInit() is required for config parsing */ - comm_init(); httpHeaderInitModule(); /* must go before any header processing (e.g. the one in errorInitialize) */ diff --git a/src/ufsdump.cc b/src/ufsdump.cc index c15f5ab700..d38ae78775 100644 --- a/src/ufsdump.cc +++ b/src/ufsdump.cc @@ -1,6 +1,6 @@ /* - * $Id: ufsdump.cc,v 1.7 2006/05/12 19:14:31 serassio Exp $ + * $Id: ufsdump.cc,v 1.8 2006/05/29 00:15:02 robertc Exp $ * * DEBUG: section 0 UFS Store Dump * AUTHOR: Robert Collins @@ -68,10 +68,6 @@ void eventAdd(const char *name, EVH * func, void *arg, double when, int, bool cbdata) {} -void -cachemgrRegister(const char *action, const char *desc, OBJH * handler, int pw_req_flag, int atomic) -{} - #endif /* end stub functions */