/*
- * $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/
#define SQUID_HTTPACCESSLOGENTRY_H
#include "HttpVersion.h"
+#include "HierarchyLogEntry.h"
class AccessLogEntry
{
--- /dev/null
+
+/*
+ * $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 */
/*
- * $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/
#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);
#
# 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:
#
gopher.cc \
helper.cc \
helper.h \
+ HierarchyLogEntry.h \
$(HTCPSOURCE) \
http.cc \
http.h \
pconn.cc \
peer_digest.cc \
peer_select.cc \
+ PeerSelectState.h \
+ PingData.h \
protos.h \
redirect.cc \
referer.cc \
--- /dev/null
+
+/*
+ * $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 */
--- /dev/null
+
+/*
+ * $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 */
/*
- * $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
#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,
/*
- * $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
#endif
#include "Generic.h"
+/* XXX Remove me */
+#include "PeerSelectState.h"
+
static int cbdataCount = 0;
#if CBDATA_DEBUG
dlink_list cbdataEntries;
/*
- * $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
#include "MemObject.h"
#include "ACLChecklist.h"
#include "htcp.h"
+#include "PeerSelectState.h"
/* count mcast group peers every 15 minutes */
#define MCAST_COUNT_RATE 900
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;
/*
- * $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
*/
#include "squid.h"
+#include "PeerSelectState.h"
#include "Store.h"
#include "ICP.h"
#include "HttpRequest.h"
else
debug(44, 3) ("peerSelect: %s\n", RequestMethodStr[request->method]);
- psstate = cbdataAlloc(ps_state);
+ psstate = new ps_state;
psstate->request = requestLink(request);
*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;
+}
/*
- * $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/
#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);
/*
- * $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/
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
{
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
/*
- * $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/
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;