]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
HTCP progress
authorwessels <>
Wed, 26 Aug 1998 11:36:42 +0000 (11:36 +0000)
committerwessels <>
Wed, 26 Aug 1998 11:36:42 +0000 (11:36 +0000)
src/HttpHeader.cc
src/enums.h
src/neighbors.cc
src/peer_select.cc
src/protos.h
src/structs.h
src/typedefs.h

index b601aa8b67e7d7db0a9f409dde4a4360bd55a33c..d9b5fddc1a20bf12763719b2b24fb6691b9a730e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: HttpHeader.cc,v 1.53 1998/08/25 19:10:43 wessels Exp $
+ * $Id: HttpHeader.cc,v 1.54 1998/08/26 05:36:42 wessels Exp $
  *
  * DEBUG: section 55    HTTP Header
  * AUTHOR: Alex Rousskov
@@ -248,6 +248,9 @@ httpHeaderInitModule()
        httpHeaderStatInit(HttpHeaderStats + i, HttpHeaderStats[i].label);
     HttpHeaderStats[hoRequest].owner_mask = &RequestHeadersMask;
     HttpHeaderStats[hoReply].owner_mask = &ReplyHeadersMask;
+#if USE_HTCP
+    HttpHeaderStats[hoHtcpReply].owner_mask = &ReplyHeadersMask;
+#endif
     /* init dependent modules */
     httpHdrCcInitModule();
     /* register with cache manager */
index d2fbd09a457365d4a943a5b12ebb3c9d5f164b07..0d68c9a37cd95536d81a7adb72110530c24e42d7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: enums.h,v 1.124 1998/08/25 19:19:05 wessels Exp $
+ * $Id: enums.h,v 1.125 1998/08/26 05:36:43 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -376,6 +376,9 @@ typedef enum {
     PROTO_WAIS,
     PROTO_CACHEOBJ,
     PROTO_ICP,
+#if USE_HTCP
+    PROTO_HTCP,
+#endif
     PROTO_URN,
     PROTO_WHOIS,
     PROTO_INTERNAL,
index 43d91a9fd7d28b9872090a73ad26ca85e7feafe5..23a63a21ae6eec0655f0c729aaf61ff666d2dec3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: neighbors.cc,v 1.234 1998/08/21 03:15:19 wessels Exp $
+ * $Id: neighbors.cc,v 1.235 1998/08/26 05:36:44 wessels Exp $
  *
  * DEBUG: section 15    Neighbor Routines
  * AUTHOR: Harvest Derived
@@ -737,20 +737,20 @@ neighborsUdpAck(const cache_key * key, icp_common_t * header, const struct socka
            /* if we reach here, source-ping reply is the first 'parent',
             * so fetch directly from the source */
            debug(15, 6) ("Source is the first to respond.\n");
-           mem->icp_reply_callback(NULL, ntype, header, mem->ircb_data);
+           mem->icp_reply_callback(NULL, ntype, PROTO_ICP, header, mem->ircb_data);
        }
     } else if (opcode == ICP_MISS) {
        if (p == NULL) {
            neighborIgnoreNonPeer(from, opcode);
        } else {
-           mem->icp_reply_callback(p, ntype, header, mem->ircb_data);
+           mem->icp_reply_callback(p, ntype, PROTO_ICP, header, mem->ircb_data);
        }
     } else if (opcode == ICP_HIT) {
        if (p == NULL) {
            neighborIgnoreNonPeer(from, opcode);
        } else {
            header->opcode = ICP_HIT;
-           mem->icp_reply_callback(p, ntype, header, mem->ircb_data);
+           mem->icp_reply_callback(p, ntype, PROTO_ICP, header, mem->ircb_data);
        }
     } else if (opcode == ICP_DECHO) {
        if (p == NULL) {
@@ -759,7 +759,7 @@ neighborsUdpAck(const cache_key * key, icp_common_t * header, const struct socka
            debug_trap("neighborsUdpAck: Found non-ICP cache as SIBLING\n");
            debug_trap("neighborsUdpAck: non-ICP neighbors must be a PARENT\n");
        } else {
-           mem->icp_reply_callback(p, ntype, header, mem->ircb_data);
+           mem->icp_reply_callback(p, ntype, PROTO_ICP, header, mem->ircb_data);
        }
     } else if (opcode == ICP_SECHO) {
        if (p) {
@@ -767,7 +767,7 @@ neighborsUdpAck(const cache_key * key, icp_common_t * header, const struct socka
            neighborCountIgnored(p, opcode);
 #if ALLOW_SOURCE_PING
        } else if (Config.onoff.source_ping) {
-           mem->icp_reply_callback(NULL, ntype, header, mem->ircb_data);
+           mem->icp_reply_callback(NULL, ntype, PROTO_ICP, header, mem->ircb_data);
 #endif
        } else {
            debug(15, 1) ("Unsolicited SECHO from %s\n", inet_ntoa(from->sin_addr));
@@ -786,7 +786,7 @@ neighborsUdpAck(const cache_key * key, icp_common_t * header, const struct socka
            }
        }
     } else if (opcode == ICP_MISS_NOFETCH) {
-       mem->icp_reply_callback(p, ntype, header, mem->ircb_data);
+       mem->icp_reply_callback(p, ntype, PROTO_ICP, header, mem->ircb_data);
     } else {
        debug(15, 0) ("neighborsUdpAck: Unexpected ICP reply: %s\n", opcode_d);
     }
@@ -1021,12 +1021,13 @@ peerCountMcastPeersDone(void *data)
 }
 
 static void
-peerCountHandleIcpReply(peer * p, peer_t type, icp_common_t * hdrnotused, void *data)
+peerCountHandleIcpReply(peer * p, peer_t type, protocol_t proto, void * hdrnotused, void *data)
 {
     ps_state *psstate = data;
     StoreEntry *fake = psstate->entry;
     MemObject *mem = fake->mem_obj;
     int rtt = tvSubMsec(mem->start_ping, current_time);
+    assert(proto == PROTO_ICP);
     assert(fake);
     assert(mem);
     psstate->icp.n_recv++;
@@ -1142,3 +1143,10 @@ dump_peers(StoreEntry * sentry, peer * peers)
            percent(e->stats.n_keepalives_recv, e->stats.n_keepalives_sent));
     }
 }
