]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Split out cbdata fully, it now is an optional include and no Init call is needed.
authorrobertc <>
Mon, 21 Aug 2006 06:50:40 +0000 (06:50 +0000)
committerrobertc <>
Mon, 21 Aug 2006 06:50:40 +0000 (06:50 +0000)
81 files changed:
include/List.h
src/ACL.h
src/DiskIO/AIO/AIODiskFile.h
src/DiskIO/Blocking/BlockingFile.h
src/DiskIO/DiskDaemon/DiskdFile.h
src/DiskIO/DiskThreads/DiskThreadsDiskFile.h
src/DiskIO/ReadRequest.h
src/DiskIO/WriteRequest.h
src/ESI.cc
src/ESISegment.h
src/ExternalACLEntry.h
src/ICAP/ICAPServiceRep.h
src/ICAP/MsgPipe.h
src/Makefile.am
src/MemBuf.h
src/MemObject.cc
src/MemObject.h
src/PeerDigest.h [new file with mode: 0644]
src/PeerSelectState.h
src/RemovalPolicy.cc [new file with mode: 0644]
src/RemovalPolicy.h [new file with mode: 0644]
src/Store.h
src/StoreIOState.h
src/SwapDir.h
src/acl_noncore.cc
src/auth/basic/auth_basic.h
src/auth/digest/auth_digest.h
src/auth/negotiate/auth_negotiate.h
src/auth/ntlm/auth_ntlm.h
src/cache_manager.cc
src/cbdata.cc
src/cbdata.h [new file with mode: 0644]
src/client_side_reply.cc
src/client_side_reply.h
src/defines.h
src/enums.h
src/errorpage.cc
src/errorpage.h [new file with mode: 0644]
src/event.cc
src/external_acl.cc
src/forward.cc
src/forward.h
src/fqdncache.cc
src/ftp.cc
src/globals.h
src/gopher.cc
src/helper.cc
src/helper.h
src/http.cc
src/internal.cc
src/ipcache.cc
src/main.cc
src/neighbors.cc
src/net_db.cc
src/peer_digest.cc
src/peer_select.cc
src/protos.h
src/redirect.cc
src/repl/heap/store_repl_heap.cc
src/repl/lru/store_repl_lru.cc
src/store_digest.cc
src/store_dir.cc
src/store_swapout.cc
src/structs.h
src/tests/stub_MemObject.cc
src/tests/stub_errorpage.cc
src/tests/stub_helper.cc
src/tests/testAuth.cc
src/tests/testCoss.cc
src/tests/testEvent.cc
src/tests/testHeader_RemovalPolicy.cc [new file with mode: 0644]
src/tests/testHeader_cbdata.cc [new file with mode: 0644]
src/tests/testHeader_errorpage.cc [new file with mode: 0644]
src/tests/testNull.cc
src/tests/testStoreController.cc
src/tests/testUfs.cc
src/tunnel.cc
src/typedefs.h
src/urn.cc
src/wais.cc
src/whois.cc

index 83c7c22eb0df54de86e05d30de7a8f0afe4aa74d..3418aae3c7c46898f33e423920346dff40eb39c3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: List.h,v 1.6 2005/05/14 20:00:25 hno Exp $
+ * $Id: List.h,v 1.7 2006/08/21 00:50:40 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -34,6 +34,8 @@
 #ifndef SQUID_LIST_H
 #define SQUID_LIST_H
 
+#include "cbdata.h"
+
 template <class C>
 
 class List
index 0a28abde7425c8d268bf8d187845191189624d44..42d44abcfad67e86d883099a6e63585749472465 100644 (file)
--- a/src/ACL.h
+++ b/src/ACL.h
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ACL.h,v 1.16 2006/04/25 12:00:29 robertc Exp $
+ * $Id: ACL.h,v 1.17 2006/08/21 00:50:40 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -36,6 +36,7 @@
 #ifndef SQUID_ACL_H
 #define SQUID_ACL_H
 #include "Array.h"
+#include "cbdata.h"
 #include "dlink.h"
 /* FIXME: finish splitting out the dependencies here
  * - typedefs should not be needed to parse this.
index b20c5516e2c357e9998749f6d2b7f940030e27d1..a8b30ad1bf1d24eada6f3384c4dcb5210f254760 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: AIODiskFile.h,v 1.1 2004/12/20 16:30:38 robertc Exp $
+ * $Id: AIODiskFile.h,v 1.2 2006/08/21 00:50:43 robertc Exp $
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
  * ----------------------------------------------------------
@@ -36,6 +36,7 @@
 
 #include "DiskIO/DiskFile.h"
 #include "async_io.h"
+#include "cbdata.h"
 
 class AIODiskIOStrategy;
 
index f26580f101c0f500385d5e2fec921ba65aa7b877..13f87bca51ecb50d9da03933890410222a4e399b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: BlockingFile.h,v 1.1 2004/12/20 16:30:38 robertc Exp $
+ * $Id: BlockingFile.h,v 1.2 2006/08/21 00:50:43 robertc Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Robert Collins
@@ -36,6 +36,8 @@
 
 #ifndef SQUID_BLOCKINGFILE_H
 #define SQUID_BLOCKINGFILE_H
+
+#include "cbdata.h"
 #include "DiskIO/DiskFile.h"
 
 class BlockingFile : public DiskFile
index d83bbeddd1ea9e7dd2eb6f43804324a76de433c2..f5bcf19b1bb370b7dbc90a167d3f511a8b41a9df 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: DiskdFile.h,v 1.1 2004/12/20 16:30:38 robertc Exp $
+ * $Id: DiskdFile.h,v 1.2 2006/08/21 00:50:45 robertc Exp $
  *
  * DEBUG: section 79    Squid-side DISKD I/O functions.
  * AUTHOR: Duane Wessels
@@ -37,6 +37,7 @@
 #ifndef __STORE_DISKDFILE_H__
 #define __STORE_DISKDFILE_H__
 
+#include "cbdata.h"
 #include "DiskIO/DiskFile.h"
 
 class DiskdIOStrategy;
index 23ebb2d0a223bf71c8e1e228bb407520fd616ebd..aa7e0d39003acb79e2d8ba032b7f43123da0e8d3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: DiskThreadsDiskFile.h,v 1.1 2004/12/20 16:30:38 robertc Exp $
+ * $Id: DiskThreadsDiskFile.h,v 1.2 2006/08/21 00:50:45 robertc Exp $
  *
  * DEBUG: section 79    Disk IO Routines
  * AUTHOR: Robert Collins
@@ -36,6 +36,7 @@
 
 #ifndef SQUID_DISKTHREADSDISKFILE_H
 #define SQUID_DISKTHREADSDISKFILE_H
+#include "cbdata.h"
 #include "DiskIO/DiskFile.h"
 #include "DiskThreads.h"
 
index b0a7f8d474f9016352d2524dbd684ae5337e1dbe..66d2c671f098ee76bb63368def45a53abd4c021e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ReadRequest.h,v 1.1 2004/12/20 16:30:38 robertc Exp $
+ * $Id: ReadRequest.h,v 1.2 2006/08/21 00:50:43 robertc Exp $
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
  * ----------------------------------------------------------
@@ -36,6 +36,7 @@
 
 #include "squid.h"
 
+#include "cbdata.h"
 #include "RefCount.h"
 
 class ReadRequest : public RefCountable
index 52ef989e7d4a3b2f5260baf89aff3d7e3041b11e..ce142a010acdaa9ea087fc08037e22e9254bd550 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: WriteRequest.h,v 1.1 2004/12/20 16:30:38 robertc Exp $
+ * $Id: WriteRequest.h,v 1.2 2006/08/21 00:50:43 robertc Exp $
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
  * ----------------------------------------------------------
@@ -36,6 +36,7 @@
 
 #include "squid.h"
 
+#include "cbdata.h"
 #include "RefCount.h"
 
 class WriteRequest : public RefCountable
index e994428db8b9b9abdec71a067547c82b3c537a6d..5eda8b8133d46d2c95374bfbbcd1689c4780062b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ESI.cc,v 1.21 2006/05/06 22:23:44 wessels Exp $
+ * $Id: ESI.cc,v 1.22 2006/08/21 00:50:40 robertc Exp $
  *
  * DEBUG: section 86    ESI processing
  * AUTHOR: Robert Collins
@@ -38,6 +38,7 @@
 #include "ESI.h"
 #include "clientStream.h"
 #include "client_side_request.h"
+#include "errorpage.h"
 #include "ESISegment.h"
 #include "ESIElement.h"
 #include "ESIContext.h"
index 44da5717e2200b2faf32e485a50ea1651b5d7d5a..b1c48e45e430afd5975b5f2fbccaebffed72a893 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ESISegment.h,v 1.3 2003/08/04 22:14:40 robertc Exp $
+ * $Id: ESISegment.h,v 1.4 2006/08/21 00:50:40 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -37,6 +37,7 @@
  * or perhaps use membuffers here?
  */
 
+#include "cbdata.h"
 #include "RefCount.h"
 #include "SquidString.h"
 
index 3e2ce8099ffa499ea4c31251ccaba4c2c1aba8da..f99a0faeab20f19687a5b9c4917eeb682a64da7a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ExternalACLEntry.h,v 1.5 2003/08/04 22:14:40 robertc Exp $
+ * $Id: ExternalACLEntry.h,v 1.6 2006/08/21 00:50:40 robertc Exp $
  *
  * DEBUG: section 82    External ACL
  * AUTHOR: Henrik Nordstrom, MARA Systems AB
@@ -44,6 +44,9 @@
 #ifndef SQUID_EXTERNALACLENTRY_H
 #define SQUID_EXTERNALACLENTRY_H
 
+
+#include "cbdata.h"
+
 /******************************************************************
  * ExternalACLEntryData
  * Core data that ExternalACLEntry manages.
index 62ec6e6964f67f342db29a612e222f29921a10f4..115f89e24ac5814f96a4e4330fcc23c1c2f21189 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ICAPServiceRep.h,v 1.3 2005/12/22 22:26:31 wessels Exp $
+ * $Id: ICAPServiceRep.h,v 1.4 2006/08/21 00:50:45 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -34,6 +34,7 @@
 #ifndef SQUID_ICAPSERVICEREP_H
 #define SQUID_ICAPSERVICEREP_H
 
+#include "cbdata.h"
 #include "ICAPElements.h"
 
 class ICAPOptions;
index a4938fba5dae465630f92851fdbedb9777a23bff..7fd5ac8c589e8a480e71223e8dbc4551ec8c898d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: MsgPipe.h,v 1.4 2006/08/07 02:28:24 robertc Exp $
+ * $Id: MsgPipe.h,v 1.5 2006/08/21 00:50:45 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -34,6 +34,7 @@
 #ifndef SQUID_MSGPIPE_H
 #define SQUID_MSGPIPE_H
 
+#include "cbdata.h"
 #include "event.h"
 
 // MsgPipe is a unidirectional communication channel for asynchronously
index f561157cd98de7700fcde45cb40e34d95f220160..5bf02a05de33118f6a9e7c5b441310b89a348b26 100644 (file)
@@ -1,7 +1,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.am,v 1.160 2006/08/12 01:43:10 robertc Exp $
+#  $Id: Makefile.am,v 1.161 2006/08/21 00:50:41 robertc Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -391,6 +391,7 @@ squid_SOURCES = \
        CacheManager.h \
        carp.cc \
        cbdata.cc \
+       cbdata.h \
        client_db.cc \
        client_side.cc \
        client_side.h \
@@ -513,11 +514,12 @@ squid_SOURCES = \
        redirect.cc \
        referer.cc \
        refresh.cc \
+       RemovalPolicy.cc \
+       RemovalPolicy.h \
        send-announce.cc \
        $(SNMP_SOURCE) \
        squid.h \
        SquidNew.cc \
-       tunnel.cc \
        $(SSL_SOURCE) \
        stat.cc \
        StatHist.cc \
@@ -565,6 +567,7 @@ squid_SOURCES = \
        SwapDir.h \
        time.cc \
        tools.cc \
+       tunnel.cc \
        typedefs.h \
        $(UNLINKDSOURCE) \
        url.cc \
@@ -739,6 +742,7 @@ ufsdump_SOURCES = \
        $(DNSSOURCE) \
        enums.h \
        errorpage.cc \
+       errorpage.h \
        $(ESI_SOURCE) \
        ETag.cc \
        event.cc \
@@ -799,6 +803,7 @@ ufsdump_SOURCES = \
        redirect.cc \
        referer.cc \
        refresh.cc \
+       RemovalPolicy.cc \
        send-announce.cc \
        $(SNMP_SOURCE) \
        squid.h \
@@ -1281,6 +1286,7 @@ tests_testCacheManager_SOURCES = \
        redirect.cc \
        referer.cc \
        refresh.cc \
+       RemovalPolicy.cc \
        Server.cc \
        $(SNMP_SOURCE) \
        $(SSL_SOURCE) \
@@ -1348,6 +1354,7 @@ tests_testEvent_SOURCES = \
        HttpRequest.cc \
        HttpRequestMethod.cc \
        mem.cc \
+       RemovalPolicy.cc \
        String.cc \
        tests/testEvent.cc \
        tests/testEvent.h \
@@ -1497,6 +1504,7 @@ tests_testEventLoop_SOURCES = \
        HttpRequest.cc \
        HttpRequestMethod.cc \
        mem.cc \
+       RemovalPolicy.cc \
        String.cc \
        tests/testEventLoop.cc \
        tests/testEventLoop.h \
@@ -1646,17 +1654,20 @@ tests_testEventLoop_DEPENDENCIES =  $(top_builddir)/lib/libmiscutil.a \
 HEADERS_TO_TEST = \
        tests/testHeader_ACL.cc \
        tests/testHeader_AsyncEngine.cc \
+       tests/testHeader_cbdata.cc \
        tests/testHeader_CompletionDispatcher.cc \
        tests/testHeader_ConfigParser.cc \
        tests/testHeader_client_side_request.cc \
        tests/testHeader_comm.cc \
        tests/testHeader_dlink.cc \
+       tests/testHeader_errorpage.cc \
        tests/testHeader_event.cc \
        tests/testHeader_EventLoop.cc \
        tests/testHeader_HttpHeader.cc \
        tests/testHeader_HttpHeaderRange.cc \
        tests/testHeader_HttpReply.cc \
        tests/testHeader_HttpRequestMethod.cc \
+       tests/testHeader_RemovalPolicy.cc \
        tests/testHeader_SquidTime.cc \
        tests/testHeader_Store.cc \
        tests/testHeader_StoreEntryStream.cc \
@@ -1753,6 +1764,7 @@ tests_test_http_range_SOURCES = \
        redirect.cc \
        referer.cc \
        refresh.cc \
+       RemovalPolicy.cc \
        Server.cc \
        $(SNMP_SOURCE) \
        $(SSL_SOURCE) \
@@ -1902,6 +1914,7 @@ tests_testHttpRequest_SOURCES = \
        redirect.cc \
        referer.cc \
        refresh.cc \
+       RemovalPolicy.cc \
        Server.cc \
        $(SNMP_SOURCE) \
        $(SSL_SOURCE) \
@@ -1971,6 +1984,7 @@ STORE_TEST_SOURCES=\
        EventLoop.cc \
        event.cc \
        HttpMsg.cc \
+       RemovalPolicy.cc \
        store_dir.cc \
        store.cc \
        HttpRequestMethod.cc \
@@ -2147,6 +2161,7 @@ tests_testURL_SOURCES = \
        HttpRequest.cc \
        HttpRequestMethod.cc \
        mem.cc \
+       RemovalPolicy.cc \
        String.cc \
        tests/testURL.cc \
        tests/testURL.h \
index e128bdc8cc385fcdb7218cdcf79bf4f9d8f5afad..6d06ea2ad62a997dc7a5433bd203b17bbfab938a 100644 (file)
@@ -1,7 +1,7 @@
 
 
 /*
- * $Id: MemBuf.h,v 1.7 2006/04/22 05:29:19 robertc Exp $
+ * $Id: MemBuf.h,v 1.8 2006/08/21 00:50:41 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -35,6 +35,7 @@
 #ifndef SQUID_MEMBUF_H
 #define SQUID_MEMBUF_H
 
+#include "cbdata.h"
 #include "Packer.h"
 
 /* auto-growing memory-resident buffer with printf interface */
