From: Amos Jeffries Date: Mon, 11 Feb 2013 23:11:12 +0000 (-0700) Subject: SourceLayout: Shuffle and collate the log result codes symbols X-Git-Tag: SQUID_3_4_0_1~289 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02c8dde5cc20d7594afac26284c0119167d19721;p=thirdparty%2Fsquid.git SourceLayout: Shuffle and collate the log result codes symbols 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. --- diff --git a/src/AccessLogEntry.h b/src/AccessLogEntry.h index 4c23518e58..2c0c807c5b 100644 --- a/src/AccessLogEntry.h +++ b/src/AccessLogEntry.h @@ -39,11 +39,11 @@ #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; diff --git a/src/ClientInfo.h b/src/ClientInfo.h index 7201bf8347..3108e2cf76 100644 --- a/src/ClientInfo.h +++ b/src/ClientInfo.h @@ -3,6 +3,7 @@ #include "ip/Address.h" #include "hash.h" +#include "LogTags.h" #include "enums.h" #include "typedefs.h" #include "cbdata.h" diff --git a/src/ICP.h b/src/ICP.h index a334b89b67..59629f44e9 100644 --- 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 index 0000000000..735a4d4057 --- /dev/null +++ b/src/LogTags.h @@ -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 diff --git a/src/Makefile.am b/src/Makefile.am index f829646f4a..e6d0b01740 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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) diff --git a/src/adaptation/icap/History.h b/src/adaptation/icap/History.h index 839ff8a92d..3c3c35c8b2 100644 --- a/src/adaptation/icap/History.h +++ b/src/adaptation/icap/History.h @@ -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 diff --git a/src/client_db.cc b/src/client_db.cc index cce0a12c04..ca09ac233a 100644 --- a/src/client_db.cc +++ b/src/client_db.cc @@ -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]; } diff --git a/src/client_db.h b/src/client_db.h index 41109c6519..1c10c4caaf 100644 --- a/src/client_db.h +++ b/src/client_db.h @@ -34,8 +34,10 @@ #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); diff --git a/src/client_side.cc b/src/client_side.cc index 800fc25a47..f60df29f13 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -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; diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index 99b4284e6a..f34b60dd6c 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -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); } diff --git a/src/client_side_request.cc b/src/client_side_request.cc index 1bc1505962..8d95b91996 100644 --- a/src/client_side_request.cc +++ b/src/client_side_request.cc @@ -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); diff --git a/src/client_side_request.h b/src/client_side_request.h index f821ce5aa8..406ea55a1e 100644 --- a/src/client_side_request.h +++ b/src/client_side_request.h @@ -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 diff --git a/src/enums.h b/src/enums.h index 90ab3df1ec..01310216b6 100644 --- a/src/enums.h +++ b/src/enums.h @@ -32,32 +32,6 @@ #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, diff --git a/src/format/ByteCode.h b/src/format/ByteCode.h index b1c3694709..b2674b8d16 100644 --- a/src/format/ByteCode.h +++ b/src/format/ByteCode.h @@ -209,8 +209,6 @@ enum Quoting { LOG_QUOTE_RAW }; -extern const char *log_tags[]; - } // namespace Format #endif /* _SQUID_FMT_BYTECODE_H */ diff --git a/src/format/Format.cc b/src/format/Format.cc index b65c817e35..59f4fcdef5 100644 --- a/src/format/Format.cc +++ b/src/format/Format.cc @@ -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; diff --git a/src/format/Token.cc b/src/format/Token.cc index b9c0a63b31..925eac09f7 100644 --- a/src/format/Token.cc +++ b/src/format/Token.cc @@ -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 diff --git a/src/format/Token.h b/src/format/Token.h index 7579191f5a..052cf80b41 100644 --- a/src/format/Token.h +++ b/src/format/Token.h @@ -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 */ diff --git a/src/htcp.cc b/src/htcp.cc index ec38011202..6c5cbdef86 100644 --- a/src/htcp.cc +++ b/src/htcp.cc @@ -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) diff --git a/src/icp_v2.cc b/src/icp_v2.cc index ec66377695..ee5b60dd94 100644 --- a/src/icp_v2.cc +++ b/src/icp_v2.cc @@ -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) diff --git a/src/log/FormatHttpdCombined.cc b/src/log/FormatHttpdCombined.cc index 088a4bbcb5..b0968ce5b7 100644 --- a/src/log/FormatHttpdCombined.cc +++ b/src/log/FormatHttpdCombined.cc @@ -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")); diff --git a/src/log/FormatHttpdCommon.cc b/src/log/FormatHttpdCommon.cc index f9270d6980..2f6a85e4e0 100644 --- a/src/log/FormatHttpdCommon.cc +++ b/src/log/FormatHttpdCommon.cc @@ -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")); diff --git a/src/log/FormatSquidNative.cc b/src/log/FormatSquidNative.cc index b90153338a..29547da488 100644 --- a/src/log/FormatSquidNative.cc +++ b/src/log/FormatSquidNative.cc @@ -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, diff --git a/src/log/access_log.cc b/src/log/access_log.cc index fdfcfc939b..a9907257c1 100644 --- a/src/log/access_log.cc +++ b/src/log/access_log.cc @@ -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; -} diff --git a/src/log/access_log.h b/src/log/access_log.h index 6a9a305742..74a8b35dfd 100644 --- a/src/log/access_log.h +++ b/src/log/access_log.h @@ -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); diff --git a/src/stat.cc b/src/stat.cc index 585688e117..a114896e52 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -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); diff --git a/src/tests/stub_client_db.cc b/src/tests/stub_client_db.cc index f9212222e0..f6f7637a60 100644 --- a/src/tests/stub_client_db.cc +++ b/src/tests/stub_client_db.cc @@ -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 diff --git a/src/tests/stub_icp.cc b/src/tests/stub_icp.cc index 04de5ff46b..67a9a1af39 100644 --- a/src/tests/stub_icp.cc +++ b/src/tests/stub_icp.cc @@ -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)