]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Move HierarchyLogEntry, all depended classes, and their dependents out of structs...
authorrobertc <>
Fri, 17 Oct 2003 03:40:16 +0000 (03:40 +0000)
committerrobertc <>
Fri, 17 Oct 2003 03:40:16 +0000 (03:40 +0000)
13 files changed:
src/AccessLogEntry.h
src/HierarchyLogEntry.h [new file with mode: 0644]
src/HttpRequest.h
src/Makefile.am
src/PeerSelectState.h [new file with mode: 0644]
src/PingData.h [new file with mode: 0644]
src/access_log.cc
src/cbdata.cc
src/neighbors.cc
src/peer_select.cc
src/protos.h
src/structs.h
src/typedefs.h

index 3baf4e3502639a9a12d70e31409f0b346bc620a7..0cd23a7c5e900f791595b17c646ca4dcd851aaef 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: AccessLogEntry.h,v 1.2 2003/09/04 11:54:23 hno Exp $
+ * $Id: AccessLogEntry.h,v 1.3 2003/10/16 21:40:16 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -36,6 +36,7 @@
 #define SQUID_HTTPACCESSLOGENTRY_H
 
 #include "HttpVersion.h"
+#include "HierarchyLogEntry.h"
 
 class AccessLogEntry
 {
diff --git a/src/HierarchyLogEntry.h b/src/HierarchyLogEntry.h
new file mode 100644 (file)
index 0000000..31f0057
--- /dev/null
@@ -0,0 +1,60 @@
+
+/*
+ * $Id: HierarchyLogEntry.h,v 1.1 2003/10/16 21:40:16 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_HTTPHIERARCHYLOGENTRY_H
+#define SQUID_HTTPHIERARCHYLOGENTRY_H
+
+#include "PingData.h"
+
+class HierarchyLogEntry
+{
+
+public:
+    HierarchyLogEntry();
+    hier_code code;
+    char host[SQUIDHOSTNAMELEN];
+    ping_data ping;
+    char cd_host[SQUIDHOSTNAMELEN];    /* the host of selected by cd peer */
+    lookup_t cd_lookup;                /* cd prediction: none, miss, hit */
+    int n_choices;             /* #peers we selected from (cd only) */
+    int n_ichoices;            /* #peers with known rtt we selected from (cd only) */
+
+    struct timeval peer_select_start;
+
+    struct timeval store_complete_stop;
+};
+
+extern void hierarchyNote(HierarchyLogEntry *, hier_code, const char *);
+
+#endif /* SQUID_HTTPHIERARCHYLOGENTRY_H */
index bc3333e8a702c4408fc1c2e5025e484fa46da176..1e42c7d33b49994a2ed989ef07cc4513673de073 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: HttpRequest.h,v 1.8 2003/09/01 03:49:37 robertc Exp $
+ * $Id: HttpRequest.h,v 1.9 2003/10/16 21:40:17 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -38,6 +38,7 @@
 #include "HttpHeader.h"
 #include "client_side.h"
 #include "HttpVersion.h"
+#include "HierarchyLogEntry.h"
 
 /*  Http Request */
 extern HttpRequest *requestCreate(method_t, protocol_t, const char *urlpath);
index 10d4ff1ecf9bfea7a77b256f2527842296fcf71e..0aca024fbfd69d95b1a396e9db2eeb229764a2a3 100644 (file)
@@ -1,7 +1,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.am,v 1.90 2003/09/01 03:49:37 robertc Exp $
+#  $Id: Makefile.am,v 1.91 2003/10/16 21:40:17 robertc Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -352,6 +352,7 @@ squid_SOURCES = \
        gopher.cc \
        helper.cc \
        helper.h \
+       HierarchyLogEntry.h \
        $(HTCPSOURCE) \
        http.cc \
        http.h \
@@ -404,6 +405,8 @@ squid_SOURCES = \
        pconn.cc \
        peer_digest.cc \
        peer_select.cc \
