]> git.ipfire.org Git - thirdparty/squid.git/blame - src/LogTags.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / LogTags.h
CommitLineData
bbc27441 1/*
4ac4a490 2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
bbc27441
AJ
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
02c8dde5
AJ
9#ifndef SQUID_SRC_LOGTAGS_H
10#define SQUID_SRC_LOGTAGS_H
11
12/** Squid transaction result code/tag set.
13 *
14 * These codes indicate how the request was received
15 * and some details about its processing pathway.
16 *
17 * see also http://wiki.squid-cache.org/SquidFaq/SquidLogs#Squid_result_codes
18 * for details on particular components.
19 */
20typedef enum {
21 LOG_TAG_NONE = 0,
22 LOG_TCP_HIT,
23 LOG_TCP_MISS,
24 LOG_TCP_REFRESH_UNMODIFIED, // refresh from origin revalidated existing entry
25 LOG_TCP_REFRESH_FAIL_OLD, // refresh from origin failed, stale reply sent
26 LOG_TCP_REFRESH_FAIL_ERR, // refresh from origin failed, error forwarded
27 LOG_TCP_REFRESH_MODIFIED, // refresh from origin replaced existing entry
cb72b1ca 28 LOG_TCP_REFRESH, // refresh from origin started, but still pending
02c8dde5
AJ
29 LOG_TCP_CLIENT_REFRESH_MISS,
30 LOG_TCP_IMS_HIT,
787ea68c 31 LOG_TCP_INM_HIT,
02c8dde5
AJ
32 LOG_TCP_SWAPFAIL_MISS,
33 LOG_TCP_NEGATIVE_HIT,
34 LOG_TCP_MEM_HIT,
35 LOG_TCP_DENIED,
36 LOG_TCP_DENIED_REPLY,
37 LOG_TCP_OFFLINE_HIT,
38 LOG_TCP_REDIRECT,
8a713747 39 LOG_TCP_TUNNEL, // a binary tunnel was established for this transaction
02c8dde5
AJ
40 LOG_UDP_HIT,
41 LOG_UDP_MISS,
42 LOG_UDP_DENIED,
43 LOG_UDP_INVALID,
44 LOG_UDP_MISS_NOFETCH,
45 LOG_ICP_QUERY,
46 LOG_TYPE_MAX
91369933 47} LogTags_ot;
02c8dde5 48
91369933 49class LogTags
02c8dde5 50{
91369933
AJ
51public:
52 LogTags(LogTags_ot t) : oldType(t) {assert(oldType < LOG_TYPE_MAX);}
eace013e
EB
53 // XXX: this operator does not reset flags
54 // TODO: either replace with a category-only setter or remove
91369933
AJ
55 LogTags &operator =(const LogTags_ot &t) {assert(t < LOG_TYPE_MAX); oldType = t; return *this;}
56
a981b360 57 /// compute the status access.log field
91369933
AJ
58 const char *c_str() const;
59
60 /// determine if the log tag code indicates a cache HIT
61 bool isTcpHit() const;
62
eace013e
EB
63 /// Things that may happen to a transaction while it is being
64 /// processed according to its LOG_* category. Logged as _SUFFIX(es).
65 /// Unlike LOG_* categories, these flags may not be mutually exclusive.
66 class Errors {
67 public:
68 Errors() : ignored(false), timedout(false), aborted(false) {}
a981b360 69
eace013e
EB
70 bool ignored; ///< _IGNORED: the response was not used for anything
71 bool timedout; ///< _TIMEDOUT: terminated due to a lifetime or I/O timeout
72 bool aborted; ///< _ABORTED: other abnormal termination (e.g., I/O error)
a981b360
AJ
73 } err;
74
91369933
AJ
75private:
76 /// list of string representations for LogTags_ot
77 static const char *Str_[];
78
79public: // XXX: only until client_db.cc stats are redesigned.
80
81 // deprecated LogTag enum value
82 LogTags_ot oldType;
83};
02c8dde5 84
91369933
AJ
85/// iterator for LogTags_ot enumeration
86inline LogTags_ot &operator++ (LogTags_ot &aLogType)
02c8dde5
AJ
87{
88 int tmp = (int)aLogType;
91369933 89 aLogType = (LogTags_ot)(++tmp);
02c8dde5
AJ
90 return aLogType;
91}
92
93#endif
f53969cc 94