]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Add a CacheManager class which provides the cachemanager menu registration facility...
authorrobertc <>
Mon, 29 May 2006 06:14:59 +0000 (06:14 +0000)
committerrobertc <>
Mon, 29 May 2006 06:14:59 +0000 (06:14 +0000)
84 files changed:
include/profiling.h
src/ACLASN.h
src/AccessLogEntry.h
src/AuthConfig.cc
src/AuthConfig.h
src/CacheManager.h [new file with mode: 0644]
src/ConfigParser.h
src/DelayPools.h
src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.cc
src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.h
src/DiskIO/DiskIOModule.cc
src/DiskIO/DiskIOModule.h
src/DiskIO/DiskThreads/DiskThreadsDiskIOModule.cc
src/DiskIO/DiskThreads/DiskThreadsDiskIOModule.h
src/DiskIO/DiskThreads/DiskThreadsIOStrategy.cc
src/DiskIO/DiskThreads/DiskThreadsIOStrategy.h
src/ExternalACL.h
src/HttpHeader.cc
src/HttpHeader.h
src/LeakFinder.cc
src/Makefile.am
src/Mem.h
src/ProfStats.cc
src/SquidString.h
src/Store.h
src/StoreFileSystem.cc
src/StoreFileSystem.h
src/String.cc
src/access_log.cc
src/asn.cc
src/auth/basic/auth_basic.cc
src/auth/basic/auth_basic.h
src/auth/digest/auth_digest.cc
src/auth/digest/auth_digest.h
src/auth/negotiate/auth_negotiate.cc
src/auth/negotiate/auth_negotiate.h
src/auth/ntlm/auth_ntlm.cc
src/auth/ntlm/auth_ntlm.h
src/authenticate.cc
src/authenticate.h
src/cache_cf.cc
src/cache_manager.cc
src/carp.cc
src/cbdata.cc
src/client_db.cc
src/comm_epoll.cc
src/comm_epoll.h [new file with mode: 0644]
src/comm_kqueue.cc
src/comm_kqueue.h [new file with mode: 0644]
src/comm_poll.cc
src/comm_poll.h [new file with mode: 0644]
src/comm_select.cc
src/comm_select.h [new file with mode: 0644]
src/delay_pools.cc
src/dns.cc
src/dns_internal.cc
src/enums.h
src/event.cc
src/external_acl.cc
src/forward.cc
src/forward.h
src/fqdncache.cc
src/fs/coss/StoreFScoss.cc
src/fs/coss/StoreFScoss.h
src/ipcache.cc
src/main.cc
src/mem.cc
src/neighbors.cc
src/net_db.cc
src/pconn.cc
src/pconn.h
src/protos.h
src/redirect.cc
src/refresh.cc
src/stat.cc
src/store.cc
src/store_digest.cc
src/tests/testAuth.cc
src/tests/testCacheManager.cc [new file with mode: 0644]
src/tests/testCacheManager.h [new file with mode: 0644]
src/tests/testCoss.cc
src/tests/testNull.cc
src/tests/testUfs.cc
src/ufsdump.cc

index 1be3c3a186aaf360f4fd2eb5ccab38e53d08c8b9..68986f12afeee57977308aaf68e50f8573396c32 100644 (file)
@@ -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)
index 02da65a86a9a6a791ec3d234e834107f7ece9bfd..ff1b0b08a3b030307331b7d6b1a34fd97f532762 100644 (file)
@@ -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/
 #include "ACLStrategised.h"
 #include "ACLChecklist.h"
 
+/* forward decls */
+
+class CacheManager;
+
 SQUIDCEXTERN int asnMatchIp(List<int> *, struct IN_ADDR);
 SQUIDCEXTERN void asnInit(void);
+extern void asnRegisterWithCacheManager(CacheManager & manager);
 SQUIDCEXTERN void asnFreeMemory(void);
 
 class ACLASN : public ACLData<struct IN_ADDR>
index e0ea9128685a8d35011944fc592be39fa7b38241..661c139e47801203171c6767c8fbcd9643d18445 100644 (file)
@@ -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/
 #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 */
index 6761ea82558dafce77c15e59ea5ffc31303c8e4b..361c1b14e2e5151acc7109d7fb171b45275d2ad5 100644 (file)
@@ -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)
+{}
index 7658212afb0133431ec27f2738b33edfa99fa045..9e75c3a3c70d9e0c52505f8567b9f464ef5b233b 100644 (file)
@@ -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 (file)
index 0000000..2864212
--- /dev/null
@@ -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 */
index 3ecfae2a8bae7cd7301c979b8d1e826e88814e9f..fde3c4b4423e205285aa80b87f74eb3342f2579b 100644 (file)
@@ -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/
 
 #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 */
