From: amosjeffries <> Date: Fri, 21 Sep 2007 17:41:52 +0000 (+0000) Subject: Misc Formatting & cleanups X-Git-Tag: SQUID_3_0_RC1~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=077fe5816c428aa8aae518ac560c10c1a5e1c030;p=thirdparty%2Fsquid.git Misc Formatting & cleanups Some comment corrections Some irrelevant typedef cleanups --- diff --git a/src/ACLDestinationDomain.cc b/src/ACLDestinationDomain.cc index ccce7500ff..f48e7e005a 100644 --- a/src/ACLDestinationDomain.cc +++ b/src/ACLDestinationDomain.cc @@ -1,5 +1,5 @@ /* - * $Id: ACLDestinationDomain.cc,v 1.13 2007/04/28 22:26:37 hno Exp $ + * $Id: ACLDestinationDomain.cc,v 1.14 2007/09/21 11:41:52 amosjeffries Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -50,7 +50,7 @@ DestinationDomainLookup::Instance() } void -DestinationDomainLookup::checkForAsync(ACLChecklist *checklist)const +DestinationDomainLookup::checkForAsync(ACLChecklist *checklist) const { checklist->asyncInProgress(true); fqdncache_nbgethostbyaddr(checklist->dst_addr, LookupDone, checklist); @@ -77,6 +77,7 @@ int ACLDestinationDomainStrategy::match (ACLData * &data, ACLChecklist *checklist) { const ipcache_addrs *ia = NULL; + const char *fqdn = NULL; if (data->match(checklist->request->host)) return 1; @@ -84,8 +85,6 @@ ACLDestinationDomainStrategy::match (ACLData * &data, ACLChecklist *c if ((ia = ipcacheCheckNumeric(checklist->request->host)) == NULL) return 0; - const char *fqdn = NULL; - fqdn = fqdncache_gethostbyaddr(ia->in_addrs[0], FQDN_LOOKUP_IF_MISS); if (fqdn) { diff --git a/src/ACLIP.cc b/src/ACLIP.cc index 8f3743e54e..fd5c9182a4 100644 --- a/src/ACLIP.cc +++ b/src/ACLIP.cc @@ -97,16 +97,9 @@ acl_ip_data::toStr(char *buf, int len) const } /* - * aclIpAddrNetworkCompare - The guts of the comparison for IP ACLs. - * The first argument (a) is a "host" address, i.e. the IP address - * of a cache client. The second argument (b) is a "network" address - * that might have a subnet and/or range. We mask the host address - * bits with the network subnet mask. - */ -/* - * aclIpAddrNetworkCompare - The comparison function used for ACL - * matching checks. The first argument (a) is a "host" address, - * i.e. the IP address of a cache client. The second argument (b) + * aclIpAddrNetworkCompare - The guts of the comparison for IP ACLs + * matching checks. The first argument (p) is a "host" address, + * i.e. the IP address of a cache client. The second argument (q) * is an entry in some address-based access control element. This * function is called via ACLIP::match() and the splay library. */ @@ -146,6 +139,9 @@ aclIpAddrNetworkCompare(acl_ip_data * const &p, acl_ip_data * const &q) * used by the splay insertion routine. It emits a warning if it * detects a "collision" or overlap that would confuse the splay * sorting algorithm. Much like aclDomainCompare. + * The first argument (p) is a "host" address, i.e. the IP address of a cache client. + * The second argument (b) is a "network" address that might have a subnet and/or range. + * We mask the host address bits with the network subnet mask. */ int acl_ip_data::NetworkCompare(acl_ip_data * const & a, acl_ip_data * const &b) @@ -177,12 +173,11 @@ acl_ip_data::NetworkCompare(acl_ip_data * const & a, acl_ip_data * const &b) } /* - * Decode a ascii representation (asc) of a IP adress, and place - * adress and netmask information in addr and mask. + * Decode an ascii representation (asc) of a IP netmask address or CIDR, + * and place resulting information in mask. * This function should NOT be called if 'asc' is a hostname! */ bool - acl_ip_data::DecodeMask(const char *asc, struct IN_ADDR *mask) { char junk; @@ -191,20 +186,20 @@ acl_ip_data::DecodeMask(const char *asc, struct IN_ADDR *mask) if (!asc || !*asc) { mask->s_addr = htonl(0xFFFFFFFFul); - return 1; + return true; } if (sscanf(asc, "%d%c", &a1, &junk) == 1 && a1 >= 0 && a1 < 33) { /* a significant bits value for a mask */ mask->s_addr = a1 ? htonl(0xfffffffful << (32 - a1)) : 0; - return 1; + return true; } /* dotted notation */ if (safe_inet_addr(asc, mask)) - return 1; + return true; - return 0; + return false; } #define SCAN_ACL1 "%[0123456789.]-%[0123456789.]/%[0123456789.]" diff --git a/src/ACLSourceDomain.cc b/src/ACLSourceDomain.cc index bbc830a3fa..8e544da4b8 100644 --- a/src/ACLSourceDomain.cc +++ b/src/ACLSourceDomain.cc @@ -1,5 +1,5 @@ /* - * $Id: ACLSourceDomain.cc,v 1.5 2007/04/28 22:26:37 hno Exp $ + * $Id: ACLSourceDomain.cc,v 1.6 2007/09/21 11:41:52 amosjeffries Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -49,7 +49,7 @@ SourceDomainLookup::Instance() } void -SourceDomainLookup::checkForAsync(ACLChecklist *checklist)const +SourceDomainLookup::checkForAsync(ACLChecklist *checklist) const { checklist->asyncInProgress(true); fqdncache_nbgethostbyaddr(checklist->src_addr, LookupDone, checklist); diff --git a/src/DelayId.cc b/src/DelayId.cc index 0ef369b693..85e2fea3d9 100644 --- a/src/DelayId.cc +++ b/src/DelayId.cc @@ -1,6 +1,6 @@ /* - * $Id: DelayId.cc,v 1.22 2007/08/27 12:50:42 hno Exp $ + * $Id: DelayId.cc,v 1.23 2007/09/21 11:41:52 amosjeffries Exp $ * * DEBUG: section 77 Delay Pools * AUTHOR: Robert Collins @@ -130,7 +130,6 @@ DelayId::DelayClient(ClientHttpRequest * http) } } - return DelayId(); } diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc index 3b6ad24125..a603775aef 100644 --- a/src/HttpHeader.cc +++ b/src/HttpHeader.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpHeader.cc,v 1.134 2007/08/13 17:20:51 hno Exp $ + * $Id: HttpHeader.cc,v 1.135 2007/09/21 11:41:52 amosjeffries Exp $ * * DEBUG: section 55 HTTP Header * AUTHOR: Alex Rousskov @@ -1642,12 +1642,12 @@ httpHeaderStoreReport(StoreEntry * e) /* field stats for all messages */ storeAppendPrintf(e, "\nHttp Fields Stats (replies and requests)\n"); - storeAppendPrintf(e, "%2s\t %-20s\t %5s\t %6s\t %6s\n", + storeAppendPrintf(e, "%2s\t %-25s\t %5s\t %6s\t %6s\n", "id", "name", "#alive", "%err", "%repeat"); for (ht = (http_hdr_type)0; ht < HDR_ENUM_END; ++ht) { HttpHeaderFieldInfo *f = Headers + ht; - storeAppendPrintf(e, "%2d\t %-20s\t %5d\t %6.3f\t %6.3f\n", + storeAppendPrintf(e, "%2d\t %-25s\t %5d\t %6.3f\t %6.3f\n", f->id, f->name.buf(), f->stat.aliveCount, xpercent(f->stat.errCount, f->stat.parsCount), xpercent(f->stat.repCount, f->stat.seenCount)); diff --git a/src/ICP.h b/src/ICP.h index 58f1027f2f..c21717352c 100644 --- a/src/ICP.h +++ b/src/ICP.h @@ -1,6 +1,6 @@ /* - * $Id: ICP.h,v 1.7 2007/04/19 20:21:34 wessels Exp $ + * $Id: ICP.h,v 1.8 2007/09/21 11:41:52 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -36,8 +36,9 @@ #include "StoreClient.h" -/* This struct is the wire-level header. - * DO NOT add ore move fields on pain of breakage. +/** + * This struct is the wire-level header. + * DO NOT add more move fields on pain of breakage. * DO NOT add virtual methods. */ @@ -71,8 +72,7 @@ inline icp_opcode & operator++ (icp_opcode & aCode) } -/* todo: mempool this */ - +/** \todo mempool this */ class ICPState { @@ -89,9 +89,7 @@ public: #endif -typedef struct _icpUdpData icpUdpData; - -struct _icpUdpData +struct icpUdpData { struct sockaddr_in address; @@ -109,9 +107,7 @@ struct _icpUdpData }; -HttpRequest * - -icpGetRequest(char *url, int reqnum, int fd, struct sockaddr_in *from); +HttpRequest* icpGetRequest(char *url, int reqnum, int fd, struct sockaddr_in *from); int icpAccessAllowed(struct sockaddr_in *from, HttpRequest * icp_request); @@ -134,6 +130,4 @@ SQUIDCEXTERN int icpSetCacheKey(const cache_key * key); SQUIDCEXTERN const cache_key *icpGetCacheKey(const char *url, int reqnum); - - #endif /* SQUID_ICP_H */ diff --git a/src/PeerDigest.h b/src/PeerDigest.h index 3ddf70f2a3..dd8b886ef8 100644 --- a/src/PeerDigest.h +++ b/src/PeerDigest.h @@ -1,6 +1,6 @@ /* - * $Id: PeerDigest.h,v 1.3 2007/05/29 13:31:38 amosjeffries Exp $ + * $Id: PeerDigest.h,v 1.4 2007/09/21 11:41:52 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -95,10 +95,10 @@ public: void *operator new (size_t); void operator delete(void *); - struct _peer *peer; /* pointer back to peer structure, argh */ - CacheDigest *cd; /* actual digest structure */ - String host; /* copy of peer->host */ - const char *req_result; /* text status of the last request */ + struct _peer *peer; /* pointer back to peer structure, argh */ + CacheDigest *cd; /* actual digest structure */ + String host; /* copy of peer->host */ + const char *req_result; /* text status of the last request */ struct { diff --git a/src/asn.cc b/src/asn.cc index 4285943f81..a533f2dd11 100644 --- a/src/asn.cc +++ b/src/asn.cc @@ -1,6 +1,6 @@ /* - * $Id: asn.cc,v 1.114 2007/08/27 12:50:42 hno Exp $ + * $Id: asn.cc,v 1.115 2007/09/21 11:41:52 amosjeffries Exp $ * * DEBUG: section 53 AS Number handling * AUTHOR: Duane Wessels, Kostas Anagnostakis @@ -77,13 +77,13 @@ template cbdata_type List * enhancements (e.g. expires) */ -struct _as_info +struct as_info { List *as_number; time_t expires; /* NOTUSED */ }; -struct _ASState +struct ASState { StoreEntry *entry; store_client *sc; @@ -95,23 +95,15 @@ struct _ASState bool dataRead; }; -typedef struct _ASState ASState; - -typedef struct _as_info as_info; - -/* entry into the radix tree */ - -struct _rtentry +/** entry into the radix tree */ +struct rtentry_t { - struct squid_radix_node e_nodes[2]; as_info *e_info; m_int e_addr; m_int e_mask; }; -typedef struct _rtentry rtentry_t; - static int asnAddNet(char *, int); static void asnCacheStart(int as); diff --git a/src/client_db.cc b/src/client_db.cc index ee77f5d48a..5ce4ae61c0 100644 --- a/src/client_db.cc +++ b/src/client_db.cc @@ -1,6 +1,6 @@ /* - * $Id: client_db.cc,v 1.70 2007/05/29 13:31:39 amosjeffries Exp $ + * $Id: client_db.cc,v 1.71 2007/09/21 11:41:52 amosjeffries Exp $ * * DEBUG: section 0 Client Database * AUTHOR: Duane Wessels @@ -133,8 +133,7 @@ clientdbUpdate(struct IN_ADDR addr, log_type ltype, protocol_t p, size_t size) c->last_seen = squid_curtime; } -/* - * clientdbEstablished() +/** * This function tracks the number of currently established connections * for a client IP address. When a connection is accepted, call this * with delta = 1. When the connection is closed, call with delta = @@ -247,10 +246,10 @@ clientdbDump(StoreEntry * sentry) while ((c = (ClientInfo *) hash_next(client_table))) { storeAppendPrintf(sentry, "Address: %s\n", hashKeyStr(&c->hash)); - storeAppendPrintf(sentry, "Name: %s\n", fqdnFromAddr(c->addr)); + storeAppendPrintf(sentry, "Name: %s\n", fqdnFromAddr(c->addr)); storeAppendPrintf(sentry, "Currently established connections: %d\n", c->n_established); - storeAppendPrintf(sentry, " ICP Requests %d\n", + storeAppendPrintf(sentry, " ICP Requests %d\n", c->Icp.n_requests); for (l = LOG_TAG_NONE; l < LOG_TYPE_MAX; ++l) { @@ -385,9 +384,8 @@ clientdbStartGC(void) #if SQUID_SNMP -struct IN_ADDR * - - client_entry(struct IN_ADDR *current) +struct in_addr* +client_entry(struct IN_ADDR *current) { ClientInfo *c = NULL; char *key;