LogTags.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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 #include "CollapsingHistory.h"
13 
18 {
19 public:
21  static LogTagsErrors FromErrno(int errNo);
22 
25  void update(const LogTagsErrors &other);
26 
27  bool ignored = false;
28  bool timedout = false;
29  bool aborted = false;
30 };
31 
40 typedef enum {
44  LOG_TCP_REFRESH_UNMODIFIED, // refresh from origin revalidated existing entry
45  LOG_TCP_REFRESH_FAIL_OLD, // refresh from origin failed, stale reply sent
46  LOG_TCP_REFRESH_FAIL_ERR, // refresh from origin failed, error forwarded
47  LOG_TCP_REFRESH_MODIFIED, // refresh from origin replaced existing entry
48  LOG_TCP_REFRESH, // refresh from origin started, but still pending
67 } LogTags_ot;
68 
69 class LogTags
70 {
71 public:
72  LogTags() = default;
73  explicit LogTags(const LogTags_ot t) { update(t); }
74 
75  void update(const LogTags_ot t);
76 
78  const char *c_str() const;
79 
81  bool isTcpHit() const;
82 
84  const char *cacheStatusSource() const;
85 
88 
89 private:
91  static const char *Str_[];
92 
93 public: // XXX: only until client_db.cc stats are redesigned.
94 
99 };
100 
103 {
104  int tmp = (int)aLogType;
105  aLogType = (LogTags_ot)(++tmp);
106  return aLogType;
107 }
108 
109 #endif /* SQUID_SRC_LOGTAGS_H */
110 
@ LOG_TCP_IMS_HIT
Definition: LogTags.h:50
LogTagsErrors err
various problems augmenting the primary log tag
Definition: LogTags.h:87
CollapsingHistory collapsingHistory
controls CF tag presence
Definition: LogTags.h:98
const char * cacheStatusSource() const
Definition: LogTags.cc:124
void update(const LogTagsErrors &other)
Definition: LogTags.cc:14
bool isTcpHit() const
determine if the log tag code indicates a cache HIT
Definition: LogTags.cc:110
@ LOG_TCP_CLIENT_REFRESH_MISS
Definition: LogTags.h:49
@ LOG_TCP_HIT
Definition: LogTags.h:42
@ LOG_TCP_MISS
Definition: LogTags.h:43
@ LOG_TYPE_MAX
Definition: LogTags.h:66
@ LOG_TCP_REFRESH_FAIL_OLD
Definition: LogTags.h:45
const char * c_str() const
compute the status access.log field
Definition: LogTags.cc:75
static const char * Str_[]
list of string representations for LogTags_ot
Definition: LogTags.h:91
void update(const LogTags_ot t)
Definition: LogTags.cc:63
@ LOG_TCP_DENIED_REPLY
Definition: LogTags.h:56
collapsed forwarding history of a master transaction
@ LOG_UDP_HIT
Definition: LogTags.h:60
@ LOG_TCP_REFRESH_FAIL_ERR
Definition: LogTags.h:46
@ LOG_TCP_TUNNEL
an attempt to establish a bidirectional TCP tunnel
Definition: LogTags.h:59
@ LOG_TCP_REFRESH_MODIFIED
Definition: LogTags.h:47
@ LOG_TAG_NONE
Definition: LogTags.h:41
@ LOG_TCP_REFRESH_UNMODIFIED
Definition: LogTags.h:44
@ LOG_UDP_INVALID
Definition: LogTags.h:63
@ LOG_TCP_REFRESH
Definition: LogTags.h:48
@ LOG_TCP_INM_HIT
Definition: LogTags.h:51
LogTags()=default
@ LOG_TCP_DENIED
Definition: LogTags.h:55
bool timedout
_TIMEDOUT: terminated due to a lifetime or I/O timeout
Definition: LogTags.h:28
@ LOG_TCP_OFFLINE_HIT
Definition: LogTags.h:57
static LogTagsErrors FromErrno(int errNo)
constructs an object matching errno(3) of a failed I/O call
Definition: LogTags.cc:22
LogTags_ot
Definition: LogTags.h:40
LogTags_ot & operator++(LogTags_ot &aLogType)
iterator for LogTags_ot enumeration
Definition: LogTags.h:102
LogTags_ot oldType
a set of client protocol, cache use, and other transaction outcome tags
Definition: LogTags.h:96
LogTags(const LogTags_ot t)
Definition: LogTags.h:73
@ LOG_TCP_REDIRECT
Definition: LogTags.h:58
bool ignored
_IGNORED: the response was not used for anything
Definition: LogTags.h:27
@ LOG_UDP_MISS_NOFETCH
Definition: LogTags.h:64
@ LOG_UDP_DENIED
Definition: LogTags.h:62
@ LOG_TCP_MEM_HIT
Definition: LogTags.h:54
bool aborted
_ABORTED: other abnormal termination (e.g., I/O error)
Definition: LogTags.h:29
@ LOG_TCP_SWAPFAIL_MISS
Definition: LogTags.h:52
@ LOG_TCP_NEGATIVE_HIT
Definition: LogTags.h:53
@ LOG_ICP_QUERY
Definition: LogTags.h:65
int unsigned int
Definition: stub_fd.cc:19
@ LOG_UDP_MISS
Definition: LogTags.h:61

 

Introduction

Documentation

Support

Miscellaneous