+       PeerSelectState.h \
+       PingData.h \
        protos.h \
        redirect.cc \
        referer.cc \
diff --git a/src/PeerSelectState.h b/src/PeerSelectState.h
new file mode 100644 (file)
index 0000000..9002a04
--- /dev/null
@@ -0,0 +1,82 @@
+
+/*
+ * $Id: PeerSelectState.h,v 1.1 2003/10/16 21:40:16 robertc Exp $
+ *
+ * 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.
+ *
+ * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
+ */
+
+#ifndef   SQUID_PEERSELECTSTATE_H
+#define   SQUID_PEERSELECTSTATE_H
+
+#include "PingData.h"
+
+class ps_state
+{
+
+public:
+    void *operator new(size_t);
+    ps_state();
+    HttpRequest *request;
+    StoreEntry *entry;
+    int always_direct;
+    int never_direct;
+    int direct;
+    PSC *callback;
+    void *callback_data;
+    FwdServer *servers;
+    /*
+     * Why are these struct sockaddr_in instead of peer *?  Because a
+     * peer structure can become invalid during the peer selection
+     * phase, specifically after a reconfigure.  Thus we need to lookup
+     * the peer * based on the address when we are finally ready to
+     * reference the peer structure.
+     */
+
+    struct sockaddr_in first_parent_miss;
+
+    struct sockaddr_in closest_parent_miss;
+    /*
+     * ->hit and ->secho can be peer* because they should only be
+     * accessed during the thread when they are set
+     */
+    peer *hit;
+    peer_t hit_type;
+#if ALLOW_SOURCE_PING
+
+    peer *secho;
+#endif
+
+    ping_data ping;
+    ACLChecklist *acl_checklist;
+};
+
+
+#endif /* SQUID_PEERSELECTSTATE_H */
diff --git a/src/PingData.h b/src/PingData.h
new file mode 100644 (file)
index 0000000..ea5b99e
--- /dev/null
@@ -0,0 +1,56 @@
+
+/*
+ * $Id: PingData.h,v 1.1 2003/10/16 21:40:16 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_PINGDATA_H
+#define SQUID_PINGDATA_H
+
+class ping_data
+{
+
+public:
+    ping_data();
+
+    struct timeval start;
+
+    struct timeval stop;
+    int n_sent;
+    int n_recv;
+    int n_replies_expected;
+    int timeout;               /* msec */
+    int timedout;
+    int w_rtt;
+    int p_rtt;
+};
+
+#endif /* SQUID_PINGDATA_H */
index 5e6396ce8437b5abb32da3cc14c2442336ed7791..b48798db47de5a40f82897b5c327a28d69d9009c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: access_log.cc,v 1.95 2003/09/01 03:49:37 robertc Exp $
+ * $Id: access_log.cc,v 1.96 2003/10/16 21:40:16 robertc Exp $
  *
  * DEBUG: section 46    Access Log
  * AUTHOR: Duane Wessels
@@ -1454,6 +1454,22 @@ accessLogClose(void)
 #endif
 }
 
