#include "config.h"
+/* forward decls (C++ only) */
+#if __cplusplus
+
+class CacheManager;
+#endif
+
#ifdef USE_XPROF_STATS
#if !defined(_SQUID_SOLARIS_)
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)
/*
- * $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>
/*
- * $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
{
};
/* 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 */
/*
- * $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
return NULL;
}
+
+/* Default behaviour is to expose nothing */
+void
+AuthConfig::registerWithCacheManager(CacheManager & manager)
+{}
/*
- * $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/
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 */
--- /dev/null
+
+/*
+ * $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 */
/*
- * $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
static char * strtokFile();
};
+extern int parseConfigFile(const char *file_name, CacheManager & manager);
+
#endif /* SQUID_CONFIGPARSER_H */
/*
- * $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
public:
static void Init();
+ static void RegisterWithCacheManager(CacheManager & manager);
static void Update(void *);
static unsigned short pools();
static void pools (u_short pools);
/*
- * $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/
* ----------------------------------------------------------
#include "squid.h"
#include "DiskDaemonDiskIOModule.h"
+#include "CacheManager.h"
#include "DiskdIOStrategy.h"
#include "Store.h"
*/
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()
{
/*
- * $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/
* ----------------------------------------------------------
static DiskDaemonDiskIOModule &GetInstance();
DiskDaemonDiskIOModule();
virtual void init();
+ virtual void registerWithCacheManager(CacheManager & manager);
virtual void shutdown();
virtual char const *type () const;
virtual DiskIOStrategy* createStrategy();
/*
- * $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
*/
}
+void
+DiskIOModule::RegisterAllModulesWithCacheManager(CacheManager & manager)
+{
+ for (iterator i = GetModules().begin(); i != GetModules().end(); ++i)
+ (*i)->registerWithCacheManager(manager);
+}
+
void
DiskIOModule::SetupAllModules()
{
return NULL;
}
+
+/* disk modules dont export anything by default */
+void
+DiskIOModule::registerWithCacheManager(CacheManager & manager)
+{}
/*
- * $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();
virtual ~DiskIOModule(){}
virtual void init() = 0;
+ virtual void registerWithCacheManager(CacheManager & manager);
virtual void shutdown() = 0;
virtual DiskIOStrategy *createStrategy() = 0;
/*
- * $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/
* ----------------------------------------------------------
DiskThreadsIOStrategy::Instance.init();
}
+void
+DiskThreadsDiskIOModule::registerWithCacheManager(CacheManager & manager)
+{
+ DiskThreadsIOStrategy::Instance.registerWithCacheManager(manager);
+}
+
void
DiskThreadsDiskIOModule::shutdown()
{
/*
- * $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/
* ----------------------------------------------------------
static DiskThreadsDiskIOModule &GetInstance();
DiskThreadsDiskIOModule();
virtual void init();
+ virtual void registerWithCacheManager(CacheManager & manager);
virtual void shutdown();
virtual char const *type () const;
virtual DiskIOStrategy* createStrategy();
/*
- * $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
#include "squid.h"
+#include "CacheManager.h"
#include "DiskThreadsIOStrategy.h"
#include "DiskThreadsDiskFile.h"
/* for statfs */
squidaio_ctrl_pool = new MemAllocatorProxy("aio_ctrl", sizeof(squidaio_ctrl_t));
- cachemgrRegister("squidaio_counts", "Async IO Function Counters",
- aioStats, 0, 1);
-
initialised = true;
/*
*/
}
+void
+DiskThreadsIOStrategy::registerWithCacheManager(CacheManager & manager)
+{
+ manager.registerAction("squidaio_counts", "Async IO Function Counters",
+ aioStats, 0, 1);
+}
+
void
DiskThreadsIOStrategy::done(void)
{
/*
- * $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
virtual int callback();
virtual void sync();
virtual void init();
+ virtual void registerWithCacheManager(CacheManager & manager);
void done();
/* Todo: add access limitations */
bool initialised;
/*
- * $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/
MEMPROXY_CLASS_INLINE(ACLExternal)
+extern void externalAclRegisterWithCacheManager(CacheManager & manager);
+
#endif /* SQUID_EXTERNALACL_H */
/*
- * $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
*/
#include "squid.h"
+#include "CacheManager.h"
#include "Store.h"
#include "HttpHeader.h"
#include "HttpHdrContRange.h"
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
/*
- * $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/
#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 */
//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);
/*
- * $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
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);
#
# 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:
#
cache_cf.cc \
CacheDigest.cc \
cache_manager.cc \
+ CacheManager.h \
carp.cc \
cbdata.cc \
client_db.cc \
tests/testAuth \
tests/testACLMaxUserIP \
tests/testBoilerplate \
+ tests/testCacheManager \
tests/testHeaders \
tests/test_http_range \
tests/testHttpRequest \
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 \
StatHist.cc \
stmem.cc \
String.cc \
- tests/stub_cache_manager.cc \
tests/stub_comm.cc \
tests/stub_DelayId.cc \
tests/stub_MemObject.cc \
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.
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 \
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 \
/*
- * $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
public:
static void Init();
+ static void RegisterWithCacheManager(CacheManager & manager);
static void Stats(StoreEntry *);
static void CleanIdlePools(void *unused);
static void Report(std::ostream &);
/*
- * $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
*/
#include "squid.h"
+#include "CacheManager.h"
#ifdef USE_XPROF_STATS
#include "Store.h"
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
/*
- * $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"
{
public:
- StringRegistry() : registered(false) {}
-
static StringRegistry &Instance();
void add
(String const *);
+ void registerWithCacheManager(CacheManager & manager);
+
void remove
(String const *);
bool registered;
- void registerMe();
};
class StoreEntry;
/*
- * $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/
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 *);
/*
- * $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()
{
}
}
+/* no filesystem is required to export statistics */
+void
+StoreFileSystem::registerWithCacheManager(CacheManager & manager)
+{}
/*
- * $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();
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 &);
/*
- * $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
}
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
StringRegistry::add
(String const *entry)
{
- if (!registered)
- registerMe();
-
entries.insert(entry, ptrcmp);
}
/*
- * $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
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;
assert(NULL != headerslog);
-#endif
-#if FORW_VIA_DB
-
- fvdbInit();
-
#endif
#if MULTICAST_MISS_STREAM
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
}
{
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
/*
- * $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
*/
#include "squid.h"
+#include "CacheManager.h"
#include "radix.h"
#include "HttpRequest.h"
#include "StoreClient.h"
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
/*
- * $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
#include "squid.h"
#include "auth_basic.h"
#include "authenticate.h"
+#include "CacheManager.h"
#include "Store.h"
#include "HttpReply.h"
#include "basicScheme.h"
void
AuthBasicConfig::init(AuthConfig * scheme)
{
- static int init = 0;
-
if (authenticate) {
authbasic_initialised = 1;
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)
{
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;
/*
- * $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
#include "rfc2617.h"
#include "auth_digest.h"
#include "authenticate.h"
+#include "CacheManager.h"
#include "Store.h"
#include "HttpRequest.h"
#include "HttpReply.h"
void
AuthDigestConfig::init(AuthConfig * scheme)
{
- static int init = 0;
-
if (authenticate) {
authenticateDigestNonceSetup();
authdigest_initialised = 1;
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
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;
/*
- * $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
#include "squid.h"
#include "auth_negotiate.h"
#include "authenticate.h"
+#include "CacheManager.h"
#include "Store.h"
#include "client_side.h"
#include "HttpReply.h"
void
AuthNegotiateConfig::init(AuthConfig * scheme)
{
- static unsigned char negotiate_was_already_initialised = 0;
-
if (authenticate) {
#if PLACEHOLDER
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
{
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;
/*
- * $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
#include "squid.h"
#include "auth_ntlm.h"
#include "authenticate.h"
+#include "CacheManager.h"
#include "Store.h"
#include "client_side.h"
#include "HttpReply.h"
void
AuthNTLMConfig::init(AuthConfig * scheme)
{
- static unsigned char ntlm_was_already_initialised = 0;
-
if (authenticate) {
#if PLACEHOLDER
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
{
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;
/*
- * $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
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)
{
/*
- * $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/
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);
/*
- * $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
#include "authenticate.h"
#include "AuthConfig.h"
#include "AuthScheme.h"
+#include "CacheManager.h"
#include "Store.h"
#include "SwapDir.h"
#include "ConfigParser.h"
}
int
-parseConfigFile(const char *file_name)
+parseConfigFile(const char *file_name, CacheManager & manager)
{
FILE *fp = NULL;
char *token = NULL;
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;
/*
- * $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
*
*/
-#include "squid.h"
+#include "CacheManager.h"
#include "HttpReply.h"
#include "HttpRequest.h"
#include "Store.h"
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;
;
*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))
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);
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)
{
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) {
}
static const char *
-cachemgrActionProtection(const action_table * at)
+cachemgrActionProtection(const CacheManagerAction * at)
{
char *pwd;
assert(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",
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);
-}
/*
- * $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
*/
#include "squid.h"
+#include "CacheManager.h"
#include "Store.h"
#if USE_CARP
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 *
/*
- * $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
*/
#include "squid.h"
+#include "CacheManager.h"
#include "Store.h"
#if CBDATA_DEBUG
#include "Stack.h"
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
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)
/*
- * $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
*/
#include "squid.h"
+#include "CacheManager.h"
#include "SquidTime.h"
#include "Store.h"
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
/*
- * $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
*
*/
#include "squid.h"
+#include "comm_epoll.h"
+#include "CacheManager.h"
#include "Store.h"
#include "fde.h"
#include "SquidTime.h"
--- /dev/null
+
+/*
+ * $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 */
/*
- * $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
*
*/
#include "squid.h"
+#include "comm_kqueue.h"
+#include "CacheManager.h"
#include "Store.h"
#include "fde.h"
#include "SquidTime.h"
--- /dev/null
+
+/*
+ * $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 */
/*
- * $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
*
*/
#include "squid.h"
+#include "comm_poll.h"
+#include "CacheManager.h"
#include "SquidTime.h"
#include "Store.h"
#include "fde.h"
* 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:
*
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);
}
--- /dev/null
+
+/*
+ * $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 */
/*
- * $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
*
*/
#include "squid.h"
+#include "comm_select.h"
+#include "CacheManager.h"
#include "SquidTime.h"
#ifdef USE_SELECT
{
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.
*
--- /dev/null
+
+/*
+ * $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 */
/*
- * $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>
#if DELAY_POOLS
#include "squid.h"
+#include "CacheManager.h"
#include "DelaySpec.h"
#include "DelayPools.h"
#include "StoreClient.h"
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
/*
- * $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
void
dnsInit(void)
{
- static int init = 0;
wordlist *w;
if (!Config.Program.dnsserver)
}
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
/*
- * $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
#include "config.h"
#include "squid.h"
+#include "CacheManager.h"
#include "SquidTime.h"
#include "Store.h"
#include "comm.h"
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)
{
/*
- * $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/
#if !USE_DNSSERVERS
MEM_IDNS_QUERY,
#endif
- MEM_EVENT,
MEM_MAX
} mem_type;
/*
- * $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;
bool cbdata;
};
+MEMPROXY_CLASS_INLINE(ev_entry);
+
static struct ev_entry *tasks = NULL;
static OBJH eventDump;
static int run_id = 0;
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;
if (event->cbdata)
cbdataReferenceDone(event->arg);
- memFree(event, MEM_EVENT);
+ delete event;
return;
}
callback(cbdata);
}
- memFree(event, MEM_EVENT);
+ delete event;
}
PROF_stop(eventRun);
}
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
if (event->cbdata)
cbdataReferenceDone(event->arg);
- memFree(event, MEM_EVENT);
+ delete event;
}
tasks = NULL;
/*
- * $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
*/
#include "squid.h"
+#include "CacheManager.h"
#include "ExternalACL.h"
#include "ExternalACLEntry.h"
#include "AuthUserRequest.h"
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)
{
/*
- * $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
#include "squid.h"
+#include "CacheManager.h"
#include "forward.h"
#include "SquidTime.h"
#include "Store.h"
void
FwdState::initModule()
{
- cachemgrRegister("forward",
- "Request Forwarding Statistics",
- fwdStats, 0, 1);
memDataInit(MEM_FWD_SERVER, "FwdServer", sizeof(FwdServer), 0);
#if WIP_FWD_LOG
#endif
}
+void
+FwdState::RegisterWithCacheManager(CacheManager & manager)
+{
+ manager.registerAction("forward",
+ "Request Forwarding Statistics",
+ fwdStats, 0, 1);
+}
+
void
FwdState::logReplyStatus(int tries, http_status status)
{
#ifndef SQUID_FORWARD_H
#define SQUID_FORWARD_H
+/* forward decls */
+
+class CacheManager;
+
class FwdServer
{
FwdState(int fd, StoreEntry *, HttpRequest *);
~FwdState();
static void initModule();
+ static void RegisterWithCacheManager(CacheManager & manager);
static void fwdStart(int fd, StoreEntry *, HttpRequest *);
void startComplete(FwdServer *);
/*
- * $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
*/
#include "squid.h"
+#include "CacheManager.h"
#include "SquidTime.h"
#include "Store.h"
#include "wordlist.h"
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)
/*
- * $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
#include "StoreFileSystem.h"
#include "StoreFScoss.h"
+#include "CacheManager.h"
#include "Store.h"
#include "CossSwapDir.h"
#include "store_coss.h"
StoreFScoss::done()
{
/* delete coss_index_pool;coss_index_pool = NULL; XXX Should be here? */
- cachemgrRegister("coss", "COSS Stats", Stats, 0, 1);
initialised = false;
}
initialised = true;
}
+void
+StoreFScoss::registerWithCacheManager(CacheManager & manager)
+{
+ manager.registerAction("coss", "COSS Stats", Stats, 0, 1);
+}
+
void
StoreFScoss::Stats(StoreEntry * sentry)
{
/*
- * $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/
* ----------------------------------------------------------
virtual char const *type() const;
virtual SwapDir *createSwapDir();
virtual void done();
+ virtual void registerWithCacheManager(CacheManager & manager);
virtual void setup();
/* Not implemented */
StoreFScoss (StoreFScoss const &);
/*
- * $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
*/
#include "squid.h"
+#include "CacheManager.h"
#include "SquidTime.h"
#include "Store.h"
#include "wordlist.h"
(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)
{
/*
- * $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"
static void mainSetCwd(void);
static int checkRunningPid(void);
+static CacheManager manager;
+
#ifndef _SQUID_MSWIN_
static const char *squid_start_script = "squid_start";
#endif
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 */
serverConnectionsOpen();
- if (theOutIcpConnection >= 0)
+ if (theOutIcpConnection >= 0) {
neighbors_init();
+ neighborsRegisterWithCacheManager(manager);
+ }
storeDirOpenSwapLogs();
#endif
urlInitialize();
- cachemgrInit();
statInit();
storeInit();
mainSetCwd();
#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
serverConnectionsOpen();
- if (theOutIcpConnection >= 0)
+ if (theOutIcpConnection >= 0) {
neighbors_init();
+ neighborsRegisterWithCacheManager(manager);
+ }
if (Config.chroot_dir)
no_suid();
cbdataInit();
- eventInit(); /* eventInit() is required for config parsing */
-
storeFsInit(); /* required for config parsing */
/* May not be needed for parsing, have not audited for such */
/* 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)
/*
- * $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
#include <iomanip>
#include <ostream>
+#include "CacheManager.h"
#include "Mem.h"
#include "memMeter.h"
#include "Store.h"
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)
/*
- * $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
*/
#include "squid.h"
+#include "CacheManager.h"
#include "Store.h"
#include "ICP.h"
#include "HttpRequest.h"
}
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
/*
- * $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
*/
#include "squid.h"
+#include "CacheManager.h"
#include "Store.h"
#include "SwapDir.h"
#include "HttpRequest.h"
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
}
/*
- * $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
*/
#include "squid.h"
+#include "CacheManager.h"
#include "Store.h"
#include "comm.h"
#include "pconn.h"
#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 ============================================ */
for (i = 0; i < PCONN_HIST_SZ; i++)
hist[i] = 0;
- if (ThePconnModule == NULL)
- ThePconnModule = new PconnModule;
-
- ThePconnModule->add
+ PconnModule::GetInstance()->add
(this);
}
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
}
}
-static void
-PconnModuleDumpWrapper(StoreEntry *e)
+void
+PconnModule::DumpWrapper(StoreEntry *e)
{
- ThePconnModule->dump(e);
+ PconnModule::GetInstance()->dump(e);
}
#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
{
{
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 *);
private:
PconnPool **pools;
+ static PconnModule * instance;
+
int poolCount;
};
/*
- * $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/
* 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);
/*
* 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);
* 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);
/* 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);
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 *);
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 *);
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 *);
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 *);
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);
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);
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);
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);
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);
#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);
* 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);
#if USE_CARP
SQUIDCEXTERN void carpInit(void);
+extern void carpRegisterWithCacheManager(CacheManager & manager);
SQUIDCEXTERN peer *carpSelectParent(HttpRequest *);
#endif
/*
- * $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
#include "squid.h"
#include "AuthUserRequest.h"
+#include "CacheManager.h"
#include "Store.h"
#include "client_side_request.h"
#include "ACLChecklist.h"
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)
{
/*
- * $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
#endif
#include "squid.h"
+#include "CacheManager.h"
#include "Store.h"
#include "MemObject.h"
#include "HttpRequest.h"
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);
+}
/*
- * $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
#include "squid.h"
#include "StoreClient.h"
#include "AuthUserRequest.h"
+#include "CacheManager.h"
#include "Store.h"
#include "HttpRequest.h"
#include "MemObject.h"
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
/*
- * $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
#include "squid.h"
#include "Store.h"
+#include "CacheManager.h"
#include "StoreClient.h"
#include "stmem.h"
#include "HttpReply.h"
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
/*
- * $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
#include "squid.h"
#if USE_CACHE_DIGESTS
+#include "CacheManager.h"
#include "Store.h"
#include "HttpRequest.h"
#include "HttpReply.h"
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;
#endif
}
+void
+storeDigestRegisterWithCacheManager(CacheManager & manager)
+{
+ manager.registerAction("store_digest", "Store Digest",
+ storeDigestReport, 0, 1);
+}
+
/* called when store_rebuild completes */
void
storeDigestNoteStoreReady(void)
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",
--- /dev/null
+#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);
+}
--- /dev/null
+
+#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
+
cbdataInit();
- eventInit(); /* eventInit() is required for config parsing */
-
comm_init();
httpHeaderInitModule(); /* must go before any header processing (e.g. the one in errorInitialize) */
cbdataInit();
- eventInit(); /* eventInit() is required for config parsing */
-
comm_init();
httpHeaderInitModule(); /* must go before any header processing (e.g. the one in errorInitialize) */
cbdataInit();
- eventInit(); /* eventInit() is required for config parsing */
-
comm_init();
httpHeaderInitModule(); /* must go before any header processing (e.g. the one in errorInitialize) */
/*
- * $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
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 */