]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Update class MessageCounters to MessageSizes
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 11 Nov 2013 12:09:44 +0000 (05:09 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 11 Nov 2013 12:09:44 +0000 (05:09 -0700)
Also, renaming polish after audit feedback.

src/AccessLogEntry.h
src/Makefile.am
src/MessageCounters.h [deleted file]
src/MessageSizes.h [new file with mode: 0644]
src/adaptation/icap/ModXact.cc
src/client_side.cc
src/format/Format.cc
src/icp_v2.cc
src/log/FormatHttpdCombined.cc
src/log/FormatHttpdCommon.cc
src/log/FormatSquidNative.cc

index 44008a54c174e5b579b005db2b34791960e0815b..2263198cd7a510f096e7e2a07d2458a05af31091 100644 (file)
@@ -40,7 +40,7 @@
 #include "icp_opcode.h"
 #include "ip/Address.h"
 #include "LogTags.h"
-#include "MessageCounters.h"
+#include "MessageSizes.h"
 #include "Notes.h"
 #if ICAP_CLIENT
 #include "adaptation/icap/Elements.h"
@@ -87,7 +87,8 @@ public:
         HttpDetails() : method(Http::METHOD_NONE), code(0), content_type(NULL),
                 timedout(false),
                 aborted(false),
-                clientRequest() {}
+                clientRequestSz(),
+                clientReplySz() {}
 
         HttpRequestMethod method;
         int code;
@@ -104,12 +105,12 @@ public:
         /// counters for the original request received from client
         // TODO calculate header and payload better (by parser)
         // XXX payload encoding overheads not calculated at all yet.
-        MessageCounters clientRequest;
+        MessageSizes clientRequestSz;
 
         /// counters for the response sent to client
         // TODO calculate header and payload better (by parser)
         // XXX payload encoding overheads not calculated at all yet.
-        MessageCounters adaptedReply;
+        MessageSizes clientReplySz;
 
     } http;
 
index 15ab4098c32a3cb0261b466ddc381bc2d885b41e..bc66e7e57c3e4db1c6dcec222964433cb90d3712 100644 (file)
@@ -442,7 +442,7 @@ squid_SOURCES = \
        MemBuf.cc \
        MemObject.cc \
        MemObject.h \
-       MessageCounters.h \
+       MessageSizes.h \
        mime.h \
        mime.cc \
        mime_header.h \
diff --git a/src/MessageCounters.h b/src/MessageCounters.h
deleted file mode 100644 (file)
index b1b86ef..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef SQUID_SRC_MESSAGECOUNTERS_H
-#define SQUID_SRC_MESSAGECOUNTERS_H
-
-/**
- * Counters used to collate the traffic size measurements
- * for a transaction message.
- */
-class MessageCounters
-{
-public:
-    MessageCounters() : headerSz(0), payloadDataSz(0), payloadTeSz(0) {}
-
-    /// size of message header block (if any)
-    uint64_t headerSz;
-
-    /// total size of payload block(s) excluding transfer encoding overheads
-    uint64_t payloadDataSz;
-
-    /// total size of extra bytes added by transfer encoding
-    uint64_t payloadTeSz;
-
-    // total message size
-    uint64_t total() const {return headerSz + payloadDataSz + payloadTeSz;}
-
-    /// total payload size including transfer encoding overheads
-    uint64_t payloadTotal() const {return payloadDataSz + payloadTeSz;}
-};
-
-#endif  /* SQUID_SRC_MESSAGECOUNTERS_H */
diff --git a/src/MessageSizes.h b/src/MessageSizes.h
new file mode 100644 (file)
index 0000000..69220c4
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef SQUID_SRC_MESSAGESIZES_H
+#define SQUID_SRC_MESSAGESIZES_H
+
+/**
+ * Counters used to collate the traffic size measurements
+ * for a transaction message.
+ */
+class MessageSizes
+{
+public:
+    MessageSizes() : header(0), payloadData(0) {}
+
+    /// size of message header block (if any)
+    /// including message Request-Line or Start-Line.
+    uint64_t header;
+
+    /// total size of payload block(s) excluding transfer encoding overheads
+    uint64_t payloadData;
+
+    /// total message size
+    uint64_t messageTotal() const {return header + payloadData;}
+};
+
+#endif  /* SQUID_SRC_MESSAGESIZES_H */
index fc038df289398ea3aa99d793e9eafb611b456f7a..20a85b5f2c224247bcc35beeff59c6d9af82ce93 100644 (file)
@@ -1290,7 +1290,7 @@ void Adaptation::Icap::ModXact::finalizeLogInfo()
 #endif
     al.cache.code = h->logType;
     // XXX: should use icap-specific counters instead ?