+HierarchyLogEntry::HierarchyLogEntry() :
+        code(HIER_NONE),
+        cd_lookup(LOOKUP_NONE),
+        n_choices(0),
+        n_ichoices(0)
+{
+    memset(host, '\0', SQUIDHOSTNAMELEN);
+    memset(cd_host, '\0', SQUIDHOSTNAMELEN);
+
+    peer_select_start.tv_sec =0;
+    peer_select_start.tv_usec =0;
+
+    store_complete_stop.tv_sec =0;
+    store_complete_stop.tv_usec =0;
+}
+
 void
 hierarchyNote(HierarchyLogEntry * hl,
               hier_code code,
index bf4832af21eabd80e19f03634cbf4cd380a49db6..727d5993014d7a73da9d101be9e427117461b8aa 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cbdata.cc,v 1.61 2003/10/08 21:21:14 robertc Exp $
+ * $Id: cbdata.cc,v 1.62 2003/10/16 21:40:16 robertc Exp $
  *
  * DEBUG: section 45    Callback Data Registry
  * ORIGINAL AUTHOR: Duane Wessels
@@ -52,6 +52,9 @@
 #endif
 #include "Generic.h"
 
+/* XXX Remove me */
+#include "PeerSelectState.h"
+
 static int cbdataCount = 0;
 #if CBDATA_DEBUG
 dlink_list cbdataEntries;
index 535e066815adab6b9773a98040e1739c05f3380f..11c822729445c689c713021763ea574fc688e0bb 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: neighbors.cc,v 1.323 2003/09/21 00:30:47 robertc Exp $
+ * $Id: neighbors.cc,v 1.324 2003/10/16 21:40:16 robertc Exp $
  *
  * DEBUG: section 15    Neighbor Routines
  * AUTHOR: Harvest Derived
@@ -40,6 +40,7 @@
 #include "MemObject.h"
 #include "ACLChecklist.h"
 #include "htcp.h"
+#include "PeerSelectState.h"
 
 /* count mcast group peers every 15 minutes */
 #define MCAST_COUNT_RATE 900
@@ -1470,7 +1471,7 @@ peerCountMcastPeersStart(void *data)
     p->mcast.flags.count_event_pending = 0;
     snprintf(url, MAX_URL, "http://%s/", inet_ntoa(p->in_addr.sin_addr));
     fake = storeCreateEntry(url, url, request_flags(), METHOD_GET);
-    psstate = cbdataAlloc(ps_state);
+    psstate = new ps_state;
     psstate->request = requestLink(urlParse(METHOD_GET, url));
     psstate->entry = fake;
     psstate->callback = NULL;
index e857a00e31183d0226193ce4dea69e3a75bb4ee1..ce2a82a92b0208b736349101900e857f8fae6668 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: peer_select.cc,v 1.131 2003/08/10 11:00:44 robertc Exp $
+ * $Id: peer_select.cc,v 1.132 2003/10/16 21:40:16 robertc Exp $
  *
  * DEBUG: section 44    Peer Selection Algorithm
  * AUTHOR: Duane Wessels
@@ -34,6 +34,7 @@
  */
 
 #include "squid.h"
+#include "PeerSelectState.h"
 #include "Store.h"
 #include "ICP.h"
 #include "HttpRequest.h"
@@ -157,7 +158,7 @@ peerSelect(HttpRequest * request,
     else
         debug(44, 3) ("peerSelect: %s\n", RequestMethodStr[request->method]);
 
-    psstate = cbdataAlloc(ps_state);
+    psstate = new ps_state;
 
     psstate->request = requestLink(request);
 
@@ -783,3 +784,44 @@ peerAddFwdServer(FwdServer ** FS, peer * p, hier_code code)
 
     *FS = fs;
 }
+
+void *
+ps_state::operator new(size_t)
+{
+    return cbdataAlloc(ps_state);
+}
+
+ps_state::ps_state() : request (NULL),
+        entry (NULL),
+        always_direct (0),
+        never_direct (0),
+        direct (0),
+        callback (NULL),
+        callback_data (NULL),
+        servers (NULL),
+        hit(NULL),
+        hit_type(PEER_NONE),
+#if ALLOW_SOURCE_PING
+
+        secho( NULL),
+#endif
+        acl_checklist (NULL)
+{
+    memset(&first_parent_miss, '\0', sizeof(first_parent_miss));
+    memset(&closest_parent_miss, '\0', sizeof(closest_parent_miss));
+}
+
+ping_data::ping_data() :
+        n_sent(0),
+        n_recv(0),
+        n_replies_expected(0),
+        timeout(0),
+        timedout(0),
+        w_rtt(0),
+        p_rtt(0)
+{
+    start.tv_sec = 0;
+    start.tv_usec = 0;
+    stop.tv_sec = 0;
+    stop.tv_usec = 0;
+}
index 41a389f599dd885f0311460f87e0986f5bbc7b5a..7895c7de31a79c80d325679bdd3c413f5a7b4c59 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: protos.h,v 1.492 2003/09/01 03:49:39 robertc Exp $
+ * $Id: protos.h,v 1.493 2003/10/16 21:40:16 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -34,7 +34,6 @@
 #ifndef SQUID_PROTOS_H
 #define SQUID_PROTOS_H
 
-SQUIDCEXTERN void hierarchyNote(HierarchyLogEntry *, hier_code, const char *);
 #if FORW_VIA_DB
 SQUIDCEXTERN void fvdbCountVia(const char *key);
 SQUIDCEXTERN void fvdbCountForw(const char *key);
index 2585aed8a319dbe0154911b921dc5c2c1fdaca58..c22c9c5fcb50f23ac3d4daa5862e031945f21086 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.482 2003/09/21 04:31:25 robertc Exp $
+ * $Id: structs.h,v 1.483 2003/10/16 21:40:16 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -950,37 +950,6 @@ unsigned int originpeer:
     1;
 };
 
