19
15
* it under the terms of the GNU General Public License as published by
20
16
* the Free Software Foundation; either version 2 of the License, or
21
17
* (at your option) any later version.
23
19
* This program is distributed in the hope that it will be useful,
24
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
25
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
22
* GNU General Public License for more details.
28
24
* You should have received a copy of the GNU General Public License
29
25
* along with this program; if not, write to the Free Software
30
26
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
32
28
* Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
35
30
#ifndef SQUID_HTTPACCESSLOGENTRY_H
36
31
#define SQUID_HTTPACCESSLOGENTRY_H
38
33
#include "HttpVersion.h"
34
#include "HttpRequestMethod.h"
39
35
#include "HierarchyLogEntry.h"
36
#include "ip/IpAddress.h"
37
#include "HttpRequestMethod.h"
39
#include "adaptation/icap/Elements.h"
41
42
/* forward decls */
45
46
class AccessLogEntry
49
AccessLogEntry() : url(NULL) , reply(NULL), request(NULL) {}
50
AccessLogEntry() : url(NULL) , reply(NULL), request(NULL),
51
adapted_request(NULL) {}
96
memset(&caddr, '\0', sizeof(caddr));
100
107
int64_t requestSize;
101
108
int64_t replySize;
109
int requestHeadersSize; ///< received, including request line
110
int replyHeadersSize; ///< sent, including status line
102
111
int64_t highOffset;
103
112
int64_t objectSize;
111
120
const char *ssluser;
122
Headers() : request(NULL), reply(NULL) {}
129
Headers() : request(NULL),
130
adapted_request(NULL),
137
char *request; //< virgin HTTP request headers
139
char *adapted_request; //< HTTP request headers after adaptation and redirection
143
char * icap; ///< last matching ICAP response header.
148
// Why is this a sub-class and not a set of real "private:" fields?
149
// It looks like its duplicating HTTPRequestMethod anyway!
134
154
Private() : method_str(NULL) {}
136
156
const char *method_str;
140
158
HierarchyLogEntry hier;
141
159
HttpReply *reply;
142
HttpRequest *request;
160
HttpRequest *request; //< virgin HTTP request
161
HttpRequest *adapted_request; //< HTTP request after adaptation and redirection
165
/** \brief This subclass holds log info for ICAP part of request
166
* \todo Inner class declarations should be moved outside
171
IcapLogEntry():request(NULL),reply(NULL),outcome(Adaptation::Icap::xoUnknown),trTime(0),ioTime(0),resStatus(HTTP_STATUS_NONE) {}
173
IpAddress hostAddr; ///< ICAP server IP address
174
String serviceName; ///< ICAP service name
175
String reqUri; ///< ICAP Request-URI
176
Adaptation::Icap::ICAP::Method reqMethod; ///< ICAP request method
177
int64_t bytesSent; ///< number of bytes sent to ICAP server so far
178
int64_t bytesRead; ///< number of bytes read from ICAP server so far
179
HttpRequest* request; ///< ICAP request
180
HttpReply* reply; ///< ICAP reply
182
Adaptation::Icap::XactOutcome outcome; ///< final transaction status
183
/** \brief Transaction response time.
184
* The timer starts when the ICAP transaction
185
* is created and stops when the result of the transaction is logged
188
/** \brief Transaction I/O time.
189
* The timer starts when the first ICAP request
190
* byte is scheduled for sending and stops when the lastbyte of the
191
* ICAP response is received.
194
http_status resStatus; ///< ICAP response status code
195
int processingTime; ///< total ICAP processing time in milliseconds
203
class logformat_token;
145
205
/* Should be in 'AccessLog.h' as the driver */
206
extern void accessLogLogTo(customlog* log, AccessLogEntry* al, ACLChecklist* checklist = NULL);
146
207
extern void accessLogLog(AccessLogEntry *, ACLChecklist * checklist);
147
208
extern void accessLogRotate(void);
148
209
extern void accessLogClose(void);
149
210
extern void accessLogInit(void);
150
extern void accessLogRegisterWithCacheManager(CacheManager & manager);
151
211
extern void accessLogFreeMemory(AccessLogEntry * aLogEntry);
152
212
extern const char *accessLogTime(time_t);
153
213
extern int accessLogParseLogFormat(logformat_token ** fmt, char *def);