]> git.ipfire.org Git - thirdparty/squid.git/blob - src/LogTags.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / LogTags.h
1 /*
2 * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
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
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 */
20 typedef 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
28 LOG_TCP_CLIENT_REFRESH_MISS,
29 LOG_TCP_IMS_HIT,
30 LOG_TCP_SWAPFAIL_MISS,
31 LOG_TCP_NEGATIVE_HIT,
32 LOG_TCP_MEM_HIT,
33 LOG_TCP_DENIED,
34 LOG_TCP_DENIED_REPLY,
35 LOG_TCP_OFFLINE_HIT,
36 LOG_TCP_REDIRECT,
37 LOG_TCP_TUNNEL, // a binary tunnel was established for this transaction
38 LOG_UDP_HIT,
39 LOG_UDP_MISS,
40 LOG_UDP_DENIED,
41 LOG_UDP_INVALID,
42 LOG_UDP_MISS_NOFETCH,
43 LOG_ICP_QUERY,
44 LOG_TYPE_MAX
45 } LogTags_ot;
46
47 class LogTags
48 {
49 public:
50 LogTags(LogTags_ot t) : oldType(t) {assert(oldType < LOG_TYPE_MAX);}
51 LogTags &operator =(const LogTags_ot &t) {assert(t < LOG_TYPE_MAX); oldType = t; return *this;}
52
53 /// compute the status access.log field
54 const char *c_str() const;
55
56 /// determine if the log tag code indicates a cache HIT
57 bool isTcpHit() const;
58
59 /// error states terminating the transaction
60 struct Errors {
61 Errors() : timedout(false), aborted(false) {}
62
63 bool timedout; ///< tag: TIMEDOUT - terminated due to a lifetime or I/O timeout
64 bool aborted; ///< tag: ABORTED - other abnormal termination (e.g., I/O error)
65 } err;
66
67 private:
68 /// list of string representations for LogTags_ot
69 static const char *Str_[];
70
71 public: // XXX: only until client_db.cc stats are redesigned.
72
73 // deprecated LogTag enum value
74 LogTags_ot oldType;
75 };
76
77 /// iterator for LogTags_ot enumeration
78 inline LogTags_ot &operator++ (LogTags_ot &aLogType)
79 {
80 int tmp = (int)aLogType;
81 aLogType = (LogTags_ot)(++tmp);
82 return aLogType;
83 }
84
85 #endif
86