--------------------- PatchSet 3032 Date: 2001/09/15 19:27:29 Author: serassio Branch: nt-2_3-tolsty Tag: (none) Log: Fixed indent problems Members: src/ftp.c:1.1.1.3.4.3.2.1.2.1->1.1.1.3.4.3.2.1.2.2 src/helper.c:1.1.1.3.24.1.2.1->1.1.1.3.24.1.2.2 src/htcp.c:1.1.1.2.4.1.2.2.2.1->1.1.1.2.4.1.2.2.2.2 src/http.c:1.1.1.3.4.3.2.2.2.2->1.1.1.3.4.3.2.2.2.3 src/icmp.c:1.1.1.2.4.2.2.1.2.1->1.1.1.2.4.2.2.1.2.2 src/pinger.c:1.1.1.3.4.1.2.1.2.2->1.1.1.3.4.1.2.1.2.3 src/protos.h:1.1.1.3.4.1.2.6.2.2->1.1.1.3.4.1.2.6.2.3 src/squid.h:1.1.1.3.4.1.2.3.2.1->1.1.1.3.4.1.2.3.2.2 Index: squid/src/ftp.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/ftp.c,v retrieving revision 1.1.1.3.4.3.2.1.2.1 retrieving revision 1.1.1.3.4.3.2.1.2.2 diff -u -r1.1.1.3.4.3.2.1.2.1 -r1.1.1.3.4.3.2.1.2.2 --- squid/src/ftp.c 27 Aug 2001 21:48:21 -0000 1.1.1.3.4.3.2.1.2.1 +++ squid/src/ftp.c 15 Sep 2001 19:27:29 -0000 1.1.1.3.4.3.2.1.2.2 @@ -1,5 +1,5 @@ /* - * $Id: ftp.c,v 1.1.1.3.4.3.2.1.2.1 2001/08/27 21:48:21 tolsty Exp $ + * $Id: ftp.c,v 1.1.1.3.4.3.2.1.2.2 2001/09/15 19:27:29 serassio Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -38,8 +38,7 @@ static const char *const crlf = "\r\n"; static char cbuf[1024]; -typedef enum -{ +typedef enum { BEGIN, SENT_USER, SENT_PASS, @@ -58,11 +57,9 @@ READING_DATA, WRITING_DATA, SENT_MKDIR -} -ftp_state_t; +} ftp_state_t; -struct _ftp_flags -{ +struct _ftp_flags { unsigned int isdir:1; unsigned int pasv_supported:1; unsigned int skip_whitespace:1; @@ -83,8 +80,7 @@ unsigned int datachannel_hack:1; }; -typedef struct _Ftpdata -{ +typedef struct _Ftpdata { StoreEntry *entry; request_t *request; char user[MAX_URL]; @@ -111,8 +107,7 @@ char *old_reply; char *old_filepath; char typecode; - struct - { + struct { int fd; char *buf; size_t size; @@ -122,10 +117,8 @@ char *last_command; char *last_reply; int replycode; - } - ctrl; - struct - { + } ctrl; + struct { int fd; char *buf; size_t size; @@ -133,23 +126,19 @@ FREE *freefunc; char *host; u_short port; - } - data; + } data; struct _ftp_flags flags; FwdState *fwd; -} -FtpStateData; +} FtpStateData; -typedef struct -{ +typedef struct { char type; int size; char *date; char *name; char *showname; char *link; -} -ftpListParts; +} ftpListParts; typedef void (FTPSM) (FtpStateData *); @@ -168,8 +157,7 @@ static wordlist *ftpParseControlReply(char *, size_t, int *, int *); static int ftpRestartable(FtpStateData * ftpState); static void ftpAppendSuccessHeader(FtpStateData * ftpState); -static void ftpAuthRequired(HttpReply * reply, request_t * request, - const char *realm); +static void ftpAuthRequired(HttpReply * reply, request_t * request, const char *realm); static void ftpHackShortcut(FtpStateData * ftpState, FTPSM * nextState); static void ftpPutStart(FtpStateData *); static CWCB ftpPutTransferDone; @@ -249,7 +237,8 @@ Quit - ************************************************/ -FTPSM *FTP_SM_FUNCS[] = { +FTPSM *FTP_SM_FUNCS[] = +{ ftpReadWelcome, /* BEGIN */ ftpReadUser, /* SENT_USER */ ftpReadPass, /* SENT_PASS */ @@ -429,20 +418,22 @@ storeBuffer(e); storeAppendPrintf(e, "\n"); if (ftpState->flags.listformat_unknown && !ftpState->flags.tried_nlst) { - storeAppendPrintf(e, - "[As plain directory]\n"); + storeAppendPrintf(e, "[As plain directory]\n"); } else if (ftpState->typecode == 'D') { storeAppendPrintf(e, "[As extended directory]\n"); } storeAppendPrintf(e, "
\n"); storeAppendPrintf(e, "
\n"); storeAppendPrintf(e, "Generated %s by %s (%s)\n", - mkrfc1123(squid_curtime), getMyHostname(), full_appname_string); + mkrfc1123(squid_curtime), + getMyHostname(), + full_appname_string); storeAppendPrintf(e, "
\n"); storeBufferFlush(e); } -static const char *Month[] = { +static const char *Month[] = +{ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; @@ -501,8 +492,8 @@ p->type = '\0'; return p; } - for (t = strtok(xbuf, w_space); t && n_tokens < MAX_TOKENS; - t = strtok(NULL, w_space)) tokens[n_tokens++] = xstrdup(t); + for (t = strtok(xbuf, w_space); t && n_tokens < MAX_TOKENS; t = strtok(NULL, w_space)) + tokens[n_tokens++] = xstrdup(t); xfree(xbuf); /* locate the Month field */ for (i = 3; i < n_tokens - 2; i++) { @@ -653,8 +644,7 @@ LOCAL_ARRAY(char, html, 8192); size_t width = Config.Ftp.list_width; ftpListParts *parts; - *icon = *href = *text = *size = *chdir = *view = *download = *link = *html = - '\0'; + *icon = *href = *text = *size = *chdir = *view = *download = *link = *html = '\0'; if ((int) strlen(line) > 1024) { snprintf(html, 8192, "%s\n", line); return html; @@ -663,7 +653,8 @@ if (strcmp(line, "") == 0) { /* {icon} {text} {link} */ snprintf(icon, 2048, "\"%-6s\"", - mimeGetIconURL("internal-dirup"), "[DIRUP]"); + mimeGetIconURL("internal-dirup"), + "[DIRUP]"); if (!ftpState->flags.no_dotdot && !ftpState->flags.root_dir) { /* Normal directory */ strcpy(href, "../"); @@ -673,12 +664,15 @@ strcpy(href, "%2e%2e/"); strcpy(text, "Parent Directory"); snprintf(link, 2048, "(%s)", - "%2f/", "Root Directory"); + "%2f/", + "Root Directory"); } else if (ftpState->flags.no_dotdot && !ftpState->flags.root_dir) { /* Normal directory where last component is / or .. */ strcpy(href, "%2e%2e/"); strcpy(text, "Parent Directory"); - snprintf(link, 2048, "(%s)", "../", "Back"); + snprintf(link, 2048, "(%s)", + "../", + "Back"); } else { /* NO_DOTDOT && ROOT_DIR */ /* "UNIX Root" directory */ strcpy(href, "../"); @@ -716,46 +710,50 @@ switch (parts->type) { case 'd': snprintf(icon, 2048, "\"%-6s\"", - mimeGetIconURL("internal-dir"), "[DIR]"); + mimeGetIconURL("internal-dir"), + "[DIR]"); strncat(href, "/", 2048); break; case 'l': snprintf(icon, 2048, "\"%-6s\"", - mimeGetIconURL("internal-link"), "[LINK]"); + mimeGetIconURL("internal-link"), + "[LINK]"); /* sometimes there is an 'l' flag, but no "->" link */ if (parts->link) { char *link2 = xstrdup(html_quote(rfc1738_escape(parts->link))); snprintf(link, 2048, " -> %s", - link2, html_quote(parts->link)); + link2, + html_quote(parts->link)); safe_free(link2); } break; case '\0': snprintf(icon, 2048, "\"%-6s\"", - mimeGetIconURL(parts->name), "[UNKNOWN]"); - snprintf(chdir, 2048, - " ", rfc1738_escape_part(parts->name), + mimeGetIconURL(parts->name), + "[UNKNOWN]"); + snprintf(chdir, 2048, " ", + rfc1738_escape_part(parts->name), mimeGetIconURL("internal-dir")); break; case '-': default: snprintf(icon, 2048, "\"%-6s\"", - mimeGetIconURL(parts->name), "[FILE]"); + mimeGetIconURL(parts->name), + "[FILE]"); snprintf(size, 2048, " %6dk", parts->size); break; } if (parts->type != 'd') { if (mimeGetViewOption(parts->name)) { - snprintf(view, 2048, - " ", href, mimeGetIconURL("internal-view")); + snprintf(view, 2048, " ", + href, mimeGetIconURL("internal-view")); } if (mimeGetDownloadOption(parts->name)) { - snprintf(download, 2048, - " ", href, - mimeGetIconURL("internal-download")); + snprintf(download, 2048, " ", + href, mimeGetIconURL("internal-download")); } } /* {icon} {text} . . . {date}{size}{chdir}{view}{download}{link}\n */ @@ -905,7 +903,10 @@ debug(50, 1) ("ftpDataRead: read error: %s\n", xstrerror()); if (ignoreErrno(errno)) { commSetSelect(fd, - COMM_SELECT_READ, ftpDataRead, data, Config.Timeout.read); + COMM_SELECT_READ, + ftpDataRead, + data, + Config.Timeout.read); } else { ftpFailed(ftpState, ERR_READ_ERROR); /* ftpFailed closes ctrl.fd and frees ftpState */ @@ -920,11 +921,13 @@ storeAppend(entry, ftpState->data.buf, len); ftpState->data.offset = 0; } - if (ftpState->size > 0 - && mem->inmem_hi >= - ftpState->size + mem->reply->hdr_sz) ftpReadComplete(ftpState); + if (ftpState->size > 0 && mem->inmem_hi >= ftpState->size + mem->reply->hdr_sz) + ftpReadComplete(ftpState); else - commSetSelect(fd, COMM_SELECT_READ, ftpDataRead, data, + commSetSelect(fd, + COMM_SELECT_READ, + ftpDataRead, + data, Config.Timeout.read); } } @@ -998,7 +1001,8 @@ request_t *request = ftpState->request; size_t len; char *t; - len = 64 + strlen(ftpState->user) + len = 64 + + strlen(ftpState->user) + strlen(ftpState->password) + strlen(request->host) + strLen(request->urlpath); @@ -1112,13 +1116,16 @@ safe_free(ftpState->ctrl.last_reply); ftpState->ctrl.last_command = xstrdup(buf); comm_write(ftpState->ctrl.fd, - xstrdup(buf), strlen(buf), ftpWriteCommandCallback, ftpState, xfree); + xstrdup(buf), + strlen(buf), + ftpWriteCommandCallback, + ftpState, + xfree); ftpScheduleReadControlReply(ftpState, 0); } static void -ftpWriteCommandCallback(int fd, char *bufnotused, size_t size, int errflag, - void *data) +ftpWriteCommandCallback(int fd, char *bufnotused, size_t size, int errflag, void *data) { FtpStateData *ftpState = data; debug(9, 7) ("ftpWriteCommandCallback: wrote %d bytes\n", size); @@ -1212,7 +1219,9 @@ } else { commSetSelect(ftpState->ctrl.fd, COMM_SELECT_READ, - ftpReadControlReply, ftpState, Config.Timeout.read); + ftpReadControlReply, + ftpState, + Config.Timeout.read); /* * Cancel the timeout on the Data socket (if any) and * establish one on the control socket. @@ -1349,7 +1358,8 @@ { if (ftpState->proxy_host != NULL) snprintf(cbuf, 1024, "USER %s@%s\r\n", - ftpState->user, ftpState->request->host); + ftpState->user, + ftpState->request->host); else snprintf(cbuf, 1024, "USER %s\r\n", ftpState->user); ftpWriteCommand(cbuf, ftpState); @@ -1628,7 +1638,8 @@ ftpState->size = atoi(ftpState->ctrl.last_reply); if (ftpState->size == 0) { debug(9, 2) ("ftpReadSize: SIZE reported %s on %s\n", - ftpState->ctrl.last_reply, ftpState->title_url); + ftpState->ctrl.last_reply, + ftpState->title_url); ftpState->size = -1; } } else if (code < 0) { @@ -1665,7 +1676,11 @@ addr.sin_addr = Config.Addrs.tcp_outgoing; } /* Open data channel with the same local address as control channel */ - fd = comm_open(SOCK_STREAM, 0, addr.sin_addr, 0, COMM_NONBLOCKING, + fd = comm_open(SOCK_STREAM, + 0, + addr.sin_addr, + 0, + COMM_NONBLOCKING, storeUrl(ftpState->entry)); debug(9, 3) ("ftpSendPasv: Unconnected data socket created on FD %d\n", fd); if (fd < 0) { @@ -1750,8 +1765,7 @@ FtpStateData *ftpState = data; debug(9, 3) ("ftpPasvCallback\n"); if (status != COMM_OK) { - debug(9, - 2) ("ftpPasvCallback: failed to connect. Retrying without PASV.\n"); + debug(9, 2) ("ftpPasvCallback: failed to connect. Retrying without PASV.\n"); ftpState->fwd->flags.dont_retry = 0; /* this is a retryable error */ ftpState->fwd->flags.ftp_pasv_failed = 1; ftpFailed(ftpState, ERR_NONE); @@ -1792,16 +1806,16 @@ * used for both control and data. */ if (fallback) { - setsockopt(ftpState->ctrl.fd, SOL_SOCKET, SO_REUSEADDR, (char *) &on, - sizeof(on)); + setsockopt(ftpState->ctrl.fd, SOL_SOCKET, SO_REUSEADDR, (char *) &on, sizeof(on)); port = ntohs(addr.sin_port); } - fd = comm_open(SOCK_STREAM, 0, addr.sin_addr, port, + fd = comm_open(SOCK_STREAM, + 0, + addr.sin_addr, + port, COMM_NONBLOCKING | (fallback ? COMM_REUSEADDR : 0), storeUrl(ftpState->entry)); - debug(9, - 3) ("ftpOpenListenSocket: Unconnected data socket created on FD %d\n", - fd); + debug(9, 3) ("ftpOpenListenSocket: Unconnected data socket created on FD %d\n", fd); if (fd < 0) { debug(9, 0) ("ftpOpenListenSocket: comm_open failed\n"); return -1; @@ -1837,7 +1851,8 @@ addrptr = (unsigned char *) &addr.sin_addr.s_addr; portptr = (unsigned char *) &addr.sin_port; snprintf(cbuf, 1024, "PORT %d,%d,%d,%d,%d,%d\r\n", - addrptr[0], addrptr[1], addrptr[2], addrptr[3], portptr[0], portptr[1]); + addrptr[0], addrptr[1], addrptr[2], addrptr[3], + portptr[0], portptr[1]); ftpWriteCommand(cbuf, ftpState); ftpState->state = SENT_PORT; } @@ -1865,16 +1880,14 @@ fd = comm_accept(fd, &my_peer, &me); if (fd < 0) { - debug(9, 1) ("ftpHandleDataAccept: comm_accept(%d): %s", fd, - xstrerror()); + debug(9, 1) ("ftpHandleDataAccept: comm_accept(%d): %s", fd, xstrerror()); /* XXX Need to set error message */ ftpFail(ftpState); return; } /* Replace the Listen socket with the accepted data socket */ comm_close(ftpState->data.fd); - debug(9, 3) ("ftpAcceptDataConnection: Connected data socket on FD %d\n", - fd); + debug(9, 3) ("ftpAcceptDataConnection: Connected data socket on FD %d\n", fd); ftpState->data.fd = fd; ftpState->data.port = ntohs(my_peer.sin_port); ftpState->data.host = xstrdup(inet_ntoa(my_peer.sin_addr)); @@ -1917,8 +1930,7 @@ snprintf(cbuf, 1024, "STOR %s\r\n", ftpState->filepath); ftpWriteCommand(cbuf, ftpState); ftpState->state = SENT_STOR; - } else if (httpHeaderGetInt(&ftpState->request->header, - HDR_CONTENT_LENGTH) > 0) { + } else if (httpHeaderGetInt(&ftpState->request->header, HDR_CONTENT_LENGTH) > 0) { /* File upload without a filename. use STOU to generate one */ snprintf(cbuf, 1024, "STOU\r\n"); ftpWriteCommand(cbuf, ftpState); @@ -1949,7 +1961,10 @@ /* Accept data channel */ debug(9, 3) ("ftpReadStor: accepting data channel\n"); commSetSelect(ftpState->data.fd, - COMM_SELECT_READ, ftpAcceptDataConnection, ftpState, 0); + COMM_SELECT_READ, + ftpAcceptDataConnection, + ftpState, + 0); } else { debug(9, 3) ("ftpReadStor: Unexpected reply code %s\n", code); ftpFail(ftpState); @@ -1976,9 +1991,7 @@ if (ftpState->size <= 0) return 0; - ftpState->restart_offset = - httpHdrRangeLowestOffset(ftpState->request->range, - (size_t) ftpState->size); + ftpState->restart_offset = httpHdrRangeLowestOffset(ftpState->request->range, (size_t) ftpState->size); if (ftpState->restart_offset <= 0) return 0; return 1; @@ -2038,7 +2051,10 @@ /* Begin data transfer */ ftpAppendSuccessHeader(ftpState); commSetSelect(ftpState->data.fd, - COMM_SELECT_READ, ftpDataRead, ftpState, Config.Timeout.read); + COMM_SELECT_READ, + ftpDataRead, + ftpState, + Config.Timeout.read); commSetDefer(ftpState->data.fd, fwdCheckDeferRead, ftpState->entry); ftpState->state = READING_DATA; /* @@ -2046,20 +2062,21 @@ * on the data socket */ commSetTimeout(ftpState->ctrl.fd, -1, NULL, NULL); - commSetTimeout(ftpState->data.fd, Config.Timeout.read, ftpTimeout, - ftpState); + commSetTimeout(ftpState->data.fd, Config.Timeout.read, ftpTimeout, ftpState); return; } else if (code == 150) { /* Accept data channel */ commSetSelect(ftpState->data.fd, - COMM_SELECT_READ, ftpAcceptDataConnection, ftpState, 0); + COMM_SELECT_READ, + ftpAcceptDataConnection, + ftpState, + 0); /* * Cancel the timeout on the Control socket and establish one * on the data socket */ commSetTimeout(ftpState->ctrl.fd, -1, NULL, NULL); - commSetTimeout(ftpState->data.fd, Config.Timeout.read, ftpTimeout, - ftpState); + commSetTimeout(ftpState->data.fd, Config.Timeout.read, ftpTimeout, ftpState); return; } else if (!ftpState->flags.tried_nlst && code > 300) { ftpSendNlst(ftpState); @@ -2088,7 +2105,10 @@ debug(9, 3) ("ftpReadRetr: reading data channel\n"); ftpAppendSuccessHeader(ftpState); commSetSelect(ftpState->data.fd, - COMM_SELECT_READ, ftpDataRead, ftpState, Config.Timeout.read); + COMM_SELECT_READ, + ftpDataRead, + ftpState, + Config.Timeout.read); commSetDefer(ftpState->data.fd, fwdCheckDeferRead, ftpState->entry); ftpState->state = READING_DATA; /* @@ -2101,7 +2121,10 @@ } else if (code == 150) { /* Accept data channel */ commSetSelect(ftpState->data.fd, - COMM_SELECT_READ, ftpAcceptDataConnection, ftpState, 0); + COMM_SELECT_READ, + ftpAcceptDataConnection, + ftpState, + 0); /* * Cancel the timeout on the Control socket and establish one * on the data socket @@ -2257,7 +2280,8 @@ } } /* Try to reopen datachannel */ - if (!ftpState->flags.datachannel_hack && ftpState->pathcomps == NULL) { + if (!ftpState->flags.datachannel_hack && + ftpState->pathcomps == NULL) { switch (ftpState->state) { case SENT_RETR: case SENT_LIST: @@ -2373,8 +2397,7 @@ } static void -ftpPutTransferDone(int fd, char *bufnotused, size_t size, int errflag, - void *data) +ftpPutTransferDone(int fd, char *bufnotused, size_t size, int errflag, void *data) { FtpStateData *ftpState = data; if (ftpState->data.fd >= 0) { @@ -2397,8 +2420,7 @@ if (cbdataValid(ftpState)) debug(9, 5) ("ftpSendReply: ftpState (%p) is valid!\n", ftpState); if (code == 226) { - err_code = - (ftpState->mdtm > 0) ? ERR_FTP_PUT_MODIFIED : ERR_FTP_PUT_CREATED; + err_code = (ftpState->mdtm > 0) ? ERR_FTP_PUT_MODIFIED : ERR_FTP_PUT_CREATED; http_code = (ftpState->mdtm > 0) ? HTTP_ACCEPTED : HTTP_CREATED; } else if (code == 227) { err_code = ERR_FTP_PUT_CREATED; @@ -2465,8 +2487,7 @@ range_spec.offset = ftpState->restarted_offset; range_spec.length = ftpState->size - ftpState->restarted_offset; httpReplySetHeaders(reply, 1.0, HTTP_PARTIAL_CONTENT, "Gatewaying", - mime_type, ftpState->size - ftpState->restarted_offset, - ftpState->mdtm, -2); + mime_type, ftpState->size - ftpState->restarted_offset, ftpState->mdtm, -2); httpHeaderAddContRange(&reply->header, range_spec, ftpState->size); } else { /* Full reply */ @@ -2489,8 +2510,7 @@ if (pe) storeRelease(pe); storeRelease(e); - } else if (EBIT_TEST(e->flags, ENTRY_CACHABLE) - && !ftpState->restarted_offset) { + } else if (EBIT_TEST(e->flags, ENTRY_CACHABLE) && !ftpState->restarted_offset) { storeSetPublicKey(e); } else { storeRelease(e); @@ -2532,7 +2552,11 @@ } snprintf(buf, MAX_URL, "%s://%s%s%s%s%s", ProtocolStr[request->protocol], - loginbuf, request->host, portbuf, "/%2f", strBuf(request->urlpath)); + loginbuf, + request->host, + portbuf, + "/%2f", + strBuf(request->urlpath)); if ((t = strchr(buf, '?'))) *t = '\0'; return buf; Index: squid/src/helper.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/helper.c,v retrieving revision 1.1.1.3.24.1.2.1 retrieving revision 1.1.1.3.24.1.2.2 diff -u -r1.1.1.3.24.1.2.1 -r1.1.1.3.24.1.2.2 --- squid/src/helper.c 27 Aug 2001 21:48:21 -0000 1.1.1.3.24.1.2.1 +++ squid/src/helper.c 15 Sep 2001 19:27:29 -0000 1.1.1.3.24.1.2.2 @@ -55,7 +55,12 @@ for (k = 0; k < hlp->n_to_start; k++) { getCurrentTime(); rfd = wfd = -1; - x = ipcCreate(hlp->ipc_type, progname, args, shortname, &rfd, &wfd + x = ipcCreate(hlp->ipc_type, + progname, + args, + shortname, + &rfd, + &wfd #ifdef _SQUID_MSWIN_ , &hIpc, &pid #endif @@ -85,11 +90,9 @@ snprintf(fd_note_buf, FD_DESC_SZ, "%s #%d", shortname, k + 1); fd_note(rfd, fd_note_buf); } else { - snprintf(fd_note_buf, FD_DESC_SZ, "reading %s #%d", shortname, - k + 1); + snprintf(fd_note_buf, FD_DESC_SZ, "reading %s #%d", shortname, k + 1); fd_note(rfd, fd_note_buf); - snprintf(fd_note_buf, FD_DESC_SZ, "writing %s #%d", shortname, - k + 1); + snprintf(fd_note_buf, FD_DESC_SZ, "writing %s #%d", shortname, k + 1); fd_note(wfd, fd_note_buf); } commSetNonBlocking(rfd); @@ -130,25 +133,35 @@ double tt; storeAppendPrintf(sentry, "number running: %d of %d\n", hlp->n_running, hlp->n_to_start); - storeAppendPrintf(sentry, "requests sent: %d\n", hlp->stats.requests); - storeAppendPrintf(sentry, "replies received: %d\n", hlp->stats.replies); - storeAppendPrintf(sentry, "queue length: %d\n", hlp->stats.queue_size); + storeAppendPrintf(sentry, "requests sent: %d\n", + hlp->stats.requests); + storeAppendPrintf(sentry, "replies received: %d\n", + hlp->stats.replies); + storeAppendPrintf(sentry, "queue length: %d\n", + hlp->stats.queue_size); storeAppendPrintf(sentry, "avg service time: %d msec\n", hlp->stats.avg_svc_time); storeAppendPrintf(sentry, "\n"); storeAppendPrintf(sentry, "%7s\t%7s\t%11s\t%s\t%7s\t%7s\n", - "#", "FD", "# Requests", "Flags", "Time", "Offset"); + "#", + "FD", + "# Requests", + "Flags", + "Time", + "Offset"); for (link = hlp->servers.head; link; link = link->next) { srv = link->data; tt = 0.001 * tvSubMsec(srv->dispatch_time, current_time); storeAppendPrintf(sentry, "%7d\t%7d\t%11ld\t%c%c%c%c\t%7.3f\t%7d\n", - srv->index + 1, srv->rfd, + srv->index + 1, + srv->rfd, srv->stats.uses, srv->flags.alive ? 'A' : ' ', srv->flags.busy ? 'B' : ' ', srv->flags.closing ? 'C' : ' ', srv->flags.shutdown ? 'S' : ' ', - tt < 0.0 ? 0.0 : tt, (int) srv->offset); + tt < 0.0 ? 0.0 : tt, + (int) srv->offset); } storeAppendPrintf(sentry, "\nFlags key:\n\n"); storeAppendPrintf(sentry, " A = ALIVE\n"); @@ -280,8 +293,7 @@ len, hlp->id_name, srv->index + 1); if (len <= 0) { if (len < 0) - debug(50, 1) ("helperHandleRead: FD %d read: %s\n", fd, - xstrerror()); + debug(50, 1) ("helperHandleRead: FD %d read: %s\n", fd, xstrerror()); comm_close(fd); return; } @@ -290,8 +302,7 @@ r = srv->request; if (r == NULL) { /* someone spoke without being spoken to */ - debug(29, - 1) ("helperHandleRead: unexpected read from %s #%d, %d bytes\n", + debug(29, 1) ("helperHandleRead: unexpected read from %s #%d, %d bytes\n", hlp->id_name, srv->index + 1, len); srv->offset = 0; } else if ((t = strchr(srv->buf, '\n'))) { @@ -332,13 +343,10 @@ return; hlp->last_queue_warn = squid_curtime; debug(14, 0) ("WARNING: All %s processes are busy.\n", hlp->id_name); - debug(14, 0) ("WARNING: %d pending requests queued\n", - hlp->stats.queue_size); + debug(14, 0) ("WARNING: %d pending requests queued\n", hlp->stats.queue_size); if (hlp->stats.queue_size > hlp->n_running * 2) fatalf("Too many queued %s requests", hlp->id_name); - debug(14, 1) - ("Consider increasing the number of %s processes in your config file.\n", - hlp->id_name); + debug(14, 1) ("Consider increasing the number of %s processes in your config file.\n", hlp->id_name); } static helper_request * @@ -386,10 +394,16 @@ srv->flags.busy = 1; srv->request = r; srv->dispatch_time = current_time; - comm_write(srv->wfd, r->buf, strlen(r->buf), NULL, /* Handler */ + comm_write(srv->wfd, + r->buf, + strlen(r->buf), + NULL, /* Handler */ NULL, /* Handler-data */ NULL); /* free */ - commSetSelect(srv->rfd, COMM_SELECT_READ, helperHandleRead, srv, 0); + commSetSelect(srv->rfd, + COMM_SELECT_READ, + helperHandleRead, + srv, 0); debug(29, 5) ("helperDispatch: Request sent to %s #%d, %d bytes\n", hlp->id_name, srv->index + 1, strlen(r->buf)); srv->stats.uses++; Index: squid/src/htcp.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/htcp.c,v retrieving revision 1.1.1.2.4.1.2.2.2.1 retrieving revision 1.1.1.2.4.1.2.2.2.2 diff -u -r1.1.1.2.4.1.2.2.2.1 -r1.1.1.2.4.1.2.2.2.2 --- squid/src/htcp.c 27 Aug 2001 21:48:21 -0000 1.1.1.2.4.1.2.2.2.1 +++ squid/src/htcp.c 15 Sep 2001 19:27:29 -0000 1.1.1.2.4.1.2.2.2.2 @@ -1,5 +1,5 @@ /* - * $Id: htcp.c,v 1.1.1.2.4.1.2.2.2.1 2001/08/27 21:48:21 tolsty Exp $ + * $Id: htcp.c,v 1.1.1.2.4.1.2.2.2.2 2001/09/15 19:27:29 serassio Exp $ * * DEBUG: section 31 Hypertext Caching Protocol * AUTHOR: Duane Wesssels @@ -43,21 +43,18 @@ typedef struct _htcpSpecifier htcpSpecifier; typedef struct _htcpDetail htcpDetail; -struct _Countstr -{ +struct _Countstr { u_short length; char *text; }; -struct _htcpHeader -{ +struct _htcpHeader { u_short length; u_char major; u_char minor; }; -struct _htcpDataHeader -{ +struct _htcpDataHeader { u_short length; #if !WORDS_BIGENDIAN unsigned int opcode:4; @@ -83,8 +80,7 @@ /* RR == 0 --> REQUEST */ /* RR == 1 --> RESPONSE */ -struct _htcpAuthHeader -{ +struct _htcpAuthHeader { u_short length; time_t sig_time; time_t sig_expire; @@ -92,23 +88,20 @@ Countstr signature; }; -struct _htcpSpecifier -{ +struct _htcpSpecifier { char *method; char *uri; char *version; char *req_hdrs; }; -struct _htcpDetail -{ +struct _htcpDetail { char *resp_hdrs; char *entity_hdrs; char *cache_hdrs; }; -struct _htcpStuff -{ +struct _htcpStuff { int op; int rr; int f1; @@ -118,8 +111,7 @@ htcpDetail D; }; -enum -{ +enum { HTCP_NOP, HTCP_TST, HTCP_MON, @@ -128,7 +120,8 @@ HTCP_END }; -static const char *const htcpOpcodeStr[] = { +static const char *const htcpOpcodeStr[] = +{ "HTCP_NOP", "HTCP_TST", "HTCP_MON", @@ -140,8 +133,7 @@ /* * values for htcpDataHeader->response */ -enum -{ +enum { AUTH_REQUIRED, AUTH_FAILURE, OPCODE_UNIMPLEMENTED, @@ -153,8 +145,7 @@ /* * values for htcpDataHeader->RR */ -enum -{ +enum { RR_REQUEST, RR_RESPONSE }; @@ -180,22 +171,15 @@ static void htcpFreeDetail(htcpDetail * s); static void htcpHandle(char *buf, int sz, struct sockaddr_in *from); static void htcpHandleData(char *buf, int sz, struct sockaddr_in *from); -static void htcpHandleMon(htcpDataHeader *, char *buf, int sz, - struct sockaddr_in *from); -static void htcpHandleNop(htcpDataHeader *, char *buf, int sz, - struct sockaddr_in *from); -static void htcpHandleSet(htcpDataHeader *, char *buf, int sz, - struct sockaddr_in *from); -static void htcpHandleTst(htcpDataHeader *, char *buf, int sz, - struct sockaddr_in *from); +static void htcpHandleMon(htcpDataHeader *, char *buf, int sz, struct sockaddr_in *from); +static void htcpHandleNop(htcpDataHeader *, char *buf, int sz, struct sockaddr_in *from); +static void htcpHandleSet(htcpDataHeader *, char *buf, int sz, struct sockaddr_in *from); +static void htcpHandleTst(htcpDataHeader *, char *buf, int sz, struct sockaddr_in *from); static void htcpRecv(int fd, void *data); static void htcpSend(const char *buf, int len, struct sockaddr_in *to); -static void htcpTstReply(htcpDataHeader *, StoreEntry *, htcpSpecifier *, - struct sockaddr_in *); -static void htcpHandleTstRequest(htcpDataHeader *, char *buf, int sz, - struct sockaddr_in *from); -static void htcpHandleTstResponse(htcpDataHeader *, char *, int, - struct sockaddr_in *); +static void htcpTstReply(htcpDataHeader *, StoreEntry *, htcpSpecifier *, struct sockaddr_in *); +static void htcpHandleTstRequest(htcpDataHeader *, char *buf, int sz, struct sockaddr_in *from); +static void htcpHandleTstResponse(htcpDataHeader *, char *, int, struct sockaddr_in *); static StoreEntry *htcpCheckHit(const htcpSpecifier *); static void @@ -329,7 +313,8 @@ htcpBuildOpData(char *buf, size_t buflen, htcpStuff * stuff) { ssize_t off = 0; - debug(31, 3) ("htcpBuildOpData: opcode %s\n", htcpOpcodeStr[stuff->op]); + debug(31, 3) ("htcpBuildOpData: opcode %s\n", + htcpOpcodeStr[stuff->op]); switch (stuff->op) { case HTCP_TST: off = htcpBuildTstOpData(buf + off, buflen, stuff); @@ -414,10 +399,12 @@ inet_ntoa(to->sin_addr), (int) ntohs(to->sin_port)); htcpHexdump("htcpSend", buf, len); x = comm_udp_sendto(htcpOutSocket, - to, sizeof(struct sockaddr_in), buf, len); + to, + sizeof(struct sockaddr_in), + buf, + len); if (x < 0) - debug(31, 0) ("htcpSend: FD %d sendto: %s\n", htcpOutSocket, - xstrerror()); + debug(31, 0) ("htcpSend: FD %d sendto: %s\n", htcpOutSocket, xstrerror()); } /* @@ -547,8 +534,7 @@ } static void -htcpTstReply(htcpDataHeader * dhdr, StoreEntry * e, htcpSpecifier * spec, - struct sockaddr_in *from) +htcpTstReply(htcpDataHeader * dhdr, StoreEntry * e, htcpSpecifier * spec, struct sockaddr_in *from) { htcpStuff stuff; char *pkt; @@ -577,7 +563,8 @@ stuff.S.version = spec->version; stuff.S.req_hdrs = spec->req_hdrs; httpHeaderPutInt(&hdr, HDR_AGE, - e->timestamp <= squid_curtime ? squid_curtime - e->timestamp : 0); + e->timestamp <= squid_curtime ? + squid_curtime - e->timestamp : 0); httpHeaderPackInto(&hdr, &p); stuff.D.resp_hdrs = xstrdup(mb.buf); debug(31, 3) ("htcpTstReply: resp_hdrs = {%s}\n", stuff.D.resp_hdrs); @@ -589,8 +576,7 @@ httpHeaderPutTime(&hdr, HDR_LAST_MODIFIED, e->lastmod); httpHeaderPackInto(&hdr, &p); stuff.D.entity_hdrs = xstrdup(mb.buf); - debug(31, 3) ("htcpTstReply: entity_hdrs = {%s}\n", - stuff.D.entity_hdrs); + debug(31, 3) ("htcpTstReply: entity_hdrs = {%s}\n", stuff.D.entity_hdrs); memBufReset(&mb); httpHeaderReset(&hdr); if ((host = urlHostname(spec->uri))) { @@ -668,8 +654,7 @@ } static void -htcpHandleTstResponse(htcpDataHeader * hdr, char *buf, int sz, - struct sockaddr_in *from) +htcpHandleTstResponse(htcpDataHeader * hdr, char *buf, int sz, struct sockaddr_in *from) { htcpReplyData htcpReply; cache_key *key = NULL; @@ -682,8 +667,7 @@ memset(&htcpReply, '\0', sizeof(htcpReply)); httpHeaderInit(&htcpReply.hdr, hoHtcpReply); htcpReply.msg_id = hdr->msg_id; - debug(31, 3) ("htcpHandleTstResponse: msg_id = %d\n", - (int) htcpReply.msg_id); + debug(31, 3) ("htcpHandleTstResponse: msg_id = %d\n", (int) htcpReply.msg_id); htcpReply.hit = hdr->response ? 0 : 1; if (hdr->F1) { debug(31, 3) ("htcpHandleTstResponse: MISS\n"); @@ -702,8 +686,7 @@ httpHeaderParse(&htcpReply.hdr, t, t + strlen(t)); } key = queried_keys[htcpReply.msg_id % N_QUERIED_KEYS]; - debug(31, 3) ("htcpHandleTstResponse: key (%p) %s\n", key, - storeKeyText(key)); + debug(31, 3) ("htcpHandleTstResponse: key (%p) %s\n", key, storeKeyText(key)); neighborsHtcpReply(key, &htcpReply, from); httpHeaderClean(&htcpReply.hdr); if (d) @@ -711,8 +694,7 @@ } static void -htcpHandleTstRequest(htcpDataHeader * dhdr, char *buf, int sz, - struct sockaddr_in *from) +htcpHandleTstRequest(htcpDataHeader * dhdr, char *buf, int sz, struct sockaddr_in *from) { /* buf should be a SPECIFIER */ htcpSpecifier *s; @@ -729,7 +711,9 @@ return; } debug(31, 3) ("htcpHandleTstRequest: %s %s %s\n", - s->method, s->uri, s->version); + s->method, + s->uri, + s->version); debug(31, 3) ("htcpHandleTstRequest: %s\n", s->req_hdrs); if ((e = htcpCheckHit(s))) htcpTstReply(dhdr, e, s, from); /* hit */ @@ -755,8 +739,7 @@ { htcpDataHeader hdr; if (sz < sizeof(htcpDataHeader)) { - debug(31, - 0) ("htcpHandleData: msg size less than htcpDataHeader size\n"); + debug(31, 0) ("htcpHandleData: msg size less than htcpDataHeader size\n"); return; } xmemcpy(&hdr, buf, sizeof(htcpDataHeader)); @@ -856,8 +839,12 @@ htcpInit(void) { enter_suid(); - htcpInSocket = comm_open(SOCK_DGRAM, 0, Config.Addrs.udp_incoming, - Config.Port.htcp, COMM_NONBLOCKING, "HTCP Socket"); + htcpInSocket = comm_open(SOCK_DGRAM, + 0, + Config.Addrs.udp_incoming, + Config.Port.htcp, + COMM_NONBLOCKING, + "HTCP Socket"); leave_suid(); if (htcpInSocket < 0) fatal("Cannot open HTCP Socket"); @@ -866,8 +853,12 @@ (int) Config.Port.htcp, htcpInSocket); if (Config.Addrs.udp_outgoing.s_addr != no_addr.s_addr) { enter_suid(); - htcpOutSocket = comm_open(SOCK_DGRAM, 0, Config.Addrs.udp_outgoing, - Config.Port.htcp, COMM_NONBLOCKING, "Outgoing HTCP Socket"); + htcpOutSocket = comm_open(SOCK_DGRAM, + 0, + Config.Addrs.udp_outgoing, + Config.Port.htcp, + COMM_NONBLOCKING, + "Outgoing HTCP Socket"); leave_suid(); if (htcpOutSocket < 0) fatal("Cannot open Outgoing HTCP Socket"); Index: squid/src/http.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/http.c,v retrieving revision 1.1.1.3.4.3.2.2.2.2 retrieving revision 1.1.1.3.4.3.2.2.2.3 diff -u -r1.1.1.3.4.3.2.2.2.2 -r1.1.1.3.4.3.2.2.2.3 --- squid/src/http.c 31 Aug 2001 06:24:34 -0000 1.1.1.3.4.3.2.2.2.2 +++ squid/src/http.c 15 Sep 2001 19:27:29 -0000 1.1.1.3.4.3.2.2.2.3 @@ -1,5 +1,5 @@ /* - * $Id: http.c,v 1.1.1.3.4.3.2.2.2.2 2001/08/31 06:24:34 tolsty Exp $ + * $Id: http.c,v 1.1.1.3.4.3.2.2.2.3 2001/09/15 19:27:29 serassio Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -334,9 +334,7 @@ strncat(httpState->reply_hdr, buf, room < size ? room : size); hdr_len += room < size ? room : size; if (hdr_len > 4 && strncmp(httpState->reply_hdr, "HTTP/", 5)) { - debug(11, - 3) ("httpProcessReplyHeader: Non-HTTP-compliant header: '%s'\n", - httpState->reply_hdr); + debug(11, 3) ("httpProcessReplyHeader: Non-HTTP-compliant header: '%s'\n", httpState->reply_hdr); httpState->reply_hdr_state += 2; reply->sline.status = HTTP_INVALID_HEADER; return; @@ -361,8 +359,7 @@ httpReplyParse(reply, httpState->reply_hdr, hdr_len); storeTimestampsSet(entry); /* Check if object is cacheable or not based on reply code */ - debug(11, 3) ("httpProcessReplyHeader: HTTP CODE: %d\n", - reply->sline.status); + debug(11, 3) ("httpProcessReplyHeader: HTTP CODE: %d\n", reply->sline.status); if (neighbors_do_private_keys) httpMaybeRemovePublic(entry, reply->sline.status); switch (httpCachableReply(httpState)) { @@ -630,7 +627,10 @@ void httpBuildRequestHeader(request_t * request, request_t * orig_request, - StoreEntry * entry, HttpHeader * hdr_out, int cfd, http_state_flags flags) + StoreEntry * entry, + HttpHeader * hdr_out, + int cfd, + http_state_flags flags) { /* building buffer for complex strings */ #define BBUF_SZ (MAX_URL+32) @@ -656,15 +656,8 @@ * the server and fetch only the requested content) */ we_do_ranges = - orig_request->range && orig_request->flags.cachable - && !httpHdrRangeWillBeComplex(orig_request->range) - && (Config.rangeOffsetLimit == -1 - || httpHdrRangeFirstOffset(orig_request->range) <= - Config.rangeOffsetLimit); - debug(11, 8) - - - ("httpBuildRequestHeader: range specs: %p, cachable: %d; we_do_ranges: %d\n", + orig_request->range && orig_request->flags.cachable && !httpHdrRangeWillBeComplex(orig_request->range) && (Config.rangeOffsetLimit == -1 || httpHdrRangeFirstOffset(orig_request->range) <= Config.rangeOffsetLimit); + debug(11, 8) ("httpBuildRequestHeader: range specs: %p, cachable: %d; we_do_ranges: %d\n", orig_request->range, orig_request->flags.cachable, we_do_ranges); strConnection = httpHeaderGetList(hdr_in, HDR_CONNECTION); @@ -781,8 +774,7 @@ if (!cc) cc = httpHdrCcCreate(); if (!EBIT_TEST(cc->mask, CC_MAX_AGE)) { - const char *url = - entry ? storeUrl(entry) : urlCanonical(orig_request); + const char *url = entry ? storeUrl(entry) : urlCanonical(orig_request); httpHdrCcSetMaxAge(cc, getMaxAge(url)); if (strLen(request->urlpath)) assert(strstr(url, strBuf(request->urlpath))); @@ -807,8 +799,11 @@ * return the length of the prefix */ mb_size_t httpBuildRequestPrefix(request_t * request, -request_t * orig_request, -StoreEntry * entry, MemBuf * mb, int cfd, http_state_flags flags) + request_t * orig_request, + StoreEntry * entry, + MemBuf * mb, + int cfd, + http_state_flags flags) { const int offset = mb->size; memBufPrintf(mb, "%s %s HTTP/1.0\r\n", @@ -839,8 +834,7 @@ peer *p = httpState->peer; CWCB *sendHeaderDone; - debug(11, 5) ("httpSendRequest: FD %d: httpState %p.\n", httpState->fd, - httpState); + debug(11, 5) ("httpSendRequest: FD %d: httpState %p.\n", httpState->fd, httpState); if (httpState->orig_request->content_length > 0) sendHeaderDone = httpSendRequestEntry; @@ -865,15 +859,18 @@ httpState->flags.keepalive = 1; else if (p->stats.n_keepalives_sent < 10) httpState->flags.keepalive = 1; - else if ((double) p->stats.n_keepalives_recv / - (double) p->stats.n_keepalives_sent > 0.50) + else if ((double) p->stats.n_keepalives_recv / (double) p->stats.n_keepalives_sent > 0.50) httpState->flags.keepalive = 1; if (httpState->peer) if (neighborType(httpState->peer, httpState->request) == PEER_SIBLING) httpState->flags.only_if_cached = 1; memBufDefInit(&mb); httpBuildRequestPrefix(req, - httpState->orig_request, entry, &mb, cfd, httpState->flags); + httpState->orig_request, + entry, + &mb, + cfd, + httpState->flags); debug(11, 6) ("httpSendRequest: FD %d:\n%s\n", httpState->fd, mb.buf); comm_write_mbuf(httpState->fd, mb, sendHeaderDone, httpState); } @@ -886,7 +883,8 @@ request_t *proxy_req; request_t *orig_req = fwd->request; debug(11, 3) ("httpStart: \"%s %s\"\n", - RequestMethodStr[orig_req->method], storeUrl(fwd->entry)); + RequestMethodStr[orig_req->method], + storeUrl(fwd->entry)); cbdataAdd(httpState, memFree, MEM_HTTP_STATE_DATA); storeLockObject(fwd->entry); httpState->fwd = fwd; @@ -935,8 +933,7 @@ } static void -httpSendRequestEntry(int fd, char *bufnotused, size_t size, int errflag, - void *data) +httpSendRequestEntry(int fd, char *bufnotused, size_t size, int errflag, void *data) { HttpStateData *httpState = data; StoreEntry *entry = httpState->entry; @@ -966,8 +963,7 @@ } static void -httpSendRequestEntryDone(int fd, char *bufnotused, size_t size, int errflag, - void *data) +httpSendRequestEntryDone(int fd, char *bufnotused, size_t size, int errflag, void *data) { HttpStateData *httpState = data; StoreEntry *entry = httpState->entry; Index: squid/src/icmp.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/icmp.c,v retrieving revision 1.1.1.2.4.2.2.1.2.1 retrieving revision 1.1.1.2.4.2.2.1.2.2 diff -u -r1.1.1.2.4.2.2.1.2.1 -r1.1.1.2.4.2.2.1.2.2 --- squid/src/icmp.c 27 Aug 2001 21:48:21 -0000 1.1.1.2.4.2.2.1.2.1 +++ squid/src/icmp.c 15 Sep 2001 19:27:29 -0000 1.1.1.2.4.2.2.1.2.2 @@ -1,5 +1,5 @@ /* - * $Id: icmp.c,v 1.1.1.2.4.2.2.1.2.1 2001/08/27 21:48:21 tolsty Exp $ + * $Id: icmp.c,v 1.1.1.2.4.2.2.1.2.2 2001/09/15 19:27:29 serassio Exp $ * * DEBUG: section 37 ICMP Routines * AUTHOR: Duane Wessels @@ -46,8 +46,7 @@ static PF icmpRecv; static void icmpSend(pingerEchoData * pkt, int len); #if ALLOW_SOURCE_PING -static void icmpHandleSourcePing(const struct sockaddr_in *from, - const char *buf); +static void icmpHandleSourcePing(const struct sockaddr_in *from, const char *buf); #endif #ifdef _SQUID_MSWIN_ @@ -79,7 +78,10 @@ commSetSelect(icmp_sock, COMM_SELECT_READ, icmpRecv, NULL, 0); memset(&preply, '\0', sizeof(pingerReplyData)); Counter.syscalls.sock.recvfroms++; - n = recv(icmp_sock, (char *) &preply, sizeof(pingerReplyData), 0); + n = recv(icmp_sock, + (char *) &preply, + sizeof(pingerReplyData), + 0); if (n < 0) { debug(50, 1) ("icmpRecv: recv: %s\n", xstrerror()); if (++fail_count == 10 || errno == ECONNREFUSED) @@ -199,7 +201,11 @@ args[0] = "(pinger)"; args[1] = NULL; x = ipcCreate(IPC_UDP_SOCKET, - Config.Program.pinger, args, "Pinger Socket", &rfd, &wfd + Config.Program.pinger, + args, + "Pinger Socket", + &rfd, + &wfd #ifdef _SQUID_MSWIN_ , &hIpc, &pid #endif Index: squid/src/pinger.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/pinger.c,v retrieving revision 1.1.1.3.4.1.2.1.2.2 retrieving revision 1.1.1.3.4.1.2.1.2.3 diff -u -r1.1.1.3.4.1.2.1.2.2 -r1.1.1.3.4.1.2.1.2.3 --- squid/src/pinger.c 31 Aug 2001 06:24:34 -0000 1.1.1.3.4.1.2.1.2.2 +++ squid/src/pinger.c 15 Sep 2001 19:27:29 -0000 1.1.1.3.4.1.2.1.2.3 @@ -1,5 +1,5 @@ /* - * $Id: pinger.c,v 1.1.1.3.4.1.2.1.2.2 2001/08/31 06:24:34 tolsty Exp $ + * $Id: pinger.c,v 1.1.1.3.4.1.2.1.2.3 2001/09/15 19:27:29 serassio Exp $ * * DEBUG: section 42 ICMP Pinger program * AUTHOR: Duane Wessels @@ -132,18 +132,17 @@ #define MAX_PKT_SZ (MAX_PAYLOAD + sizeof(struct timeval) + sizeof (char) + sizeof(struct icmphdr) + 1) #endif -typedef struct -{ +typedef struct { struct timeval tv; unsigned char opcode; char payload[MAX_PAYLOAD]; -} -icmpEchoData; +} icmpEchoData; int icmp_ident = -1; int icmp_pkts_sent = 0; -static const char *icmpPktStr[] = { +static const char *icmpPktStr[] = +{ "Echo Reply", "ICMP 1", "ICMP 2", @@ -310,7 +309,10 @@ assert(icmp_pktsize <= MAX_PKT_SZ); sendto(icmp_sock, pkt, - icmp_pktsize, 0, (struct sockaddr *) &S, sizeof(struct sockaddr_in)); + icmp_pktsize, + 0, + (struct sockaddr *) &S, + sizeof(struct sockaddr_in)); pingerLog(icmp, to, 0, 0); } @@ -332,14 +334,17 @@ pkt = xmalloc(MAX_PKT_SZ); fromlen = sizeof(from); n = recvfrom(icmp_sock, - pkt, MAX_PKT_SZ, 0, (struct sockaddr *) &from, &fromlen); + pkt, + MAX_PKT_SZ, + 0, + (struct sockaddr *) &from, + &fromlen); #if GETTIMEOFDAY_NO_TZP gettimeofday(&now); #else gettimeofday(&now, NULL); #endif - debug(42, 9) ("pingerRecv: %d bytes from %s\n", n, - inet_ntoa(from.sin_addr)); + debug(42, 9) ("pingerRecv: %d bytes from %s\n", n, inet_ntoa(from.sin_addr)); ip = (struct iphdr *) (void *) pkt; #if HAVE_IP_HL iphdrlen = ip->ip_hl << 2; @@ -395,7 +400,10 @@ (int) current_time.tv_sec, (int) current_time.tv_usec, inet_ntoa(addr), - (int) icmp->icmp_type, icmpPktStr[icmp->icmp_type], rtt, hops); + (int) icmp->icmp_type, + icmpPktStr[icmp->icmp_type], + rtt, + hops); } static int @@ -441,7 +449,10 @@ /* don't process this message, but keep running */ return 0; } - pingerSendEcho(pecho.to, pecho.opcode, pecho.payload, pecho.psize); + pingerSendEcho(pecho.to, + pecho.opcode, + pecho.payload, + pecho.psize); return n; } @@ -460,7 +471,8 @@ } } -time_t getCurrentTime(void) +time_t +getCurrentTime(void) { #if GETTIMEOFDAY_NO_TZP gettimeofday(¤t_time); Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.1.1.3.4.1.2.6.2.2 retrieving revision 1.1.1.3.4.1.2.6.2.3 diff -u -r1.1.1.3.4.1.2.6.2.2 -r1.1.1.3.4.1.2.6.2.3 --- squid/src/protos.h 31 Aug 2001 06:24:34 -0000 1.1.1.3.4.1.2.6.2.2 +++ squid/src/protos.h 15 Sep 2001 19:27:29 -0000 1.1.1.3.4.1.2.6.2.3 @@ -1,5 +1,5 @@ /* - * $Id: protos.h,v 1.1.1.3.4.1.2.6.2.2 2001/08/31 06:24:34 tolsty Exp $ + * $Id: protos.h,v 1.1.1.3.4.1.2.6.2.3 2001/09/15 19:27:29 serassio Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -42,7 +42,8 @@ #endif extern aclCheck_t *aclChecklistCreate(const struct _acl_access *, - request_t *, const char *ident); + request_t *, + const char *ident); extern void aclNBCheck(aclCheck_t *, PF *, void *); extern int aclCheckFast(const struct _acl_access *A, aclCheck_t *); extern void aclChecklistFree(aclCheck_t *); @@ -84,8 +85,7 @@ extern void aioCancel(int); extern void aioOpen(const char *, int, mode_t, AIOCB *, void *); extern void aioClose(int); -extern void aioWrite(int, int offset, char *, int size, AIOCB *, void *, - FREE *); +extern void aioWrite(int, int offset, char *, int size, AIOCB *, void *, FREE *); extern void aioRead(int, int offset, char *, int size, AIOCB *, void *); extern void aioStat(char *, struct stat *, AIOCB *, void *); extern void aioUnlink(const char *, AIOCB *, void *); @@ -137,8 +137,7 @@ extern int checkNegativeHit(StoreEntry *); extern void clientHttpConnectionsOpen(void); extern void clientHttpConnectionsClose(void); -extern StoreEntry *clientCreateStoreEntry(clientHttpRequest *, method_t, - request_flags); +extern StoreEntry *clientCreateStoreEntry(clientHttpRequest *, method_t, request_flags); extern int isTcpHit(log_type); extern int commSetNonBlocking(int fd); @@ -153,19 +152,20 @@ extern int comm_connect_addr(int sock, const struct sockaddr_in *); extern void comm_init(void); extern int comm_listen(int sock); -extern int comm_open(int, int, struct in_addr, u_short port, int, - const char *note); +extern int comm_open(int, int, struct in_addr, u_short port, int, const char *note); extern u_short comm_local_port(int fd); extern void commSetSelect(int, unsigned int, PF *, void *, time_t); extern void comm_add_close_handler(int fd, PF *, void *); extern void comm_remove_close_handler(int fd, PF *, void *); -extern int comm_udp_sendto(int, const struct sockaddr_in *, int, const void *, - int); -extern void comm_write(int fd, char *buf, int size, CWCB * handler, - void *handler_data, FREE *); -extern void comm_write_mbuf(int fd, MemBuf mb, CWCB * handler, - void *handler_data); +extern int comm_udp_sendto(int, const struct sockaddr_in *, int, const void *, int); +extern void comm_write(int fd, + char *buf, + int size, + CWCB * handler, + void *handler_data, + FREE *); +extern void comm_write_mbuf(int fd, MemBuf mb, CWCB * handler, void *handler_data); extern void commCallCloseHandlers(int fd); extern int commSetTimeout(int fd, int, PF *, void *); extern void commSetDefer(int fd, DEFER * func, void *); @@ -211,15 +211,13 @@ extern void xassert(const char *, const char *, int); /* packs, then prints an object using debug() */ -extern void debugObj(int section, int level, const char *label, void *obj, - ObjPackMethod pm); +extern void debugObj(int section, int level, const char *label, void *obj, ObjPackMethod pm); extern int file_open(const char *path, int mode); extern void file_close(int fd); extern void file_write(int, off_t, void *, int len, DWCB *, void *, FREE *); -extern void file_write_mbuf(int fd, off_t, MemBuf mb, DWCB * handler, - void *handler_data); +extern void file_write_mbuf(int fd, off_t, MemBuf mb, DWCB * handler, void *handler_data); extern void file_read(int, char *, int, off_t, DRCB *, void *); extern void disk_init(void); @@ -234,8 +232,7 @@ extern void idnsPTRLookup(const struct in_addr, IDNSCB *, void *); extern void eventAdd(const char *name, EVH * func, void *arg, double when, int); -extern void eventAddIsh(const char *name, EVH * func, void *arg, - double delta_ish, int); +extern void eventAddIsh(const char *name, EVH * func, void *arg, double delta_ish, int); extern void eventRun(void); extern time_t eventNextTime(void); extern void eventDelete(EVH * func, void *arg); @@ -287,12 +284,14 @@ extern void httpProcessReplyHeader(HttpStateData *, const char *, int); extern mb_size_t httpBuildRequestPrefix(request_t * request, request_t * orig_request, - StoreEntry * entry, MemBuf * mb, int cfd, http_state_flags); + StoreEntry * entry, + MemBuf * mb, + int cfd, + http_state_flags); extern void httpAnonInitModule(void); extern int httpAnonHdrAllowed(http_hdr_type hdr_id); extern int httpAnonHdrDenied(http_hdr_type hdr_id); -extern void httpBuildRequestHeader(request_t *, request_t *, StoreEntry *, - HttpHeader *, int, http_state_flags); +extern void httpBuildRequestHeader(request_t *, request_t *, StoreEntry *, HttpHeader *, int, http_state_flags); /* ETag */ extern int etagParseInit(ETag * etag, const char *str); @@ -338,20 +337,17 @@ extern void httpHdrCcSetMaxAge(HttpHdrCc * cc, int max_age); extern void httpHdrCcSetSMaxAge(HttpHdrCc * cc, int s_maxage); extern void httpHdrCcUpdateStats(const HttpHdrCc * cc, StatHist * hist); -extern void httpHdrCcStatDumper(StoreEntry * sentry, int idx, double val, - double size, int count); +extern void httpHdrCcStatDumper(StoreEntry * sentry, int idx, double val, double size, int count); /* Http Range Header Field */ extern HttpHdrRange *httpHdrRangeParseCreate(const String * range_spec); /* returns true if ranges are valid; inits HttpHdrRange */ -extern int httpHdrRangeParseInit(HttpHdrRange * range, - const String * range_spec); +extern int httpHdrRangeParseInit(HttpHdrRange * range, const String * range_spec); extern void httpHdrRangeDestroy(HttpHdrRange * range); extern HttpHdrRange *httpHdrRangeDup(const HttpHdrRange * range); extern void httpHdrRangePackInto(const HttpHdrRange * range, Packer * p); /* iterate through specs */ -extern HttpHdrRangeSpec *httpHdrRangeGetSpec(const HttpHdrRange * range, - HttpHdrRangePos * pos); +extern HttpHdrRangeSpec *httpHdrRangeGetSpec(const HttpHdrRange * range, HttpHdrRangePos * pos); /* adjust specs after the length is known */ extern int httpHdrRangeCanonize(HttpHdrRange *, ssize_t); /* other */ @@ -366,40 +362,33 @@ extern HttpHdrContRange *httpHdrContRangeCreate(void); extern HttpHdrContRange *httpHdrContRangeParseCreate(const char *crange_spec); /* returns true if range is valid; inits HttpHdrContRange */ -extern int httpHdrContRangeParseInit(HttpHdrContRange * crange, - const char *crange_spec); +extern int httpHdrContRangeParseInit(HttpHdrContRange * crange, const char *crange_spec); extern void httpHdrContRangeDestroy(HttpHdrContRange * crange); extern HttpHdrContRange *httpHdrContRangeDup(const HttpHdrContRange * crange); -extern void httpHdrContRangePackInto(const HttpHdrContRange * crange, - Packer * p); +extern void httpHdrContRangePackInto(const HttpHdrContRange * crange, Packer * p); /* inits with given spec */ extern void httpHdrContRangeSet(HttpHdrContRange *, HttpHdrRangeSpec, ssize_t); /* Http Header Tools */ -extern HttpHeaderFieldInfo *httpHeaderBuildFieldsInfo(const HttpHeaderFieldAttrs - * attrs, int count); +extern HttpHeaderFieldInfo *httpHeaderBuildFieldsInfo(const HttpHeaderFieldAttrs * attrs, int count); extern void httpHeaderDestroyFieldsInfo(HttpHeaderFieldInfo * info, int count); -extern int httpHeaderIdByName(const char *name, int name_len, - const HttpHeaderFieldInfo * attrs, int end); +extern int httpHeaderIdByName(const char *name, int name_len, const HttpHeaderFieldInfo * attrs, int end); extern int httpHeaderIdByNameDef(const char *name, int name_len); extern const char *httpHeaderNameById(int id); extern void httpHeaderMaskInit(HttpHeaderMask * mask, int value); -extern void httpHeaderCalcMask(HttpHeaderMask * mask, const int *enums, - int count); +extern void httpHeaderCalcMask(HttpHeaderMask * mask, const int *enums, int count); extern int httpHeaderHasConnDir(const HttpHeader * hdr, const char *directive); extern void httpHeaderAddContRange(HttpHeader *, HttpHdrRangeSpec, ssize_t); extern void strListAdd(String * str, const char *item, char del); extern int strListIsMember(const String * str, const char *item, char del); extern int strListIsSubstr(const String * list, const char *s, char del); -extern int strListGetItem(const String * str, char del, const char **item, - int *ilen, const char **pos); +extern int strListGetItem(const String * str, char del, const char **item, int *ilen, const char **pos); extern const char *getStringPrefix(const char *str, const char *end); extern int httpHeaderParseInt(const char *start, int *val); extern int httpHeaderParseSize(const char *start, ssize_t * sz); extern int httpHeaderReset(HttpHeader * hdr); #if STDC_HEADERS -extern void httpHeaderPutStrf(HttpHeader * hdr, http_hdr_type id, - const char *fmt, ...); +extern void httpHeaderPutStrf(HttpHeader * hdr, http_hdr_type id, const char *fmt, ...); #else extern void httpHeaderPutStrf(); #endif @@ -413,49 +402,37 @@ extern void httpHeaderClean(HttpHeader * hdr); /* append/update */ extern void httpHeaderAppend(HttpHeader * dest, const HttpHeader * src); -extern void httpHeaderUpdate(HttpHeader * old, const HttpHeader * fresh, - const HttpHeaderMask * denied_mask); +extern void httpHeaderUpdate(HttpHeader * old, const HttpHeader * fresh, const HttpHeaderMask * denied_mask); /* parse/pack */ -extern int httpHeaderParse(HttpHeader * hdr, const char *header_start, - const char *header_end); +extern int httpHeaderParse(HttpHeader * hdr, const char *header_start, const char *header_end); extern void httpHeaderPackInto(const HttpHeader * hdr, Packer * p); /* field manipulation */ extern int httpHeaderHas(const HttpHeader * hdr, http_hdr_type type); extern void httpHeaderPutInt(HttpHeader * hdr, http_hdr_type type, int number); -extern void httpHeaderPutTime(HttpHeader * hdr, http_hdr_type type, - time_t time); -extern void httpHeaderPutStr(HttpHeader * hdr, http_hdr_type type, - const char *str); -extern void httpHeaderPutAuth(HttpHeader * hdr, const char *authScheme, - const char *realm); +extern void httpHeaderPutTime(HttpHeader * hdr, http_hdr_type type, time_t time); +extern void httpHeaderPutStr(HttpHeader * hdr, http_hdr_type type, const char *str); +extern void httpHeaderPutAuth(HttpHeader * hdr, const char *authScheme, const char *realm); extern void httpHeaderPutCc(HttpHeader * hdr, const HttpHdrCc * cc); -extern void httpHeaderPutContRange(HttpHeader * hdr, - const HttpHdrContRange * cr); +extern void httpHeaderPutContRange(HttpHeader * hdr, const HttpHdrContRange * cr); extern void httpHeaderPutRange(HttpHeader * hdr, const HttpHdrRange * range); -extern void httpHeaderPutExt(HttpHeader * hdr, const char *name, - const char *value); +extern void httpHeaderPutExt(HttpHeader * hdr, const char *name, const char *value); extern int httpHeaderGetInt(const HttpHeader * hdr, http_hdr_type id); extern time_t httpHeaderGetTime(const HttpHeader * hdr, http_hdr_type id); -extern TimeOrTag httpHeaderGetTimeOrTag(const HttpHeader * hdr, - http_hdr_type id); +extern TimeOrTag httpHeaderGetTimeOrTag(const HttpHeader * hdr, http_hdr_type id); extern HttpHdrCc *httpHeaderGetCc(const HttpHeader * hdr); extern ETag httpHeaderGetETag(const HttpHeader * hdr, http_hdr_type id); extern HttpHdrRange *httpHeaderGetRange(const HttpHeader * hdr); extern HttpHdrContRange *httpHeaderGetContRange(const HttpHeader * hdr); extern const char *httpHeaderGetStr(const HttpHeader * hdr, http_hdr_type id); -extern const char *httpHeaderGetLastStr(const HttpHeader * hdr, - http_hdr_type id); -extern const char *httpHeaderGetAuth(const HttpHeader * hdr, http_hdr_type id, - const char *authScheme); +extern const char *httpHeaderGetLastStr(const HttpHeader * hdr, http_hdr_type id); +extern const char *httpHeaderGetAuth(const HttpHeader * hdr, http_hdr_type id, const char *authScheme); extern String httpHeaderGetList(const HttpHeader * hdr, http_hdr_type id); extern int httpHeaderDelByName(HttpHeader * hdr, const char *name); extern int httpHeaderDelById(HttpHeader * hdr, http_hdr_type id); extern void httpHeaderDelAt(HttpHeader * hdr, HttpHeaderPos pos); /* avoid using these low level routines */ -extern HttpHeaderEntry *httpHeaderGetEntry(const HttpHeader * hdr, - HttpHeaderPos * pos); -extern HttpHeaderEntry *httpHeaderFindEntry(const HttpHeader * hdr, - http_hdr_type id); +extern HttpHeaderEntry *httpHeaderGetEntry(const HttpHeader * hdr, HttpHeaderPos * pos); +extern HttpHeaderEntry *httpHeaderFindEntry(const HttpHeader * hdr, http_hdr_type id); extern void httpHeaderAddEntry(HttpHeader * hdr, HttpHeaderEntry * e); extern HttpHeaderEntry *httpHeaderEntryClone(const HttpHeaderEntry * e); extern void httpHeaderEntryPackInto(const HttpHeaderEntry * e, Packer * p); @@ -464,8 +441,7 @@ /* Http Msg (currently in HttpReply.c @?@ ) */ extern int httpMsgIsPersistent(float http_ver, const HttpHeader * hdr); -extern int httpMsgIsolateHeaders(const char **parse_start, - const char **blk_start, const char **blk_end); +extern int httpMsgIsolateHeaders(const char **parse_start, const char **blk_start, const char **blk_end); /* Http Reply */ extern void httpReplyInitModule(void); @@ -486,8 +462,7 @@ extern void httpReplySwapOut(const HttpReply * rep, StoreEntry * e); /* set commonly used info with one call */ extern void httpReplySetHeaders(HttpReply * rep, double ver, http_status status, - const char *reason, const char *ctype, int clen, time_t lmt, - time_t expires); + const char *reason, const char *ctype, int clen, time_t lmt, time_t expires); /* do everything in one call: init, set, pack, clean, return MemBuf */ extern MemBuf httpPackedReply(double ver, http_status status, const char *ctype, int clen, time_t lmt, time_t expires); @@ -512,21 +487,21 @@ extern void httpRequestSwapOut(const request_t * req, StoreEntry * e); extern void httpRequestPack(const request_t * req, Packer * p); extern int httpRequestPrefixLen(const request_t * req); -extern int httpRequestHdrAllowed(const HttpHeaderEntry * e, - String * strConnection); +extern int httpRequestHdrAllowed(const HttpHeaderEntry * e, String * strConnection); extern int httpRequestHdrAllowedByName(http_hdr_type id); extern void icmpOpen(void); extern void icmpClose(void); extern void icmpPing(struct in_addr to); -extern void icmpSourcePing(struct in_addr to, const icp_common_t *, - const char *url); +extern void icmpSourcePing(struct in_addr to, const icp_common_t *, const char *url); extern void icmpDomainPing(struct in_addr to, const char *domain); extern void *icpCreateMessage(icp_opcode opcode, - int flags, const char *url, int reqnum, int pad); -extern int icpUdpSend(int, const struct sockaddr_in *, icp_common_t *, log_type, - int); + int flags, + const char *url, + int reqnum, + int pad); +extern int icpUdpSend(int, const struct sockaddr_in *, icp_common_t *, log_type, int); extern PF icpHandleUdp; extern PF icpUdpSendQueue; extern PF httpAccept; @@ -570,7 +545,8 @@ extern const cache_key *icpGetCacheKey(const char *url, int reqnum); extern void ipcache_nbgethostbyname(const char *name, - IPH * handler, void *handlerData); + IPH * handler, + void *handlerData); extern EVH ipcache_purgelru; extern const ipcache_addrs *ipcache_gethostbyname(const char *, int flags); extern void ipcacheInvalidate(const char *); @@ -613,11 +589,9 @@ extern void memBufReport(MemBuf * mb); extern char *mime_get_header(const char *mime, const char *header); -extern char *mime_get_header_field(const char *mime, const char *name, - const char *prefix); +extern char *mime_get_header_field(const char *mime, const char *name, const char *prefix); extern size_t headersEnd(const char *, size_t); -extern const char *mime_get_auth(const char *hdr, const char *auth_scheme, - const char **auth_field); +extern const char *mime_get_auth(const char *hdr, const char *auth_scheme, const char **auth_field); extern void mimeInit(char *filename); extern void mimeFreeMemory(void); @@ -642,10 +616,13 @@ extern peer *getSingleParent(request_t *); extern int neighborsCount(request_t *); extern int neighborsUdpPing(request_t *, - StoreEntry *, IRCB * callback, void *data, int *exprep, int *timeout); + StoreEntry *, + IRCB * callback, + void *data, + int *exprep, + int *timeout); extern void neighborAddAcl(const char *, const char *); -extern void neighborsUdpAck(const cache_key *, icp_common_t *, - const struct sockaddr_in *); +extern void neighborsUdpAck(const cache_key *, icp_common_t *, const struct sockaddr_in *); extern void neighborAdd(const char *, const char *, int, int, int, int, int); extern void neighbors_open(int); extern peer *peerFindByName(const char *); @@ -653,11 +630,9 @@ extern peer *getDefaultParent(request_t * request); extern peer *getRoundRobinParent(request_t * request); extern peer *getAnyParent(request_t * request); -extern lookup_t peerDigestLookup(peer * p, request_t * request, - StoreEntry * entry); +extern lookup_t peerDigestLookup(peer * p, request_t * request, StoreEntry * entry); extern peer *neighborsDigestSelect(request_t * request, StoreEntry * entry); -extern void peerNoteDigestLookup(request_t * request, peer * p, - lookup_t lookup); +extern void peerNoteDigestLookup(request_t * request, peer * p, lookup_t lookup); extern void peerNoteDigestGone(peer * p); extern int neighborUp(const peer * e); extern CBDUNL peerDestroy; @@ -668,13 +643,11 @@ 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 *); +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); +extern void netdbHandlePingReply(const struct sockaddr_in *from, int hops, int rtt); extern void netdbPingSite(const char *hostname); extern void netdbInit(void); extern void netdbDump(StoreEntry *); @@ -746,8 +719,7 @@ /* ident.c */ #if USE_IDENT -extern void identStart(struct sockaddr_in *me, struct sockaddr_in *peer, - IDCB * callback, void *cbdata); +extern void identStart(struct sockaddr_in *me, struct sockaddr_in *peer, IDCB * callback, void *cbdata); extern void identInit(void); #endif @@ -769,8 +741,7 @@ extern void statHistCopy(StatHist * Dest, const StatHist * Orig); extern void statHistSafeCopy(StatHist * Dest, const StatHist * Orig); extern double statHistDeltaMedian(const StatHist * A, const StatHist * B); -extern void statHistDump(const StatHist * H, StoreEntry * sentry, - StatHistBinDumper * bd); +extern void statHistDump(const StatHist * H, StoreEntry * sentry, StatHistBinDumper * bd); extern void statHistLogInit(StatHist * H, int capacity, double min, double max); extern void statHistEnumInit(StatHist * H, int last_enum); extern void statHistIntInit(StatHist * H, int n); @@ -833,8 +804,7 @@ extern StoreEntry *new_StoreEntry(int, const char *, const char *); extern StoreEntry *storeGet(const cache_key *); extern StoreEntry *storeGetPublic(const char *uri, const method_t method); -extern StoreEntry *storeCreateEntry(const char *, const char *, request_flags, - method_t); +extern StoreEntry *storeCreateEntry(const char *, const char *, request_flags, method_t); extern void storeSetPublicKey(StoreEntry *); extern void storeComplete(StoreEntry *); extern void storeInit(void); @@ -847,7 +817,11 @@ extern int storeUnregister(StoreEntry *, void *); extern void storeClientCopy(StoreEntry * e, off_t seen_offset, - off_t copy_offset, size_t size, char *buf, STCB * callback, void *data); + off_t copy_offset, + size_t size, + char *buf, + STCB * callback, + void *data); extern int storePendingNClients(const StoreEntry *); extern EVH storeMaintainSwapSpace; extern void storeExpireNow(StoreEntry *); @@ -903,8 +877,7 @@ */ extern storeIOState *storeUfsOpen(sfileno, mode_t, STIOCB *, void *); extern void storeUfsClose(storeIOState * sio); -extern void storeUfsRead(storeIOState *, char *, size_t, off_t, STRCB *, - void *); +extern void storeUfsRead(storeIOState *, char *, size_t, off_t, STRCB *, void *); extern void storeUfsWrite(storeIOState *, char *, size_t, off_t, FREE *); extern void storeUfsUnlink(int fileno); @@ -914,8 +887,7 @@ */ extern storeIOState *storeAufsOpen(sfileno, mode_t, STIOCB *, void *); extern void storeAufsClose(storeIOState * sio); -extern void storeAufsRead(storeIOState *, char *, size_t, off_t, STRCB *, - void *); +extern void storeAufsRead(storeIOState *, char *, size_t, off_t, STRCB *, void *); extern void storeAufsWrite(storeIOState *, char *, size_t, off_t, FREE *); extern void storeAufsUnlink(int fileno); #endif @@ -1029,8 +1001,7 @@ */ extern store_client *storeClientListSearch(const MemObject * mem, void *data); extern void storeClientListAdd(StoreEntry * e, void *data); -extern void storeClientCopy(StoreEntry *, off_t, off_t, size_t, char *, STCB *, - void *); +extern void storeClientCopy(StoreEntry *, off_t, off_t, size_t, char *, STCB *, void *); extern int storeClientCopyPending(StoreEntry * e, void *data); extern int storeUnregister(StoreEntry * e, void *data); extern off_t storeLowestMemReaderOffset(const StoreEntry * entry); @@ -1092,8 +1063,7 @@ extern void urlInitialize(void); extern request_t *urlParse(method_t, char *); extern const char *urlCanonical(request_t *); -extern char *urlRInternal(const char *host, u_short port, const char *dir, - const char *name); +extern char *urlRInternal(const char *host, u_short port, const char *dir, const char *name); extern char *urlInternal(const char *dir, const char *name); extern int matchDomainName(const char *host, const char *domain); extern int urlCheckRequest(const request_t *); @@ -1171,7 +1141,11 @@ * ipc.c */ extern int ipcCreate(int type, - const char *prog, char *const args[], const char *name, int *rfd, int *wfd + const char *prog, + char *const args[], + const char *name, + int *rfd, + int *wfd #ifdef _SQUID_MSWIN_ , HANDLE * hIpc, pid_t * ppid #endif @@ -1188,19 +1162,15 @@ extern void cacheDigestDel(CacheDigest * cd, const cache_key * key); extern size_t cacheDigestCalcMaskSize(int cap, int bpe); extern int cacheDigestBitUtil(const CacheDigest * cd); -extern void cacheDigestGuessStatsUpdate(cd_guess_stats * stats, int real_hit, - int guess_hit); -extern void cacheDigestGuessStatsReport(const cd_guess_stats * stats, - StoreEntry * sentry, const char *label); -extern void cacheDigestReport(CacheDigest * cd, const char *label, - StoreEntry * e); +extern void cacheDigestGuessStatsUpdate(cd_guess_stats * stats, int real_hit, int guess_hit); +extern void cacheDigestGuessStatsReport(const cd_guess_stats * stats, StoreEntry * sentry, const char *label); +extern void cacheDigestReport(CacheDigest * cd, const char *label, StoreEntry * e); extern void internalStart(request_t *, StoreEntry *); extern int internalCheck(const char *urlpath); extern int internalStaticCheck(const char *urlpath); extern char *internalLocalUri(const char *dir, const char *name); -extern char *internalRemoteUri(const char *, u_short, const char *, - const char *); +extern char *internalRemoteUri(const char *, u_short, const char *, const char *); extern const char *internalHostname(void); extern int internalHostnameIs(const char *); @@ -1214,8 +1184,7 @@ extern void delayInitDelayData(unsigned short pools); extern void delayFreeDelayData(void); extern void delayCreateDelayPool(unsigned short pool, u_char class); -extern void delayInitDelayPool(unsigned short pool, u_char class, - delaySpecSet * rates); +extern void delayInitDelayPool(unsigned short pool, u_char class, delaySpecSet * rates); extern void delayFreeDelayPool(unsigned short pool); extern void delayPoolsReconfigure(void); extern void delaySetNoDelay(int fd); @@ -1234,8 +1203,7 @@ /* helper.c */ extern void helperOpenServers(helper * hlp); -extern void helperSubmit(helper * hlp, const char *buf, HLPCB * callback, - void *data); +extern void helperSubmit(helper * hlp, const char *buf, HLPCB * callback, void *data); extern void helperStats(StoreEntry * sentry, helper * hlp); extern void helperShutdown(helper * hlp); extern helper *helperCreate(const char *); Index: squid/src/squid.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/squid.h,v retrieving revision 1.1.1.3.4.1.2.3.2.1 retrieving revision 1.1.1.3.4.1.2.3.2.2 diff -u -r1.1.1.3.4.1.2.3.2.1 -r1.1.1.3.4.1.2.3.2.2 --- squid/src/squid.h 27 Aug 2001 21:48:21 -0000 1.1.1.3.4.1.2.3.2.1 +++ squid/src/squid.h 15 Sep 2001 19:27:29 -0000 1.1.1.3.4.1.2.3.2.2 @@ -1,5 +1,5 @@ /* - * $Id: squid.h,v 1.1.1.3.4.1.2.3.2.1 2001/08/27 21:48:21 tolsty Exp $ + * $Id: squid.h,v 1.1.1.3.4.1.2.3.2.2 2001/09/15 19:27:29 serassio Exp $ * * AUTHOR: Duane Wessels * @@ -272,8 +272,7 @@ * source code cleaner, so we don't need lots of #ifdefs in other * places */ -struct rusage -{ +struct rusage { struct timeval ru_stime; struct timeval ru_utime; int ru_maxrss;