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.
29 #ifndef SQUID_STRUCTS_H
30 #define SQUID_STRUCTS_H
36 #include "ip/Address.h"
38 /* needed for the global config */
39 #include "HttpHeader.h"
40 #include "HttpHeaderTools.h"
42 #define PEER_MULTICAST_SIBLINGS 1
48 #include "snmp_session.h"
49 class snmp_request_t
{
61 ACLChecklist
*acl_checklist
;
64 struct snmp_session session
;
90 #include "DelayConfig.h"
91 #include "ClientDelayConfig.h"
95 #include "icmp/IcmpConfig.h"
98 #include "HelperChildConfig.h"
100 /* forward decl for SquidConfig, see RemovalPolicy.h */
102 class CpuAffinityMap
;
103 class RemovalPolicySettings
;
107 class cachemgr_passwd
;
114 class close_handler
{
144 void *wrt_handle_data
;
146 dwrite_q
*write_q_tail
;
151 class http_state_flags
{
153 unsigned int proxying
:1;
154 unsigned int keepalive
:1;
155 unsigned int only_if_cached
:1;
156 unsigned int handling1xx
:1; ///< we are ignoring or forwarding 1xx response
157 unsigned int headers_parsed
:1;
158 unsigned int front_end_https
:2;
159 unsigned int originpeer
:1;
160 unsigned int keepalive_broken
:1;
161 unsigned int abuse_detected
:1;
162 unsigned int request_sent
:1;
163 unsigned int do_next_read
:1;
164 unsigned int consume_body_data
:1;
165 unsigned int chunked
:1; ///< reading a chunked response; TODO: rename
166 unsigned int chunked_request
:1; ///< writing a chunked request
167 unsigned int sentLastChunk
:1; ///< do not try to write last-chunk again
173 int do_ping
; /* boolean */
191 hash_link hash
; /* must be first */
193 netdbEntry
*net_db_entry
;
198 const char *peername
;
206 hash_link hash
; /* must be first */
207 char network
[MAX_IPSTRLEN
];
212 time_t next_ping_time
;
213 time_t last_use_time
;
223 static const int histSize
=16;
225 // enum { histSize = 16 };
230 int read_hist
[histSize
];
232 int write_hist
[histSize
];
238 struct request_flags
{
239 request_flags(): range(0),nocache(0),ims(0),auth(0),cachable(0),hierarchical(0),loopdetect(0),proxy_keepalive(0),proxying(0),refresh(0),redirected(0),need_validation(0),fail_on_validation_err(0),stale_if_hit(0),accelerated(0),ignore_cc(0),intercepted(0),hostVerified(0),spoof_client_ip(0),internal(0),internalclient(0),must_keepalive(0),pinned(0),canRePin(0),chunked_reply(0),stream_error(0),sslPeek(0),sslBumped(0),destinationIPLookedUp_(0) {
240 #if USE_HTTP_VIOLATIONS
243 #if FOLLOW_X_FORWARDED_FOR
244 done_follow_x_forwarded_for
= 0;
245 #endif /* FOLLOW_X_FORWARDED_FOR */
248 unsigned int range
:1;
249 unsigned int nocache
:1; ///< whether the response to this request may be READ from cache
252 unsigned int cachable
:1; ///< whether the response to thie request may be stored in the cache
253 unsigned int hierarchical
:1;
254 unsigned int loopdetect
:1;
255 unsigned int proxy_keepalive
:1;
256 unsigned int proxying
:
257 1; /* this should be killed, also in httpstateflags */
258 unsigned int refresh
:1;
259 unsigned int redirected
:1;
260 unsigned int need_validation
:1;
261 unsigned int fail_on_validation_err
:1; ///< whether we should fail if validation fails
262 unsigned int stale_if_hit
:1; ///< reply is stale if it is a hit
263 #if USE_HTTP_VIOLATIONS
264 unsigned int nocache_hack
:1; /* for changing/ignoring no-cache requests */
266 unsigned int accelerated
:1;
267 unsigned int ignore_cc
:1;
268 unsigned int intercepted
:1; ///< intercepted request
269 unsigned int hostVerified
:1; ///< whether the Host: header passed verification
270 unsigned int spoof_client_ip
:1; /**< spoof client ip if possible */
271 unsigned int internal
:1;
272 unsigned int internalclient
:1;
273 unsigned int must_keepalive
:1;
274 unsigned int connection_auth
:1; /** Request wants connection oriented auth */
275 unsigned int connection_auth_disabled
:1; /** Connection oriented auth can not be supported */
276 unsigned int connection_proxy_auth
:1; /** Request wants connection oriented auth */
277 unsigned int pinned
:1; /* Request sent on a pinned connection */
278 unsigned int canRePin
:1; ///< OK to reopen a failed pinned connection
279 unsigned int auth_sent
:1; /* Authentication forwarded */
280 unsigned int no_direct
:1; /* Deny direct forwarding unless overriden by always_direct. Used in accelerator mode */
281 unsigned int chunked_reply
:1; /**< Reply with chunked transfer encoding */
282 unsigned int stream_error
:1; /**< Whether stream error has occured */
283 unsigned int sslPeek
:1; ///< internal ssl-bump request to get server cert
284 unsigned int sslBumped
:1; /**< ssl-bumped request*/
286 // When adding new flags, please update cloneAdaptationImmune() as needed.
288 bool resetTCP() const;
290 void clearResetTCP();
291 void destinationIPLookupCompleted();
292 bool destinationIPLookedUp() const;
294 // returns a partial copy of the flags that includes only those flags
295 // that are safe for a related (e.g., ICAP-adapted) request to inherit
296 request_flags
cloneAdaptationImmune() const;
298 #if FOLLOW_X_FORWARDED_FOR
299 unsigned int done_follow_x_forwarded_for
;
300 #endif /* FOLLOW_X_FORWARDED_FOR */
303 unsigned int reset_tcp
:1;
304 unsigned int destinationIPLookedUp_
:1;
308 class cachemgr_passwd
{
312 cachemgr_passwd
*next
;
317 struct _sslproxy_cert_sign
{
320 sslproxy_cert_sign
*next
;
323 struct _sslproxy_cert_adapt
{
327 sslproxy_cert_adapt
*next
;
331 #endif /* SQUID_STRUCTS_H */