]> git.ipfire.org Git - thirdparty/squid.git/blob - src/HierarchyLogEntry.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / HierarchyLogEntry.h
1 /*
2 * Copyright (C) 1996-2015 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_HTTPHIERARCHYLOGENTRY_H
10 #define SQUID_HTTPHIERARCHYLOGENTRY_H
11
12 #include "comm/Connection.h"
13 #include "enums.h"
14 #include "hier_code.h"
15 #include "http/StatusCode.h"
16 #include "lookup_t.h"
17 #include "PingData.h"
18 #include "rfc2181.h"
19
20 class HierarchyLogEntry
21 {
22
23 public:
24 HierarchyLogEntry();
25 ~HierarchyLogEntry() { tcpServer = NULL; };
26
27 /// Record details from a new server connection.
28 /// call this whenever the destination server changes.
29 void note(const Comm::ConnectionPointer &server, const char *requestedHost);
30
31 /// Start recording total time spent communicating with peers
32 void startPeerClock();
33 /**
34 * Record total time spent communicating with peers
35 * \param force whether to overwrite old recorded value if any
36 */
37 void stopPeerClock(const bool force);
38
39 /// Return the total time spent communicating with peers
40 void totalResponseTime(struct timeval &responseTime);
41
42 public:
43 hier_code code;
44 char host[SQUIDHOSTNAMELEN];
45 ping_data ping;
46 char cd_host[SQUIDHOSTNAMELEN]; /* the host of selected by cd peer */
47 lookup_t cd_lookup; /* cd prediction: none, miss, hit */
48 int n_choices; /* #peers we selected from (cd only) */
49 int n_ichoices; /* #peers with known rtt we selected from (cd only) */
50
51 struct timeval peer_select_start;
52
53 struct timeval store_complete_stop;
54
55 Http::StatusCode peer_reply_status; ///< last HTTP status code received
56 timeval peer_http_request_sent; ///< last peer finished writing req
57 struct timeval peer_response_time; ///< last peer response delay
58 Comm::ConnectionPointer tcpServer; ///< TCP/IP level details of the last peer/server connection
59 int64_t bodyBytesRead; ///< number of body bytes received from the next hop or -1
60
61 private:
62 timeval firstConnStart_; ///< first connection use among all peers
63 struct timeval totalResponseTime_; ///< cumulative for all peers
64 };
65
66 #endif /* SQUID_HTTPHIERARCHYLOGENTRY_H */
67