2 * $Id: structs.h,v 1.575 2008/02/11 22:28:47 rousskov Exp $
5 * SQUID Web Proxy Cache http://www.squid-cache.org/
6 * ----------------------------------------------------------
8 * Squid is the result of efforts by numerous individuals from
9 * the Internet community; see the CONTRIBUTORS file for full
10 * details. Many organizations have provided support for Squid's
11 * development; see the SPONSORS file for full details. Squid is
12 * Copyrighted (C) 2001 by the Regents of the University of
13 * California; see the COPYRIGHT file for full details. Squid
14 * incorporates software developed and/or copyrighted by other
15 * sources; see the CREDITS file for full details.
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
32 #ifndef SQUID_STRUCTS_H
33 #define SQUID_STRUCTS_H
39 /* needed for various structures still in structs.h */
41 /* needed for the global config */
42 #include "HttpHeader.h"
46 char name
[ACL_NAME_SZ
];
50 struct acl_deny_info_list
54 acl_name_list
*acl_list
;
55 acl_deny_info_list
*next
;
61 struct _header_mangler
63 acl_access
*access_list
;
71 struct _snmp_request_t
83 ACLChecklist
*acl_checklist
;
86 struct snmp_session session
;
129 #include "DelayConfig.h"
133 #include "ICMPConfig.h"
136 /* forward decl for SquidConfig, see RemovalPolicy.h */
138 class RemovalPolicySettings
;
147 /* These should be for the Store::Root instance.
148 * this needs pluggable parsing to be done smoothly.
161 int64_t readAheadGap
;
162 RemovalPolicySettings
*replPolicy
;
163 RemovalPolicySettings
*memPolicy
;
165 time_t negativeDnsTtl
;
166 time_t positiveDnsTtl
;
167 time_t shutdownLifetime
;
168 time_t backgroundPingRate
;
178 time_t persistent_request
;
182 int icp_query
; /* msec */
183 int icp_query_max
; /* msec */
184 int icp_query_min
; /* msec */
185 int mcast_icp_query
; /* msec */
192 time_t idns_retransmit
;
197 size_t maxRequestHeaderSize
;
198 int64_t maxRequestBodySize
;
199 size_t maxReplyHeaderSize
;
200 acl_size_t
*ReplyBodySize
;
217 http_port_list
*http
;
220 https_port_list
*https
;
247 IPAddress_list
*router
;
250 int forwarding_method
;
252 int assignment_method
;
263 char *as_whois_server
;
270 #if USE_USERAGENT_LOG
283 logformat
*logformats
;
285 customlog
*accesslogs
;
293 char *visible_appname_string
;
294 char *effectiveGroup
;
320 int redirectChildren
;
321 int redirectConcurrency
;
322 time_t authenticateGCInterval
;
323 time_t authenticateTTL
;
324 time_t authenticateIpTTL
;
334 size_t appendDomainLen
;
338 char *mimeTablePathname
;
340 char *visibleHostname
;
341 char *uniqueHostname
;
342 wordlist
*hostnameAliases
;
356 IPAddress udp_incoming
;
358 IPAddress udp_outgoing
;
361 IPAddress snmp_incoming
;
363 IPAddress snmp_outgoing
;
365 /* FIXME INET6 : this should really be a CIDR value */
366 IPAddress client_netmask
;
369 size_t udpMaxHitObjsz
;
370 wordlist
*hierarchy_stoplist
;
371 wordlist
*mcast_group_list
;
372 wordlist
*dns_testname_list
;
373 wordlist
*dns_nameservers
;
390 cachemgr_passwd
*passwd_list
;
394 int objectsPerBucket
;
395 int64_t avgObjectSize
;
396 int64_t maxObjectSize
;
397 int64_t minObjectSize
;
398 size_t maxInMemObjSize
;
422 int test_reachability
;
423 int half_closed_clients
;
431 int redir_rewrites_host
;
433 int nonhierarchical_direct
;
434 int strip_query_terms
;
435 int redirector_bypass
;
436 int ignore_unknown_nameservers
;
440 #if USE_CACHE_DIGESTS
442 int digest_generation
;
445 int log_ip_on_direct
;
447 int vary_ignore_expire
;
448 int pipeline_prefetch
;
451 int surrogate_is_remote
;
454 int request_entities
;
455 int detect_broken_server_pconns
;
456 int balance_on_multiple_ip
;
457 int relaxed_header_parser
;
459 int allow_underscore
;
462 int httpd_suppress_version_string
;
463 int global_internal_static
;
465 int debug_override_X
;
475 acl_access
*NeverDirect
;
476 acl_access
*AlwaysDirect
;
485 acl_access
*brokenPosts
;
488 acl_access
*identLookup
;
491 acl_access
*redirector
;
493 acl_address
*outgoing_address
;
494 acl_tos
*outgoing_tos
;
495 acl_tos
*clientside_tos
;
499 acl_access
*htcp_clr
;
503 acl_access
*ssl_bump
;
507 acl_deny_info_list
*denyInfoList
;
508 authConfig authConfiguration
;
524 RefCount
<class Store
> *swapDirs
;
534 char *errorDirectory
;
560 int max_open_disk_fds
;
562 int64_t rangeOffsetLimit
;
563 #if MULTICAST_MISS_STREAM
575 /* one access list per header type we know of */
576 header_mangler request_header_access
[HDR_ENUM_END
];
577 /* one access list per header type we know of */
578 header_mangler reply_header_access
[HDR_ENUM_END
];
581 #if USE_CACHE_DIGESTS
586 time_t rebuild_period
;
587 time_t rewrite_period
;
588 size_t swapout_chunk_size
;
589 int rebuild_chunk_percentage
;
596 int unclean_shutdown
;
601 wordlist
*ext_methods
;
609 char *store_dir_select_algorithm
;
610 int sleep_after_fork
; /* microseconds */
611 time_t minimum_expiry_time
; /* seconds */
612 external_acl
*externalAclHelperList
;
626 acl_access
*cert_error
;
634 SQUIDCEXTERN SquidConfig Config
;
641 int mangle_request_headers
;
643 uid_t effectiveUserID
;
644 gid_t effectiveGroupID
;
647 SQUIDCEXTERN SquidConfig2 Config2
;
649 struct _close_handler
678 /* ETag support is rudimantal;
679 * this struct is likely to change
680 * Note: "str" points to memory in HttpHeaderEntry (for now)
681 * so ETags should be used as tmp variables only (for now) */
685 const char *str
; /* quoted-string */
686 int weak
; /* true if it is a weak validator */
692 void *wrt_handle_data
;
694 dwrite_q
*write_q_tail
;
704 unsigned long *file_map
;
708 * Note: HttpBody is used only for messages with a small content that is
709 * known a priory (e.g., error messages).
720 #include "SquidString.h"
721 /* http header extention field */
723 class HttpHdrExtField
725 String name
; /* field-name from HTTP/1.1 (no column after name) */
726 String value
; /* field-value from HTTP/1.1 */
729 /* http cache control header field */
742 /* some fields can hold either time or etag specs (e.g. If-Range) */
746 ETag tag
; /* entity tag */
748 int valid
; /* true if struct is usable */
751 /* per field statistics */
753 class HttpHeaderFieldStat
757 HttpHeaderFieldStat() : aliveCount(0), seenCount(0), parsCount(0), errCount(0), repCount(0){}
759 int aliveCount
; /* created but not destroyed (count) */
760 int seenCount
; /* #fields we've seen */
761 int parsCount
; /* #parsing attempts */
762 int errCount
; /* #pasring errors */
763 int repCount
; /* #repetitons */
766 /* compiled version of HttpHeaderFieldAttrs plus stats */
768 class HttpHeaderFieldInfo
772 HttpHeaderFieldInfo() : id (HDR_ACCEPT
), type (ftInvalid
){}
777 HttpHeaderFieldStat stat
;
780 struct _http_state_flags
782 unsigned int proxying
:1;
783 unsigned int keepalive
:1;
784 unsigned int only_if_cached
:1;
785 unsigned int headers_parsed
:1;
786 unsigned int front_end_https
:2;
787 unsigned int originpeer
:1;
788 unsigned int keepalive_broken
:1;
789 unsigned int abuse_detected
:1;
790 unsigned int request_sent
:1;
791 unsigned int do_next_read
:1;
792 unsigned int consume_body_data
:1;
793 unsigned int chunked
:1;
796 struct _ipcache_addrs
799 unsigned char *bad_mask
;
802 unsigned char badcount
;
808 int do_ping
; /* boolean */
819 #if USE_CACHE_DIGESTS
821 /* statistics for cache digests and other hit "predictors" */
823 struct _cd_guess_stats
825 /* public, read-only */
830 int close_hits
; /* tmp, remove it later */
853 int n_keepalives_sent
;
854 int n_keepalives_recv
;
858 time_t last_connect_failure
;
859 time_t last_connect_probe
;
860 int logged_state
; /* so we can print dead/revived msgs */
861 int conn_open
; /* current opened connections */
867 int counts
[ICP_END
+1];
881 domain_ping
*peer_domain
;
882 domain_type
*typelist
;
887 unsigned int proxy_only
:1;
888 unsigned int no_query
:1;
889 unsigned int background_ping
:1;
890 unsigned int no_digest
:1;
891 unsigned int default_parent
:1;
892 unsigned int roundrobin
:1;
893 unsigned int weighted_roundrobin
:1;
894 unsigned int mcast_responder
:1;
895 unsigned int closest_only
:1;
898 unsigned int htcp_oldsquid
:1;
900 unsigned int no_netdb_exchange
:1;
902 unsigned int no_delay
:1;
904 unsigned int allow_miss
:1;
908 unsigned int originserver
:1;
916 double avg_n_members
;
918 int n_replies_expected
;
924 unsigned int count_event_pending
:1;
925 unsigned int counting
:1;
928 #if USE_CACHE_DIGESTS
934 int tcp_up
; /* 0 if a connect() fails */
936 IPAddress addresses
[10];
947 double load_multiplier
;
948 double load_factor
; /* normalized weight value */
952 char *login
; /* Proxy authorization */
953 time_t connect_timeout
;
955 char *domain
; /* Forced domain */
970 SSL_SESSION
*sslSession
;
978 hash_link hash
; /* must be first */
980 netdbEntry
*net_db_entry
;
985 const char *peername
;
993 hash_link hash
; /* must be first */
994 char network
[MAX_IPSTRLEN
];
999 time_t next_ping_time
;
1000 time_t last_use_time
;
1025 struct request_flags
1027 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),accelerated(0),intercepted(0),spoof_client_ip(0),internal(0),internalclient(0),must_keepalive(0),destinationIPLookedUp_(0)
1034 unsigned int range
:1;
1035 unsigned int nocache
:1;
1037 unsigned int auth
:1;
1038 unsigned int cachable
:1;
1039 unsigned int hierarchical
:1;
1040 unsigned int loopdetect
:1;
1041 unsigned int proxy_keepalive
:1;
1042 unsigned int proxying
:1; /* this should be killed, also in httpstateflags */
1043 unsigned int refresh
:1;
1044 unsigned int redirected
:1;
1045 unsigned int need_validation
:1;
1047 unsigned int nocache_hack
:1; /* for changing/ignoring no-cache requests */
1049 unsigned int accelerated
:1;
1050 unsigned int intercepted
:1; /**< transparently intercepted request */
1051 unsigned int spoof_client_ip
:1; /**< spoof client ip if possible */
1052 unsigned int internal
:1;
1053 unsigned int internalclient
:1;
1054 unsigned int must_keepalive
:1;
1056 // When adding new flags, please update cloneAdaptationImmune() as needed.
1058 bool resetTCP() const;
1060 void clearResetTCP();
1061 void destinationIPLookupCompleted();
1062 bool destinationIPLookedUp() const;
1064 // returns a partial copy of the flags that includes only those flags
1065 // that are safe for a related (e.g., ICAP-adapted) request to inherit
1066 request_flags
cloneAdaptationImmune() const;
1070 unsigned int reset_tcp
:1;
1071 unsigned int destinationIPLookedUp_
:1;
1078 struct _link_list
*next
;
1081 struct _cachemgr_passwd
1085 cachemgr_passwd
*next
;
1090 const char *pattern
;
1091 regex_t compiled_pattern
;
1099 unsigned int icase
:1;
1100 unsigned int refresh_ims
:1;
1102 unsigned int override_expire
:1;
1103 unsigned int override_lastmod
:1;
1104 unsigned int reload_into_ims
:1;
1105 unsigned int ignore_reload
:1;
1106 unsigned int ignore_no_cache
:1;
1107 unsigned int ignore_no_store
:1;
1108 unsigned int ignore_private
:1;
1109 unsigned int ignore_auth
:1;
1115 * "very generic" histogram;
1116 * see important comments on hbase_f restrictions in StatHist.c
1126 hbase_f
*val_in
; /* e.g., log() for log-based histogram */
1127 hbase_f
*val_out
; /* e.g., exp() for log based histogram */
1131 * if you add a field to StatCounters,
1132 * you MUST sync statCountersInitSpecial, statCountersClean, and statCountersCopy
1135 struct _StatCounters
1148 kb_t hit_kbytes_out
;
1149 StatHist miss_svc_time
;
1150 StatHist nm_svc_time
;
1151 StatHist nh_svc_time
;
1152 StatHist hit_svc_time
;
1153 StatHist all_svc_time
;
1165 } all
, http
, ftp
, other
;
1179 int replies_dropped
;
1186 StatHist query_svc_time
;
1187 StatHist reply_svc_time
;
1216 #if USE_CACHE_DIGESTS
1218 cd_guess_stats guess
;
1221 StatHist on_xition_count
;
1234 struct timeval timestamp
;
1235 StatHist comm_icp_incoming
;
1236 StatHist comm_dns_incoming
;
1237 StatHist comm_http_incoming
;
1238 StatHist select_fds_hist
;
1266 int aborted_requests
;
1276 /* per header statistics */
1278 struct _HttpHeaderStat
1281 HttpHeaderMask
*owner_mask
;
1283 StatHist hdrUCountDistr
;
1284 StatHist fieldTypeDistr
;
1285 StatHist ccTypeDistr
;
1286 StatHist scTypeDistr
;
1292 int busyDestroyedCount
;
1298 hash_link hash
; /* must be first */
1304 int result_hist
[LOG_TYPE_MAX
];
1308 kb_t hit_kbytes_out
;
1317 int n_established
; /* number of current established connections */
1323 /* public, read-only */
1324 char *mask
; /* bit mask */
1325 int mask_size
; /* mask size in bytes */
1326 int capacity
; /* expected maximum for .count, not a hard limit */
1327 int bits_per_entry
; /* number of bits allocated for each entry from capacity */
1328 int count
; /* number of digested entries */
1329 int del_count
; /* number of deletions performed so far */
1333 struct _store_rebuild_data
1335 int objcount
; /* # objects successfully reloaded */
1336 int expcount
; /* # objects expired */
1337 int scancount
; /* # entries scanned or read from state file */
1338 int clashcount
; /* # swapfile clashes avoided */
1339 int dupcount
; /* # duplicates purged */
1340 int cancelcount
; /* # SWAP_LOG_DEL objects purged */
1341 int invalid
; /* # bad lines */
1342 int badflags
; /* # bad e->flags */
1350 char path
[MAXPATHLEN
];
1358 unsigned int syslog
;
1361 int syslog_priority
;
1364 class logformat_token
;
1369 logformat_token
*format
;
1377 logformat
*logFormat
;
1380 customlog_type type
;
1383 #endif /* SQUID_STRUCTS_H */