index 8e94af3a5104a9819ec08a2bbf69d7cca5d8d927..c1148762bafd846a7b536c63a51e9d03d24fc7f2 100644 (file)
@@ -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/
 #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);
index 4cdc6d2330e0c612985c883b06610f2a4bb56ff2..bd34d0c59a0fecba40f6ae28dc7b8c023b063bca 100644 (file)
@@ -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()
 {
index dc9b1e36055df43ed2e73c878b6791215220c7b9..233812cd434f5288dd2f872340e77fc289ed95ce 100644 (file)
@@ -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();
index 2a4190f871c96f5a4f8acd83e0f7ef0d31bf8256..fbabb84217e360e82a47253f8037eb0541abe133 100644 (file)
@@ -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)
+{}
index 1b7e9f6fa826693de8e46b83326255d8eb3d3999..995b92607b7d0b39b89bf0e9e584ebee8ec115be 100644 (file)
@@ -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/
  * ----------------------------------------------------------
 #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;
 
index 564018a9b9a0bd587f27a5bb2d233d77dbeaf1ac..4fc53ba0899b558f1f6039976b328952d0a86972 100644 (file)
@@ -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()
 {
index a5fe10ca3499bb15494a6467f1269c28257c484f..6386e1a4ae0cfa5dc608fcccb19282981d224174 100644 (file)
@@ -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();
index 3938012f63e4d61986c32d8f7757192ebb9c0308..e0446a619096b42a4548861d9a5852da335bff40 100644 (file)
@@ -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)
 {
index 83f47f8cf4baa89bde5f36636e6f04e2706935cb..56e8199fe626eb34b78327aa9a1e8863c6299830 100644 (file)
@@ -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;
index 3a063922143bb59e6d89ae9391a65f82c7775808..0c1fa11333cb48f39041cebcbeefc61d52447fa6 100644 (file)
@@ -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 */
index c9fd4f5daf2a9e8ddac3c2c05ba5e4d7b19e0085..c9e34c8b5a6891139f0018a6f48119b8dcc63821 100644 (file)
@@ -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
index 6c34deef5ee250443e3d0bf634a3ec43ba939293..2f6abe6d5a3de3dad249c73b7a071e66d394d2b1 100644 (file)
@@ -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);
index 38990f18fa4d033401e8451576cde3d59804f785..f4bcb8b2133ce51d00dcb1147a66ea2c650689e1 100644 (file)
@@ -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);
index 4e7dbe5d1342e63b4a1b7e5f7d3f9c35aaf0d468..e90cf676a2d7d5012202cf57d9a7a7a1d3a838e3 100644 (file)
@@ -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 \
index ab234f04464ce7577b2533bf557201098f49fed5..22f7d44c7bd478105259bd0c8f9b031c1880b536 100644 (file)
--- 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
 #ifndef SQUID_MEM
 #define SQUID_MEM
 
+/* forward decls */
+
+class CacheManager;
+
 #include <iosfwd>
 
 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 &);
index 99643e8c1305e03286aab4dff3fd9a1bab464e8a..1e593ea2fb42d40a8f2e9313271bfcaab8ad23eb 100644 (file)
@@ -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
index dd50269c8262ba68c795fd02c6739ce00a4d5140..9dfaeb49b5dafcd35bf0929242c72e0c72059583 100644 (file)
@@ -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
 #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;
index 14f32837c384cf9aa56ad427dc341f6c7a966b98..247bdd1605245099ccb85dc440224fdb3e5313ac 100644 (file)
@@ -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 *);
index 5f516ac9122bf90025a41443ce168b4f64e00e81..e25e3ff32cef0e07fd54c4024ce09df351bd0f40 100644 (file)
@@ -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
 
 Vector<StoreFileSystem*> *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)
+{}
index 3be17893794d61f296cb3abddad98e61066c61c8..aa4d5193ab2f15a9153ebe4d3c525b515bd968e8 100644 (file)
@@ -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/
  * ----------------------------------------------------------
 #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 &);
index ee115e37d211ec0c49753ae64cdee855dabd252b..cb991407ad165464b79de9d57db8f15c65811d1f 100644 (file)
@@ -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);
 }
 
