]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
SourceLayout: Shuffle and collate the log result codes symbols
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 11 Feb 2013 23:11:12 +0000 (16:11 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 11 Feb 2013 23:11:12 +0000 (16:11 -0700)
This collates all the small definitions spread around Squid for defining
and handling the TCP_* and UDP_* result code tags logged by Squid.

* log_type enumeration shuffled from enums.h
* log_type increment operator shuffled from client_db
* log_type strings shuffled from Format:: and built automatically
* is-HIT lookup test shuffled from ICP

Due to LogTags.cc being automatically built from the enum list we define
the shuffled functions as inline. This is not a problem due to their small
size. When the LogTags type is converted to a class thay can be de-inlined.

27 files changed:
src/AccessLogEntry.h
src/ClientInfo.h
src/ICP.h
src/LogTags.h [new file with mode: 0644]
src/Makefile.am
src/adaptation/icap/History.h
src/client_db.cc
src/client_db.h
src/client_side.cc
src/client_side_reply.cc
src/client_side_request.cc
src/client_side_request.h
src/enums.h
src/format/ByteCode.h
src/format/Format.cc
src/format/Token.cc
src/format/Token.h
src/htcp.cc
src/icp_v2.cc
src/log/FormatHttpdCombined.cc
src/log/FormatHttpdCommon.cc
src/log/FormatSquidNative.cc
src/log/access_log.cc
src/log/access_log.h
src/stat.cc
src/tests/stub_client_db.cc
src/tests/stub_icp.cc

index 4c23518e5837fd3d7f58522bc2cc8783db9dab55..2c0c807c5b6c69e43e2d80c9638c1377d53d6a8e 100644 (file)
 #include "HierarchyLogEntry.h"
 #include "icp_opcode.h"
 #include "ip/Address.h"
-#include "HttpRequestMethod.h"
+#include "LogTags.h"
+#include "Notes.h"
 #if ICAP_CLIENT
 #include "adaptation/icap/Elements.h"
 #endif
-#include "Notes.h"
 #if USE_SSL
 #include "ssl/gadgets.h"
 #endif
@@ -169,7 +169,7 @@ public:
         int replyHeadersSize; ///< sent, including status line
         int64_t highOffset;
         int64_t objectSize;
-        log_type code;
+        LogTags code;
         int msec;
         const char *rfc931;
         const char *authuser;
index 7201bf8347f660668bd73aa72adb7baeda943f09..3108e2cf76baf2d36f4eff7cbc2b8bf324878b5d 100644 (file)
@@ -3,6 +3,7 @@
 
 #include "ip/Address.h"
 #include "hash.h"
+#include "LogTags.h"
 #include "enums.h"
 #include "typedefs.h"
 #include "cbdata.h"
index a334b89b67fcc7d790f86d8c8828fb1df82301f1..59629f44e9b735d2a87b7abf38bad7ce2ac7154f 100644 (file)
--- a/src/ICP.h
+++ b/src/ICP.h
@@ -40,6 +40,7 @@
 #include "icp_opcode.h"
 #include "ip/Address.h"
 #include "StoreClient.h"
+#include "LogTags.h"
 
 class HttpRequest;
 
@@ -122,7 +123,7 @@ struct icpUdpData {
     struct timeval start;
 #endif
 
-    log_type logcode;
+    LogTags logcode;
 
     struct timeval queue_time;
 };
@@ -144,10 +145,10 @@ void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pa
 icp_opcode icpGetCommonOpcode();
 
 /// \ingroup ServerProtocolICPAPI
-int icpUdpSend(int, const Ip::Address &, icp_common_t *, log_type, int);
+int icpUdpSend(int, const Ip::Address &, icp_common_t *, LogTags, int);
 
 /// \ingroup ServerProtocolICPAPI
-log_type icpLogFromICPCode(icp_opcode opcode);
+LogTags icpLogFromICPCode(icp_opcode opcode);
 
 /// \ingroup ServerProtocolICPAPI
 void icpDenyAccess(Ip::Address &from, char *url, int reqnum, int fd);
diff --git a/src/LogTags.h b/src/LogTags.h
new file mode 100644 (file)
index 0000000..735a4d4
--- /dev/null
@@ -0,0 +1,62 @@
+#ifndef SQUID_SRC_LOGTAGS_H
+#define SQUID_SRC_LOGTAGS_H
+
+/** Squid transaction result code/tag set.
+ *
+ * These codes indicate how the request was received
+ * and some details about its processing pathway.
+ *
+ * see also http://wiki.squid-cache.org/SquidFaq/SquidLogs#Squid_result_codes
+ * for details on particular components.
+ */
+typedef enum {
+    LOG_TAG_NONE = 0,
+    LOG_TCP_HIT,
+    LOG_TCP_MISS,
+    LOG_TCP_REFRESH_UNMODIFIED, // refresh from origin revalidated existing entry
+    LOG_TCP_REFRESH_FAIL_OLD,   // refresh from origin failed, stale reply sent
+    LOG_TCP_REFRESH_FAIL_ERR,   // refresh from origin failed, error forwarded
+    LOG_TCP_REFRESH_MODIFIED,   // refresh from origin replaced existing entry
+    LOG_TCP_CLIENT_REFRESH_MISS,
+    LOG_TCP_IMS_HIT,
+    LOG_TCP_SWAPFAIL_MISS,
+    LOG_TCP_NEGATIVE_HIT,
+    LOG_TCP_MEM_HIT,
+    LOG_TCP_DENIED,
+    LOG_TCP_DENIED_REPLY,
+    LOG_TCP_OFFLINE_HIT,
+    LOG_TCP_REDIRECT,
+    LOG_UDP_HIT,
+    LOG_UDP_MISS,
+    LOG_UDP_DENIED,
+    LOG_UDP_INVALID,
+    LOG_UDP_MISS_NOFETCH,
+    LOG_ICP_QUERY,
+    LOG_TYPE_MAX
+} LogTags;
+
+/// list of string representations for LogTags
+extern const char *LogTags_str[];
+
+/// determine if the log tag code indicates a cache HIT
+inline bool logTypeIsATcpHit(LogTags code)
+{
+    return
+        (code == LOG_TCP_HIT) ||
+        (code == LOG_TCP_IMS_HIT) ||
+        (code == LOG_TCP_REFRESH_FAIL_OLD) ||
+        (code == LOG_TCP_REFRESH_UNMODIFIED) ||
+        (code == LOG_TCP_NEGATIVE_HIT) ||
+        (code == LOG_TCP_MEM_HIT) ||
+        (code == LOG_TCP_OFFLINE_HIT);
+}
+
+/// iterator for LogTags enumeration
+inline LogTags &operator++ (LogTags &aLogType)
+{
+    int tmp = (int)aLogType;
+    aLogType = (LogTags)(++tmp);
+    return aLogType;
+}
+
+#endif
index f829646f4a8e29329ddd4f21068fab1d1acea207..e6d0b017402640fd4355f83ff308f53d4bac102c 100644 (file)
@@ -423,6 +423,7 @@ squid_SOURCES = \
        $(LEAKFINDERSOURCE) \
        SquidList.h \
        SquidList.cc \
+       LogTags.h \
        lookup_t.h \
        main.cc \
        Mem.h \
@@ -603,6 +604,7 @@ BUILT_SOURCES = \
        globals.cc \
        hier_code.cc \
        icp_opcode.cc \
+       LogTags.cc \
        lookup_t.cc \
        repl_modules.cc \
        swap_log_op.cc
@@ -956,6 +958,9 @@ err_type.cc: err_type.h mk-string-arrays.awk
 err_detail_type.cc: err_detail_type.h mk-string-arrays.awk
        $(AWK) -f $(srcdir)/mk-string-arrays.awk < $(srcdir)/err_detail_type.h | sed 's/ERR_DETAIL_//' > $@ || ($(RM) -f $@ && exit 1)
 
+LogTags.cc: LogTags.h mk-string-arrays.awk
+       $(AWK) -f $(srcdir)/mk-string-arrays.awk < $(srcdir)/LogTags.h | sed 's/LOG_//' > $@ || ($(RM) -f $@ && exit 1)
+
 lookup_t.cc: lookup_t.h mk-string-arrays.awk
        $(AWK) -f $(srcdir)/mk-string-arrays.awk < $(srcdir)/lookup_t.h > $@ || ($(RM) -f $@ && exit 1)
 
index 839ff8a92df0f8db74693b243e4b748e77b6a5d1..3c3c35c8b2f90545d301e0495dd73b6bbb3216e9 100644 (file)
@@ -3,6 +3,7 @@
 
 #include "base/RefCount.h"
 #include "enums.h"
+#include "LogTags.h"
 #include "SquidString.h"
 
 namespace Adaptation
@@ -30,7 +31,7 @@ public:
 #if USE_SSL
     String ssluser; ///< the username from SSL
 #endif
-    log_type logType; ///< the squid request status (TCP_MISS etc)
+    LogTags logType; ///< the squid request status (TCP_MISS etc)
 
     String log_uri; ///< the request uri
     size_t req_sz; ///< the request size
index cce0a12c042fe11b08fcbdb469c35027e9fa0d9b..ca09ac233aab86692bfff08e870e77aebe97f2d5 100644 (file)
@@ -151,7 +151,7 @@ ClientInfo * clientdbGetInfo(const Ip::Address &addr)
 }
 #endif
 void