-struct _ping_data
-{
-
-    struct timeval start;
-
-    struct timeval stop;
-    int n_sent;
-    int n_recv;
-    int n_replies_expected;
-    int timeout;               /* msec */
-    int timedout;
-    int w_rtt;
-    int p_rtt;
-};
-
-struct _HierarchyLogEntry
-{
-    hier_code code;
-    char host[SQUIDHOSTNAMELEN];
-    ping_data ping;
-    char cd_host[SQUIDHOSTNAMELEN];    /* the host of selected by cd peer */
-    lookup_t cd_lookup;                /* cd prediction: none, miss, hit */
-    int n_choices;             /* #peers we selected from (cd only) */
-    int n_ichoices;            /* #peers with known rtt we selected from (cd only) */
-
-    struct timeval peer_select_start;
-
-    struct timeval store_complete_stop;
-};
-
-
 struct _ipcache_addrs
 {
 
@@ -1345,41 +1314,6 @@ struct _netdbEntry
     int n_peers;
 };
 
-struct _ps_state
-{
-    HttpRequest *request;
-    StoreEntry *entry;
-    int always_direct;
-    int never_direct;
-    int direct;
-    PSC *callback;
-    void *callback_data;
-    FwdServer *servers;
-    /*
-     * Why are these struct sockaddr_in instead of peer *?  Because a
-     * peer structure can become invalid during the peer selection
-     * phase, specifically after a reconfigure.  Thus we need to lookup
-     * the peer * based on the address when we are finally ready to
-     * reference the peer structure.
-     */
-
-    struct sockaddr_in first_parent_miss;
-
-    struct sockaddr_in closest_parent_miss;
-    /*
-     * ->hit and ->secho can be peer* because they should only be
-     * accessed during the thread when they are set
-     */
-    peer *hit;
-    peer_t hit_type;
-#if ALLOW_SOURCE_PING
-
-    peer *secho;
-#endif
-
-    ping_data ping;
-    ACLChecklist *acl_checklist;
-};
 
 #if USE_ICMP
 
index 13395a63057f302b0e859fc5148ea72c31068723..450b0f8f1686e0856e8f55830640e98b4f8e5277 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: typedefs.h,v 1.170 2003/09/01 03:49:40 robertc Exp $
+ * $Id: typedefs.h,v 1.171 2003/10/16 21:40:16 robertc Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -163,12 +163,6 @@ typedef struct _net_db_peer net_db_peer;
 
 typedef struct _netdbEntry netdbEntry;
 
-typedef struct _ping_data ping_data;
-
-typedef struct _ps_state ps_state;
-
-typedef struct _HierarchyLogEntry HierarchyLogEntry;
-
 typedef struct _pingerEchoData pingerEchoData;
 
 typedef struct _pingerReplyData pingerReplyData;