~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to src/AccessLogEntry.h

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2010-05-04 11:15:49 UTC
  • mfrom: (1.3.1 upstream)
  • mto: (20.3.1 squeeze) (21.2.1 sid)
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: james.westby@ubuntu.com-20100504111549-1apjh2g5sndki4te
Tags: upstream-3.1.3
ImportĀ upstreamĀ versionĀ 3.1.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
1
/*
3
 
 * $Id: AccessLogEntry.h,v 1.6 2007/08/13 17:20:51 hno Exp $
4
 
 *
5
 
 *
6
2
 * SQUID Web Proxy Cache          http://www.squid-cache.org/
7
3
 * ----------------------------------------------------------
8
4
 *
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.
22
 
 *  
 
18
 *
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.
27
 
 *  
 
23
 *
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.
31
27
 *
32
28
 * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
33
29
 */
34
 
 
35
30
#ifndef SQUID_HTTPACCESSLOGENTRY_H
36
31
#define SQUID_HTTPACCESSLOGENTRY_H
37
32
 
38
33
#include "HttpVersion.h"
 
34
#include "HttpRequestMethod.h"
39
35
#include "HierarchyLogEntry.h"
 
36
#include "ip/IpAddress.h"
 
37
#include "HttpRequestMethod.h"
 
38
#if ICAP_CLIENT
 
39
#include "adaptation/icap/Elements.h"
 
40
#endif
40
41
 
41
42
/* forward decls */
42
 
 
43
 
class CacheManager;
 
43
class HttpReply;
 
44
class HttpRequest;
44
45
 
45
46
class AccessLogEntry
46
47
{
47
48
 
48
49
public:
49
 
    AccessLogEntry() : url(NULL) , reply(NULL), request(NULL) {}
 
50
    AccessLogEntry() : url(NULL) , reply(NULL), request(NULL),
 
51
            adapted_request(NULL) {}
50
52
 
51
53
    const char *url;
52
54
 
56
58
    public:
57
59
        HttpDetails() : method(METHOD_NONE), code(0), content_type(NULL) {}
58
60
 
59
 
        method_t method;
 
61
        HttpRequestMethod method;
60
62
        int code;
61
63
        const char *content_type;
62
64
        HttpVersion version;
63
 
    }
64
 
 
65
 
    http;
 
65
    } http;
66
66
 
67
67
    class ICPDetails
68
68
    {
71
71
        ICPDetails() : opcode(ICP_INVALID) {}
72
72
 
73
73
        icp_opcode opcode;
74
 
    }
75
 
 
76
 
    icp;
 
74
    } icp;
 
75
 
 
76
    class HtcpDetails
 
77
    {
 
78
    public:
 
79
        HtcpDetails() : opcode(NULL) {};
 
80
 
 
81
        const char *opcode;
 
82
    } htcp;
77
83
 
78
84
    class CacheDetails
79
85
    {
80
86
 
81
87
    public:
82
 
        CacheDetails() :
 
88
        CacheDetails() : caddr(),
83
89
                requestSize(0),
84
90
                replySize(0),
 
91
                requestHeadersSize(0),
 
92
                replyHeadersSize(0),
85
93
                highOffset(0),
86
94
                objectSize(0),
87
95
                code (LOG_TAG_NONE),
92
100
#if USE_SSL
93
101
                ,ssluser(NULL)
94
102
#endif
95
 
        {
96
 
            memset(&caddr, '\0', sizeof(caddr));
 
103
        {;
97
104
        }
98
105
 
99
 
        struct IN_ADDR caddr;
 
106
        IpAddress 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;
104
113
        log_type code;
111
120
        const char *ssluser;
112
121
#endif
113
122
 
114
 
    }
115
 
 
116
 
    cache;
 
123
    } cache;
117
124
 
118
125
    class Headers
119
126
    {
120
127
 
121
128
    public:
122
 
        Headers() : request(NULL), reply(NULL) {}
123
 
 
124
 
        char *request;
 
129
        Headers() : request(NULL),
 
130
                adapted_request(NULL),
 
131
 
 
132
#if ICAP_CLIENT
 
133
                icap(NULL),
 
134
#endif
 
135
                reply(NULL) {}
 
136
 
 
137
        char *request; //< virgin HTTP request headers
 
138
 
 
139
        char *adapted_request; //< HTTP request headers after adaptation and redirection
 
140
 
 
141
 
 
142
#if ICAP_CLIENT
 
143
        char * icap;    ///< last matching ICAP response header.
 
144
#endif
125
145
        char *reply;
126
 
    }
127
 
 
128
 
    headers;
129
 
 
 
146
    } headers;
 
147
 
 
148
    // Why is this a sub-class and not a set of real "private:" fields?
 
149
    // It looks like its duplicating HTTPRequestMethod anyway!
130
150
    class Private
131
151
    {
132
152
 
134
154
        Private() : method_str(NULL) {}
135
155
 
136
156
        const char *method_str;
137
 
    }
138
 
 
139
 
    _private;
 
157
    } _private;
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
 
162
 
 
163
 
 
164
#if ICAP_CLIENT
 
165
    /** \brief This subclass holds log info for ICAP part of request
 
166
     *  \todo Inner class declarations should be moved outside
 
167
     */
 
168
    class IcapLogEntry
 
169
    {
 
170
    public:
 
171
        IcapLogEntry():request(NULL),reply(NULL),outcome(Adaptation::Icap::xoUnknown),trTime(0),ioTime(0),resStatus(HTTP_STATUS_NONE) {}
 
172
 
 
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
 
181
 
 
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
 
186
         */
 
187
        int trTime;
 
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.
 
192
         */
 
193
        int ioTime;
 
194
        http_status resStatus;   ///< ICAP response status code
 
195
        int processingTime;      ///< total ICAP processing time in milliseconds
 
196
    }
 
197
    icap;
 
198
#endif
143
199
};
144
200
 
 
201
class ACLChecklist;
 
202
class StoreEntry;
 
203
class logformat_token;
 
204
 
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);