-    al.http.clientRequest.payloadDataSz = h->req_sz;
+    al.http.clientRequestSz.payloadData = h->req_sz;
 
     // leave al.icap.bodyBytesRead negative if no body
     if (replyHttpHeaderSize >= 0 || replyHttpBodySize >= 0) {
@@ -1304,8 +1304,8 @@ void Adaptation::Icap::ModXact::finalizeLogInfo()
         al.http.content_type = reply_->content_type.termedBuf();
         if (replyHttpBodySize >= 0) {
             // XXX: should use icap-specific counters instead ?
-            al.http.adaptedReply.payloadDataSz = replyHttpBodySize;
-            al.http.adaptedReply.headerSz =  reply_->hdr_sz;
+            al.http.clientReplySz.payloadData = replyHttpBodySize;
+            al.http.clientReplySz.header =  reply_->hdr_sz;
             al.cache.highOffset = replyHttpBodySize;
         }
         //don't set al.cache.objectSize because it hasn't exist yet
index cdd086dd14ba32f8c0c60166db4d4a3786312fa6..7edf6c199e657c40b472e340e03d72e9378749a6 100644 (file)
@@ -597,7 +597,7 @@ prepareLogWithRequestDetails(HttpRequest * request, AccessLogEntry::Pointer &aLo
     aLogEntry->http.version = request->http_ver;
     aLogEntry->hier = request->hier;
     if (request->content_length > 0) // negative when no body or unknown length
-        aLogEntry->http.clientRequest.payloadDataSz += request->content_length; // XXX: actually adaptedRequest payload size ??
+        aLogEntry->http.clientRequestSz.payloadData += request->content_length; // XXX: actually adaptedRequest payload size ??
     aLogEntry->cache.extuser = request->extacl_user.termedBuf();
 
     // Adapted request, if any, inherits and then collects all the stats, but
@@ -640,10 +640,10 @@ ClientHttpRequest::logRequest()
         al->cache.port =  cbdataReference(getConn()->port);
     }
 
-    al->http.clientRequest.headerSz = req_sz;
-    al->http.adaptedReply.headerSz = out.headers_sz;
+    al->http.clientRequestSz.header = req_sz;
+    al->http.clientReplySz.header = out.headers_sz;
     // XXX: calculate without payload encoding or headers !!
-    al->http.adaptedReply.payloadDataSz = out.size - out.headers_sz; // pretend its all un-encoded data for now.
+    al->http.clientReplySz.payloadData = out.size - out.headers_sz; // pretend its all un-encoded data for now.
 
     al->cache.highOffset = out.offset;
 
index 25a7b1b7a9f813a2e0e35095d94af17aba80cf8b..70c79aa62c4d9cd086b3a2b9f96100a68bfe2bf0 100644 (file)
@@ -983,12 +983,12 @@ Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer &al, int logS
             break;
 
         case LFT_CLIENT_REQUEST_SIZE_TOTAL:
-            outoff = al->http.clientRequest.total();
+            outoff = al->http.clientRequestSz.messageTotal();
             dooff = 1;
             break;
 
         case LFT_CLIENT_REQUEST_SIZE_HEADERS:
-            outoff = al->http.clientRequest.headerSz;
+            outoff = al->http.clientRequestSz.header;
             dooff =1;
             break;
 
@@ -996,7 +996,7 @@ Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer &al, int logS
             /*case LFT_REQUEST_SIZE_BODY_NO_TE: */
 
         case LFT_ADAPTED_REPLY_SIZE_TOTAL:
-            outoff = al->http.adaptedReply.total();
+            outoff = al->http.clientReplySz.messageTotal();
             dooff = 1;
             break;
 
@@ -1015,7 +1015,7 @@ Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer &al, int logS
             break;
 
         case LFT_ADAPTED_REPLY_SIZE_HEADERS:
-            outint = al->http.adaptedReply.headerSz;
+            outint = al->http.clientReplySz.header;
             doint = 1;
             break;
 
@@ -1023,7 +1023,7 @@ Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer &al, int logS
             /*case LFT_REPLY_SIZE_BODY_NO_TE: */
 
         case LFT_CLIENT_IO_SIZE_TOTAL:
-            outint = al->http.clientRequest.total() + al->http.adaptedReply.total();
+            outint = al->http.clientRequestSz.messageTotal() + al->http.clientReplySz.messageTotal();
             doint = 1;
             break;
             /*case LFT_SERVER_IO_SIZE_TOTAL: */
index edd0934c5eadd15f35f2416fd98be25ed8835408..6f1317d573ac1264471d77fba5370a35a58fd48a 100644 (file)
@@ -223,7 +223,7 @@ icpLogIcp(const Ip::Address &caddr, LogTags logcode, int len, const char *url, i
     al->cache.caddr = caddr;
 
     // XXX: move to use icp.clientReply instead
-    al->http.adaptedReply.payloadDataSz = len;
+    al->http.clientReplySz.payloadData = len;
 
     al->cache.code = logcode;
 
index efb1a5e3441fd0b9e4c04e9d8115afebf205a09e..4c19d3e3ec924795329426826c4207305ab814ba 100644 (file)
@@ -77,7 +77,7 @@ Log::Format::HttpdCombined(const AccessLogEntry::Pointer &al, Logfile * logfile)
                   AnyP::ProtocolType_str[al->http.version.protocol],
                   al->http.version.major, al->http.version.minor,
                   al->http.code,
-                  al->http.adaptedReply.total(),
+                  al->http.clientReplySz.messageTotal(),
                   referer,
                   agent,
                   LogTags_str[al->cache.code],
index 590882f5a626907af97a3d9c8beaf045c047714f..401d46ec1e92eaa0083ad0cbbb6398208b75694b 100644 (file)
@@ -64,7 +64,7 @@ Log::Format::HttpdCommon(const AccessLogEntry::Pointer &al, Logfile * logfile)
                   AnyP::ProtocolType_str[al->http.version.protocol],
                   al->http.version.major, al->http.version.minor,
                   al->http.code,
-                  al->http.adaptedReply.total(),
+                  al->http.clientReplySz.messageTotal(),
                   LogTags_str[al->cache.code],
                   al->http.statusSfx(),
                   hier_code_str[al->hier.code],
index e10a84f866b0d9dc9c34b18873a8a7684b3aa2b8..6cc0dbaf525d9c582d72636b911c69188a31ff5b 100644 (file)
@@ -78,7 +78,7 @@ Log::Format::SquidNative(const AccessLogEntry::Pointer &al, Logfile * logfile)
                   LogTags_str[al->cache.code],
                   al->http.statusSfx(),
                   al->http.code,
-                  al->http.adaptedReply.total(),
+                  al->http.clientReplySz.messageTotal(),
                   al->_private.method_str,
                   al->url,
                   user ? user : dash_str,