from enums.
protoStart() can be static and should use a switch() instead of
if-else-else
#
# Makefile for the Squid Object Cache server
#
-# $Id: Makefile.in,v 1.95 1997/11/13 05:25:47 wessels Exp $
+# $Id: Makefile.in,v 1.96 1997/11/20 06:25:24 wessels Exp $
#
# Uncomment and customize the following to suit your needs:
#
store_dir.o \
store_key_sha.o \
store_key_url.o \
+ string_arrays.o \
tools.o \
unlinkd.o \
url.o \
globals.c: globals.h mk-globals-c.pl
$(PERL) mk-globals-c.pl < globals.h > $@
+string_arrays.c: enums.h mk-string-arrays.pl
+ $(PERL) mk-string-arrays.pl < enums.h > $@
+
client: client.o
$(CC) -o $@ $(LDFLAGS) $@.o $(CLIENT_LIBS)
/*
- * $Id: access_log.cc,v 1.10 1997/11/12 23:36:20 wessels Exp $
+ * $Id: access_log.cc,v 1.11 1997/11/20 06:25:25 wessels Exp $
*
* DEBUG: section 46 Access Log
* AUTHOR: Duane Wessels
if (!al->cache.ident || *al->cache.ident == '\0')
al->cache.ident = dash_str;
if (al->icp.opcode)
- al->private.method_str = IcpOpcodeStr[al->icp.opcode];
+ al->private.method_str = icp_opcode_str[al->icp.opcode];
else
al->private.method_str = RequestMethodStr[al->http.method];
if (al->hier.host[0] == '\0')
} hier_code;
typedef enum {
- ICP_OP_INVALID, /* 00 to insure 0 doesn't get accidently interpreted. */
- ICP_OP_QUERY, /* 01 query opcode (cl->sv) */
- ICP_OP_HIT, /* 02 hit (cl<-sv) */
- ICP_OP_MISS, /* 03 miss (cl<-sv) */
- ICP_OP_ERR, /* 04 error (cl<-sv) */
- ICP_OP_SEND, /* 05 send object non-auth (cl->sv) */
- ICP_OP_SENDA, /* 06 send object authoritative (cl->sv) */
- ICP_OP_DATABEG, /* 07 first data, but not last (sv<-cl) */
- ICP_OP_DATA, /* 08 data middle of stream (sv<-cl) */
- ICP_OP_DATAEND, /* 09 last data (sv<-cl) */
- ICP_OP_SECHO, /* 10 echo from source (sv<-os) */
- ICP_OP_DECHO, /* 11 echo from dumb cache (sv<-dc) */
- ICP_OP_UNUSED0, /* 12 */
- ICP_OP_UNUSED1, /* 13 */
- ICP_OP_UNUSED2, /* 14 */
- ICP_OP_UNUSED3, /* 15 */
- ICP_OP_UNUSED4, /* 16 */
- ICP_OP_UNUSED5, /* 17 */
- ICP_OP_UNUSED6, /* 18 */
- ICP_OP_UNUSED7, /* 19 */
- ICP_OP_UNUSED8, /* 20 */
- ICP_OP_MISS_NOFETCH, /* 21 access denied while reloading */
- ICP_OP_DENIED, /* 22 access denied (cl<-sv) */
- ICP_OP_HIT_OBJ, /* 23 hit with object data (cl<-sv) */
- ICP_OP_END /* 24 marks end of opcodes */
+ ICP_INVALID,
+ ICP_QUERY,
+ ICP_HIT,
+ ICP_MISS,
+ ICP_ERR,
+ ICP_SEND,
+ ICP_SENDA,
+ ICP_DATABEG,
+ ICP_DATA,
+ ICP_DATAEND,
+ ICP_SECHO,
+ ICP_DECHO,
+ ICP_UNUSED12,
+ ICP_UNUSED13,
+ ICP_UNUSED14,
+ ICP_UNUSED15,
+ ICP_UNUSED16,
+ ICP_UNUSED17,
+ ICP_UNUSED18,
+ ICP_UNUSED19,
+ ICP_UNUSED20,
+ ICP_MISS_NOFETCH,
+ ICP_DENIED,
+ ICP_HIT_OBJ,
+ ICP_END
} icp_opcode;
enum {
/*
- * $Id: errorpage.cc,v 1.101 1997/11/12 00:08:49 wessels Exp $
+ * $Id: errorpage.cc,v 1.102 1997/11/20 06:25:26 wessels Exp $
*
* DEBUG: section 4 Error Generation
* AUTHOR: Duane Wessels
#include "squid.h"
-static const char *err_string[] =
-{
- "ERR_NONE",
- "ERR_READ_TIMEOUT",
- "ERR_LIFETIME_EXP",
- "ERR_READ_ERROR",
- "ERR_WRITE_ERROR",
- "ERR_CLIENT_ABORT",
- "ERR_CONNECT_FAIL",
- "ERR_INVALID_REQ",
- "ERR_UNSUP_REQ",
- "ERR_INVALID_URL",
- "ERR_SOCKET_FAILURE",
- "ERR_DNS_FAIL",
- "ERR_CANNOT_FORWARD",
- "ERR_NO_RELAY",
- "ERR_ZERO_SIZE_OBJECT",
- "ERR_FTP_DISABLED",
- "ERR_FTP_FAILURE",
- "ERR_ACCESS_DENIED",
- "ERR_MAX"
-};
-
static char *error_text[ERR_MAX];
static void errorStateFree(ErrorState * err);
int fd;
char path[MAXPATHLEN];
struct stat sb;
- assert(sizeof(err_string) == (ERR_MAX + 1) * sizeof(char *));
for (i = ERR_NONE + 1; i < ERR_MAX; i++) {
snprintf(path, MAXPATHLEN, "%s/%s",
- Config.errorDirectory, err_string[i]);
+ Config.errorDirectory, err_type_str[i]);
fd = file_open(path, O_RDONLY, NULL, NULL);
if (fd < 0) {
debug(4, 0) ("errorInitialize: %s: %s\n", path, xstrerror());
/*
- * $Id: globals.h,v 1.18 1997/11/15 00:14:48 wessels Exp $
+ * $Id: globals.h,v 1.19 1997/11/20 06:25:26 wessels Exp $
*/
extern FILE *debug_log; /* NULL */
extern icpUdpData *UdpQueueTail; /* NULL */
extern time_t hit_only_mode_until; /* 0 */
extern StatCounters Counter;
+extern char *err_type_str[];
+extern char *icp_opcode_str[];
#ifdef HAVE_SYSLOG
extern int _db_level;
if (!Config.onoff.log_udp)
return;
memset(&al, '\0', sizeof(AccessLogEntry));
- al.icp.opcode = ICP_OP_QUERY;
+ al.icp.opcode = ICP_QUERY;
al.url = url;
al.cache.caddr = queue->address.sin_addr;
al.cache.size = queue->len;
char *urloffset = NULL;
int buf_len;
buf_len = sizeof(icp_common_t) + strlen(url) + 1;
- if (opcode == ICP_OP_QUERY)
+ if (opcode == ICP_QUERY)
buf_len += sizeof(u_num32);
buf = xcalloc(buf_len, 1);
headerp = (icp_common_t *) (void *) buf;
headerp->pad = htonl(pad);
headerp->shostid = htonl(theOutICPAddr.s_addr);
urloffset = buf + sizeof(icp_common_t);
- if (opcode == ICP_OP_QUERY)
+ if (opcode == ICP_QUERY)
urloffset += sizeof(u_num32);
xmemcpy(urloffset, url, strlen(url));
return buf;
MemObject *m = entry->mem_obj;
assert(m != NULL);
buf_len = sizeof(icp_common_t) + strlen(url) + 1 + 2 + entry->object_len;
- if (opcode == ICP_OP_QUERY)
+ if (opcode == ICP_QUERY)
buf_len += sizeof(u_num32);
buf = xcalloc(buf_len, 1);
headerp = (icp_common_t *) (void *) buf;
{
icpUdpData *data = xcalloc(1, sizeof(icpUdpData));
debug(12, 4) ("icpUdpSend: Queueing %s for %s\n",
- IcpOpcodeStr[msg->opcode],
+ icp_opcode_str[msg->opcode],
inet_ntoa(to->sin_addr));
data->address = *to;
data->msg = msg;
header.pad = ntohl(headerp->pad);
switch (header.opcode) {
- case ICP_OP_QUERY:
+ case ICP_QUERY:
/* We have a valid packet */
url = buf + sizeof(header) + sizeof(u_num32);
if ((icp_request = urlParse(METHOD_GET, url)) == NULL) {
- reply = icpCreateMessage(ICP_OP_ERR, 0, url, header.reqnum, 0);
+ reply = icpCreateMessage(ICP_ERR, 0, url, header.reqnum, 0);
icpUdpSend(fd, &from, reply, LOG_UDP_INVALID, PROTO_NONE);
break;
}
debug(12, 2) ("icpHandleIcpV2: Access Denied for %s by %s.\n",
inet_ntoa(from.sin_addr), AclMatchedName);
if (clientdbDeniedPercent(from.sin_addr) < 95) {
- reply = icpCreateMessage(ICP_OP_DENIED, 0, url, header.reqnum, 0);
+ reply = icpCreateMessage(ICP_DENIED, 0, url, header.reqnum, 0);
icpUdpSend(fd, &from, reply, LOG_UDP_DENIED, icp_request->protocol);
}
break;
/* The peer is allowed to use this cache */
key = storeKeyPublic(url, METHOD_GET);
entry = storeGet(key);
- debug(12, 5) ("icpHandleIcpV2: OPCODE %s\n", IcpOpcodeStr[header.opcode]);
+ debug(12, 5) ("icpHandleIcpV2: OPCODE %s\n", icp_opcode_str[header.opcode]);
if (icpCheckUdpHit(entry, icp_request)) {
pkt_len = sizeof(icp_common_t) + strlen(url) + 1 + 2 + entry->object_len;
#if USE_ICP_HIT_OBJ
if (icpCheckUdpHitObj(entry, icp_request, &header, pkt_len)) {
- reply = icpCreateHitObjMessage(ICP_OP_HIT_OBJ,
+ reply = icpCreateHitObjMessage(ICP_HIT_OBJ,
flags,
url,
header.reqnum,
break;
} else {
#endif
- reply = icpCreateMessage(ICP_OP_HIT, flags, url, header.reqnum, src_rtt);
+ reply = icpCreateMessage(ICP_HIT, flags, url, header.reqnum, src_rtt);
icpUdpSend(fd, &from, reply, LOG_UDP_HIT, icp_request->protocol);
break;
#if USE_ICP_HIT_OBJ
}
/* if store is rebuilding, return a UDP_HIT, but not a MISS */
if (store_rebuilding && opt_reload_hit_only) {
- reply = icpCreateMessage(ICP_OP_MISS_NOFETCH, flags, url, header.reqnum, src_rtt);
+ reply = icpCreateMessage(ICP_MISS_NOFETCH, flags, url, header.reqnum, src_rtt);
icpUdpSend(fd, &from, reply, LOG_UDP_MISS_NOFETCH, icp_request->protocol);
} else if (hit_only_mode_until > squid_curtime) {
- reply = icpCreateMessage(ICP_OP_MISS_NOFETCH, flags, url, header.reqnum, src_rtt);
+ reply = icpCreateMessage(ICP_MISS_NOFETCH, flags, url, header.reqnum, src_rtt);
icpUdpSend(fd, &from, reply, LOG_UDP_MISS_NOFETCH, icp_request->protocol);
} else {
- reply = icpCreateMessage(ICP_OP_MISS, flags, url, header.reqnum, src_rtt);
+ reply = icpCreateMessage(ICP_MISS, flags, url, header.reqnum, src_rtt);
icpUdpSend(fd, &from, reply, LOG_UDP_MISS, icp_request->protocol);
}
break;
- case ICP_OP_HIT_OBJ:
- case ICP_OP_HIT:
- case ICP_OP_SECHO:
- case ICP_OP_DECHO:
- case ICP_OP_MISS:
- case ICP_OP_DENIED:
- case ICP_OP_MISS_NOFETCH:
+ case ICP_HIT_OBJ:
+ case ICP_HIT:
+ case ICP_SECHO:
+ case ICP_DECHO:
+ case ICP_MISS:
+ case ICP_DENIED:
+ case ICP_MISS_NOFETCH:
if (neighbors_do_private_keys && header.reqnum == 0) {
debug(12, 0) ("icpHandleIcpV2: Neighbor %s returned reqnum = 0\n",
inet_ntoa(from.sin_addr));
neighbors_do_private_keys = 0;
}
url = buf + sizeof(header);
- if (header.opcode == ICP_OP_HIT_OBJ) {
+ if (header.opcode == ICP_HIT_OBJ) {
data = url + strlen(url) + 1;
xmemcpy((char *) &u, data, sizeof(u_short));
data += sizeof(u_short);
data_sz = ntohs(u);
if ((int) data_sz > (len - (data - buf))) {
- debug(12, 0) ("icpHandleIcpV2: ICP_OP_HIT_OBJ object too small\n");
+ debug(12, 0) ("icpHandleIcpV2: ICP_HIT_OBJ object too small\n");
break;
}
}
debug(12, 3) ("icpHandleIcpV2: %s from %s for '%s'\n",
- IcpOpcodeStr[header.opcode],
+ icp_opcode_str[header.opcode],
inet_ntoa(from.sin_addr),
url);
if (neighbors_do_private_keys && header.reqnum)
storeKeyText(key));
if ((entry = storeGet(key)) == NULL) {
debug(12, 3) ("icpHandleIcpV2: Ignoring %s for NULL Entry.\n",
- IcpOpcodeStr[header.opcode]);
+ icp_opcode_str[header.opcode]);
} else {
/* call neighborsUdpAck even if ping_status != PING_WAITING */
neighborsUdpAck(url, &header, &from, entry);
}
break;
- case ICP_OP_INVALID:
- case ICP_OP_ERR:
+ case ICP_INVALID:
+ case ICP_ERR:
break;
default:
debug(12, 9) ("opcode: %3d %s\n",
(int) pkt->opcode,
- IcpOpcodeStr[pkt->opcode]);
+ icp_opcode_str[pkt->opcode]);
debug(12, 9) ("version: %-8d\n", (int) pkt->version);
debug(12, 9) ("length: %-8d\n", (int) ntohs(pkt->length));
debug(12, 9) ("reqnum: %-8d\n", ntohl(pkt->reqnum));
header.shostid = ntohl(headerp->shostid);
switch (header.opcode) {
- case ICP_OP_QUERY:
+ case ICP_QUERY:
/* We have a valid packet */
url = buf + sizeof(header) + sizeof(u_num32);
if ((icp_request = urlParse(METHOD_GET, url)) == NULL) {
- reply = icpCreateMessage(ICP_OP_ERR, 0, url, header.reqnum, 0);
+ reply = icpCreateMessage(ICP_ERR, 0, url, header.reqnum, 0);
icpUdpSend(fd, &from, reply, LOG_UDP_INVALID, PROTO_NONE);
break;
}
debug(12, 2) ("icpHandleIcpV3: Access Denied for %s by %s.\n",
inet_ntoa(from.sin_addr), AclMatchedName);
if (clientdbDeniedPercent(from.sin_addr) < 95) {
- reply = icpCreateMessage(ICP_OP_DENIED, 0, url, header.reqnum, 0);
+ reply = icpCreateMessage(ICP_DENIED, 0, url, header.reqnum, 0);
icpUdpSend(fd, &from, reply, LOG_UDP_DENIED, icp_request->protocol);
}
break;
key = storeKeyPublic(url, METHOD_GET);
entry = storeGet(key);
debug(12, 5) ("icpHandleIcpV3: OPCODE %s\n",
- IcpOpcodeStr[header.opcode]);
+ icp_opcode_str[header.opcode]);
if (icpCheckUdpHit(entry, icp_request)) {
- reply = icpCreateMessage(ICP_OP_HIT, 0, url, header.reqnum, 0);
+ reply = icpCreateMessage(ICP_HIT, 0, url, header.reqnum, 0);
icpUdpSend(fd, &from, reply, LOG_UDP_HIT, icp_request->protocol);
break;
}
/* if store is rebuilding, return a UDP_HIT, but not a MISS */
if (opt_reload_hit_only && store_rebuilding) {
- reply = icpCreateMessage(ICP_OP_MISS_NOFETCH, 0, url, header.reqnum, 0);
+ reply = icpCreateMessage(ICP_MISS_NOFETCH, 0, url, header.reqnum, 0);
icpUdpSend(fd, &from, reply, LOG_UDP_MISS_NOFETCH, icp_request->protocol);
} else if (hit_only_mode_until > squid_curtime) {
- reply = icpCreateMessage(ICP_OP_MISS_NOFETCH, 0, url, header.reqnum, 0);
+ reply = icpCreateMessage(ICP_MISS_NOFETCH, 0, url, header.reqnum, 0);
icpUdpSend(fd, &from, reply, LOG_UDP_MISS_NOFETCH, icp_request->protocol);
} else {
- reply = icpCreateMessage(ICP_OP_MISS, 0, url, header.reqnum, 0);
+ reply = icpCreateMessage(ICP_MISS, 0, url, header.reqnum, 0);
icpUdpSend(fd, &from, reply, LOG_UDP_MISS, icp_request->protocol);
}
break;
- case ICP_OP_HIT_OBJ:
- case ICP_OP_HIT:
- case ICP_OP_SECHO:
- case ICP_OP_DECHO:
- case ICP_OP_MISS:
- case ICP_OP_DENIED:
- case ICP_OP_MISS_NOFETCH:
+ case ICP_HIT_OBJ:
+ case ICP_HIT:
+ case ICP_SECHO:
+ case ICP_DECHO:
+ case ICP_MISS:
+ case ICP_DENIED:
+ case ICP_MISS_NOFETCH:
if (neighbors_do_private_keys && header.reqnum == 0) {
debug(12, 0) ("icpHandleIcpV3: Neighbor %s returned reqnum = 0\n",
inet_ntoa(from.sin_addr));
neighbors_do_private_keys = 0;
}
url = buf + sizeof(header);
- if (header.opcode == ICP_OP_HIT_OBJ) {
+ if (header.opcode == ICP_HIT_OBJ) {
data = url + strlen(url) + 1;
xmemcpy((char *) &u, data, sizeof(u_short));
data += sizeof(u_short);
data_sz = ntohs(u);
if ((int) data_sz > (len - (data - buf))) {
- debug(12, 0) ("icpHandleIcpV3: ICP_OP_HIT_OBJ object too small\n");
+ debug(12, 0) ("icpHandleIcpV3: ICP_HIT_OBJ object too small\n");
break;
}
}
debug(12, 3) ("icpHandleIcpV3: %s from %s for '%s'\n",
- IcpOpcodeStr[header.opcode],
+ icp_opcode_str[header.opcode],
inet_ntoa(from.sin_addr),
url);
if (neighbors_do_private_keys && header.reqnum)
storeKeyText(key));
if ((entry = storeGet(key)) == NULL) {
debug(12, 3) ("icpHandleIcpV3: Ignoring %s for NULL Entry.\n",
- IcpOpcodeStr[header.opcode]);
+ icp_opcode_str[header.opcode]);
} else {
/* call neighborsUdpAck even if ping_status != PING_WAITING */
neighborsUdpAck(url, &header, &from, entry);
}
break;
- case ICP_OP_INVALID:
- case ICP_OP_ERR:
+ case ICP_INVALID:
+ case ICP_ERR:
break;
default:
/*
- * $Id: neighbors.cc,v 1.168 1997/11/12 23:47:39 wessels Exp $
+ * $Id: neighbors.cc,v 1.169 1997/11/20 06:25:28 wessels Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
debug(15, 1) ("getsockname(%d,%p,%p) failed.\n", fd, &name, &len);
peerRefreshDNS(NULL);
if (0 == echo_hdr.opcode) {
- echo_hdr.opcode = ICP_OP_SECHO;
+ echo_hdr.opcode = ICP_SECHO;
echo_hdr.version = ICP_VERSION_CURRENT;
echo_hdr.length = 0;
echo_hdr.reqnum = 0;
if (p->icp_port == echo_port) {
debug(15, 4) ("neighborsUdpPing: Looks like a dumb cache, send DECHO ping\n");
echo_hdr.reqnum = reqnum;
- query = icpCreateMessage(ICP_OP_DECHO, 0, url, reqnum, 0);
+ query = icpCreateMessage(ICP_DECHO, 0, url, reqnum, 0);
icpUdpSend(theOutIcpConnection,
&p->in_addr,
query,
if (Config.onoff.query_icmp)
if (p->icp_version == ICP_VERSION_2)
flags |= ICP_FLAG_SRC_RTT;
- query = icpCreateMessage(ICP_OP_QUERY, flags, url, reqnum, 0);
+ query = icpCreateMessage(ICP_QUERY, flags, url, reqnum, 0);
icpUdpSend(theOutIcpConnection,
&p->in_addr,
query,
to_addr.sin_family = AF_INET;
to_addr.sin_addr = ia->in_addrs[ia->cur];
to_addr.sin_port = htons(echo_port);
- query = icpCreateMessage(ICP_OP_SECHO, 0, url, reqnum, 0);
+ query = icpCreateMessage(ICP_SECHO, 0, url, reqnum, 0);
icpUdpSend(theOutIcpConnection,
&to_addr,
query,
}
p->stats.ack_deficit = 0;
n = ++p->stats.pings_acked;
- if ((icp_opcode) header->opcode <= ICP_OP_END)
+ if ((icp_opcode) header->opcode <= ICP_END)
p->stats.counts[header->opcode]++;
if (mem) {
rtt = tvSubMsec(mem->start_ping, current_time);
debug(15, 6) ("neighborsUdpAck: opcode %d '%s'\n", (int) opcode, url);
if ((p = whichPeer(from)))
neighborAlive(p, mem, header);
- if (opcode > ICP_OP_END)
+ if (opcode > ICP_END)
return;
- opcode_d = IcpOpcodeStr[opcode];
+ opcode_d = icp_opcode_str[opcode];
/* check if someone is already fetching it */
if (EBIT_TEST(entry->flag, ENTRY_DISPATCHED)) {
debug(15, 3) ("neighborsUdpAck: '%s' already being fetched.\n", url);
ntype = neighborType(p, mem->request);
if (ignoreMulticastReply(p, mem)) {
neighborCountIgnored(p, opcode);
- } else if (opcode == ICP_OP_SECHO) {
+ } else if (opcode == ICP_SECHO) {
/* Received source-ping reply */
if (p) {
debug(15, 1) ("Ignoring SECHO from neighbor %s\n", p->host);
debug(15, 6) ("Source is the first to respond.\n");
mem->icp_reply_callback(NULL, ntype, header, mem->ircb_data);
}
- } else if (opcode == ICP_OP_MISS) {
+ } else if (opcode == ICP_MISS) {
if (p == NULL) {
neighborIgnoreNonPeer(from, opcode);
} else if (ntype != PEER_PARENT) {
} else {
mem->icp_reply_callback(p, ntype, header, mem->ircb_data);
}
- } else if (opcode == ICP_OP_HIT || opcode == ICP_OP_HIT_OBJ) {
+ } else if (opcode == ICP_HIT || opcode == ICP_HIT_OBJ) {
if (p == NULL) {
neighborIgnoreNonPeer(from, opcode);
} else {
- header->opcode = ICP_OP_HIT;
+ header->opcode = ICP_HIT;
mem->icp_reply_callback(p, ntype, header, mem->ircb_data);
}
- } else if (opcode == ICP_OP_DECHO) {
+ } else if (opcode == ICP_DECHO) {
if (p == NULL) {
neighborIgnoreNonPeer(from, opcode);
} else if (ntype == PEER_SIBLING) {
} else {
mem->icp_reply_callback(p, ntype, header, mem->ircb_data);
}
- } else if (opcode == ICP_OP_SECHO) {
+ } else if (opcode == ICP_SECHO) {
if (p) {
debug(15, 1) ("Ignoring SECHO from neighbor %s\n", p->host);
neighborCountIgnored(p, opcode);
} else {
mem->icp_reply_callback(NULL, ntype, header, mem->ircb_data);
}
- } else if (opcode == ICP_OP_DENIED) {
+ } else if (opcode == ICP_DENIED) {
if (p == NULL) {
neighborIgnoreNonPeer(from, opcode);
} else if (p->stats.pings_acked > 100) {
- if (100 * p->stats.counts[ICP_OP_DENIED] / p->stats.pings_acked > 95) {
+ if (100 * p->stats.counts[ICP_DENIED] / p->stats.pings_acked > 95) {
debug(15, 0) ("95%% of replies from '%s' are UDP_DENIED\n", p->host);
debug(15, 0) ("Disabling '%s', please check your configuration.\n", p->host);
neighborRemove(p);
neighborCountIgnored(p, opcode);
}
}
- } else if (opcode == ICP_OP_MISS_NOFETCH) {
+ } else if (opcode == ICP_MISS_NOFETCH) {
mem->icp_reply_callback(p, ntype, header, mem->ircb_data);
} else {
debug(15, 0) ("neighborsUdpAck: Unexpected ICP reply: %s\n", opcode_d);
mem->ircb_data = psstate;
mcastSetTtl(theOutIcpConnection, p->mcast.ttl);
p->mcast.reqnum = mem->reqnum;
- query = icpCreateMessage(ICP_OP_QUERY, 0, url, p->mcast.reqnum, 0);
+ query = icpCreateMessage(ICP_QUERY, 0, url, p->mcast.reqnum, 0);
icpUdpSend(theOutIcpConnection,
&p->in_addr,
query,
/*
- * $Id: peer_select.cc,v 1.32 1997/11/12 00:09:01 wessels Exp $
+ * $Id: peer_select.cc,v 1.33 1997/11/20 06:25:29 wessels Exp $
*
* DEBUG: section 44 Peer Selection Algorithm
* AUTHOR: Duane Wessels
icp_opcode op = header->opcode;
request_t *request = psstate->request;
debug(44, 3) ("peerHandleIcpReply: %s %s\n",
- IcpOpcodeStr[op],
+ icp_opcode_str[op],
storeUrl(psstate->entry));
psstate->icp.n_recv++;
- if (op == ICP_OP_MISS || op == ICP_OP_DECHO) {
+ if (op == ICP_MISS || op == ICP_DECHO) {
if (type == PEER_PARENT)
peerIcpParentMiss(p, header, psstate);
- } else if (op == ICP_OP_HIT || op == ICP_OP_HIT_OBJ) {
+ } else if (op == ICP_HIT || op == ICP_HIT_OBJ) {
hierarchyNote(&request->hier,
type == PEER_PARENT ? PARENT_HIT : SIBLING_HIT,
&psstate->icp,
p->host);
peerSelectCallback(psstate, p);
return;
- } else if (op == ICP_OP_SECHO) {
+ } else if (op == ICP_SECHO) {
hierarchyNote(&request->hier,
SOURCE_FASTEST,
&psstate->icp,
extern void protoDispatch(int, StoreEntry *, request_t *);
extern int protoUnregister(StoreEntry *, request_t *);
-extern void protoStart(int, StoreEntry *, peer *, request_t *);
extern int protoAbortFetch(StoreEntry * entry);
extern DEFER protoCheckDeferRead;
/*
- * $Id: stat.cc,v 1.174 1997/11/18 01:02:40 wessels Exp $
+ * $Id: stat.cc,v 1.175 1997/11/20 06:25:31 wessels Exp $
*
* DEBUG: section 18 Cache Manager Statistics
* AUTHOR: Harvest Derived
e->stats.ignored_replies,
percent(e->stats.ignored_replies, e->stats.pings_acked));
storeAppendPrintf(sentry, "{Histogram of PINGS ACKED:}\n");
- for (op = ICP_OP_INVALID; op < ICP_OP_END; op++) {
+ for (op = ICP_INVALID; op < ICP_END; op++) {
if (e->stats.counts[op] == 0)
continue;
storeAppendPrintf(sentry, "{ %12.12s : %8d %3d%%}\n",
- IcpOpcodeStr[op],
+ icp_opcode_str[op],
e->stats.counts[op],
percent(e->stats.counts[op], e->stats.pings_acked));
}
int ack_deficit;
int fetches;
int rtt;
- int counts[ICP_OP_END];
+ int counts[ICP_END];
int ignored_replies;
int n_keepalives_sent;
int n_keepalives_recv;