From: wessels <> Date: Tue, 27 Apr 1999 03:04:39 +0000 (+0000) Subject: gindent X-Git-Tag: SQUID_3_0_PRE1~2249 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f6308664a976d1cf311f93931775f4184cef1b06;p=thirdparty%2Fsquid.git gindent --- diff --git a/src/acl.cc b/src/acl.cc index 6ff02a1f47..2d578c3d13 100644 --- a/src/acl.cc +++ b/src/acl.cc @@ -1,6 +1,6 @@ /* - * $Id: acl.cc,v 1.201 1999/04/23 02:57:17 wessels Exp $ + * $Id: acl.cc,v 1.202 1999/04/26 21:04:39 wessels Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -1810,7 +1810,7 @@ aclDestroyAcls(acl ** head) break; case ACL_NONE: default: - debug(28,1)("aclDestroyAcls: no case for ACL type %d\n", a->type); + debug(28, 1) ("aclDestroyAcls: no case for ACL type %d\n", a->type); break; } safe_free(a->cfgline); diff --git a/src/client.cc b/src/client.cc index 6c6d351fd6..94b74c5b7e 100644 --- a/src/client.cc +++ b/src/client.cc @@ -1,6 +1,7 @@ + /* - * $Id: client.cc,v 1.83 1999/04/15 06:15:48 wessels Exp $ + * $Id: client.cc,v 1.84 1999/04/26 21:04:40 wessels Exp $ * * DEBUG: section 0 WWW Client * AUTHOR: Harvest Derived diff --git a/src/client_side.cc b/src/client_side.cc index f38b1b3c80..09d9220be7 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.444 1999/04/23 23:01:23 wessels Exp $ + * $Id: client_side.cc,v 1.445 1999/04/26 21:04:42 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -81,8 +81,8 @@ static int clientOnlyIfCached(clientHttpRequest * http); static STCB clientSendMoreData; static STCB clientCacheHit; static void clientSetKeepaliveFlag(clientHttpRequest *); -static void clientPackRangeHdr(const HttpReply *rep, const HttpHdrRangeSpec *spec, String boundary, MemBuf *mb); -static void clientPackTermBound(String boundary, MemBuf *mb); +static void clientPackRangeHdr(const HttpReply * rep, const HttpHdrRangeSpec * spec, String boundary, MemBuf * mb); +static void clientPackTermBound(String boundary, MemBuf * mb); static void clientInterpretRequestHeaders(clientHttpRequest *); static void clientProcessRequest(clientHttpRequest *); static void clientProcessExpired(void *data); @@ -990,7 +990,8 @@ clientIfRangeMatch(clientHttpRequest * http, HttpReply * rep) * time of the actuall assembly will be exactly the same as * the headers when clientMRangeCLen() is called */ static int -clientMRangeCLen(clientHttpRequest * http) { +clientMRangeCLen(clientHttpRequest * http) +{ int clen = 0; HttpHdrRangePos pos = HttpHdrRangeInitPos; const HttpHdrRangeSpec *spec; @@ -1362,7 +1363,7 @@ clientCacheHit(void *data, char *buf, ssize_t size) /* put terminating boundary for multiparts */ static void -clientPackTermBound(String boundary, MemBuf *mb) +clientPackTermBound(String boundary, MemBuf * mb) { memBufPrintf(mb, "\r\n--%s--\r\n", strBuf(boundary)); debug(33, 6) ("clientPackTermBound: buf offset: %d\n", mb->size); @@ -1370,7 +1371,7 @@ clientPackTermBound(String boundary, MemBuf *mb) /* appends a "part" HTTP header (as in a multi-part/range reply) to the buffer */ static void -clientPackRangeHdr(const HttpReply *rep, const HttpHdrRangeSpec *spec, String boundary, MemBuf *mb) +clientPackRangeHdr(const HttpReply * rep, const HttpHdrRangeSpec * spec, String boundary, MemBuf * mb) { HttpHeader hdr; Packer p; @@ -1385,7 +1386,7 @@ clientPackRangeHdr(const HttpReply *rep, const HttpHdrRangeSpec *spec, String bo /* stuff the header with required entries and pack it */ httpHeaderInit(&hdr, hoReply); if (httpHeaderHas(&rep->header, HDR_CONTENT_TYPE)) - httpHeaderPutStr(&hdr, HDR_CONTENT_TYPE, httpHeaderGetStr(&rep->header, HDR_CONTENT_TYPE)); + httpHeaderPutStr(&hdr, HDR_CONTENT_TYPE, httpHeaderGetStr(&rep->header, HDR_CONTENT_TYPE)); httpHeaderAddContRange(&hdr, *spec, rep->content_length); packerToMemInit(&p, mb); httpHeaderPackInto(&hdr, &p); @@ -1413,13 +1414,12 @@ clientPackRange(clientHttpRequest * http, HttpHdrRangeIter * i, const char **buf if (http->request->range->specs.count > 1 && i->debt_size == i->spec->length) { assert(http->entry->mem_obj); clientPackRangeHdr( - http->entry->mem_obj->reply, /* original reply */ - i->spec, /* current range */ - i->boundary, /* boundary, the same for all */ + http->entry->mem_obj->reply, /* original reply */ + i->spec, /* current range */ + i->boundary, /* boundary, the same for all */ mb - ); + ); } - /* append content */ debug(33, 3) ("clientPackRange: appending %d bytes\n", copy_sz); memBufAppend(mb, *buf, copy_sz); diff --git a/src/globals.h b/src/globals.h index 220b80a0fe..f6cdc182a9 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1,6 +1,6 @@ /* - * $Id: globals.h,v 1.79 1999/04/26 20:44:08 glenn Exp $ + * $Id: globals.h,v 1.80 1999/04/26 21:04:44 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -99,10 +99,10 @@ extern int theOutSnmpConnection; /* -1 */ extern char *snmp_agentinfo; #endif #ifdef WCCP -extern int theInWccpConnection; /* -1 */ -extern int theOutWccpConnection; /* -1 */ -extern int theInGreConnection; /* -1 */ -extern int theOutGreConnection; /* -1 */ +extern int theInWccpConnection; /* -1 */ +extern int theOutWccpConnection; /* -1 */ +extern int theInGreConnection; /* -1 */ +extern int theOutGreConnection; /* -1 */ #endif extern int vhost_mode; /* 0 */ extern int n_disk_objects; /* 0 */ diff --git a/src/main.cc b/src/main.cc index 2e07e00eaf..e767788426 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,7 +1,7 @@ /* - * $Id: main.cc,v 1.296 1999/04/26 20:44:09 glenn Exp $ - * $Id: main.cc,v 1.296 1999/04/26 20:44:09 glenn Exp $ + * $Id: main.cc,v 1.297 1999/04/26 21:04:45 wessels Exp $ + * $Id: main.cc,v 1.297 1999/04/26 21:04:45 wessels Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -472,7 +472,7 @@ mainInitialize(void) unlinkdInit(); urlInitialize(); cachemgrInit(); - eventInit(); /* eventInit() before statInit() */ + eventInit(); /* eventInit() before statInit() */ statInit(); storeInit(); mainSetCwd(); @@ -520,7 +520,7 @@ mainInitialize(void) eventAdd("ipcache_purgelru", ipcache_purgelru, NULL, 10.0, 1); eventAdd("fqdncache_purgelru", fqdncache_purgelru, NULL, 15.0, 1); #ifdef WCCP - if(Config.Wccp.router.s_addr != inet_addr("0.0.0.0")) + if (Config.Wccp.router.s_addr != inet_addr("0.0.0.0")) eventAdd("wccpHereIam", wccpHereIam, NULL, 10.0, 1); #endif } diff --git a/src/protos.h b/src/protos.h index c0894da051..db43b96500 100644 --- a/src/protos.h +++ b/src/protos.h @@ -1,7 +1,7 @@ /* - * $Id: protos.h,v 1.322 1999/04/26 20:44:10 glenn Exp $ - * $Id: protos.h,v 1.322 1999/04/26 20:44:10 glenn Exp $ + * $Id: protos.h,v 1.323 1999/04/26 21:04:46 wessels Exp $ + * $Id: protos.h,v 1.323 1999/04/26 21:04:46 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -521,7 +521,7 @@ extern variable_list *snmp_meshCtblFn(variable_list *, snint *); #endif /* SQUID_SNMP */ #ifdef WCCP -extern PF wccpHandleUdp; +extern PF wccpHandleUdp; extern PF wccpHandleGre; extern EVH wccpHereIam; extern void wccpInit(void); diff --git a/src/structs.h b/src/structs.h index 62f8ba9a58..970a1d629f 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,7 +1,6 @@ /* - * $Id: structs.h,v 1.284 1999/04/26 20:44:12 glenn Exp $ - * $Id: structs.h,v 1.284 1999/04/26 20:44:12 glenn Exp $ + * $Id: structs.h,v 1.285 1999/04/26 21:04:48 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -325,8 +324,8 @@ struct _SquidConfig { struct in_addr snmp_outgoing; #endif #if WCCP - struct in_addr wccp_incoming; - struct in_addr wccp_outgoing; + struct in_addr wccp_incoming; + struct in_addr wccp_outgoing; #endif struct in_addr client_netmask; } Addrs; diff --git a/src/wccp.cc b/src/wccp.cc index 2567897070..1ced89305e 100644 --- a/src/wccp.cc +++ b/src/wccp.cc @@ -1,8 +1,8 @@ /* - * $Id: wccp.cc,v 1.1 1999/04/26 20:44:12 glenn Exp $ + * $Id: wccp.cc,v 1.2 1999/04/26 21:04:49 wessels Exp $ * - * DEBUG: section 80 WCCP Support + * DEBUG: section 80 WCCP Support * AUTHOR: Glenn Chisholm * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -72,11 +72,11 @@ struct wccp_i_see_you_t { }; struct wccp_assign_bucket_t { - int type; - int id; - int number; - int ip_addr[32]; - char bucket[WCCP_BUCKETS]; + int type; + int id; + int number; + int ip_addr[32]; + char bucket[WCCP_BUCKETS]; }; static struct wccp_here_i_am_t wccp_here_i_am; @@ -86,7 +86,7 @@ static int last_change; static int last_assign; static int change; -static void wccpAssignBuckets(struct wccp_i_see_you_t * wccp_i_see_you); +static void wccpAssignBuckets(struct wccp_i_see_you_t *wccp_i_see_you); /* * The functions used during startup: * wccpInit @@ -100,16 +100,16 @@ wccpInit(void) { debug(80, 5) ("wccpInit: Called\n"); - router_len = sizeof(router); + router_len = sizeof(router); memset(&router, '\0', router_len); router.sin_family = AF_INET; router.sin_port = htons(2048); router.sin_addr = Config.Wccp.router; - + memset(&wccp_here_i_am, '\0', sizeof(wccp_here_i_am)); wccp_here_i_am.type = htonl(WCCP_HERE_I_AM); wccp_here_i_am.version = htonl(WCCP_VERSION); - wccp_here_i_am.revision = htonl(WCCP_REVISION); + wccp_here_i_am.revision = htonl(WCCP_REVISION); change = 0; last_change = 0; @@ -168,7 +168,7 @@ wccpConnectionOpen(void) theOutWccpConnection = theInWccpConnection; theOutGreConnection = theInGreConnection; } - }else{ + } else { debug(1, 1) ("WCCP Disabled.\n"); } } @@ -214,14 +214,14 @@ wccpConnectionClose(void) /* * Accept the GRE packet - */ + */ void wccpHandleGre(int sock, void *not_used) -{ +{ struct wccp_i_see_you_t wccp_i_see_you; struct sockaddr_in from; - socklen_t from_len; - int len; + socklen_t from_len; + int len; debug(80, 6) ("wccpHandleUdp: Called.\n"); @@ -232,119 +232,119 @@ wccpHandleGre(int sock, void *not_used) Counter.syscalls.sock.recvfroms++; len = recvfrom(sock, - &wccp_i_see_you, - WCCP_RESPONSE_SIZE, - 0, - (struct sockaddr *) &from, - &from_len); + &wccp_i_see_you, + WCCP_RESPONSE_SIZE, + 0, + (struct sockaddr *) &from, + &from_len); if (len > 0) { - debug(80, 5) ("wccpHandleUdp: FD %d: received %d bytes from %s.\n", - sock, - len, - inet_ntoa(from.sin_addr)); - if(Config.Wccp.router.s_addr != ntohl(from.sin_addr.s_addr)){ - if((ntohl(wccp_i_see_you.version) == WCCP_VERSION) && (ntohl(wccp_i_see_you.type) == WCCP_I_SEE_YOU)){ - debug(80, 5) ("wccpHandleUdp: Valid WCCP packet recieved.\n"); - wccp_here_i_am.id = wccp_i_see_you.id; - if(change != wccp_i_see_you.change){ - change = wccp_i_see_you.change; - if(last_assign) - last_assign = 0; - else - last_change = 4; - } - if(last_change){ - last_change--; - if(!last_change){ - wccpAssignBuckets(&wccp_i_see_you); - last_assign = 1; - } - } - }else{ - debug(80, 5) ("wccpHandleUdp: Invalid WCCP packet recieved.\n"); - } - } else { - debug(80, 5) ("wccpHandleUdp: WCCP packet recieved from invalid address.\n"); - } + debug(80, 5) ("wccpHandleUdp: FD %d: received %d bytes from %s.\n", + sock, + len, + inet_ntoa(from.sin_addr)); + if (Config.Wccp.router.s_addr != ntohl(from.sin_addr.s_addr)) { + if ((ntohl(wccp_i_see_you.version) == WCCP_VERSION) && (ntohl(wccp_i_see_you.type) == WCCP_I_SEE_YOU)) { + debug(80, 5) ("wccpHandleUdp: Valid WCCP packet recieved.\n"); + wccp_here_i_am.id = wccp_i_see_you.id; + if (change != wccp_i_see_you.change) { + change = wccp_i_see_you.change; + if (last_assign) + last_assign = 0; + else + last_change = 4; + } + if (last_change) { + last_change--; + if (!last_change) { + wccpAssignBuckets(&wccp_i_see_you); + last_assign = 1; + } + } + } else { + debug(80, 5) ("wccpHandleUdp: Invalid WCCP packet recieved.\n"); + } + } else { + debug(80, 5) ("wccpHandleUdp: WCCP packet recieved from invalid address.\n"); + } } -} - +} + /* * Accept the UDP packet - */ + */ void wccpHandleUdp(int sock, void *not_used) -{ +{ struct wccp_i_see_you_t wccp_i_see_you; struct sockaddr_in from; - socklen_t from_len; - int len; + socklen_t from_len; + int len; debug(80, 6) ("wccpHandleUdp: Called.\n"); - + commSetSelect(sock, COMM_SELECT_READ, wccpHandleUdp, NULL, 0); from_len = sizeof(struct sockaddr_in); memset(&from, '\0', from_len); - + Counter.syscalls.sock.recvfroms++; - + len = recvfrom(sock, - &wccp_i_see_you, - WCCP_RESPONSE_SIZE, - 0, - (struct sockaddr *) &from, - &from_len); - + &wccp_i_see_you, + WCCP_RESPONSE_SIZE, + 0, + (struct sockaddr *) &from, + &from_len); + if (len > 0) { - debug(80, 5) ("wccpHandleUdp: FD %d: received %d bytes from %s.\n", - sock, - len, - inet_ntoa(from.sin_addr)); - if(Config.Wccp.router.s_addr != ntohl(from.sin_addr.s_addr)){ - if((ntohl(wccp_i_see_you.version) == WCCP_VERSION) && (ntohl(wccp_i_see_you.type) == WCCP_I_SEE_YOU)){ + debug(80, 5) ("wccpHandleUdp: FD %d: received %d bytes from %s.\n", + sock, + len, + inet_ntoa(from.sin_addr)); + if (Config.Wccp.router.s_addr != ntohl(from.sin_addr.s_addr)) { + if ((ntohl(wccp_i_see_you.version) == WCCP_VERSION) && (ntohl(wccp_i_see_you.type) == WCCP_I_SEE_YOU)) { debug(80, 5) ("wccpHandleUdp: Valid WCCP packet recieved.\n"); wccp_here_i_am.id = wccp_i_see_you.id; - if(change != wccp_i_see_you.change){ + if (change != wccp_i_see_you.change) { change = wccp_i_see_you.change; - if(last_assign) + if (last_assign) last_assign = 0; else - last_change = 4; + last_change = 4; } - if(last_change){ + if (last_change) { last_change--; - if(!last_change){ - wccpAssignBuckets(&wccp_i_see_you); + if (!last_change) { + wccpAssignBuckets(&wccp_i_see_you); last_assign = 1; } } - }else{ + } else { debug(80, 5) ("wccpHandleUdp: Invalid WCCP packet recieved.\n"); - } + } } else { - debug(80, 5) ("wccpHandleUdp: WCCP packet recieved from invalid address.\n"); + debug(80, 5) ("wccpHandleUdp: WCCP packet recieved from invalid address.\n"); } - } -} + } +} void wccpHereIam(void *voidnotused) { - debug(80, 6) ("wccpHereIam: Called\n"); + debug(80, 6) ("wccpHereIam: Called\n"); - sendto(theOutWccpConnection, - &wccp_here_i_am, - sizeof(wccp_here_i_am), - 0, - (struct sockaddr *) & router, + sendto(theOutWccpConnection, + &wccp_here_i_am, + sizeof(wccp_here_i_am), + 0, + (struct sockaddr *) &router, router_len); eventAdd("wccpHereIam", wccpHereIam, NULL, 10.0, 1); } void -wccpAssignBuckets(struct wccp_i_see_you_t * wccp_i_see_you) +wccpAssignBuckets(struct wccp_i_see_you_t *wccp_i_see_you) { struct wccp_assign_bucket_t wccp_assign_bucket; int number_buckets, loop_buckets, loop, bucket, number_caches; @@ -354,14 +354,14 @@ wccpAssignBuckets(struct wccp_i_see_you_t * wccp_i_see_you) memset(&wccp_assign_bucket.bucket, 0, sizeof(wccp_assign_bucket.bucket)); number_caches = ntohl(wccp_i_see_you->number); - if(number_caches > WCCP_ACTIVE_CACHES) + if (number_caches > WCCP_ACTIVE_CACHES) number_caches = WCCP_ACTIVE_CACHES; - number_buckets = WCCP_BUCKETS/number_caches; + number_buckets = WCCP_BUCKETS / number_caches; bucket = 0; - for(loop=0;loop < number_caches;loop++){ + for (loop = 0; loop < number_caches; loop++) { wccp_assign_bucket.ip_addr[loop] = wccp_i_see_you->wccp_cache_entry[loop].ip_addr; - for(loop_buckets=0;loop_buckets < number_buckets;loop_buckets++){ + for (loop_buckets = 0; loop_buckets < number_buckets; loop_buckets++) { wccp_assign_bucket.bucket[bucket++] = loop; } } @@ -372,6 +372,6 @@ wccpAssignBuckets(struct wccp_i_see_you_t * wccp_i_see_you) &wccp_assign_bucket, sizeof(wccp_assign_bucket), 0, - (struct sockaddr *) & router, + (struct sockaddr *) &router, router_len); }