+
+#if USE_HTCP
+void
+neighborsHtcpReply(const cache_key * key, htcpReplyData * htcp, const struct sockaddr_in *from)
+{
+}
+#endif
index 63d428a182e8ad6e206fd83d6725d34a1c2d9497..f9d434ee0ff584a66d88413b1c02cf2c4f25f879 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: peer_select.cc,v 1.77 1998/08/25 15:58:14 wessels Exp $
+ * $Id: peer_select.cc,v 1.78 1998/08/26 05:36:45 wessels Exp $
  *
  * DEBUG: section 44    Peer Selection Algorithm
  * AUTHOR: Duane Wessels
@@ -76,7 +76,7 @@ static char *DirectStr[] =
 static void peerSelectFoo(ps_state *);
 static void peerPingTimeout(void *data);
 static void peerSelectCallbackFail(ps_state * psstate);
-static IRCB peerHandleIcpReply;
+static IRCB peerHandlePingReply;
 static void peerSelectStateFree(ps_state * psstate);
 static void peerIcpParentMiss(peer *, icp_common_t *, ps_state *);
 static int peerCheckNetdbDirect(ps_state * psstate);
@@ -330,7 +330,7 @@ peerSelectFoo(ps_state * psstate)
        psstate->icp.start = current_time;
        psstate->icp.n_sent = neighborsUdpPing(request,
            entry,
-           peerHandleIcpReply,
+           peerHandlePingReply,
            psstate,
            &psstate->icp.n_replies_expected,
            &psstate->icp.timeout);
@@ -479,3 +479,25 @@ peerHandleIcpReply(peer * p, peer_t type, icp_common_t * header, void *data)
        return;
     peerSelectFoo(psstate);
 }
+
+#if USE_HTCP
+static void
+peerHandleHtcpReply(peer * p, peer_t type, icp_common_t * header, void *data)
+{
+    ps_state *psstate = data;
+    debug(44,1)("peerHandleHtcpReply: write me\n");
+}
+#endif
+
+static void
+peerHandlePingReply(peer * p, peer_t type, protocol_t proto, void *ping_data, void *data)
+{
+    if (proto == PROTO_ICP)
+       peerHandleIcpReply(p, type, ping_data, data);
+#if USE_HTCP
+    else if (proto == PROTO_HTCP)
+       peerHandleHtcpReply(p, type, ping_data, data);
+#endif
+    else
+       debug(44, 1) ("peerHandlePingReply: unknown protocol_t %d\n", (int) proto);
+}
index f35804844a98c9b80ca1cb56fcfa00bbda1c9325..a3184047559f046430d52d60bbae8b86f1176d7c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: protos.h,v 1.255 1998/08/25 19:10:10 wessels Exp $
+ * $Id: protos.h,v 1.256 1998/08/26 05:36:45 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -585,6 +585,9 @@ extern void peerCheckConnectStart(peer *);
 extern void dump_peer_options(StoreEntry *, peer *);
 extern int peerHTTPOkay(const peer *, request_t *);
 extern peer *whichPeer(const struct sockaddr_in *from);
+#if USE_HTCP
+extern void neighborsHtcpReply(const cache_key *, htcpReplyData *, const struct sockaddr_in *);
+#endif
 
 extern void netdbInit(void);
 extern void netdbHandlePingReply(const struct sockaddr_in *from, int hops, int rtt);
index 8c8584db4ac5a9161e44255d1f8404becdb2c8fd..3169d3af043a23c6113cc7b2b1d1f96c9431d58d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.209 1998/08/21 04:03:49 wessels Exp $
+ * $Id: structs.h,v 1.210 1998/08/26 05:36:46 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -1489,3 +1489,11 @@ struct _FwdServer {
     peer *peer;
     struct _FwdServer *next;
 };
+
+#if USE_HTCP
+struct _htcpReplyData {
+       int hit;
+       HttpHeader hdr;
+       u_num32 msg_id;
+};
+#endif
index 8f98d107cd694c1c74052fdaa2224f5649c65e6d..2f15caa47f70caedbf2da989f793bc7818b21680 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: typedefs.h,v 1.71 1998/08/21 03:15:27 wessels Exp $
+ * $Id: typedefs.h,v 1.72 1998/08/26 05:36:47 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -176,7 +176,7 @@ typedef void DWCB(int, int, size_t, void *);
 typedef void FQDNH(const char *, void *);
 typedef void IDCB(void *);
 typedef void IPH(const ipcache_addrs *, void *);
-typedef void IRCB(peer *, peer_t, icp_common_t *, void *data);
+typedef void IRCB(peer *, peer_t, protocol_t, void *, void *data);
 typedef void PSC(peer *, void *);
 typedef void RH(void *data, char *);
 typedef void UH(void *data, wordlist *);
@@ -226,3 +226,7 @@ typedef void (*ObjPackMethod) (void *obj, Packer * p);
 #if DELAY_POOLS
 typedef int delay_id;
 #endif
+
+#if USE_HTCP
+typedef struct _htcpReplyData htcpReplyData;
+#endif