index 402288c62bdc77d53816dfecd2f29fa92d57ceb1..23957eb18f79b11ee592a527d7ccbdb6f99e9630 100644 (file)
@@ -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
index 248c608c9863247f30aebc457c1eedde5bc8a704..eff765355581860da65db637a296b35d123e42d6 100644 (file)
@@ -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
index f55fe929bc1461e037b5fac78700af71ef4f1739..d838c630f33b39e310df6c4aa7106382a23436a4 100644 (file)
@@ -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)
 {
index 77ddfdb87d3a0662a2e2080520d3b14a2791a5cf..6dff777b01b0fb20dff9ecb4173ff4fc8fa3d616 100644 (file)
@@ -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;
index 9fed8f294d448940f61de7e82c6a375dc9ac76f1..abe4f4955c57ea11b9d7f7262ef7f5aa78905281 100644 (file)
@@ -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
index cbf3e256f1a16c66f045bf37f9fd24ce638d7f05..4cd6d059db46581f007480b264bef1b7c82bf7ac 100644 (file)
@@ -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;
index 36bd4cc07e4a98b0c07423f872ac287c01248dff..9815b2b97bab40a07bbeba5e2e4d81990f82b742 100644 (file)
@@ -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
 {
index c88dedc5ea2925b198dbb93771076390fe22ab9a..e02ab1a82cbacc99facf2c991ea004535328b5c5 100644 (file)
@@ -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;
index d194986f47a1f41fea7e66e39d0944c99568131c..20f063bb190671d912916c683f8d555e7f85697b 100644 (file)
@@ -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
 {
index 4df71aa456e6014e08687d6d03f0995948420ad1..332cc5b04bdf718dc760359548f2490a159761d5 100644 (file)
@@ -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;
index 5cbd8ef4202227b1065b6fd4e34d9046e466293d..8343eb0a2cc789a4bacc0f9c2c1c99f5ba640f15 100644 (file)
@@ -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)
 {
index 7c51e098185050999042a6cbdef885555565333b..0ac032709f9626a08dd92adcb403ae3b79eb1877 100644 (file)
@@ -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);
 
index 9578b1e05de9ef08f40bad72a365ce5a4ae498a8..3f0d8c0c511f2b07c0eab41c25923f96ea15ce4f 100644 (file)
@@ -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;
index 8c29a0c3dc55154b461982e65c5cbc45eab850a4..6ca762ff15af9d688a5a1c9c0da0bebf79afec4c 100644 (file)
@@ -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);
-}
index ef383fda84b8835222938d3ecdea65a778af67fc..d41ac55e8007d751549863a80c124d29a71c4b9b 100644 (file)
@@ -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 *
index ac051cb2b1e09763b8b016e82f1d56941698befe..91b7cc6a596d9e2d5852d41679e09af318a31f42 100644 (file)
@@ -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)
index b8f2b25a7dbb04c363ad5fd614bfaae32db3791b..77193d9569dcda34e9c6c31073331626e998e16e 100644 (file)
@@ -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
index 1a26b2bd99a7d54bb54131be1d4c3af9a940295a..81f9abd66fcf4e51c3c3511a1120f3bb15e3ca9e 100644 (file)
@@ -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 (file)
index 0000000..9df4627
--- /dev/null
@@ -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 */
index abdc4acfd43ba48c62df400236de43ee81777ae9..8835839852ddbe24ead374d51517673e87c5b58b 100644 (file)
@@ -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 (file)
index 0000000..d726b29
--- /dev/null
@@ -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 */
index 0643c16902b2abc9e2a5477cda7f08a094b53598..086dd990df946066f6c2594e534c977380ccc7ba 100644 (file)
@@ -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 (file)
index 0000000..3c0f693
--- /dev/null
@@ -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 */
index 2227181e5d07130458166e479577fb36422a1495..6cf9f9f04a525f2ec2ae8c3126b00fabaa36d80e 100644 (file)
@@ -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 (file)
index 0000000..ac9d37d
--- /dev/null
@@ -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 */
index 10e9d97e63cc86f46edf00313f8722fc095e0726..8ef73b5f9f77d7044c74e4d73d3fba0e0093e8bd 100644 (file)
@@ -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 <robertc@squid-cache.org>
@@ -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
index bac4f3e23e38ae98f6d598e0555f371c6640ae9b..6c2d16115453d8b31f9090142e509c44c800e85d 100644 (file)
@@ -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
index a21576371f78abc5348ff20dbc8583c1ae3d7a5d..43eecd322d03ec7a53c28581acde7285d5ebd2de 100644 (file)
@@ -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)
 {
index 7f694af08ca7b5591e29995c5401f14e37c3d991..3e0924d0b15d2be333a96ae45cca4cc28e4d0193 100644 (file)
@@ -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;
 
index 89fe23b82ea5bbd94fbb55ee57236cfa96fea474..82a93d179ae6387f8f7080ccee56b3564f4bd206 100644 (file)
@@ -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
  */
 
 #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;
index 8e0aa3907d289ff7ac9ec1c9c7b69977178f6b3d..76e289bf15c91d697e378f36b8ee1ff9cf707860 100644 (file)
@@ -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)
 {
index 1eb90bfd216f25450fef83ca364987b33042f231..8cb013696f87b5cdb255043171f5945a9b215a10 100644 (file)
@@ -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)
 {
index 12866d02967848a330daf13195e1ee85dad1592b..64b349623a7138817f0c41359c73ac68a8fa214d 100644 (file)
@@ -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 *);
index ae6bcd6ffd39b4d9c83c8066479c3dc2c3651e85..efa7e5192d25037781a021f2dbfcf8bfa29f92cf 100644 (file)
@@ -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)
index d1dfe7579c412108c8d5b4067814872db60787ef..832edda8e3af06a20838f395bf8e87c9c026f3cd 100644 (file)
@@ -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)
 {
index c289c3638b5dc647ab33bc34cfda1c1231a6e16e..56ce5d94887a54fd55cd4cb63124c4f2e2a1eef4 100644 (file)
@@ -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 &);
index 0202738c5f6d03c32d9482432f34cba64c8f3fc6..41c47b0e57945e9a17b3846040d5fc69a7e62b2c 100644 (file)
@@ -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)
 {
index 2c8f8c42a8d9923fd581dcc3bab0ebb789f8c3b0..23e052f96a6808a3118b1308c117670e9b234e1f 100644 (file)
@@ -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
 #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"
 #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)
 
index a4a8b9e683db0b1c8a96af2c75e97bec6aadcd28..6cf6441559550825c77264a29579d548b99ae26a 100644 (file)
@@ -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 <iomanip>
 #include <ostream>
 
+#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)
index 922a1d620c0461f9612340c37b83c026727b3883..607cb5a577bf71c2a5db6071bb9a96912241ebb1 100644 (file)
@@ -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
index 752daf973a771881032327efb374b1ed4e75094b..7e83d727df549dcccdf0a6a75425ff493d243e77 100644 (file)
@@ -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
 }
