]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/AccessLogEntry.h
2 * SQUID Web Proxy Cache http://www.squid-cache.org/
3 * ----------------------------------------------------------
5 * Squid is the result of efforts by numerous individuals from
6 * the Internet community; see the CONTRIBUTORS file for full
7 * details. Many organizations have provided support for Squid's
8 * development; see the SPONSORS file for full details. Squid is
9 * Copyrighted (C) 2001 by the Regents of the University of
10 * California; see the COPYRIGHT file for full details. Squid
11 * incorporates software developed and/or copyrighted by other
12 * sources; see the CREDITS file for full details.
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
28 * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
30 #ifndef SQUID_HTTPACCESSLOGENTRY_H
31 #define SQUID_HTTPACCESSLOGENTRY_H
33 #include "HttpVersion.h"
34 #include "HttpRequestMethod.h"
35 #include "HierarchyLogEntry.h"
36 #include "ip/Address.h"
37 #include "HttpRequestMethod.h"
39 #include "adaptation/icap/Elements.h"
50 AccessLogEntry() : url(NULL
) , reply(NULL
), request(NULL
),
51 adapted_request(NULL
) {}
55 /** \brief This subclass holds log info for HTTP protocol
56 * \todo Inner class declarations should be moved outside
57 * \todo details of HTTP held in the parent class need moving into here.
63 HttpDetails() : method(METHOD_NONE
), code(0), content_type(NULL
),
64 timedout(false), aborted(false) {}
66 HttpRequestMethod method
;
68 const char *content_type
;
70 bool timedout
; ///< terminated due to a lifetime or I/O timeout
71 bool aborted
; ///< other abnormal termination (e.g., I/O error)
73 /// compute suffix for the status access.log field
74 const char *statusSfx() const {
75 return timedout
? "_TIMEDOUT" : (aborted
? "_ABORTED" : "");
79 /** \brief This subclass holds log info for ICP protocol
80 * \todo Inner class declarations should be moved outside
86 IcpDetails() : opcode(ICP_INVALID
) {}
91 /** \brief This subclass holds log info for HTCP protocol
92 * \todo Inner class declarations should be moved outside
97 HtcpDetails() : opcode(NULL
) {};
102 /** \brief This subclass holds log info for Squid internal stats
103 * \todo Inner class declarations should be moved outside
104 * \todo some details relevant to particular protocols need shuffling to other sub-classes
105 * \todo this object field need renaming to 'squid' or something.
111 CacheDetails() : caddr(),
114 requestHeadersSize(0),
132 int requestHeadersSize
; ///< received, including request line
133 int replyHeadersSize
; ///< sent, including status line
139 const char *authuser
;
148 /** \brief This subclass holds log info for various headers in raw format
149 * \todo shuffle this to the relevant protocol section.
155 Headers() : request(NULL
),
156 adapted_request(NULL
),
159 char *request
; //< virgin HTTP request headers
161 char *adapted_request
; //< HTTP request headers after adaptation and redirection
167 /** \brief This subclass holds general adaptation log info.
168 * \todo Inner class declarations should be moved outside.
170 class AdaptationDetails
174 AdaptationDetails(): last_meta(NULL
) {}
176 /// image of the last ICAP response header or eCAP meta received
181 // Why is this a sub-class and not a set of real "private:" fields?
182 // It looks like its duplicating HTTPRequestMethod anyway!
183 // TODO: shuffle this to the relevant protocol section OR replace with request->method
188 Private() : method_str(NULL
) {}
190 const char *method_str
;
192 HierarchyLogEntry hier
;
194 HttpRequest
*request
; //< virgin HTTP request
195 HttpRequest
*adapted_request
; //< HTTP request after adaptation and redirection
199 /** \brief This subclass holds log info for ICAP part of request
200 * \todo Inner class declarations should be moved outside
205 IcapLogEntry():bodyBytesRead(-1),request(NULL
),reply(NULL
),outcome(Adaptation::Icap::xoUnknown
),trTime(0),ioTime(0),resStatus(HTTP_STATUS_NONE
) {}
207 Ip::Address hostAddr
; ///< ICAP server IP address
208 String serviceName
; ///< ICAP service name
209 String reqUri
; ///< ICAP Request-URI
210 Adaptation::Icap::ICAP::Method reqMethod
; ///< ICAP request method
211 int64_t bytesSent
; ///< number of bytes sent to ICAP server so far
212 int64_t bytesRead
; ///< number of bytes read from ICAP server so far
214 * number of ICAP body bytes read from ICAP server or -1 for no encapsulated
215 * message data in ICAP reply (eg 204 responses)
217 int64_t bodyBytesRead
;
218 HttpRequest
* request
; ///< ICAP request
219 HttpReply
* reply
; ///< ICAP reply
221 Adaptation::Icap::XactOutcome outcome
; ///< final transaction status
222 /** \brief Transaction response time.
223 * The timer starts when the ICAP transaction
224 * is created and stops when the result of the transaction is logged
227 /** \brief Transaction I/O time.
228 * The timer starts when the first ICAP request
229 * byte is scheduled for sending and stops when the lastbyte of the
230 * ICAP response is received.
233 http_status resStatus
; ///< ICAP response status code
234 int processingTime
; ///< total ICAP processing time in milliseconds
243 /* Should be in 'AccessLog.h' as the driver */
244 extern void accessLogLogTo(customlog
* log
, AccessLogEntry
* al
, ACLChecklist
* checklist
= NULL
);
245 extern void accessLogLog(AccessLogEntry
*, ACLChecklist
* checklist
);
246 extern void accessLogRotate(void);
247 extern void accessLogClose(void);
248 extern void accessLogInit(void);
249 extern void accessLogFreeMemory(AccessLogEntry
* aLogEntry
);
250 extern const char *accessLogTime(time_t);
252 #endif /* SQUID_HTTPACCESSLOGENTRY_H */