index 36e74c86468cdbb9972edcd0e6a0263c7b8327c1..1dadcc31081fed77a065c718af59b039e1c90552 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: MemObject.cc,v 1.22 2006/02/17 18:10:59 wessels Exp $
+ * $Id: MemObject.cc,v 1.23 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 19    Store Memory Primitives
  * AUTHOR: Robert Collins
@@ -63,6 +63,8 @@ url_checksum(const char *url)
 
 #endif
 
+RemovalPolicy * mem_policy = NULL;
+
 size_t
 MemObject::inUseCount()
 {
index 3a778629f731a418bab189ee8754cd4d6d51f5a1..899fe447a1f463dfa30e0c76d9a506db08b30d20 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: MemObject.h,v 1.12 2006/05/22 19:58:51 wessels Exp $
+ * $Id: MemObject.h,v 1.13 2006/08/21 00:50:41 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -38,6 +38,7 @@
 #include "StoreIOState.h"
 #include "stmem.h"
 #include "CommRead.h"
+#include "RemovalPolicy.h"
 
 typedef void STMCB (void *data, StoreIOBuffer wroteBuffer);
 
@@ -156,4 +157,7 @@ private:
 
 MEMPROXY_CLASS_INLINE(MemObject)
 
+/* global current memory removal policy */
+extern RemovalPolicy *mem_policy;
+
 #endif /* SQUID_MEMOBJECT_H */
diff --git a/src/PeerDigest.h b/src/PeerDigest.h
new file mode 100644 (file)
index 0000000..cd85a12
--- /dev/null
@@ -0,0 +1,156 @@
+
+/*
+ * $Id: PeerDigest.h,v 1.1 2006/08/21 00:50:41 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_PEERDIGEST_H
+#define   SQUID_PEERDIGEST_H
+
+#include "squid.h"
+
+#if USE_CACHE_DIGESTS
+
+#include "cbdata.h"
+
+struct _Version
+{
+    short int current;         /* current version */
+    short int required;                /* minimal version that can safely handle current version */
+};
+
+/* digest control block; used for transmission and storage */
+
+class StoreDigestCBlock
+{
+  public:
+    Version ver;
+    int capacity;
+    int count;
+    int del_count;
+    int mask_size;
+    unsigned char bits_per_entry;
+    unsigned char hash_func_count;
+    short int reserved_short;
+    int reserved[32 - 6];
+};
+
+struct _DigestFetchState
+{
+    PeerDigest *pd;
+    StoreEntry *entry;
+    StoreEntry *old_entry;
+    store_client *sc;
+    store_client *old_sc;
+    HttpRequest *request;
+    int offset;
+    int mask_offset;
+    time_t start_time;
+    time_t resp_time;
+    time_t expires;
+
+    struct
+    {
+        int msg;
+        int bytes;
+    }
+
+    sent, recv;
+    char buf[SM_PAGE_SIZE];
+    ssize_t bufofs;
+    digest_read_state_t state;
+};
+
+class PeerDigest
+{
+
+public:
+    void *operator new (size_t);
+    void operator delete(void *);
+
+    struct _peer *peer;                        /* pointer back to peer structure, argh */
+    CacheDigest *cd;           /* actual digest structure */
+    String host;               /* copy of peer->host */
+    const char *req_result;    /* text status of the last request */
+
+    struct
+    {
+
+unsigned int needed:
+        1;     /* there were requests for this digest */
+
+unsigned int usable:
+        1;     /* can be used for lookups */
+
+unsigned int requested:
+        1;     /* in process of receiving [fresh] digest */
+    }
+
+    flags;
+
+    struct
+    {
+        /* all times are absolute unless augmented with _delay */
+        time_t initialized;    /* creation */
+        time_t needed;         /* first lookup/use by a peer */
+        time_t next_check;     /* next scheduled check/refresh event */
+        time_t retry_delay;    /* delay before re-checking _invalid_ digest */
+        time_t requested;      /* requested a fresh copy of a digest */
+        time_t req_delay;      /* last request response time */
+        time_t received;       /* received the current copy of a digest */
+        time_t disabled;       /* disabled for good */
+    }
+
+    times;
+
+    struct
+    {
+        cd_guess_stats guess;
+        int used_count;
+
+        struct
+        {
+            int msgs;
+            kb_t kbytes;
+        }
+
+        sent, recv;
+    }
+
+    stats;
+
+private:
+    CBDATA_CLASS(PeerDigest);
+};
+
+extern const Version CacheDigestVer;
+#endif
+
+#endif /* SQUID_PEERDIGEST_H */
index 9002a0406b78b76d8a29498b903b503d1162a80b..84f162beda0ee636bd69d93dd8d40ad549697dc2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: PeerSelectState.h,v 1.1 2003/10/16 21:40:16 robertc Exp $
+ * $Id: PeerSelectState.h,v 1.2 2006/08/21 00:50:41 robertc Exp $
  *
  * AUTHOR: Robert Collins
  *
@@ -36,6 +36,7 @@
 #ifndef   SQUID_PEERSELECTSTATE_H
 #define   SQUID_PEERSELECTSTATE_H
 
+#include "cbdata.h"
 #include "PingData.h"
 
 class ps_state
@@ -76,6 +77,8 @@ public:
 
     ping_data ping;
     ACLChecklist *acl_checklist;
+private:
+    CBDATA_CLASS(ps_state);
 };
 
 
diff --git a/src/RemovalPolicy.cc b/src/RemovalPolicy.cc
new file mode 100644 (file)
index 0000000..f3fe3b5
--- /dev/null
@@ -0,0 +1,39 @@
+
+/*
+ * $Id: RemovalPolicy.cc,v 1.1 2006/08/21 00:50:41 robertc Exp $
+ *
+ * DEBUG: section ?     Common Removal policy
+ * AUTHOR: Robert Collins
+ *
+ * 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.
+ *
+ */
+
+#include "RemovalPolicy.h"
+CBDATA_CLASS_INIT(RemovalPolicy);
+CBDATA_CLASS_INIT(RemovalPolicyWalker);
+CBDATA_CLASS_INIT(RemovalPurgeWalker);
diff --git a/src/RemovalPolicy.h b/src/RemovalPolicy.h
new file mode 100644 (file)
index 0000000..7424d95
--- /dev/null
@@ -0,0 +1,108 @@
+
+/*
+ * $Id: RemovalPolicy.h,v 1.1 2006/08/21 00:50:41 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.
+ *
+ * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
+ */
+
+#ifndef   SQUID_REMOVALPOLICY_H
+#define   SQUID_REMOVALPOLICY_H
+
+#include "squid.h"
+#include "cbdata.h"
+
+class RemovalPolicyWalker;
+class RemovalPurgeWalker;
+
+class RemovalPolicySettings
+{
+
+public:
+    RemovalPolicySettings() : type(NULL), args(NULL) {};
+
+    char *type;
+    wordlist *args;
+};
+
+class RemovalPolicyNode
+{
+
+public:
+    RemovalPolicyNode() : data(NULL) {}
+
+    void *data;
+};
+
+class RemovalPolicy
+{
+  public:
+    const char *_type;
+    void *_data;
+    void (*Free) (RemovalPolicy * policy);
+    void (*Add) (RemovalPolicy * policy, StoreEntry * entry, RemovalPolicyNode * node);
+    void (*Remove) (RemovalPolicy * policy, StoreEntry * entry, RemovalPolicyNode * node);
+    void (*Referenced) (RemovalPolicy * policy, const StoreEntry * entry, RemovalPolicyNode * node);
+    void (*Dereferenced) (RemovalPolicy * policy, const StoreEntry * entry, RemovalPolicyNode * node);
+    RemovalPolicyWalker *(*WalkInit) (RemovalPolicy * policy);
+    RemovalPurgeWalker *(*PurgeInit) (RemovalPolicy * policy, int max_scan);
+    void (*Stats) (RemovalPolicy * policy, StoreEntry * entry);
+  private:
+    CBDATA_CLASS2(RemovalPolicy);
+};
+
+class RemovalPolicyWalker
+{
+  public:
+    RemovalPolicy *_policy;
+    void *_data;
+    const StoreEntry *(*Next) (RemovalPolicyWalker * walker);
+    void (*Done) (RemovalPolicyWalker * walker);
+  private:
+    CBDATA_CLASS2(RemovalPolicyWalker);
+};
+
+class RemovalPurgeWalker
+{
+  public:
+    RemovalPolicy *_policy;
+    void *_data;
+    int scanned, max_scan, locked;
+    StoreEntry *(*Next) (RemovalPurgeWalker * walker);
+    void (*Done) (RemovalPurgeWalker * walker);
+  private:
+    CBDATA_CLASS2(RemovalPurgeWalker);
+};
+
+extern RemovalPolicy *createRemovalPolicy(RemovalPolicySettings * settings);
+
+typedef RemovalPolicy *REMOVALPOLICYCREATE(wordlist * args);
+
+
+#endif /* SQUID_REMOVALPOLICY_H */
index 247bdd1605245099ccb85dc440224fdb3e5313ac..008ad74affaa407d37d0ae455b44904c49105733 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: Store.h,v 1.24 2006/05/29 00:15:01 robertc Exp $
+ * $Id: Store.h,v 1.25 2006/08/21 00:50:41 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -43,6 +43,7 @@
 #include "RefCount.h"
 #include "CommRead.h"
 #include "Packer.h"
+#include "RemovalPolicy.h"
 
 #if ESI
 #include "ESIElement.h"
index 95353a9ba090a88bb9bcce35b56be911b9bbcbf0..2f5f9f1c023fae53773963b436510cdc28079c9a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: StoreIOState.h,v 1.9 2006/05/23 00:30:21 wessels Exp $
+ * $Id: StoreIOState.h,v 1.10 2006/08/21 00:50:41 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -34,6 +34,7 @@
 #ifndef SQUID_STOREIOSTATE_H
 #define SQUID_STOREIOSTATE_H
 
+#include "cbdata.h"
 #include "RefCount.h"
 
 class StoreIOState : public RefCountable
index b667806a4fca5562b1662bbc935d2a45a4d2318a..c864f258374b69da0e264361838a71eeb12a2bb0 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: SwapDir.h,v 1.10 2006/08/19 12:31:21 robertc Exp $
+ * $Id: SwapDir.h,v 1.11 2006/08/21 00:50:41 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -37,6 +37,9 @@
 #include "Store.h"
 #include "StoreIOState.h"
 
+/* forward decls */
+class RemovalPolicy;
+
 /* Store dir configuration routines */
 /* SwapDir *sd, char *path ( + char *opt later when the strtok mess is gone) */
 
index 0f492571a21cff8ddd54f758ec858af48245ce13..5bee2d37dd53ebb3c69ee5b817cb81a74bfa4185 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: acl_noncore.cc,v 1.2 2006/04/25 12:00:29 robertc Exp $
+ * $Id: acl_noncore.cc,v 1.3 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -42,6 +42,7 @@
 #include "ACL.h"
 #include "ACLChecklist.h"
 #include "ConfigParser.h"
+#include "errorpage.h"
 #include "HttpRequest.h"
 
 
index 6dff777b01b0fb20dff9ecb4173ff4fc8fa3d616..473424f329ed0af82b182e60a3680460dbd8d7d1 100644 (file)
@@ -9,6 +9,7 @@
 #include "AuthUser.h"
 #include "AuthUserRequest.h"
 #include "AuthConfig.h"
+#include "helper.h"
 
 #define DefaultAuthenticateChildrenMax  32     /* 32 processes */
 
index 4cd6d059db46581f007480b264bef1b7c82bf7ac..8891502ed7857c9f77c7dcc5eab014d89b00f476 100644 (file)
@@ -10,6 +10,8 @@
 #include "AuthUser.h"
 #include "AuthUserRequest.h"
 #include "AuthConfig.h"
