|
|
|
@ -13,7 +13,6 @@
|
|
|
|
|
|
|
|
|
|
void *
|
|
|
|
|
make_icp_sendline (url, shost, opcode, length)
|
|
|
|
|
|
|
|
|
|
const char *url;
|
|
|
|
|
u_num32 *shost;
|
|
|
|
|
icp_opcode opcode;
|
|
|
|
@ -51,7 +50,6 @@ make_icp_sendline (url, shost, opcode, length)
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
recv_icp (sockfd, buf, retcode)
|
|
|
|
|
|
|
|
|
|
int sockfd;
|
|
|
|
|
char *buf;
|
|
|
|
|
char *retcode;
|
|
|
|
@ -62,43 +60,42 @@ recv_icp (sockfd, buf, retcode)
|
|
|
|
|
icp_common_t *headerp = (icp_common_t *) buf;
|
|
|
|
|
int nr, length;
|
|
|
|
|
unsigned char opcode;
|
|
|
|
|
static char *icp_op_code[] =
|
|
|
|
|
{
|
|
|
|
|
/* 0 */ "ICP_OP_INVALID",
|
|
|
|
|
/* 1 */ "ICP_OP_QUERY",
|
|
|
|
|
/* 2 */ "ICP_OP_HIT",
|
|
|
|
|
/* 3 */ "ICP_OP_MISS",
|
|
|
|
|
/* 4 */ "ICP_OP_ERR",
|
|
|
|
|
/* 5 */ "",
|
|
|
|
|
/* 6 */ "",
|
|
|
|
|
/* 7 */ "",
|
|
|
|
|
/* 8 */ "",
|
|
|
|
|
/* 9 */ "",
|
|
|
|
|
/* 10 */ "ICP_OP_SECHO",
|
|
|
|
|
/* 11 */ "ICP_OP_DECHO",
|
|
|
|
|
/* 12 */ "",
|
|
|
|
|
/* 13 */ "",
|
|
|
|
|
/* 14 */ "",
|
|
|
|
|
/* 15 */ "",
|
|
|
|
|
/* 16 */ "",
|
|
|
|
|
/* 17 */ "",
|
|
|
|
|
/* 18 */ "",
|
|
|
|
|
/* 19 */ "",
|
|
|
|
|
/* 20 */ "",
|
|
|
|
|
/* 21 */ "ICP_OP_MISS_NOFETCH",
|
|
|
|
|
/* 22 */ "ICP_OP_DENIED",
|
|
|
|
|
/* 23 */ "ICP_OP_HIT_OBJ"
|
|
|
|
|
static char *icp_op_code[] = {
|
|
|
|
|
/* 0 */ "ICP_OP_INVALID",
|
|
|
|
|
/* 1 */ "ICP_OP_QUERY",
|
|
|
|
|
/* 2 */ "ICP_OP_HIT",
|
|
|
|
|
/* 3 */ "ICP_OP_MISS",
|
|
|
|
|
/* 4 */ "ICP_OP_ERR",
|
|
|
|
|
/* 5 */ "",
|
|
|
|
|
/* 6 */ "",
|
|
|
|
|
/* 7 */ "",
|
|
|
|
|
/* 8 */ "",
|
|
|
|
|
/* 9 */ "",
|
|
|
|
|
/* 10 */ "ICP_OP_SECHO",
|
|
|
|
|
/* 11 */ "ICP_OP_DECHO",
|
|
|
|
|
/* 12 */ "",
|
|
|
|
|
/* 13 */ "",
|
|
|
|
|
/* 14 */ "",
|
|
|
|
|
/* 15 */ "",
|
|
|
|
|
/* 16 */ "",
|
|
|
|
|
/* 17 */ "",
|
|
|
|
|
/* 18 */ "",
|
|
|
|
|
/* 19 */ "",
|
|
|
|
|
/* 20 */ "",
|
|
|
|
|
/* 21 */ "ICP_OP_MISS_NOFETCH",
|
|
|
|
|
/* 22 */ "ICP_OP_DENIED",
|
|
|
|
|
/* 23 */ "ICP_OP_HIT_OBJ"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nr = recvfrom (sockfd, buf, DEFLINE, 0,
|
|
|
|
|
(struct sockaddr *) 0, (int *) 0);
|
|
|
|
|
if (nr < 0) {
|
|
|
|
|
if (timeout_flag)
|
|
|
|
|
err_quit ("Timeout while reading");
|
|
|
|
|
else
|
|
|
|
|
err_sys ("No reply from ICP proxy server");
|
|
|
|
|
}
|
|
|
|
|
nr = recvfrom (sockfd, buf, DEFLINE, 0, (struct sockaddr *) 0, (int *) 0);
|
|
|
|
|
if (nr < 0)
|
|
|
|
|
{
|
|
|
|
|
if (timeout_flag)
|
|
|
|
|
err_quit ("Timeout while reading");
|
|
|
|
|
else
|
|
|
|
|
err_sys ("No reply from ICP proxy server");
|
|
|
|
|
}
|
|
|
|
|
opcode = headerp->opcode;
|
|
|
|
|
length = ntohs (headerp->length);
|
|
|
|
|
sprintf (retcode, "ICP reply: \42%s\42", icp_op_code[opcode]);
|
|
|
|
@ -107,9 +104,3 @@ recv_icp (sockfd, buf, retcode)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* ICP */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|