index a0b56ae748c869d519bc6fd6304539b025a1b097..12da503f424515a560e18cbfac7af4fd67d38685 100644 (file)
@@ -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);
 }
index a8a08b556da13314bb25526387f9ebaef1f4f256..41a1584d7b346b103da6e266be120a16a613b3b9 100644 (file)
@@ -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;
 };
 
index 371f11423d49372d1e353bb5b318b75982ef3370..b2d324f7e20ed15ddc429633249b53cb7e8f0e01 100644 (file)
@@ -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
 
index 56445ef0fe48e4a2fe6d68e18e53f5b4a9d675ad..145d7c6007808ab08109df5b302604a9a3ff01d8 100644 (file)
@@ -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)
 {
index a72ca5753d009b62f2df138398143cd495976ea1..98391dc15cce6d2b4c2876adf85df5894bcbd13d 100644 (file)
@@ -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 = "<none>";
     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);
+}
index 50cd5f255f8c96845d756c4a00cabb8258eb66b0..e8d89c99f067a190de8e7ee4583f78f14b3ece7c 100644 (file)
@@ -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
index befe61ff398da807cae0699f0b304bccd0ee64c2..3dba7b88209c29d528dda007bb8966bfe9197522 100644 (file)
@@ -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
index 1561c5aeb1bc73d1db97bc44838477e9a966329d..6a2faa487557f0e4ff54891b8f1bd09ba1e6234f 100644 (file)
@@ -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)
index 04361791374b9d15fa746c2f483bcaf0ffab4ede..722275959f4864ba956d992d165a9a14f49c81b6 100644 (file)
@@ -97,8 +97,6 @@ fake_auth_setup()
 
     cbdataInit();
 
-    eventInit();
-
     Vector<AuthConfig *> &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 (file)
index 0000000..252f327
--- /dev/null
@@ -0,0 +1,55 @@
+#include "squid.h"
+#include <cppunit/TestAssert.h>
+
+#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 (file)
index 0000000..ffc6e7f
--- /dev/null
@@ -0,0 +1,26 @@
+
+#ifndef SQUID_SRC_TEST_CACHEMANAGER_H
+#define SQUID_SRC_TEST_CACHEMANAGER_H
+
+#include <cppunit/extensions/HelperMacros.h>
+
+/*
+ * 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
+
index e691581294f8316254b3efe8dc4994885a2b25cf..61b29110934cf0cc66aff45e0bf4d508b57e0661 100644 (file)
@@ -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) */
index 6a073e13ed6282bf4a2b88c739bfbea845b22d37..adfa19c91ae745a1bf52806b09ee590b1d654333 100644 (file)
@@ -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) */
index e916ae5d9ee6b6a2de12159316f17be40955556a..2c1beb0b2fbbf54166c481fbc8ede59db278c451 100644 (file)
@@ -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) */
index c15f5ab7006f59c6166e11b58976d887c75ac1fb..d38ae787754201fa7255aed2171a9f3a42659875 100644 (file)
@@ -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 */