-clientdbUpdate(const Ip::Address &addr, log_type ltype, AnyP::ProtocolType p, size_t size)
+clientdbUpdate(const Ip::Address &addr, LogTags ltype, AnyP::ProtocolType p, size_t size)
 {
     char key[MAX_IPSTRLEN];
     ClientInfo *c;
@@ -279,19 +279,11 @@ clientdbCutoffDenied(const Ip::Address &addr)
     return 1;
 }
 
-log_type &operator++ (log_type &aLogType)
-{
-    int tmp = (int)aLogType;
-    aLogType = (log_type)(++tmp);
-    return aLogType;
-}
-
 void
 clientdbDump(StoreEntry * sentry)
 {
     const char *name;
     ClientInfo *c;
-    log_type l;
     int icp_total = 0;
     int icp_hits = 0;
     int http_total = 0;
@@ -309,7 +301,7 @@ clientdbDump(StoreEntry * sentry)
         storeAppendPrintf(sentry, "    ICP  Requests %d\n",
                           c->Icp.n_requests);
 
-        for (l = LOG_TAG_NONE; l < LOG_TYPE_MAX; ++l) {
+        for (LogTags l = LOG_TAG_NONE; l < LOG_TYPE_MAX; ++l) {
             if (c->Icp.result_hist[l] == 0)
                 continue;
 
@@ -318,12 +310,12 @@ clientdbDump(StoreEntry * sentry)
             if (LOG_UDP_HIT == l)
                 icp_hits += c->Icp.result_hist[l];
 
-            storeAppendPrintf(sentry, "        %-20.20s %7d %3d%%\n",Format::log_tags[l], c->Icp.result_hist[l], Math::intPercent(c->Icp.result_hist[l], c->Icp.n_requests));
+            storeAppendPrintf(sentry, "        %-20.20s %7d %3d%%\n",LogTags_str[l], c->Icp.result_hist[l], Math::intPercent(c->Icp.result_hist[l], c->Icp.n_requests));
         }
 
         storeAppendPrintf(sentry, "    HTTP Requests %d\n", c->Http.n_requests);
 
-        for (l = LOG_TAG_NONE; l < LOG_TYPE_MAX; ++l) {
+        for (LogTags l = LOG_TAG_NONE; l < LOG_TYPE_MAX; ++l) {
             if (c->Http.result_hist[l] == 0)
                 continue;
 
@@ -334,7 +326,7 @@ clientdbDump(StoreEntry * sentry)
 
             storeAppendPrintf(sentry,
                               "        %-20.20s %7d %3d%%\n",
-                              Format::log_tags[l],
+                              LogTags_str[l],
                               c->Http.result_hist[l],
                               Math::intPercent(c->Http.result_hist[l], c->Http.n_requests));
         }
@@ -504,7 +496,6 @@ snmp_meshCtblFn(variable_list * Var, snint * ErrP)
 
     variable_list *Answer = NULL;
     int aggr = 0;
-    log_type l;
 
     switch (Var->name[LEN_SQ_NET + 2]) {
 
@@ -543,7 +534,7 @@ snmp_meshCtblFn(variable_list * Var, snint * ErrP)
     case MESH_CTBL_HTHITS:
         aggr = 0;
 
-        for (l = LOG_TAG_NONE; l < LOG_TYPE_MAX; ++l) {
+        for (LogTags l = LOG_TAG_NONE; l < LOG_TYPE_MAX; ++l) {
             if (logTypeIsATcpHit(l))
                 aggr += c->Http.result_hist[l];
         }
index 41109c6519405bfc817424db054d894df53e51c6..1c10c4caaf1f13b937917794e17e6aadb727b2f1 100644 (file)
 #define SQUID_CLIENT_DB_H_
 
 #include "anyp/ProtocolType.h"
-#include "enums.h"
+//#include "enums.h"
 #include "ip/Address.h"
+#include "LogTags.h"
+
 namespace Ip
 {
 class Address;
@@ -45,7 +47,7 @@ class StoreEntry;
 class ClientInfo;
 
 void clientdbInit(void);
-void clientdbUpdate(const Ip::Address &, log_type, AnyP::ProtocolType, size_t);
+void clientdbUpdate(const Ip::Address &, LogTags, AnyP::ProtocolType, size_t);
 int clientdbCutoffDenied(const Ip::Address &);
 void clientdbDump(StoreEntry *);
 void clientdbFreeMemory(void);
index 800fc25a4770553bf9dd4f539a6f2d8f1bb4c8e6..f60df29f13699a34723276c7f2805a1026c64d36 100644 (file)
@@ -231,8 +231,8 @@ static void clientSetKeepaliveFlag(ClientHttpRequest *);
 static int clientIsContentLengthValid(HttpRequest * r);
 static int clientIsRequestBodyTooLargeForPolicy(int64_t bodyLength);
 
-static void clientUpdateStatHistCounters(log_type logType, int svc_time);
-static void clientUpdateStatCounters(log_type logType);
+static void clientUpdateStatHistCounters(LogTags logType, int svc_time);
+static void clientUpdateStatCounters(LogTags logType);
 static void clientUpdateHierCounters(HierarchyLogEntry *);
 static bool clientPingHasFinished(ping_data const *aPing);
 void prepareLogWithRequestDetails(HttpRequest *, AccessLogEntry::Pointer &);
@@ -241,7 +241,7 @@ static bool connIsUsable(ConnStateData * conn);
 #endif
 static int responseFinishedOrFailed(HttpReply * rep, StoreIOBuffer const &receivedData);
 static void ClientSocketContextPushDeferredIfNeeded(ClientSocketContext::Pointer deferredRequest, ConnStateData * conn);
-static void clientUpdateSocketStats(log_type logType, size_t size);
+static void clientUpdateSocketStats(LogTags logType, size_t size);
 
 char *skipLeadingSpace(char *aString);
 static void connNoteUseOfBuffer(ConnStateData* conn, size_t byteCount);
@@ -444,7 +444,7 @@ clientIdentDone(const char *ident, void *data)
 #endif
 
 void
-clientUpdateStatCounters(log_type logType)
+clientUpdateStatCounters(LogTags logType)
 {
     ++statCounter.client_http.requests;
 
@@ -458,7 +458,7 @@ clientUpdateStatCounters(log_type logType)
 }
 
 void
-clientUpdateStatHistCounters(log_type logType, int svc_time)
+clientUpdateStatHistCounters(LogTags logType, int svc_time)
 {
     statCounter.client_http.allSvcTime.count(svc_time);
     /**
@@ -1640,7 +1640,7 @@ ClientSocketContext::keepaliveNextRequest()
 }
 
 void
-clientUpdateSocketStats(log_type logType, size_t size)
+clientUpdateSocketStats(LogTags logType, size_t size)
 {
     if (size == 0)
         return;
index 99b4284e6a9ea4a5fc44054adbd2240bf8aa74d0..f34b60dd6c1799a35be7f864eedca506efc6e526 100644 (file)
@@ -631,7 +631,7 @@ clientReplyContext::processMiss()
     if (http->storeEntry()) {
         if (EBIT_TEST(http->storeEntry()->flags, ENTRY_SPECIAL)) {
             debugs(88, DBG_CRITICAL, "clientProcessMiss: miss on a special object (" << url << ").");
-            debugs(88, DBG_CRITICAL, "\tlog_type = " << Format::log_tags[http->logType]);
+            debugs(88, DBG_CRITICAL, "\tlog_type = " << LogTags_str[http->logType]);
             http->storeEntry()->dump(1);
         }
 
index 1bc15059628a593a3376a8adfaa193ae46753a6a..8d95b91996c4fd7b051a3cf436ef87a72c289c9d 100644 (file)
@@ -1556,7 +1556,7 @@ ClientHttpRequest::httpStart()
 {
     PROF_start(httpStart);
     logType = LOG_TAG_NONE;
-    debugs(85, 4, "ClientHttpRequest::httpStart: " << Format::log_tags[logType] << " for '" << uri << "'");
+    debugs(85, 4, LogTags_str[logType] << " for '" << uri << "'");
 
     /* no one should have touched this */
     assert(out.offset == 0);
index f821ce5aa8c2cbdd85e411e25505e1927b1bf489..406ea55a1e41eee9a14f1b8ec554919cbd10f00b 100644 (file)
@@ -37,6 +37,7 @@
 #include "dlink.h"
 #include "base/AsyncJob.h"
 #include "HttpHeaderRange.h"
+#include "LogTags.h"
 
 #if USE_ADAPTATION
 #include "adaptation/forward.h"
@@ -108,7 +109,10 @@ public:
 
     HttpHdrRangeIter range_iter;       /* data for iterating thru range specs */
     size_t req_sz;             /* raw request size on input, not current request size */
-    log_type logType;
+
+    /// the processing tags associated with this request transaction.
+    // NP: still an enum so each stage altering it must take care when replacing it.
+    LogTags logType;
 
     struct timeval start_time;
     AccessLogEntry::Pointer al; ///< access.log entry
index 90ab3df1eca032f7fb50847b0010aedf18b19aec..01310216b62df589bbb8954477b6a283264d4918 100644 (file)
 #ifndef SQUID_ENUMS_H
 #define SQUID_ENUMS_H
 
-typedef enum {
-    LOG_TAG_NONE,
-    LOG_TCP_HIT,
-    LOG_TCP_MISS,
-    LOG_TCP_REFRESH_UNMODIFIED, // refresh from origin revalidated existing entry
-    LOG_TCP_REFRESH_FAIL_OLD,   // refresh from origin failed, stale reply sent
-    LOG_TCP_REFRESH_FAIL_ERR,   // refresh from origin failed, error forwarded
-    LOG_TCP_REFRESH_MODIFIED,   // refresh from origin replaced existing entry
-    LOG_TCP_CLIENT_REFRESH_MISS,
-    LOG_TCP_IMS_HIT,
-    LOG_TCP_SWAPFAIL_MISS,
-    LOG_TCP_NEGATIVE_HIT,
-    LOG_TCP_MEM_HIT,
-    LOG_TCP_DENIED,
-    LOG_TCP_DENIED_REPLY,
-    LOG_TCP_OFFLINE_HIT,
-    LOG_TCP_REDIRECT,
-    LOG_UDP_HIT,
-    LOG_UDP_MISS,
-    LOG_UDP_DENIED,
-    LOG_UDP_INVALID,
-    LOG_UDP_MISS_NOFETCH,
-    LOG_ICP_QUERY,
-    LOG_TYPE_MAX
-} log_type;
-
 enum fd_type {
     FD_NONE,
     FD_LOG,
index b1c369470969f0cb4dc03433c243f79d7b99d4ad..b2674b8d16a70eef553202e0ce45d748717ecb8a 100644 (file)
@@ -209,8 +209,6 @@ enum Quoting {
     LOG_QUOTE_RAW
 };
 
-extern const char *log_tags[];
-
 } // namespace Format
 
 #endif /* _SQUID_FMT_BYTECODE_H */
index b65c817e3508fadb11f25e2e6764e6ddc3e098b1..59f4fcdef5c43474786b49122519f705798bfd7b 100644 (file)
@@ -821,11 +821,11 @@ Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer &al, int logS
 
         case LFT_SQUID_STATUS:
             if (al->http.timedout || al->http.aborted) {
-                snprintf(tmp, sizeof(tmp), "%s%s", log_tags[al->cache.code],
+                snprintf(tmp, sizeof(tmp), "%s%s", LogTags_str[al->cache.code],
                          al->http.statusSfx());
                 out = tmp;
             } else {
-                out = log_tags[al->cache.code];
+                out = LogTags_str[al->cache.code];
             }
 
             break;
index b9c0a63b31ccbe97282add3915a42767170d06c9..925eac09f7f57ea687cf1908816073587c77273f 100644 (file)
@@ -6,32 +6,6 @@
 #include "SquidConfig.h"
 #include "Store.h"
 
-const char *Format::log_tags[] = {
-    "NONE",
-    "TCP_HIT",
-    "TCP_MISS",
-    "TCP_REFRESH_UNMODIFIED",
-    "TCP_REFRESH_FAIL", // same tag logged for LOG_TCP_REFRESH_FAIL_OLD and
-    "TCP_REFRESH_FAIL", // LOG_TCP_REFRESH_FAIL_ERR for backward-compatibility
-    "TCP_REFRESH_MODIFIED",
-    "TCP_CLIENT_REFRESH_MISS",
-    "TCP_IMS_HIT",
-    "TCP_SWAPFAIL_MISS",
-    "TCP_NEGATIVE_HIT",
-    "TCP_MEM_HIT",
-    "TCP_DENIED",
-    "TCP_DENIED_REPLY",
-    "TCP_OFFLINE_HIT",
-    "TCP_REDIRECT",
-    "UDP_HIT",
-    "UDP_MISS",
-    "UDP_DENIED",
-    "UDP_INVALID",
-    "UDP_MISS_NOFETCH",
-    "ICP_QUERY",
-    "LOG_TYPE_MAX"
-};
-
 // Due to token overlaps between 1 and 2 letter tokens (Bug 3310)
 // We split the token table into sets determined by the token length
 namespace Format
index 7579191f5a50c11692d8721ecde17f3f00af495c..052cf80b41070c8e075b83330656f4a7f64eb456 100644 (file)
@@ -75,8 +75,6 @@ private:
     const char *scanForToken(TokenTableEntry const table[], const char *cur);
 };
 
-extern const char *log_tags[];
-
 } // namespace Format
 
 #endif /* _SQUID_FORMAT_TOKEN_H */
index ec38011202b707afe6840620ee8aacce6a928531..6c5cbdef865ffd985c5a81291d9e61ec5b19719a 100644 (file)
@@ -267,7 +267,7 @@ static void htcpFreeDetail(htcpDetail * s);
 
 static void htcpHandleMsg(char *buf, int sz, Ip::Address &from);
 
-static void htcpLogHtcp(Ip::Address &, int, log_type, const char *);
+static void htcpLogHtcp(Ip::Address &, int, LogTags, const char *);
 static void htcpHandleMon(htcpDataHeader *, char *buf, int sz, Ip::Address &from);
 
 static void htcpHandleNop(htcpDataHeader *, char *buf, int sz, Ip::Address &from);
@@ -1721,7 +1721,7 @@ htcpClosePorts(void)
 }
 
 static void
-htcpLogHtcp(Ip::Address &caddr, int opcode, log_type logcode, const char *url)
+htcpLogHtcp(Ip::Address &caddr, int opcode, LogTags logcode, const char *url)
 {
     AccessLogEntry::Pointer al = new AccessLogEntry;
     if (LOG_TAG_NONE == logcode)
index ec66377695eaac8af4e47dbbac32a87a11270ee3..ee5b60dd9437b7bf66755c2d387121144559deca 100644 (file)
@@ -72,7 +72,7 @@
 static void icpIncomingConnectionOpened(const Comm::ConnectionPointer &conn, int errNo);
 
 /// \ingroup ServerProtocolICPInternal2
-static void icpLogIcp(const Ip::Address &, log_type, int, const char *, int);
+static void icpLogIcp(const Ip::Address &, LogTags, int, const char *, int);
 
 /// \ingroup ServerProtocolICPInternal2
 static void icpHandleIcpV2(int, Ip::Address &, char *, int);
@@ -199,7 +199,7 @@ ICP2State::created(StoreEntry *newEntry)
 
 /// \ingroup ServerProtocolICPInternal2
 static void
-icpLogIcp(const Ip::Address &caddr, log_type logcode, int len, const char *url, int delay)
+icpLogIcp(const Ip::Address &caddr, LogTags logcode, int len, const char *url, int delay)
 {
     AccessLogEntry::Pointer al = new AccessLogEntry();
 
@@ -296,7 +296,7 @@ int
 icpUdpSend(int fd,
            const Ip::Address &to,
            icp_common_t * msg,
-           log_type logcode,
+           LogTags logcode,
            int delay)
 {
     icpUdpData *queue;
@@ -380,7 +380,7 @@ icpGetCommonOpcode()
     return ICP_ERR;
 }
 
-log_type
+LogTags
 icpLogFromICPCode(icp_opcode opcode)
 {
     if (opcode == ICP_ERR)
index 088a4bbcb5685b23be237c2bf2db3b42de837fd6..b0968ce5b7e242a3be28dd8b435ec47229612d84 100644 (file)
@@ -78,7 +78,7 @@ Log::Format::HttpdCombined(const AccessLogEntry::Pointer &al, Logfile * logfile)
                   al->cache.replySize,
                   referer,
                   agent,
-                  ::Format::log_tags[al->cache.code],
+                  LogTags_str[al->cache.code],
                   al->http.statusSfx(),
                   hier_code_str[al->hier.code],
                   (Config.onoff.log_mime_hdrs?"":"\n"));
index f9270d6980a052cd0e4c24e8f456ad5149f2a915..2f6a85e4e008d8ee9a13bd978da9481adb1f49a8 100644 (file)
@@ -60,7 +60,7 @@ Log::Format::HttpdCommon(const AccessLogEntry::Pointer &al, Logfile * logfile)
                   al->http.version.major, al->http.version.minor,
                   al->http.code,
                   al->cache.replySize,
-                  ::Format::log_tags[al->cache.code],
+                  LogTags_str[al->cache.code],
                   al->http.statusSfx(),
                   hier_code_str[al->hier.code],
                   (Config.onoff.log_mime_hdrs?"":"\n"));
index b90153338a574142c5f311acb90ac2d6a67b5322..29547da4880386ef16bd0e0eaa27fee0c21ce83d 100644 (file)
@@ -69,7 +69,7 @@ Log::Format::SquidNative(const AccessLogEntry::Pointer &al, Logfile * logfile)
                   (int) current_time.tv_usec / 1000,
                   al->cache.msec,
                   clientip,
-                  ::Format::log_tags[al->cache.code],
+                  LogTags_str[al->cache.code],
                   al->http.statusSfx(),
                   al->http.code,
                   al->cache.replySize,
index fdfcfc939bc112c4d5c86c4aced342ec9c275935..a9907257c1bd2c24f7eef9669e8093340f5491d6 100644 (file)
@@ -579,32 +579,3 @@ headersLog(int cs, int pq, const HttpRequestMethod& method, void *data)
 }
 
 #endif
-
-int
-logTypeIsATcpHit(log_type code)
-{
-    /* this should be a bitmap for better optimization */
-
-    if (code == LOG_TCP_HIT)
-        return 1;
-
-    if (code == LOG_TCP_IMS_HIT)
-        return 1;
-
-    if (code == LOG_TCP_REFRESH_FAIL_OLD)
-        return 1;
-
-    if (code == LOG_TCP_REFRESH_UNMODIFIED)
-        return 1;
-
-    if (code == LOG_TCP_NEGATIVE_HIT)
-        return 1;
-
-    if (code == LOG_TCP_MEM_HIT)
-        return 1;
-
-    if (code == LOG_TCP_OFFLINE_HIT)
-        return 1;
-
-    return 0;
-}
index 6a9a3057426271a1604a961f99aedb04bb7fdc62..74a8b35dfd736b8843e806d056edeae518d187c3 100644 (file)
@@ -33,7 +33,8 @@
 #ifndef SQUID_LOG_ACCESS_LOG_H_
 #define SQUID_LOG_ACCESS_LOG_H_
 
-int logTypeIsATcpHit(log_type);
+#include "LogTags.h"
+
 void fvdbCountVia(const char *key);
 void fvdbCountForw(const char *key);
 
index 585688e1171d8732c11925188c6fbe13b272b4bb..a114896e52cfb6a771e52770e0dce4f5ed40491c 100644 (file)
@@ -2033,7 +2033,7 @@ statClientRequests(StoreEntry * s)
         }
 
         storeAppendPrintf(s, "uri %s\n", http->uri);
-        storeAppendPrintf(s, "logType %s\n", Format::log_tags[http->logType]);
+        storeAppendPrintf(s, "logType %s\n", LogTags_str[http->logType]);
         storeAppendPrintf(s, "out.offset %ld, out.size %lu\n",
                           (long int) http->out.offset, (unsigned long int) http->out.size);
         storeAppendPrintf(s, "req_sz %ld\n", (long int) http->req_sz);
index f9212222e0d89d63d6c867ee8ce4c96b8ff62cad..f6f7637a60391d4eb7923dc9984d85140c904508 100644 (file)
@@ -7,7 +7,7 @@
 class ClientInfo;
 
 void clientdbInit(void) STUB
-void clientdbUpdate(const Ip::Address &, log_type, AnyP::ProtocolType, size_t) STUB
+void clientdbUpdate(const Ip::Address &, LogTags, AnyP::ProtocolType, size_t) STUB
 int clientdbCutoffDenied(const Ip::Address &) STUB_RETVAL(-1)
 void clientdbDump(StoreEntry *) STUB
 void clientdbFreeMemory(void) STUB
index 04de5ff46b49034da29bceabe7f3605a2ac177ff..67a9a1af39bbee5b37a611e6ebe4c28ef5e052ce 100644 (file)
@@ -24,8 +24,8 @@ HttpRequest* icpGetRequest(char *url, int reqnum, int fd, Ip::Address &from) STU
 bool icpAccessAllowed(Ip::Address &from, HttpRequest * icp_request) STUB_RETVAL(false)
 void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pad, int fd, const Ip::Address &from) STUB
 icp_opcode icpGetCommonOpcode() STUB_RETVAL(ICP_INVALID)
-int icpUdpSend(int, const Ip::Address &, icp_common_t *, log_type, int) STUB_RETVAL(0)
-log_type icpLogFromICPCode(icp_opcode opcode) STUB_RETVAL(LOG_TAG_NONE)
+int icpUdpSend(int, const Ip::Address &, icp_common_t *, LogTags, int) STUB_RETVAL(0)
+LogTags icpLogFromICPCode(icp_opcode opcode) STUB_RETVAL(LOG_TAG_NONE)
 void icpDenyAccess(Ip::Address &from, char *url, int reqnum, int fd) STUB
 void icpHandleIcpV3(int, Ip::Address &, char *, int) STUB
 int icpCheckUdpHit(StoreEntry *, HttpRequest * request) STUB_RETVAL(0)