+#include "helper.h"
+
 /* Generic */
 
 class DigestAuthenticateStateData
index e02ab1a82cbacc99facf2c991ea004535328b5c5..538608627fc30610cffe8f560646bb3456ef71db 100644 (file)
@@ -9,6 +9,7 @@
 #include "AuthUser.h"
 #include "AuthUserRequest.h"
 #include "AuthConfig.h"
+#include "helper.h"
 
 #define DefaultAuthenticateChildrenMax  32     /* 32 processes */
 
index 332cc5b04bdf718dc760359548f2490a159761d5..fde75ee6221b9d0a9c43b765d94b0c5da04b7c00 100644 (file)
@@ -9,6 +9,7 @@
 #include "AuthUser.h"
 #include "AuthUserRequest.h"
 #include "AuthConfig.h"
+#include "helper.h"
 
 #define DefaultAuthenticateChildrenMax  32     /* 32 processes */
 
index 6ca762ff15af9d688a5a1c9c0da0bebf79afec4c..37d734b23c15c0e5b0388dadab21ecbe4bdcc2ca 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_manager.cc,v 1.43 2006/05/29 00:15:01 robertc Exp $
+ * $Id: cache_manager.cc,v 1.44 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 16    Cache Manager Objects
  * AUTHOR: Duane Wessels
@@ -34,6 +34,7 @@
  */
 
 #include "CacheManager.h"
+#include "errorpage.h"
 #include "HttpReply.h"
 #include "HttpRequest.h"
 #include "Store.h"
index 91b7cc6a596d9e2d5852d41679e09af318a31f42..ea9ddd70de7eeb22804bdde074e88dfad1abe0c8 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cbdata.cc,v 1.71 2006/05/29 00:15:01 robertc Exp $
+ * $Id: cbdata.cc,v 1.72 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 45    Callback Data Registry
  * ORIGINAL AUTHOR: Duane Wessels
@@ -45,7 +45,7 @@
  * when finished.
  */
 
-#include "squid.h"
+#include "cbdata.h"
 #include "CacheManager.h"
 #include "Store.h"
 #if CBDATA_DEBUG
@@ -53,9 +53,6 @@
 #endif
 #include "Generic.h"
 
-/* XXX Remove me */
-#include "PeerSelectState.h"
-
 static int cbdataCount = 0;
 #if CBDATA_DEBUG
 dlink_list cbdataEntries;
