]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Misc Formatting & cleanups
authoramosjeffries <>
Fri, 21 Sep 2007 17:41:52 +0000 (17:41 +0000)
committeramosjeffries <>
Fri, 21 Sep 2007 17:41:52 +0000 (17:41 +0000)
Some comment corrections
Some irrelevant typedef cleanups

src/ACLDestinationDomain.cc
src/ACLIP.cc
src/ACLSourceDomain.cc
src/DelayId.cc
src/HttpHeader.cc
src/ICP.h
src/PeerDigest.h
src/asn.cc
src/client_db.cc

index ccce7500fff55060e79ed0613b328f5faa673f9f..f48e7e005adf17d5e25b8de060394ec67d4f0f77 100644 (file)
@@ -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<MatchType> * &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<MatchType> * &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) {
index 8f3743e54e6682c2b651af4749af57d490a22ac1..fd5c9182a4e3382bdc4e43d8ac7ed4303c56ef8b 100644 (file)
@@ -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.]"
index bbc830a3fae0dfd6eab9fbfe403d598851134843..8e544da4b8b4ca5493518dc45633cf00cd84a485 100644 (file)
@@ -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);
index 0ef369b693c89f77085c0e57909a3923d45e1136..85e2fea3d9f08d25c9cf262bee90d90248772cca 100644 (file)
@@ -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 <robertc@squid-cache.org>
@@ -130,7 +130,6 @@ DelayId::DelayClient(ClientHttpRequest * http)
         }
     }
 
-
     return DelayId();
 }
 
index 3b6ad241250287dd97b08683b2ac5740a40bd78d..a603775aef580399d4266dd42f40bfd06a948342 100644 (file)
@@ -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));
index 58f1027f2f7026f6532548db4ba9bec815b36b18..c21717352cb750d3075faf276211ddd36a1dcd9c 100644 (file)
--- 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 */
index 3ddf70f2a32f96adfdf65da710ad4768a98e98e9..dd8b886ef837683db6a189dd0438d1f141887a56 100644 (file)
@@ -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
     {
index 4285943f81050674c81d15e91b37f691340c1d9b..a533f2dd112498927ecca745a07b17792e64ceb6 100644 (file)
@@ -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<int>
  * enhancements (e.g. expires)
  */
 
-struct _as_info
+struct as_info
 {
     List<int> *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);
index ee77f5d48afddd10787b2dde3c7530a92422461b..5ce4ae61c00b21976840ba39972af3d83c7e8dfa 100644 (file)
@@ -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;