From: wessels <> Date: Wed, 26 Aug 1998 11:36:42 +0000 (+0000) Subject: HTCP progress X-Git-Tag: SQUID_3_0_PRE1~2790 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=86aebcda0d9485b1db66778b9c2cd2e417c7138f;p=thirdparty%2Fsquid.git HTCP progress --- diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc index b601aa8b67..d9b5fddc1a 100644 --- a/src/HttpHeader.cc +++ b/src/HttpHeader.cc @@ -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 */ diff --git a/src/enums.h b/src/enums.h index d2fbd09a45..0d68c9a37c 100644 --- a/src/enums.h +++ b/src/enums.h @@ -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, diff --git a/src/neighbors.cc b/src/neighbors.cc index 43d91a9fd7..23a63a21ae 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -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 diff --git a/src/peer_select.cc b/src/peer_select.cc index 63d428a182..f9d434ee0f 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -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); +} diff --git a/src/protos.h b/src/protos.h index f35804844a..a318404755 100644 --- a/src/protos.h +++ b/src/protos.h @@ -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); diff --git a/src/structs.h b/src/structs.h index 8c8584db4a..3169d3af04 100644 --- a/src/structs.h +++ b/src/structs.h @@ -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 diff --git a/src/typedefs.h b/src/typedefs.h index 8f98d107cd..2f15caa47f 100644 --- a/src/typedefs.h +++ b/src/typedefs.h @@ -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