@@ -186,16 +183,11 @@ static void
 cbdataInternalInitType(cbdata_type type, const char *name, int size, FREE * free_func)
 {
     char *label;
+    assert (type == cbdata_types + 1);
 
-    if (type >= cbdata_types) {
-        cbdata_index = (CBDataIndex *)xrealloc(cbdata_index, (type + 1) * sizeof(*cbdata_index));
-        memset(&cbdata_index[cbdata_types], 0,
-               (type + 1 - cbdata_types) * sizeof(*cbdata_index));
-        cbdata_types = type + 1;
-    }
-
-    if (cbdata_index[type].pool)
-        return;
+    cbdata_index = (CBDataIndex *)xrealloc(cbdata_index, (type + 1) * sizeof(*cbdata_index));
+    memset(&cbdata_index[type], 0, sizeof(*cbdata_index));
+    cbdata_types = type;
 
     label = (char *)xmalloc(strlen(name) + 20);
 
@@ -214,34 +206,13 @@ cbdataInternalAddType(cbdata_type type, const char *name, int size, FREE * free_
     if (type)
         return type;
 
-    type = (cbdata_type)cbdata_types;
+    type = (cbdata_type)(cbdata_types + 1);
 
     cbdataInternalInitType(type, name, size, free_func);
 
     return type;
 }
 
-void
-cbdataInit(void)
-{
-    debug(45, 3) ("cbdataInit\n");
-#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
-     * most of these should be moved out to their respective module.
-     */
-    CREATE_CBDATA(ErrorState);
-    CREATE_CBDATA(generic_cbdata);
-    CREATE_CBDATA(helper);
-    CREATE_CBDATA(helper_server);
-    CREATE_CBDATA(statefulhelper);
-    CREATE_CBDATA(helper_stateful_server);
-    CREATE_CBDATA(ps_state);
-    CREATE_CBDATA(RemovalPolicy);
-    CREATE_CBDATA(RemovalPolicyWalker);
-    CREATE_CBDATA(RemovalPurgeWalker);
-}
-
 void
 cbdataRegisterWithCacheManager(CacheManager & manager)
 {
@@ -264,9 +235,11 @@ cbdataInternalAlloc(cbdata_type type)
 #endif
 {
     cbdata *p;
-    assert(type > 0 && type < cbdata_types);
+    assert(type > 0 && type <= cbdata_types);
+    /* placement new: the pool alloc gives us cbdata + user type memory space
+     * and we init it with cbdata at the start of it
+     */
     p = new (cbdata_index[type].pool->alloc()) cbdata;
-    //    p = (cbdata *)cbdata_index[type].pool->alloc();
 
     p->type = type;
     p->valid = 1;
@@ -337,6 +310,7 @@ cbdataInternalFree(void *p)
      * we could use the normal delete operator
      * and it would Just Work. RBC 20030902
      */
+    assert ( cbdata_index[theType].pool );
     cbdata_index[theType].pool->free(c);
     return NULL;
 }
@@ -535,6 +509,8 @@ cbdataDump(StoreEntry * sentry)
     storeAppendPrintf(sentry, "\nsee also \"Memory utilization\" for detailed per type statistics\n");
 }
 
+CBDATA_CLASS_INIT(generic_cbdata);
+
 #if CBDATA_DEBUG
 
 struct CBDataCallDumper : public unary_function<CBDataCall, void>
diff --git a/src/cbdata.h b/src/cbdata.h
new file mode 100644 (file)
index 0000000..1d6ab14
--- /dev/null
@@ -0,0 +1,139 @@
+
+/*
+ * $Id: cbdata.h,v 1.1 2006/08/21 00:50:41 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.
+ *
+ * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
+ */
+
+#ifndef   SQUID_CBDATA_H
+#define   SQUID_CBDATA_H
+
+#include "squid.h"
+
+/*
+ * cbdata types. similar to the MEM_* types above, but managed
+ * in cbdata.c. A big difference is that these types are dynamically
+ * allocated. This list is only a list of predefined types. Other types
+ * are added runtime
+ */
+typedef enum {
+    CBDATA_UNKNOWN = 0,
+} cbdata_type;
+
+extern void cbdataRegisterWithCacheManager(CacheManager & manager);
+#if CBDATA_DEBUG
+extern void *cbdataInternalAllocDbg(cbdata_type type, const char *, int);
+extern void *cbdataInternalFreeDbg(void *p, const char *, int);
+extern void cbdataInternalLockDbg(const void *p, const char *, int);
+extern void cbdataInternalUnlockDbg(const void *p, const char *, int);
+extern int cbdataInternalReferenceDoneValidDbg(void **p, void **tp, const char *, int);
+#else
+extern void *cbdataInternalAlloc(cbdata_type type);
+extern void *cbdataInternalFree(void *p);
+extern void cbdataInternalLock(const void *p);
+extern void cbdataInternalUnlock(const void *p);
+extern int cbdataInternalReferenceDoneValid(void **p, void **tp);
+#endif
+extern int cbdataReferenceValid(const void *p);
+extern cbdata_type cbdataInternalAddType(cbdata_type type, const char *label, int size, FREE * free_func);
+
+
+/* cbdata macros */
+#if CBDATA_DEBUG
+#define cbdataAlloc(type)      ((type *)cbdataInternalAllocDbg(CBDATA_##type,__FILE__,__LINE__))
+#define cbdataFree(var)                do {if (var) {cbdataInternalFreeDbg(var,__FILE__,__LINE__); var = NULL;}} while(0)
+#define cbdataInternalLock(a)          cbdataInternalLockDbg(a,__FILE__,__LINE__)
+#define cbdataInternalUnlock(a)                cbdataInternalUnlockDbg(a,__FILE__,__LINE__)
+#define cbdataReferenceValidDone(var, ptr) cbdataInternalReferenceDoneValidDbg((void **)&(var), (ptr), __FILE__,__LINE__)
+#define CBDATA_CLASS2(type)    \
+       static cbdata_type CBDATA_##type; \
+       public: \
+               void *operator new(size_t size) { \
+                 assert(size == sizeof(type)); \
+                 (CBDATA_##type ?  CBDATA_UNKNOWN : (CBDATA_##type = cbdataInternalAddType(CBDATA_##type, #type, sizeof(type), NULL))); \
+                 return cbdataInternalAllocDbg(CBDATA_##type,__FILE__,__LINE__); \
+               } \
+               void operator delete (void *address) { \
+                 if (address) cbdataInternalFreeDbg(address,__FILE__,__LINE__); \
+               } \
+       private:
+#else
+#define cbdataAlloc(type) ((type *)cbdataInternalAlloc(CBDATA_##type))
+#define cbdataFree(var)                do {if (var) {cbdataInternalFree(var); var = NULL;}} while(0)
+#define cbdataReferenceValidDone(var, ptr) cbdataInternalReferenceDoneValid((void **)&(var), (ptr))
+#define CBDATA_CLASS2(type)    \
+       static cbdata_type CBDATA_##type; \
+       public: \
+               void *operator new(size_t size) { \
+                 assert(size == sizeof(type)); \
+                 (CBDATA_##type ?  CBDATA_UNKNOWN : (CBDATA_##type = cbdataInternalAddType(CBDATA_##type, #type, sizeof(type), NULL))); \
+                 return (type *)cbdataInternalAlloc(CBDATA_##type); \
+               } \
+               void operator delete (void *address) { \
+                 if (address) cbdataInternalFree(address);\
+               } \
+       private:
+#endif
+#define cbdataReference(var)   (cbdataInternalLock(var), var)
+#define cbdataReferenceDone(var) do {if (var) {cbdataInternalUnlock(var); var = NULL;}} while(0)
+#define CBDATA_CLASS(type)     static cbdata_type CBDATA_##type
+#define CBDATA_CLASS_INIT(type) cbdata_type type::CBDATA_##type = CBDATA_UNKNOWN
+#define CBDATA_TYPE(type)      static cbdata_type CBDATA_##type = CBDATA_UNKNOWN
+#define CBDATA_GLOBAL_TYPE(type)       cbdata_type CBDATA_##type
+#define CBDATA_INIT_TYPE(type) (CBDATA_##type ?  CBDATA_UNKNOWN : (CBDATA_##type = cbdataInternalAddType(CBDATA_##type, #type, sizeof(type), NULL)))
+#define CBDATA_INIT_TYPE_FREECB(type, free_func)       (CBDATA_##type ?  CBDATA_UNKNOWN : (CBDATA_##type = cbdataInternalAddType(CBDATA_##type, #type, sizeof(type), free_func)))
+
+/*
+ * use this when you need to pass callback data to a blocking
+ * operation, but you don't want to/cannot have that pointer be cbdata itself.
+ */
+
+class generic_cbdata
+{
+  public:
+    generic_cbdata(void * data) : data(data) {}
+    template<typename wrapped_type>void unwrap(wrapped_type **output) 
+      {
+       *output = static_cast<wrapped_type *>(data);
+       delete this;
+      }
+    /* the wrapped data - only public to allow the mild abuse of this facility
+     * done by store_swapout - it gives a wrapped StoreEntry to StoreIO as the
+     * object to be given to the callbacks. That needs to be fully cleaned up!
+     * - RBC 20060820
+     */
+    void *data; /* the wrapped data */
+  private:
+    CBDATA_CLASS2(generic_cbdata);
+};
+
+
+
+#endif /* SQUID_CBDATA_H */
index be8673133fc92e09e15c0e93dd006a4ec1c77410..78a2be24b2708d80b5dbb706d51aef256cbf3c02 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side_reply.cc,v 1.110 2006/07/02 10:02:04 serassio Exp $
+ * $Id: client_side_reply.cc,v 1.111 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 88    Client-side Reply Routines
  * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
@@ -35,6 +35,7 @@
 
 #include "squid.h"
 #include "client_side_reply.h"
+#include "errorpage.h"
 #include "StoreClient.h"
 #include "Store.h"
 #include "HttpReply.h"
index daf3d206dc65f4fae8ae75429b967cc989cfdb93..794068aba2b213f1890a754cd1380e7c3718df88 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side_reply.h,v 1.14 2006/06/07 22:39:34 hno Exp $
+ * $Id: client_side_reply.h,v 1.15 2006/08/21 00:50:41 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -41,6 +41,9 @@
 #include "StoreClient.h"
 #include "client_side_request.h"
 
+
+class ErrorState;
+
 /* XXX make static method */
 
 class clientReplyContext : public RefCountable, public StoreClient
index 015b4c33f6e541660f9dbdf8af3794822cdd7afe..1631f39d1fa13b1de4b2ff2df4f24f8450b56209 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: defines.h,v 1.120 2006/08/20 09:50:05 serassio Exp $
+ * $Id: defines.h,v 1.121 2006/08/21 00:50:41 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
 #endif
 #endif
 
-/* cbdata macros */
-#if CBDATA_DEBUG
-#define cbdataAlloc(type)      ((type *)cbdataInternalAllocDbg(CBDATA_##type,__FILE__,__LINE__))
-#define cbdataFree(var)                do {if (var) {cbdataInternalFreeDbg(var,__FILE__,__LINE__); var = NULL;}} while(0)
-#define cbdataInternalLock(a)          cbdataInternalLockDbg(a,__FILE__,__LINE__)
-#define cbdataInternalUnlock(a)                cbdataInternalUnlockDbg(a,__FILE__,__LINE__)
-#define cbdataReferenceValidDone(var, ptr) cbdataInternalReferenceDoneValidDbg((void **)&(var), (ptr), __FILE__,__LINE__)
-#define CBDATA_CLASS2(type)    \
-       static cbdata_type CBDATA_##type; \
-       public: \
-               void *operator new(size_t size) { \
-                 assert(size == sizeof(type)); \
-                 (CBDATA_##type ?  CBDATA_UNKNOWN : (CBDATA_##type = cbdataInternalAddType(CBDATA_##type, #type, sizeof(type), NULL))); \
-                 return cbdataInternalAllocDbg(CBDATA_##type,__FILE__,__LINE__); \
-               } \
-               void operator delete (void *address) { \
-                 if (address) cbdataInternalFreeDbg(address,__FILE__,__LINE__); \
-               } \
-       private:
-#else
-#define cbdataAlloc(type) ((type *)cbdataInternalAlloc(CBDATA_##type))
-#define cbdataFree(var)                do {if (var) {cbdataInternalFree(var); var = NULL;}} while(0)
-#define cbdataReferenceValidDone(var, ptr) cbdataInternalReferenceDoneValid((void **)&(var), (ptr))
-#define CBDATA_CLASS2(type)    \
-       static cbdata_type CBDATA_##type; \
-       public: \
-               void *operator new(size_t size) { \
-                 assert(size == sizeof(type)); \
-                 (CBDATA_##type ?  CBDATA_UNKNOWN : (CBDATA_##type = cbdataInternalAddType(CBDATA_##type, #type, sizeof(type), NULL))); \
-                 return (type *)cbdataInternalAlloc(CBDATA_##type); \
-               } \
-               void operator delete (void *address) { \
-                 if (address) cbdataInternalFree(address);\
-               } \
-       private:
-#endif
-#define cbdataReference(var)   (cbdataInternalLock(var), var)
-#define cbdataReferenceDone(var) do {if (var) {cbdataInternalUnlock(var); var = NULL;}} while(0)
-#define CBDATA_CLASS(type)     static cbdata_type CBDATA_##type
-#define CBDATA_CLASS_INIT(type) cbdata_type type::CBDATA_##type = CBDATA_UNKNOWN
-#define CBDATA_TYPE(type)      static cbdata_type CBDATA_##type = CBDATA_UNKNOWN
-#define CBDATA_GLOBAL_TYPE(type)       cbdata_type CBDATA_##type
-#define CBDATA_INIT_TYPE(type) (CBDATA_##type ?  CBDATA_UNKNOWN : (CBDATA_##type = cbdataInternalAddType(CBDATA_##type, #type, sizeof(type), NULL)))
-#define CBDATA_INIT_TYPE_FREECB(type, free_func)       (CBDATA_##type ?  CBDATA_UNKNOWN : (CBDATA_##type = cbdataInternalAddType(CBDATA_##type, #type, sizeof(type), free_func)))
-
 #ifndef O_TEXT
 #define O_TEXT 0
 #endif
index a3c2eba08b7ab81093812d2ed7b136b143ff58d0..e052646e3e2f3b2bdd5c49915eb114b7645fdd59 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: enums.h,v 1.253 2006/08/07 02:28:22 robertc Exp $
+ * $Id: enums.h,v 1.254 2006/08/21 00:50:41 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -495,31 +495,6 @@ enum {
     NETDB_EX_HOPS
 };
 
-/*
- * cbdata types. similar to the MEM_* types above, but managed
- * in cbdata.c. A big difference is that these types are dynamically
- * allocated. This list is only a list of predefined types. Other types
- * are added runtime
- */
-typedef enum {
-    CBDATA_UNKNOWN = 0,
-    CBDATA_UNDEF = 0,
-    CBDATA_acl_access,
-    CBDATA_ConnStateData,
-    CBDATA_ErrorState,
-    CBDATA_FwdState,
-    CBDATA_generic_cbdata,
-    CBDATA_helper,
-    CBDATA_helper_server,
-    CBDATA_statefulhelper,
-    CBDATA_helper_stateful_server,
-    CBDATA_ps_state,
-    CBDATA_RemovalPolicy,
-    CBDATA_RemovalPolicyWalker,
-    CBDATA_RemovalPurgeWalker,
-    CBDATA_FIRST_CUSTOM_TYPE = 1000
-} cbdata_type;
-
 /*
  * Return codes from checkVary(request)
  */
index 60b45e2f3eb600b3557bcd7b65d719f30de5e999..5ec8a0a7221d137c87ca8b662c0a54930dcb55bd 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: errorpage.cc,v 1.214 2006/05/19 17:19:09 wessels Exp $
+ * $Id: errorpage.cc,v 1.215 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 4     Error Generation
  * AUTHOR: Duane Wessels
@@ -40,7 +40,7 @@
  *              Config.errorDirectory)
  */
 
-#include "squid.h"
+#include "errorpage.h"
 #include "AuthUserRequest.h"
 #include "SquidTime.h"
 #include "Store.h"
@@ -52,6 +52,8 @@
 #include "URLScheme.h"
 #include "wordlist.h"
 
+CBDATA_CLASS_INIT(ErrorState);
+
 /* local types */
 
 typedef struct
@@ -322,8 +324,7 @@ errorPageName(int pageId)
 ErrorState *
 errorCon(err_type type, http_status status)
 {
-    ErrorState *err;
-    err = cbdataAlloc(ErrorState);
+    ErrorState *err = new ErrorState;
     err->page_id = type;       /* has to be reset manually if needed */
     err->type = type;
     err->httpStatus = status;
diff --git a/src/errorpage.h b/src/errorpage.h
new file mode 100644 (file)
index 0000000..6ec68f5
--- /dev/null
@@ -0,0 +1,93 @@
+
+/*
+ * $Id: errorpage.h,v 1.1 2006/08/21 00:50:41 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.
+ *
+ * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
+ */
+
+#ifndef   SQUID_ERRORPAGE_H
+#define   SQUID_ERRORPAGE_H
+
+#include "squid.h"
+#include "cbdata.h"
+
+class ErrorState
+{
+  public:
+    err_type type;
+    int page_id;
+    http_status httpStatus;
+    auth_user_request_t *auth_user_request;
+    HttpRequest *request;
+    char *url;
+    int xerrno;
+    u_short port;
+    char *dnsserver_msg;
+    time_t ttl;
+
+    struct IN_ADDR src_addr;
+    char *redirect_url;
+    ERCB *callback;
+    void *callback_data;
+
+    struct
+    {
+
+unsigned int flag_cbdata:
+        1;
+    }
+
+    flags;
+
+    struct
+    {
+        wordlist *server_msg;
+        char *request;
+        char *reply;
+    }
+
+    ftp;
+    char *request_hdrs;
+    char *err_msg; /* Preformatted error message from the cache */
+  private:
+    CBDATA_CLASS2(ErrorState);
+};
+
+SQUIDCEXTERN void errorInitialize(void);
+SQUIDCEXTERN void errorClean(void);
+SQUIDCEXTERN HttpReply *errorBuildReply(ErrorState * err);
+SQUIDCEXTERN void errorSend(int fd, ErrorState *);
+SQUIDCEXTERN void errorAppendEntry(StoreEntry *, ErrorState *);
+SQUIDCEXTERN void errorStateFree(ErrorState * err);
+SQUIDCEXTERN err_type errorReservePageId(const char *page_name);
+SQUIDCEXTERN ErrorState *errorCon(err_type type, http_status);
+
+
+#endif /* SQUID_ERRORPAGE_H */
index 74ee38322f631e6289839c9e7b3319790ecedd36..d6fccd769456e03fff1a59c854633d8522fdee35 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: event.cc,v 1.42 2006/08/12 01:43:11 robertc Exp $
+ * $Id: event.cc,v 1.43 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 41    Event Processing
  * AUTHOR: Henrik Nordstrom
@@ -183,7 +183,7 @@ int
 EventScheduler::checkDelay()
 {
     if (!tasks)
-        return (int) 10;
+        return EVENT_IDLE;
 
     int result = (int) ((tasks->when - current_dtime) * 1000);
 
index 76e289bf15c91d697e378f36b8ee1ff9cf707860..45124d3c13a20579355e8c8708eb528d49a482c2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: external_acl.cc,v 1.73 2006/05/29 00:15:02 robertc Exp $
+ * $Id: external_acl.cc,v 1.74 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 82    External ACL
  * AUTHOR: Henrik Nordstrom, MARA Systems AB
@@ -56,6 +56,7 @@
 #include "client_side.h"
 #include "HttpRequest.h"
 #include "authenticate.h"
+#include "helper.h"
 #include "MemBuf.h"
 #include "URLScheme.h"
 #include "wordlist.h"
index fac0684f6dcd07234f4a5bb3fda8b21450db75bc..da946a40eec23a5da38786c2fc0c962a48bd950e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: forward.cc,v 1.147 2006/08/07 02:28:22 robertc Exp $
+ * $Id: forward.cc,v 1.148 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 17    Request Forwarding
  * AUTHOR: Duane Wessels
 
 
 #include "squid.h"
-#include "event.h"
-#include "CacheManager.h"
 #include "forward.h"
-#include "SquidTime.h"
-#include "Store.h"
-#include "HttpRequest.h"
-#include "fde.h"
-#include "MemObject.h"
 #include "ACLChecklist.h"
 #include "ACL.h"
+#include "CacheManager.h"
+#include "event.h"
+#include "errorpage.h"
+#include "fde.h"
 #include "HttpReply.h"
+#include "HttpRequest.h"
+#include "MemObject.h"
 #include "pconn.h"
+#include "SquidTime.h"
+#include "Store.h"
 
 static PSC fwdStartCompleteWrapper;
 static PF fwdServerClosedWrapper;
index 9cf06cc65d180071d952af0c942c12b4b0089c51..9c2f416fbb58861c50c4033cdc62c4012e3c4d8b 100644 (file)
@@ -4,6 +4,7 @@
 /* forward decls */
 
 class CacheManager;
+class ErrorState;
 
 #include "comm.h"
 
index 19862cf89e0631146601d174b4cf3c8e9ccd2d7a..617ddff14a268a081992f7028b9caefd1d1ef479 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: fqdncache.cc,v 1.169 2006/08/07 02:28:22 robertc Exp $
+ * $Id: fqdncache.cc,v 1.170 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 35    FQDN Cache
  * AUTHOR: Harvest Derived
@@ -34,6 +34,7 @@
  */
 
 #include "squid.h"
+#include "cbdata.h"
 #include "event.h"
 #include "CacheManager.h"
 #include "SquidTime.h"
@@ -411,6 +412,7 @@ fqdncacheParse(fqdncache_entry *f, rfc1035_rr * answers, int nr, const char *err
 
 #endif
 
+
 static void
 #if USE_DNSSERVERS
 fqdncacheHandleReply(void *data, char *reply)
@@ -419,10 +421,8 @@ fqdncacheHandleReply(void *data, rfc1035_rr * answers, int na, const char *error
 #endif
 {
     int n;
-    generic_cbdata *c = (generic_cbdata *)data;
-    fqdncache_entry *f = (fqdncache_entry *)c->data;
-    cbdataFree(c);
-    c = NULL;
+    fqdncache_entry *f;
+    static_cast<generic_cbdata *>(data)->unwrap(&f);
     n = ++FqdncacheStats.replies;
     statHistCount(&statCounter.dns.svc_time,
                   tvSubMsec(f->request_time, current_time));
@@ -495,8 +495,7 @@ fqdncache_nbgethostbyaddr(struct IN_ADDR addr, FQDNH * handler, void *handlerDat
     f->handler = handler;
     f->handlerData = cbdataReference(handlerData);
     f->request_time = current_time;
-    c = cbdataAlloc(generic_cbdata);
-    c->data = f;
+    c = new generic_cbdata(f);
 #if USE_DNSSERVERS
 
     dnsSubmit(hashKeyStr(&f->hash), fqdncacheHandleReply, c);
index 5783c9f5586f64bfb04fa78d7c63d09d00e25457..1050b76d935384e3ce51c967660cf7ffdd9b51a1 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ftp.cc,v 1.399 2006/06/14 19:43:28 serassio Exp $
+ * $Id: ftp.cc,v 1.400 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -37,6 +37,7 @@
 #include "Store.h"
 #include "HttpRequest.h"
 #include "HttpReply.h"
+#include "errorpage.h"
 #include "fde.h"
 #include "comm.h"
 #include "HttpHeaderRange.h"
index 29b9ea8b7d990610bd00e7e6337801584b0f97c2..f8b0da85d2e0862f89996cc7e70d162e93e701fb 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: globals.h,v 1.137 2006/08/19 12:31:21 robertc Exp $
+ * $Id: globals.h,v 1.138 2006/08/21 00:50:41 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -144,10 +144,6 @@ extern "C"
     extern CacheDigest *store_digest;  /* NULL */
     extern const char *StoreDigestFileName;            /* "store_digest" */
     extern const char *StoreDigestMimeStr;     /* "application/cache-digest" */
-#if USE_CACHE_DIGESTS
-
-    extern const Version CacheDigestVer;       /* { 5, 3 } */
-#endif
 
     extern const char *MultipartMsgBoundaryStr;        /* "Unique-Squid-Separator" */
 #if HTTP_VIOLATIONS
@@ -161,7 +157,6 @@ extern "C"
     extern int store_swap_high;        /* 0 */
     extern size_t store_pages_max;     /* 0 */
     extern ssize_t store_maxobjsize;   /* -1 */
-    extern RemovalPolicy *mem_policy;
     extern hash_table *proxy_auth_username_cache;      /* NULL */
     extern int incoming_sockets_accepted;
 #ifdef _SQUID_MSWIN_
index b01789b60ddaf21d6800c955816e6d409ef86162..f35fcc3ca818d11e8acb9dd284393e9b14f8e7bd 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: gopher.cc,v 1.197 2006/05/19 17:19:09 wessels Exp $
+ * $Id: gopher.cc,v 1.198 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 10    Gopher
  * AUTHOR: Harvest Derived
@@ -34,6 +34,7 @@
  */
 
 #include "squid.h"
+#include "errorpage.h"
 #include "Store.h"
 #include "HttpRequest.h"
 #include "comm.h"
index b34e13fc9eb82d8b690236c8848b2c1c00894139..352c422b82993228549b38f73636c56797f7c681 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: helper.cc,v 1.74 2006/05/08 23:38:33 robertc Exp $
+ * $Id: helper.cc,v 1.75 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 84    Helper process maintenance
  * AUTHOR: Harvest Derived?
@@ -63,6 +63,11 @@ static helper_stateful_request *StatefulServerDequeue(helper_stateful_server * s
 static void StatefulServerEnqueue(helper_stateful_server * srv, helper_stateful_request * r);
 static void helperStatefulServerKickQueue(helper_stateful_server * srv);
 
+CBDATA_TYPE(helper);
+CBDATA_TYPE(helper_server);
+CBDATA_TYPE(statefulhelper);
+CBDATA_TYPE(helper_stateful_server);
+
 void
 helperOpenServers(helper * hlp)
 {
@@ -123,6 +128,7 @@ helperOpenServers(helper * hlp)
 
         hlp->n_running++;
         hlp->n_active++;
+       CBDATA_INIT_TYPE(helper_server);
         srv = cbdataAlloc(helper_server);
         srv->pid = x;
         srv->index = k;
@@ -221,6 +227,7 @@ helperStatefulOpenServers(statefulhelper * hlp)
 
         hlp->n_running++;
         hlp->n_active++;
+       CBDATA_INIT_TYPE(helper_stateful_server);
         srv = cbdataAlloc(helper_stateful_server);
         srv->pid = x;
         srv->flags.reserved = S_HELPER_FREE;
@@ -706,6 +713,7 @@ helper *
 helperCreate(const char *name)
 {
     helper *hlp;
+    CBDATA_INIT_TYPE(helper);
     hlp = cbdataAlloc(helper);
     hlp->id_name = name;
     return hlp;
@@ -715,6 +723,7 @@ statefulhelper *
 helperStatefulCreate(const char *name)
 {
     statefulhelper *hlp;
+    CBDATA_INIT_TYPE(statefulhelper);
     hlp = cbdataAlloc(statefulhelper);
     hlp->id_name = name;
     return hlp;
index 8c28682f05441b4b207ac9238fea036274717e62..0bdb5d92220db5a3f4428284c7936e808570ef1a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: helper.h,v 1.3 2004/08/30 05:12:31 robertc Exp $
+ * $Id: helper.h,v 1.4 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 84    Helper process maintenance
  * AUTHOR: Harvest Derived?
 #define SQUID_HELPER_H
 
 #include "squid.h"
+#include "cbdata.h"
+
+class helper_request;
+
+typedef struct _helper helper;
+
+typedef struct _helper_stateful statefulhelper;
+
+typedef struct _helper_server helper_server;
+
+typedef struct _helper_stateful_server helper_stateful_server;
+
+typedef struct _helper_flags helper_flags;
+
+typedef struct _helper_stateful_flags helper_stateful_flags;
+
+typedef stateful_helper_callback_t HLPSCB(void *, void *lastserver, char *buf);
+
+struct _helper
+{
+    wordlist *cmdline;
+    dlink_list servers;
+    dlink_list queue;
+    const char *id_name;
+    int n_to_start;
+    int n_running;
+    int n_active;
+    int ipc_type;
+    unsigned int concurrency;
+    time_t last_queue_warn;
+    time_t last_restart;
+
+    struct
+    {
+        int requests;
+        int replies;
+        int queue_size;
+        int avg_svc_time;
+    }
+
+    stats;
+};
+
+struct _helper_stateful
+{
+    wordlist *cmdline;
+    dlink_list servers;
+    dlink_list queue;
+    const char *id_name;
+    int n_to_start;
+    int n_running;
+    int n_active;
+    int ipc_type;
+    MemAllocatorProxy *datapool;
+    HLPSAVAIL *IsAvailable;
+    HLPSONEQ *OnEmptyQueue;
+    time_t last_queue_warn;
+    time_t last_restart;
+
+    struct
+    {
+        int requests;
+        int replies;
+        int queue_size;
+        int avg_svc_time;
+    }
+
+    stats;
+};
+
+struct _helper_server
+{
+    int index;
+    int pid;
+    int rfd;
+    int wfd;
+    MemBuf *wqueue;
+    MemBuf *writebuf;
+    char *rbuf;
+    size_t rbuf_sz;
+    off_t roffset;
+
+    struct timeval dispatch_time;
+
+    struct timeval answer_time;
+
+    dlink_node link;
+    helper *parent;
+    helper_request **requests;
+
+    struct _helper_flags
+    {
+
+unsigned int writing:
+        1;
+
+unsigned int closing:
+        1;
+
+unsigned int shutdown:
+        1;
+    }
+
+    flags;
+
+    struct
+    {
+        int uses;
+        unsigned int pending;
+    }
+
+    stats;
+};
+
+class helper_stateful_request;
+
+struct _helper_stateful_server
+{
+    int index;
+    int pid;
+    int rfd;
+    int wfd;
+    /* MemBuf wqueue; */
+    /* MemBuf writebuf; */
+    char *rbuf;
+    size_t rbuf_sz;
+    off_t roffset;
+
+    struct timeval dispatch_time;
+
+    struct timeval answer_time;
+
+    dlink_node link;
+    dlink_list queue;
+    statefulhelper *parent;
+    helper_stateful_request *request;
+
+    struct _helper_stateful_flags
+    {
+
+unsigned int busy:
+        1;
+
+unsigned int closing:
+        1;
+
+unsigned int shutdown:
+        1;
+        stateful_helper_reserve_t reserved;
+    }
+
+    flags;
+
+    struct
+    {
+        int uses;
+        int submits;
+        int releases;
+        int deferbyfunc;
+        int deferbycb;
+    }
+
+    stats;
+    int deferred_requests;     /* current number of deferred requests */
+    void *data;                        /* State data used by the calling routines */
+};
 
 class helper_request
 {
@@ -65,4 +231,24 @@ public:
 
 MEMPROXY_CLASS_INLINE(helper_stateful_request)
 
+/* helper.c */
+SQUIDCEXTERN void helperOpenServers(helper * hlp);
+SQUIDCEXTERN void helperStatefulOpenServers(statefulhelper * hlp);
+SQUIDCEXTERN void helperSubmit(helper * hlp, const char *buf, HLPCB * callback, void *data);
+SQUIDCEXTERN void helperStatefulSubmit(statefulhelper * hlp, const char *buf, HLPSCB * callback, void *data, helper_stateful_server * lastserver);
+SQUIDCEXTERN void helperStats(StoreEntry * sentry, helper * hlp);
+SQUIDCEXTERN void helperStatefulStats(StoreEntry * sentry, statefulhelper * hlp);
+SQUIDCEXTERN void helperShutdown(helper * hlp);
+SQUIDCEXTERN void helperStatefulShutdown(statefulhelper * hlp);
+SQUIDCEXTERN helper *helperCreate(const char *);
+SQUIDCEXTERN statefulhelper *helperStatefulCreate(const char *);
+SQUIDCEXTERN void helperFree(helper *);
+SQUIDCEXTERN void helperStatefulFree(statefulhelper *);
+SQUIDCEXTERN void helperStatefulReset(helper_stateful_server * srv);
+SQUIDCEXTERN void helperStatefulReleaseServer(helper_stateful_server * srv);
+SQUIDCEXTERN void *helperStatefulServerGetData(helper_stateful_server * srv);
+SQUIDCEXTERN helper_stateful_server *helperStatefulDefer(statefulhelper *);
+
+
+
 #endif /* SQUID_HELPER_H */
index a1cd3d831ce73ebcec085f9d0a5231e355938928..beb68e50ef9b72aea57b32dcdf21621529f6eacf 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.cc,v 1.503 2006/06/14 19:39:19 serassio Exp $
+ * $Id: http.cc,v 1.504 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -39,6 +39,7 @@
  */
 
 #include "squid.h"
+#include "errorpage.h"
 #include "MemBuf.h"
 #include "http.h"
 #include "AuthUserRequest.h"
index fbc0ce62d88e72aa702b56944ec52ce9086b8339..563cdfdbe29776e70621870ba4d4739166e3d3c3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: internal.cc,v 1.41 2006/05/12 19:06:10 serassio Exp $
+ * $Id: internal.cc,v 1.42 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 76    Internal Squid Object handling
  * AUTHOR: Duane, Alex, Henrik
@@ -34,6 +34,7 @@
  */
 
 #include "squid.h"
+#include "errorpage.h"
 #include "Store.h"
 #include "HttpRequest.h"
 #include "HttpReply.h"
index f337033939c354e2ef9a93bf37accba0f694d6d3..7f54344cc9af2f1c97bb0d289fba8e1855cf15cd 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ipcache.cc,v 1.257 2006/08/20 21:02:53 hno Exp $
+ * $Id: ipcache.cc,v 1.258 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 14    IP Cache
  * AUTHOR: Harvest Derived
@@ -34,6 +34,7 @@
  */
 
 #include "squid.h"
+#include "cbdata.h"
 #include "event.h"
 #include "CacheManager.h"
 #include "SquidTime.h"
@@ -473,10 +474,8 @@ ipcacheHandleReply(void *data, char *reply)
 ipcacheHandleReply(void *data, rfc1035_rr * answers, int na, const char *error_message)
 #endif
 {
-    generic_cbdata *c = (generic_cbdata *)data;
-    ipcache_entry *i = (ipcache_entry *)c->data;
-    cbdataFree(c);
-    c = NULL;
+    ipcache_entry *i;
+    static_cast<generic_cbdata *>(data)->unwrap(&i);
     IpcacheStats.replies++;
     statHistCount(&statCounter.dns.svc_time,
                   tvSubMsec(i->request_time, current_time));
@@ -548,8 +547,7 @@ ipcache_nbgethostbyname(const char *name, IPH * handler, void *handlerData)
     i->handler = handler;
     i->handlerData = cbdataReference(handlerData);
     i->request_time = current_time;
-    c = cbdataAlloc(generic_cbdata);
-    c->data = i;
+    c = new generic_cbdata(i);
 #if USE_DNSSERVERS
 
     dnsSubmit(hashKeyStr(&i->hash), ipcacheHandleReply, c);
index 77bd3c201cd6bed2a043ef7efacb6c2c9df3c8fb..23541fb6c66cee21cb351f90649cbeb865fc9603 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: main.cc,v 1.431 2006/08/20 09:50:05 serassio Exp $
+ * $Id: main.cc,v 1.432 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -38,6 +38,7 @@
 #include "authenticate.h"
 #include "CacheManager.h"
 #include "ConfigParser.h"
+#include "errorpage.h"
 #include "event.h"
 #include "EventLoop.h"
 #include "ExternalACL.h"
@@ -1206,8 +1207,6 @@ main(int argc, char **argv)
 
         Mem::Init();
 
-        cbdataInit();
-
         storeFsInit();         /* required for config parsing */
 
         /* May not be needed for parsing, have not audited for such */
index 4b90ec4979a9838d0b4547636541e4c3132aeb9b..77069f916fcdfb4e67c7940c6314a3e15c0ee322 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: neighbors.cc,v 1.339 2006/08/07 02:28:22 robertc Exp $
+ * $Id: neighbors.cc,v 1.340 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 15    Neighbor Routines
  * AUTHOR: Harvest Derived
  */
 
 #include "squid.h"
+#include "ACLChecklist.h"
 #include "event.h"
 #include "CacheManager.h"
-#include "Store.h"
-#include "ICP.h"
+#include "htcp.h"
 #include "HttpRequest.h"
+#include "ICP.h"
 #include "MemObject.h"
-#include "ACLChecklist.h"
-#include "htcp.h"
+#include "PeerDigest.h"
 #include "PeerSelectState.h"
 #include "SquidTime.h"
+#include "Store.h"
 
 /* count mcast group peers every 15 minutes */
 #define MCAST_COUNT_RATE 900
index 794febee33f63b19e001745699b2ae8757398967..45caeeb828eb4f3857bc67fc281190463eff2171 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: net_db.cc,v 1.190 2006/08/07 02:28:22 robertc Exp $
+ * $Id: net_db.cc,v 1.191 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 38    Network Measurement Database
  * AUTHOR: Duane Wessels
@@ -42,6 +42,7 @@
  */
 
 #include "squid.h"
+#include "cbdata.h"
 #include "event.h"
 #include "CacheManager.h"
 #include "Store.h"
@@ -280,12 +281,12 @@ netdbSendPing(const ipcache_addrs * ia, void *data)
 {
 
     struct IN_ADDR addr;
-    char *hostname = (char *)((generic_cbdata *) data)->data;
+    char *hostname;
+    static_cast<generic_cbdata *>(data)->unwrap(&hostname);
     netdbEntry *n;
     netdbEntry *na;
     net_db_name *x;
     net_db_name **X;
-    cbdataFree(data);
 
     if (ia == NULL) {
         xfree(hostname);
@@ -922,17 +923,13 @@ netdbPingSite(const char *hostname)
 {
 #if USE_ICMP
     netdbEntry *n;
-    generic_cbdata *h;
 
     if ((n = netdbLookupHost(hostname)) != NULL)
         if (n->next_ping_time > squid_curtime)
             return;
 
-    h = cbdataAlloc(generic_cbdata);
-
-    h->data = xstrdup(hostname);
-
-    ipcache_nbgethostbyname(hostname, netdbSendPing, h);
+    ipcache_nbgethostbyname(hostname, netdbSendPing,
+                           new generic_cbdata(xstrdup(hostname)));
 
 #endif
 }
index 184694222bfef32cf81660c4b6d8c48e9df3e223..c31ad5fe18d013affbaaf8a3280af1025a1481ae 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: peer_digest.cc,v 1.117 2006/08/07 02:28:22 robertc Exp $
+ * $Id: peer_digest.cc,v 1.118 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 72    Peer Digest Routines
  * AUTHOR: Alex Rousskov
 #if USE_CACHE_DIGESTS
 
 #include "event.h"
+#include "forward.h"
 #include "Store.h"
 #include "HttpRequest.h"
 #include "HttpReply.h"
 #include "MemObject.h"
+#include "PeerDigest.h"
 #include "SquidTime.h"
 #include "StoreClient.h"
-#include "forward.h"
 
 /* local types */
 
@@ -71,6 +72,7 @@ static int peerDigestUseful(const PeerDigest * pd);
 
 
 /* local constants */
+Version const CacheDigestVer = { 5, 3 };
 
 #define StoreDigestCBlockSize sizeof(StoreDigestCBlock)
 
index 3bd17444bbe150c0d344695dea58915b86fb7188..463b2b8543d176909cca35aea19ab4406b8f36fc 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: peer_select.cc,v 1.141 2006/08/07 02:28:22 robertc Exp $
+ * $Id: peer_select.cc,v 1.142 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 44    Peer Selection Algorithm
  * AUTHOR: Duane Wessels
@@ -103,6 +103,8 @@ static void peerGetSomeParent(ps_state *);
 static void peerGetAllParents(ps_state *);
 static void peerAddFwdServer(FwdServer **, peer *, hier_code);
 
+CBDATA_CLASS_INIT(ps_state);
+
 static void
 peerSelectStateFree(ps_state * psstate)
 {
@@ -791,6 +793,7 @@ peerAddFwdServer(FwdServer ** FSVR, peer * p, hier_code code)
 void *
 ps_state::operator new(size_t)
 {
+    CBDATA_INIT_TYPE(ps_state);
     return cbdataAlloc(ps_state);
 }
 
index 2f61364ec21c4183002f7b26705b1134e3b0702c..0a3ff3f5413a1b593f3fb2ccce1118c9b9018853 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: protos.h,v 1.535 2006/08/07 02:28:22 robertc Exp $
+ * $Id: protos.h,v 1.536 2006/08/21 00:50:41 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -78,27 +78,6 @@ SQUIDCEXTERN void parse_time_t(time_t * var);
 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);
-SQUIDCEXTERN void cbdataInternalLockDbg(const void *p, const char *, int);
-SQUIDCEXTERN void cbdataInternalUnlockDbg(const void *p, const char *, int);
-SQUIDCEXTERN int cbdataInternalReferenceDoneValidDbg(void **p, void **tp, const char *, int);
-#else
-SQUIDCEXTERN void *cbdataInternalAlloc(cbdata_type type);
-SQUIDCEXTERN void *cbdataInternalFree(void *p);
-SQUIDCEXTERN void cbdataInternalLock(const void *p);
-SQUIDCEXTERN void cbdataInternalUnlock(const void *p);
-SQUIDCEXTERN int cbdataInternalReferenceDoneValid(void **p, void **tp);
-#endif
-SQUIDCEXTERN int cbdataReferenceValid(const void *p);
-SQUIDCEXTERN cbdata_type cbdataInternalAddType(cbdata_type type, const char *label, int size, FREE * free_func);
-
 /* client_side.c - FD related client side routines */
 
 SQUIDCEXTERN void clientdbInit(void);
@@ -675,15 +654,6 @@ SQUIDCEXTERN void logReferer(const char *, const char *, const char *);
 SQUIDCEXTERN void refererCloseLog(void);
 SQUIDCEXTERN peer_t parseNeighborType(const char *s);
 
-SQUIDCEXTERN void errorInitialize(void);
-SQUIDCEXTERN void errorClean(void);
-SQUIDCEXTERN HttpReply *errorBuildReply(ErrorState * err);
-SQUIDCEXTERN void errorSend(int fd, ErrorState *);
-SQUIDCEXTERN void errorAppendEntry(StoreEntry *, ErrorState *);
-SQUIDCEXTERN void errorStateFree(ErrorState * err);
-SQUIDCEXTERN err_type errorReservePageId(const char *page_name);
-SQUIDCEXTERN ErrorState *errorCon(err_type type, http_status);
-
 /* tools.c */
 SQUIDCEXTERN void dlinkAdd(void *data, dlink_node *, dlink_list *);
 SQUIDCEXTERN void dlinkAddAfter(void *, dlink_node *, dlink_node *, dlink_list *);
@@ -746,25 +716,6 @@ extern void carpRegisterWithCacheManager(CacheManager & manager);
 SQUIDCEXTERN peer *carpSelectParent(HttpRequest *);
 #endif
 
-/* helper.c */
-SQUIDCEXTERN void helperOpenServers(helper * hlp);
-SQUIDCEXTERN void helperStatefulOpenServers(statefulhelper * hlp);
-SQUIDCEXTERN void helperSubmit(helper * hlp, const char *buf, HLPCB * callback, void *data);
-SQUIDCEXTERN void helperStatefulSubmit(statefulhelper * hlp, const char *buf, HLPSCB * callback, void *data, helper_stateful_server * lastserver);
-SQUIDCEXTERN void helperStats(StoreEntry * sentry, helper * hlp);
-SQUIDCEXTERN void helperStatefulStats(StoreEntry * sentry, statefulhelper * hlp);
-SQUIDCEXTERN void helperShutdown(helper * hlp);
-SQUIDCEXTERN void helperStatefulShutdown(statefulhelper * hlp);
-SQUIDCEXTERN helper *helperCreate(const char *);
-SQUIDCEXTERN statefulhelper *helperStatefulCreate(const char *);
-SQUIDCEXTERN void helperFree(helper *);
-SQUIDCEXTERN void helperStatefulFree(statefulhelper *);
-SQUIDCEXTERN void helperStatefulReset(helper_stateful_server * srv);
-SQUIDCEXTERN void helperStatefulReleaseServer(helper_stateful_server * srv);
-SQUIDCEXTERN void *helperStatefulServerGetData(helper_stateful_server * srv);
-SQUIDCEXTERN helper_stateful_server *helperStatefulDefer(statefulhelper *);
-
-
 
 #if USE_LEAKFINDER
 SQUIDCEXTERN void leakInit(void);
@@ -786,11 +737,6 @@ logfilePrintf(Logfile * lf, const char *fmt,...) PRINTF_FORMAT_ARG2;
 SQUIDCEXTERN void logfilePrintf(va_alist);
 #endif
 
-/*
- * Removal Policies
- */
-SQUIDCEXTERN RemovalPolicy *createRemovalPolicy(RemovalPolicySettings * settings);
-
 /*
  * prototypes for system functions missing from system includes
  */
index e3398de9eaf17adfe183480e54fd3bd70669dad5..5c2d6f495c22b08ab7a6aab9189eacf8e713ce83 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: redirect.cc,v 1.114 2006/07/08 16:38:47 serassio Exp $
+ * $Id: redirect.cc,v 1.115 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 61    Redirector
  * AUTHOR: Duane Wessels
@@ -42,6 +42,7 @@
 #include "ACLChecklist.h"
 #include "HttpRequest.h"
 #include "client_side.h"
+#include "helper.h"
 
 typedef struct
 {
index 40a452a6117dc07a44bb49c147f853791fb053f4..5e8351bca2b137b331ad6481f0bff543e900cc08 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_repl_heap.cc,v 1.20 2006/05/19 17:19:10 wessels Exp $
+ * $Id: store_repl_heap.cc,v 1.21 2006/08/21 00:50:47 robertc Exp $
  *
  * DEBUG: section ?     HEAP based removal policies
  * AUTHOR: Henrik Nordstrom
@@ -184,7 +184,7 @@ heap_walkDone(RemovalPolicyWalker * walker)
     assert(heap->nwalkers > 0);
     heap->nwalkers -= 1;
     safe_free(walker->_data);
-    cbdataFree(walker);
+    delete walker;
 }
 
 static RemovalPolicyWalker *
@@ -194,7 +194,7 @@ heap_walkInit(RemovalPolicy * policy)
     RemovalPolicyWalker *walker;
     HeapWalkData *heap_walk;
     heap->nwalkers += 1;
-    walker = cbdataAlloc(RemovalPolicyWalker);
+    walker = new RemovalPolicyWalker;
     heap_walk = (HeapWalkData *)xcalloc(1, sizeof(*heap_walk));
     heap_walk->current = 0;
     walker->_policy = policy;
@@ -274,7 +274,7 @@ heap_purgeDone(RemovalPurgeWalker * walker)
     }
 
     safe_free(walker->_data);
-    cbdataFree(walker);
+    delete walker;
 }
 
 static RemovalPurgeWalker *
@@ -284,7 +284,7 @@ heap_purgeInit(RemovalPolicy * policy, int max_scan)
     RemovalPurgeWalker *walker;
     HeapPurgeData *heap_walk;
     heap->nwalkers += 1;
-    walker = cbdataAlloc(RemovalPurgeWalker);
+    walker = new RemovalPurgeWalker;
     heap_walk = (HeapPurgeData *)xcalloc(1, sizeof(*heap_walk));
     heap_walk->min_age = 0.0;
     heap_walk->locked_entries = NULL;
@@ -307,7 +307,7 @@ heap_free(RemovalPolicy * policy)
     /* Ok, time to destroy this policy */
     safe_free(heap);
     memset(policy, 0, sizeof(*policy));
-    cbdataFree(policy);
+    delete policy;
 }
 
 RemovalPolicy *
@@ -317,7 +317,7 @@ createRemovalPolicy_heap(wordlist * args)
     HeapPolicyData *heap_data;
     const char *keytype;
     /* Allocate the needed structures */
-    policy = cbdataAlloc(RemovalPolicy);
+    policy = new RemovalPolicy;
     heap_data = (HeapPolicyData *)xcalloc(1, sizeof(*heap_data));
     /* Initialize the policy data */
     heap_data->policy = policy;
index 22208d865aea79bcbab44b090daf5626334bc9c9..61f1b1842129ad638e66f55bb577145fe25a1ea9 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_repl_lru.cc,v 1.17 2006/05/08 23:38:35 robertc Exp $
+ * $Id: store_repl_lru.cc,v 1.18 2006/08/21 00:50:47 robertc Exp $
  *
  * DEBUG: section ?     LRU Removal policy
  * AUTHOR: Henrik Nordstrom
@@ -189,7 +189,7 @@ lru_walkDone(RemovalPolicyWalker * walker)
     assert(lru->nwalkers > 0);
     lru->nwalkers -= 1;
     safe_free(walker->_data);
-    cbdataFree(walker);
+    delete walker;
 }
 
 static RemovalPolicyWalker *
@@ -199,7 +199,7 @@ lru_walkInit(RemovalPolicy * policy)
     RemovalPolicyWalker *walker;
     LruWalkData *lru_walk;
     lru->nwalkers += 1;
-    walker = cbdataAlloc(RemovalPolicyWalker);
+    walker = new RemovalPolicyWalker;
     lru_walk = (LruWalkData *)xcalloc(1, sizeof(*lru_walk));
     walker->_policy = policy;
     walker->_data = lru_walk;
@@ -268,7 +268,7 @@ lru_purgeDone(RemovalPurgeWalker * walker)
     assert(lru->nwalkers > 0);
     lru->nwalkers -= 1;
     safe_free(walker->_data);
-    cbdataFree(walker);
+    delete walker;
 }
 
 static RemovalPurgeWalker *
@@ -278,7 +278,7 @@ lru_purgeInit(RemovalPolicy * policy, int max_scan)
     RemovalPurgeWalker *walker;
     LruPurgeData *lru_walk;
     lru->nwalkers += 1;
-    walker = cbdataAlloc(RemovalPurgeWalker);
+    walker = new RemovalPurgeWalker;
     lru_walk = (LruPurgeData *)xcalloc(1, sizeof(*lru_walk));
     walker->_policy = policy;
     walker->_data = lru_walk;
@@ -320,7 +320,7 @@ lru_free(RemovalPolicy * policy)
     /* Ok, time to destroy this policy */
     safe_free(lru);
     memset(policy, 0, sizeof(*policy));
-    cbdataFree(policy);
+    delete policy;
 }
 
 RemovalPolicy *
@@ -341,7 +341,7 @@ createRemovalPolicy_lru(wordlist * args)
     /* Allocate the needed structures */
     lru_data = (LruPolicyData *)xcalloc(1, sizeof(*lru_data));
 
-    policy = cbdataAlloc(RemovalPolicy);
+    policy = new RemovalPolicy;
 
     /* Initialize the URL data */
     lru_data->policy = policy;
index f2a78854211848f2704a0762547a4e15371f438a..7be9ce8fb92212b9d9cee002978d4379166a5ac3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_digest.cc,v 1.69 2006/08/07 02:28:22 robertc Exp $
+ * $Id: store_digest.cc,v 1.70 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 71    Store Digest Manager
  * AUTHOR: Alex Rousskov
@@ -49,6 +49,7 @@
 #include "HttpRequest.h"
 #include "HttpReply.h"
 #include "MemObject.h"
+#include "PeerDigest.h"
 #include "SquidTime.h"
 #include "StoreSearch.h"
 
@@ -62,7 +63,7 @@ class StoreDigestState
 public:
     StoreDigestCBlock cblock;
     int rebuild_lock;          /* bucket number */
-    generic_cbdata *rewrite_lock;      /* points to store entry with the digest */
+    StoreEntry * rewrite_lock; /* points to store entry with the digest */
     StoreSearchPointer theSearch;
     int rewrite_offset;
     int rebuild_count;
@@ -403,8 +404,7 @@ storeDigestRewriteStart(void *datanotused)
     flags.cachable = 1;
     e = storeCreateEntry(url, url, flags, METHOD_GET);
     assert(e);
-    sd_state.rewrite_lock = cbdataAlloc(generic_cbdata);
-    sd_state.rewrite_lock->data = e;
+    sd_state.rewrite_lock = e;
     debug(71, 3) ("storeDigestRewrite: url: %s key: %s\n", url, e->getMD5Text());
     HttpRequest *req = HttpRequest::CreateFromUrl(url);
     e->mem_obj->request = HTTPMSGLOCK(req);
@@ -425,7 +425,7 @@ storeDigestRewriteResume(void)
 
     assert(sd_state.rewrite_lock);
     assert(!sd_state.rebuild_lock);
-    e = (StoreEntry *)sd_state.rewrite_lock->data;
+    e = sd_state.rewrite_lock;
     sd_state.rewrite_offset = 0;
     EBIT_SET(e->flags, ENTRY_SPECIAL);
     /* setting public key will purge old digest entry if any */
@@ -442,14 +442,14 @@ storeDigestRewriteResume(void)
     e->replaceHttpReply(rep);
     storeDigestCBlockSwapOut(e);
     storeBufferFlush(e);
-    eventAdd("storeDigestSwapOutStep", storeDigestSwapOutStep, sd_state.rewrite_lock, 0.0, 1);
+    eventAdd("storeDigestSwapOutStep", storeDigestSwapOutStep, sd_state.rewrite_lock, 0.0, 1, false);
 }
 
 /* finishes swap out sequence for the digest; schedules next rewrite */
 static void
 storeDigestRewriteFinish(StoreEntry * e)
 {
-    assert(sd_state.rewrite_lock && e == sd_state.rewrite_lock->data);
+    assert(e == sd_state.rewrite_lock);
     e->complete();
     storeTimestampsSet(e);
     debug(71, 2) ("storeDigestRewriteFinish: digest expires at %ld (%+d)\n",
@@ -457,7 +457,6 @@ storeDigestRewriteFinish(StoreEntry * e)
     /* is this the write order? @?@ */
     e->mem_obj->unlinkRequest();
     e->unlock();
-    cbdataFree(sd_state.rewrite_lock);
     sd_state.rewrite_lock = NULL;
     sd_state.rewrite_count++;
     eventAdd("storeDigestRewriteStart", storeDigestRewriteStart, NULL, (double)
@@ -472,10 +471,9 @@ storeDigestRewriteFinish(StoreEntry * e)
 static void
 storeDigestSwapOutStep(void *data)
 {
-    StoreEntry *e;
+    StoreEntry *e = static_cast<StoreEntry *>(data);
     int chunk_size = Config.digest.swapout_chunk_size;
-    assert(data == sd_state.rewrite_lock);
-    e = (StoreEntry *) ((generic_cbdata *) data)->data;
+    assert(e == sd_state.rewrite_lock);
     assert(e);
     /* _add_ check that nothing bad happened while we were waiting @?@ @?@ */
 
@@ -494,7 +492,7 @@ storeDigestSwapOutStep(void *data)
     if ((size_t)sd_state.rewrite_offset >= store_digest->mask_size)
         storeDigestRewriteFinish(e);
     else
-        eventAdd("storeDigestSwapOutStep", storeDigestSwapOutStep, data, 0.0, 1);
+        eventAdd("storeDigestSwapOutStep", storeDigestSwapOutStep, data, 0.0, 1, false);
 }
 
 static void
index 3a6447ba85ebd165ce42a5ac2bf14245f80bd3ef..a7449e873e69884d40170b360fff35659a8b5a50 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir.cc,v 1.155 2006/08/19 12:31:21 robertc Exp $
+ * $Id: store_dir.cc,v 1.156 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -893,6 +893,7 @@ StoreHashIndex::search(String const url, HttpRequest *)
 }
 
 CBDATA_CLASS_INIT(StoreSearchHashIndex);
+
 StoreSearchHashIndex::StoreSearchHashIndex(RefCount<StoreHashIndex> aSwapDir) : sd(aSwapDir), _done (false), bucket (0)
 {}
 
index 10494b99ddc73900695307853f1551e8cdf0e4ec..a531c1b9ae2c1d954e3c5c3a432c2c957a0b0ee4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_swapout.cc,v 1.107 2006/05/31 17:24:23 wessels Exp $
+ * $Id: store_swapout.cc,v 1.108 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 20    Storage Manager Swapout Functions
  * AUTHOR: Duane Wessels
@@ -34,6 +34,7 @@
  */
 
 #include "squid.h"
+#include "cbdata.h"
 #include "StoreClient.h"
 #include "Store.h"
 /* FIXME: Abstract the use of this more */
@@ -62,13 +63,12 @@ storeSwapOutStart(StoreEntry * e)
      * then this code needs changing
      */
     /* Create the swap file */
-    generic_cbdata *c = cbdataAlloc(generic_cbdata);
-    c->data = e;
+    generic_cbdata *c = new generic_cbdata(e);
     sio = storeCreate(e, storeSwapOutFileNotify, storeSwapOutFileClosed, c);
 
     if (NULL == sio.getRaw()) {
         e->swap_status = SWAPOUT_NONE;
-        cbdataFree(c);
+        delete c;
         storeLog(STORE_LOG_SWAPOUTFAIL, e);
         return;
     }
index dbecfd81c2fb8d5dbcc23bc9d9d1a79433cd8bda..c913a71228cd499ccc9b9455cf8ef7f95b7eec15 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.546 2006/08/07 02:28:22 robertc Exp $
+ * $Id: structs.h,v 1.547 2006/08/21 00:50:41 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -179,15 +179,9 @@ struct _https_port_list
 #include "DelayConfig.h"
 #endif
 
-class RemovalPolicySettings
-{
-
-public:
-    RemovalPolicySettings() : type(NULL), args(NULL) {};
+/* forward decl for SquidConfig, see RemovalPolicy.h */
+class RemovalPolicySettings;
 
-    char *type;
-    wordlist *args;
-};
 
 class external_acl;
 
@@ -961,53 +955,6 @@ struct _domain_type
 
 #if USE_CACHE_DIGESTS
 
-struct _Version
-{
-    short int current;         /* current version */
-    short int required;                /* minimal version that can safely handle current version */
-};
-
-/* digest control block; used for transmission and storage */
-
-struct _StoreDigestCBlock
-{
-    Version ver;
-    int capacity;
-    int count;
-    int del_count;
-    int mask_size;
-    unsigned char bits_per_entry;
-    unsigned char hash_func_count;
-    short int reserved_short;
-    int reserved[32 - 6];
-};
-
-struct _DigestFetchState
-{
-    PeerDigest *pd;
-    StoreEntry *entry;
-    StoreEntry *old_entry;
-    store_client *sc;
-    store_client *old_sc;
-    HttpRequest *request;
-    int offset;
-    int mask_offset;
-    time_t start_time;
-    time_t resp_time;
-    time_t expires;
-
-    struct
-    {
-        int msg;
-        int bytes;
-    }
-
-    sent, recv;
-    char buf[SM_PAGE_SIZE];
-    ssize_t bufofs;
-    digest_read_state_t state;
-};
-
 /* statistics for cache digests and other hit "predictors" */
 
 struct _cd_guess_stats
@@ -1020,68 +967,6 @@ struct _cd_guess_stats
     int close_hits;            /* tmp, remove it later */
 };
 
-class PeerDigest
-{
-
-public:
-    void *operator new (size_t);
-    void operator delete(void *);
-
-    struct _peer *peer;                        /* pointer back to peer structure, argh */
-    CacheDigest *cd;           /* actual digest structure */
-    String host;               /* copy of peer->host */
-    const char *req_result;    /* text status of the last request */
-
-    struct
-    {
-
-unsigned int needed:
-        1;     /* there were requests for this digest */
-
-unsigned int usable:
-        1;     /* can be used for lookups */
-
-unsigned int requested:
-        1;     /* in process of receiving [fresh] digest */
-    }
-
-    flags;
-
-    struct
-    {
-        /* all times are absolute unless augmented with _delay */
-        time_t initialized;    /* creation */
-        time_t needed;         /* first lookup/use by a peer */
-        time_t next_check;     /* next scheduled check/refresh event */
-        time_t retry_delay;    /* delay before re-checking _invalid_ digest */
-        time_t requested;      /* requested a fresh copy of a digest */
-        time_t req_delay;      /* last request response time */
-        time_t received;       /* received the current copy of a digest */
-        time_t disabled;       /* disabled for good */
-    }
-
-    times;
-
-    struct
-    {
-        cd_guess_stats guess;
-        int used_count;
-
-        struct
-        {
-            int msgs;
-            kb_t kbytes;
-        }
-
-        sent, recv;
-    }
-
-    stats;
-
-private:
-    CBDATA_CLASS(PeerDigest);
-};
-
 #endif
 
 struct _peer
@@ -1343,47 +1228,6 @@ struct _iostats
     Http, Ftp, Gopher, Wais;
 };
 
-/* Removal policies */
-
-class RemovalPolicyNode
-{
-
-public:
-    RemovalPolicyNode() : data(NULL) {}
-
-    void *data;
-};
-
-struct _RemovalPolicy
-{
-    const char *_type;
-    void *_data;
-    void (*Free) (RemovalPolicy * policy);
-    void (*Add) (RemovalPolicy * policy, StoreEntry * entry, RemovalPolicyNode * node);
-    void (*Remove) (RemovalPolicy * policy, StoreEntry * entry, RemovalPolicyNode * node);
-    void (*Referenced) (RemovalPolicy * policy, const StoreEntry * entry, RemovalPolicyNode * node);
-    void (*Dereferenced) (RemovalPolicy * policy, const StoreEntry * entry, RemovalPolicyNode * node);
-    RemovalPolicyWalker *(*WalkInit) (RemovalPolicy * policy);
-    RemovalPurgeWalker *(*PurgeInit) (RemovalPolicy * policy, int max_scan);
-    void (*Stats) (RemovalPolicy * policy, StoreEntry * entry);
-};
-
-struct _RemovalPolicyWalker
-{
-    RemovalPolicy *_policy;
-    void *_data;
-    const StoreEntry *(*Next) (RemovalPolicyWalker * walker);
-    void (*Done) (RemovalPolicyWalker * walker);
-};
-
-struct _RemovalPurgeWalker
-{
-    RemovalPolicy *_policy;
-    void *_data;
-    int scanned, max_scan, locked;
-    StoreEntry *(*Next) (RemovalPurgeWalker * walker);
-    void (*Done) (RemovalPurgeWalker * walker);
-};
 
 struct request_flags
 {
@@ -1531,45 +1375,6 @@ unsigned int ignore_auth:
     flags;
 };
 
-struct _ErrorState
-{
-    err_type type;
-    int page_id;
-    http_status httpStatus;
-    auth_user_request_t *auth_user_request;
-    HttpRequest *request;
-    char *url;
-    int xerrno;
-    u_short port;
-    char *dnsserver_msg;
-    time_t ttl;
-
-    struct IN_ADDR src_addr;
-    char *redirect_url;
-    ERCB *callback;
-    void *callback_data;
-
-    struct
-    {
-
-unsigned int flag_cbdata:
-        1;
-    }
-
-    flags;
-
-    struct
-    {
-        wordlist *server_msg;
-        char *request;
-        char *reply;
-    }
-
-    ftp;
-    char *request_hdrs;
-    char *err_msg; /* Preformatted error message from the cache */
-};
-
 /*
  * "very generic" histogram; 
  * see important comments on hbase_f restrictions in StatHist.c
@@ -1826,166 +1631,6 @@ struct _CacheDigest
     int del_count;             /* number of deletions performed so far */
 };
 
-class helper_request;
-
-struct _helper
-{
-    wordlist *cmdline;
-    dlink_list servers;
-    dlink_list queue;
-    const char *id_name;
-    int n_to_start;
-    int n_running;
-    int n_active;
-    int ipc_type;
-    unsigned int concurrency;
-    time_t last_queue_warn;
-    time_t last_restart;
-
-    struct
-    {
-        int requests;
-        int replies;
-        int queue_size;
-        int avg_svc_time;
-    }
-
-    stats;
-};
-
-struct _helper_stateful
-{
-    wordlist *cmdline;
-    dlink_list servers;
-    dlink_list queue;
-    const char *id_name;
-    int n_to_start;
-    int n_running;
-    int n_active;
-    int ipc_type;
-    MemAllocatorProxy *datapool;
-    HLPSAVAIL *IsAvailable;
-    HLPSONEQ *OnEmptyQueue;
-    time_t last_queue_warn;
-    time_t last_restart;
-
-    struct
-    {
-        int requests;
-        int replies;
-        int queue_size;
-        int avg_svc_time;
-    }
-
-    stats;
-};
-
-struct _helper_server
-{
-    int index;
-    int pid;
-    int rfd;
-    int wfd;
-    MemBuf *wqueue;
-    MemBuf *writebuf;
-    char *rbuf;
-    size_t rbuf_sz;
-    off_t roffset;
-
-    struct timeval dispatch_time;
-
-    struct timeval answer_time;
-
-    dlink_node link;
-    helper *parent;
-    helper_request **requests;
-
-    struct _helper_flags
-    {
-
-unsigned int writing:
-        1;
-
-unsigned int closing:
-        1;
-
-unsigned int shutdown:
-        1;
-    }
-
-    flags;
-
-    struct
-    {
-        int uses;
-        unsigned int pending;
-    }
-
-    stats;
-};
-
-class helper_stateful_request;
-
-struct _helper_stateful_server
-{
-    int index;
-    int pid;
-    int rfd;
-    int wfd;
-    /* MemBuf wqueue; */
-    /* MemBuf writebuf; */
-    char *rbuf;
-    size_t rbuf_sz;
-    off_t roffset;
-
-    struct timeval dispatch_time;
-
-    struct timeval answer_time;
-
-    dlink_node link;
-    dlink_list queue;
-    statefulhelper *parent;
-    helper_stateful_request *request;
-
-    struct _helper_stateful_flags
-    {
-
-unsigned int busy:
-        1;
-
-unsigned int closing:
-        1;
-
-unsigned int shutdown:
-        1;
-        stateful_helper_reserve_t reserved;
-    }
-
-    flags;
-
-    struct
-    {
-        int uses;
-        int submits;
-        int releases;
-        int deferbyfunc;
-        int deferbycb;
-    }
-
-    stats;
-    int deferred_requests;     /* current number of deferred requests */
-    void *data;                        /* State data used by the calling routines */
-};
-
-/*
- * use this when you need to pass callback data to a blocking
- * operation, but you don't want to add that pointer to cbdata
- */
-
-struct _generic_cbdata
-{
-    void *data;
-};
 
 struct _store_rebuild_data
 {
index bba22b582852648ac0977dc0d98be21cc01dd1b6..c65fd183a2305081aee6436f8c9859918c2148f6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: stub_MemObject.cc,v 1.4 2006/04/25 07:13:33 robertc Exp $
+ * $Id: stub_MemObject.cc,v 1.5 2006/08/21 00:50:47 robertc Exp $
  *
  * DEBUG: section 84    Helper process maintenance
  * AUTHOR: Robert Collins
@@ -39,6 +39,8 @@
 #include "DelayPools.h"
 #endif
 
+RemovalPolicy * mem_policy = NULL;
+
 off_t
 MemObject::endOffset () const
 {
index cf0195f771ca4ac667606fb5d00d1b335385126c..ddb5fb424c2b2b52c706cd0765348408ee443ce4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: stub_errorpage.cc,v 1.2 2006/04/25 07:13:34 robertc Exp $
+ * $Id: stub_errorpage.cc,v 1.3 2006/08/21 00:50:47 robertc Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Robert Collins
@@ -32,7 +32,7 @@
  *
  */
 
-#include "squid.h"
+#include "errorpage.h"
 
 err_type
 errorReservePageId(const char *page_name)
index fe3df26c298e2e27f71581d0ab84c3c712da2ab3..6a7be44e0f538528646d23f0bd1ebf50418608e5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: stub_helper.cc,v 1.1 2004/08/30 03:29:02 robertc Exp $
+ * $Id: stub_helper.cc,v 1.2 2006/08/21 00:50:47 robertc Exp $
  *
  * DEBUG: section 84    Helper process maintenance
  * AUTHOR: Robert Collins
@@ -33,6 +33,7 @@
  */
 
 #include "squid.h"
+#include "helper.h"
 
 void
 helperSubmit(helper * hlp, const char *buf, HLPCB * callback, void *data)
@@ -58,10 +59,13 @@ helperFree(helper * hlp)
     fatal("Not implemented");
 }
 
+CBDATA_TYPE(helper);
+
 helper *
 helperCreate(const char *name)
 {
     helper *hlp;
+    CBDATA_INIT_TYPE(helper);
     hlp = cbdataAlloc(helper);
     hlp->id_name = name;
     return hlp;
@@ -123,10 +127,13 @@ helperStatefulReleaseServer(helper_stateful_server * srv)
     fatal("Not implemented");
 }
 
+CBDATA_TYPE(statefulhelper);
+
 statefulhelper *
 helperStatefulCreate(const char *name)
 {
     statefulhelper *hlp;
+    CBDATA_INIT_TYPE(statefulhelper);
     hlp = cbdataAlloc(statefulhelper);
     hlp->id_name = name;
     return hlp;
index 722275959f4864ba956d992d165a9a14f49c81b6..a9d3659e8e775cf3329e90eefd041d1d4b4751d5 100644 (file)
@@ -95,8 +95,6 @@ fake_auth_setup()
 
     Mem::Init();
 
-    cbdataInit();
-
     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",
index bafd610b09b9b2915a49b732aec80d2673ede8a9..38e68b0125b735f607f950532bc2cd820e8c4c2b 100644 (file)
@@ -8,6 +8,7 @@
 #include "fs/ufs/ufscommon.h"
 #include "fs/coss/CossSwapDir.h"
 #include "Mem.h"
+#include "MemObject.h"
 #include "HttpHeader.h"
 #include "HttpReply.h"
 #include "StoreFileSystem.h"
@@ -59,8 +60,6 @@ testCoss::commonInit()
 
     Mem::Init();
 
-    cbdataInit();
-
     comm_init();
 
     httpHeaderInitModule();    /* must go before any header processing (e.g. the one in errorInitialize) */
@@ -178,8 +177,7 @@ testCoss::testCossSearch()
     /* our swapdir must be scheduled to rebuild */
     CPPUNIT_ASSERT_EQUAL(1, StoreController::store_dirs_rebuilding);
 
-    while (StoreController::store_dirs_rebuilding)
-        loop.runOnce();
+    loop.run();
 
     /* cannot use loop.run(); as the loop will never idle: the store-dir
      * clean() scheduled event prevents it 
index 9b30c2376d17b341412568b38b6130d5b5617c55..2317a687bceddc33a27269cb3506527d9ceb42ae 100644 (file)
@@ -135,10 +135,13 @@ testEvent::testCheckEvents()
     EventDispatcher dispatcher;
     EventScheduler scheduler(&dispatcher);
     CalledEvent event;
-    CPPUNIT_ASSERT_EQUAL(10, scheduler.checkEvents(0));
-    /* event running now gets sent to the dispatcher and the delay is set to 10ms */
+    /* with no events, its an idle engine */
+    CPPUNIT_ASSERT_EQUAL(int(AsyncEngine::EVENT_IDLE), scheduler.checkEvents(0));
+    /* event running now gets will get sent to the dispatcher and the 
+     * engine becomes idle.
+     */
     scheduler.schedule("test event", CalledEvent::Handler, &event, 0, 0, false);
-    CPPUNIT_ASSERT_EQUAL(10, scheduler.checkEvents(0));
+    CPPUNIT_ASSERT_EQUAL(int(AsyncEngine::EVENT_IDLE), scheduler.checkEvents(0));
     dispatcher.dispatch();
     /* event running later results in  a delay of the time till it runs */
     scheduler.schedule("test event", CalledEvent::Handler, &event, 2, 0, false);
diff --git a/src/tests/testHeader_RemovalPolicy.cc b/src/tests/testHeader_RemovalPolicy.cc
new file mode 100644 (file)
index 0000000..fdde7cb
--- /dev/null
@@ -0,0 +1,4 @@
+/* This test tests that the header below can be processed on its own with
+ * no other #includes. Dont add any!
+ */
+#include "RemovalPolicy.h"
diff --git a/src/tests/testHeader_cbdata.cc b/src/tests/testHeader_cbdata.cc
new file mode 100644 (file)
index 0000000..9bc24cf
--- /dev/null
@@ -0,0 +1,4 @@
+/* This test tests that the header below can be processed on its own with
+ * no other #includes. Dont add any!
+ */
+#include "cbdata.h"
diff --git a/src/tests/testHeader_errorpage.cc b/src/tests/testHeader_errorpage.cc
new file mode 100644 (file)
index 0000000..8e2da24
--- /dev/null
@@ -0,0 +1,4 @@
+/* This test tests that the header below can be processed on its own with
+ * no other #includes. Dont add any!
+ */
+#include "errorpage.h"
index ab6d92d04001e44031309735a9c5e71dd57a617a..f81f1e38daffa9866ae4956614427671990aec63 100644 (file)
@@ -8,6 +8,7 @@
 #include "fs/ufs/ufscommon.h"
 #include "fs/null/store_null.h"
 #include "Mem.h"
+#include "MemObject.h"
 #include "HttpHeader.h"
 #include "HttpReply.h"
 #include "StoreFileSystem.h"
@@ -59,8 +60,6 @@ testNull::commonInit()
 
     Mem::Init();
 
-    cbdataInit();
-
     comm_init();
 
     httpHeaderInitModule();    /* must go before any header processing (e.g. the one in errorInitialize) */
@@ -148,12 +147,7 @@ testNull::testNullSearch()
      */
     CPPUNIT_ASSERT_EQUAL(1, StoreController::store_dirs_rebuilding);
 
-    while (StoreController::store_dirs_rebuilding)
-        loop.runOnce();
-
-    /* cannot use loop.run(); as the loop will never idle: the store-dir
-     * clean() scheduled event prevents it 
-     */
+    loop.run();
 
     /* nothing left to rebuild */
     CPPUNIT_ASSERT_EQUAL(0, StoreController::store_dirs_rebuilding);
index 17a76fc474e09ff1474f6210903dc7a2128cef46..479c7791ea8d5881b803218d09a06593d5bf85f5 100644 (file)
@@ -49,8 +49,6 @@ commonInit()
 
     Mem::Init();
 
-    cbdataInit();
-
     Config.Store.avgObjectSize = 1024;
 
     Config.Store.objectsPerBucket = 20;
index fc150fb3755b6b6c86596d33b21dbdcfbc399604..c3e724dbb03a0095fd3a03d3ae8ebb9f1105c2c0 100644 (file)
@@ -7,6 +7,7 @@
 #include "DiskIO/DiskIOModule.h"
 #include "fs/ufs/ufscommon.h"
 #include "Mem.h"
+#include "MemObject.h"
 #include "HttpHeader.h"
 #include "HttpReply.h"
 #include "testStoreSupport.h"
@@ -76,8 +77,6 @@ testUfs::testUfsSearch()
 
     Mem::Init();
 
-    cbdataInit();
-
     comm_init();
 
     httpHeaderInitModule();    /* must go before any header processing (e.g. the one in errorInitialize) */
index c36ec99e58edfdfd7212a62894266ccc6ff18965..d266cad2382624463a607efc456ce2f4c48a5f28 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tunnel.cc,v 1.162 2006/05/06 22:13:18 wessels Exp $
+ * $Id: tunnel.cc,v 1.163 2006/08/21 00:50:41 robertc Exp $
  *
  * DEBUG: section 26    Secure Sockets Layer Proxy
  * AUTHOR: Duane Wessels
@@ -34,6 +34,7 @@
  */
 
 #include "squid.h"
+#include "errorpage.h"
 #include "HttpRequest.h"
 #include "fde.h"
 #include "comm.h"
index 2f1724b0ff2c25f5a4f99dd4b11529f174a16015..7f8f5af9d65de462da0b278d57c440a4a3446aee 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: typedefs.h,v 1.187 2006/08/07 02:28:22 robertc Exp $
+ * $Id: typedefs.h,v 1.188 2006/08/21 00:50:41 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -139,8 +139,6 @@ typedef struct _domain_type domain_type;
 
 typedef struct _DynPool DynPool;
 
-typedef struct _StoreDigestCBlock StoreDigestCBlock;
-
 typedef struct _DigestFetchState DigestFetchState;
 
 class PeerDigest;
@@ -171,10 +169,6 @@ class StoreEntry;
 
 class SwapDir;
 
-typedef struct _helper_flags helper_flags;
-
-typedef struct _helper_stateful_flags helper_stateful_flags;
-
 typedef struct _http_state_flags http_state_flags;
 
 typedef struct _header_mangler header_mangler;
@@ -189,8 +183,6 @@ typedef struct _refresh_t refresh_t;
 
 typedef struct _CommWriteStateData CommWriteStateData;
 
-typedef struct _ErrorState ErrorState;
-
 typedef struct _StatCounters StatCounters;
 
 typedef struct _storeSwapLogData storeSwapLogData;
@@ -205,16 +197,6 @@ typedef struct _CacheDigest CacheDigest;
 
 typedef struct _Version Version;
 
-typedef struct _helper helper;
-
-typedef struct _helper_stateful statefulhelper;
-
-typedef struct _helper_server helper_server;
-
-typedef struct _helper_stateful_server helper_stateful_server;
-
-typedef struct _generic_cbdata generic_cbdata;
-
 typedef struct _link_list link_list;
 
 typedef struct _Logfile Logfile;
@@ -225,12 +207,6 @@ typedef struct _logformat logformat;
 
 typedef struct _customlog customlog;
 
-typedef struct _RemovalPolicy RemovalPolicy;
-
-typedef struct _RemovalPolicyWalker RemovalPolicyWalker;
-
-typedef struct _RemovalPurgeWalker RemovalPurgeWalker;
-
 #if SQUID_SNMP
 typedef variable_list *(oid_ParseFn) (variable_list *, snint *);
 
@@ -273,7 +249,6 @@ typedef void OBJH(StoreEntry *);
 typedef void SIGHDLR(int sig);
 typedef void STVLDCB(void *, int, int);
 typedef void HLPCB(void *, char *buf);
-typedef stateful_helper_callback_t HLPSCB(void *, void *lastserver, char *buf);
 typedef int HLPSAVAIL(void *);
 typedef void HLPSONEQ(void *);
 typedef void HLPCMDOPTS(int *argc, char **argv);
@@ -291,7 +266,5 @@ typedef int Ctx;
 /* in case we want to change it later */
 typedef ssize_t mb_size_t;
 
-typedef RemovalPolicy *REMOVALPOLICYCREATE(wordlist * args);
-
 typedef int STDIRSELECT(const StoreEntry *);
 #endif /* SQUID_TYPEDEFS_H */
index 9a59b06dfd916148e5f8004e81653444747e84c2..c759440731f1a7185bef63b1802639a50d24c39a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: urn.cc,v 1.101 2006/05/19 17:19:10 wessels Exp $
+ * $Id: urn.cc,v 1.102 2006/08/21 00:50:42 robertc Exp $
  *
  * DEBUG: section 52    URN Parsing
  * AUTHOR: Kostas Anagnostakis
@@ -34,6 +34,7 @@
  */
 
 #include "squid.h"
+#include "errorpage.h"
 #include "StoreClient.h"
 #include "Store.h"
 #include "HttpReply.h"
index 29af70d6f04459b42f7b7ac28a67c6a16f6520c6..4b8656617fb1a185d1a461971a7462c396827d31 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: wais.cc,v 1.160 2006/05/19 17:19:10 wessels Exp $
+ * $Id: wais.cc,v 1.161 2006/08/21 00:50:42 robertc Exp $
  *
  * DEBUG: section 24    WAIS Relay
  * AUTHOR: Harvest Derived
@@ -34,6 +34,7 @@
  */
 
 #include "squid.h"
+#include "errorpage.h"
 #include "Store.h"
 #include "HttpRequest.h"
 #if DELAY_POOLS
index 30f9a61119b6f53b3f0e586bbbdfa341268e5076..51d22232c8a162c3203da59b21335676dfa1b8bc 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: whois.cc,v 1.35 2006/05/19 17:19:10 wessels Exp $
+ * $Id: whois.cc,v 1.36 2006/08/21 00:50:42 robertc Exp $
  *
  * DEBUG: section 75    WHOIS protocol
  * AUTHOR: Duane Wessels, Kostas Anagnostakis
@@ -34,6 +34,7 @@
  */
 
 #include "squid.h"
+#include "errorpage.h"
 #include "Store.h"
 #include "HttpReply.h"
 #include "HttpRequest.h"