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 /* needed for various structures still in structs.h */
38 /* needed for the global config */
39 #include "HttpHeader.h"
41 struct acl_name_list
{
42 char name
[ACL_NAME_SZ
];
46 struct acl_deny_info_list
{
49 acl_name_list
*acl_list
;
50 acl_deny_info_list
*next
;
56 struct _header_mangler
{
57 acl_access
*access_list
;
65 struct _snmp_request_t
{
76 ACLChecklist
*acl_checklist
;
79 struct snmp_session session
;
117 #include "DelayConfig.h"
121 #include "icmp/IcmpConfig.h"
125 #include "ip/QosConfig.h"
128 /* forward decl for SquidConfig, see RemovalPolicy.h */
130 class RemovalPolicySettings
;
137 /* These should be for the Store::Root instance.
138 * this needs pluggable parsing to be done smoothly.
150 int64_t readAheadGap
;
151 RemovalPolicySettings
*replPolicy
;
152 RemovalPolicySettings
*memPolicy
;
156 time_t negativeDnsTtl
;
157 time_t positiveDnsTtl
;
158 time_t shutdownLifetime
;
159 time_t backgroundPingRate
;
168 time_t persistent_request
;
172 int icp_query
; /* msec */
173 int icp_query_max
; /* msec */
174 int icp_query_min
; /* msec */
175 int mcast_icp_query
; /* msec */
182 time_t idns_retransmit
;
187 size_t maxRequestHeaderSize
;
188 int64_t maxRequestBodySize
;
189 size_t maxReplyHeaderSize
;
190 acl_size_t
*ReplyBodySize
;
205 http_port_list
*http
;
208 https_port_list
*https
;
232 IpAddress_list
*router
;
235 int forwarding_method
;
237 int assignment_method
;
248 char *as_whois_server
;
254 #if USE_USERAGENT_LOG
267 logformat
*logformats
;
269 customlog
*accesslogs
;
277 char *visible_appname_string
;
278 char *effectiveGroup
;
303 int redirectChildren
;
304 int redirectConcurrency
;
305 time_t authenticateGCInterval
;
306 time_t authenticateTTL
;
307 time_t authenticateIpTTL
;
316 size_t appendDomainLen
;
320 char *mimeTablePathname
;
322 char *visibleHostname
;
323 char *uniqueHostname
;
324 wordlist
*hostnameAliases
;
336 IpAddress udp_incoming
;
338 IpAddress udp_outgoing
;
341 IpAddress snmp_incoming
;
343 IpAddress snmp_outgoing
;
345 /* FIXME INET6 : this should really be a CIDR value */
346 IpAddress client_netmask
;
349 size_t udpMaxHitObjsz
;
350 wordlist
*hierarchy_stoplist
;
351 wordlist
*mcast_group_list
;
352 wordlist
*dns_nameservers
;
367 cachemgr_passwd
*passwd_list
;
370 int objectsPerBucket
;
371 int64_t avgObjectSize
;
372 int64_t maxObjectSize
;
373 int64_t minObjectSize
;
374 size_t maxInMemObjSize
;
396 int test_reachability
;
397 int half_closed_clients
;
405 int redir_rewrites_host
;
407 int nonhierarchical_direct
;
408 int strip_query_terms
;
409 int redirector_bypass
;
410 int ignore_unknown_nameservers
;
414 #if USE_CACHE_DIGESTS
416 int digest_generation
;
419 int log_ip_on_direct
;
421 int vary_ignore_expire
;
422 int pipeline_prefetch
;
425 int surrogate_is_remote
;
428 int request_entities
;
429 int detect_broken_server_pconns
;
430 int balance_on_multiple_ip
;
431 int relaxed_header_parser
;
433 int allow_underscore
;
436 int httpd_suppress_version_string
;
437 int global_internal_static
;
439 int debug_override_X
;
441 #if FOLLOW_X_FORWARDED_FOR
442 int acl_uses_indirect_client
;
443 int delay_pool_uses_indirect_client
;
444 int log_uses_indirect_client
;
445 #endif /* FOLLOW_X_FORWARDED_FOR */
447 int WIN32_IpAddrChangeMonitor
;
456 acl_access
*NeverDirect
;
457 acl_access
*AlwaysDirect
;
466 acl_access
*brokenPosts
;
470 acl_access
*identLookup
;
473 acl_access
*redirector
;
475 acl_address
*outgoing_address
;
476 acl_tos
*outgoing_tos
;
477 acl_tos
*clientside_tos
;
481 acl_access
*htcp_clr
;
485 acl_access
*ssl_bump
;
487 #if FOLLOW_X_FORWARDED_FOR
488 acl_access
*followXFF
;
489 #endif /* FOLLOW_X_FORWARDED_FOR */
492 acl_deny_info_list
*denyInfoList
;
493 authConfig authConfiguration
;
507 RefCount
<class Store
> *swapDirs
;
516 char *errorDirectory
;
518 char *errorDefaultLanguage
;
519 int errorLogMissingLanguages
;
521 char *errorStylesheet
;
544 int max_open_disk_fds
;
546 int64_t rangeOffsetLimit
;
547 #if MULTICAST_MISS_STREAM
558 /* one access list per header type we know of */
559 header_mangler request_header_access
[HDR_ENUM_END
];
560 /* one access list per header type we know of */
561 header_mangler reply_header_access
[HDR_ENUM_END
];
564 #if USE_CACHE_DIGESTS
568 time_t rebuild_period
;
569 time_t rewrite_period
;
570 size_t swapout_chunk_size
;
571 int rebuild_chunk_percentage
;
577 int unclean_shutdown
;
582 wordlist
*ext_methods
;
589 char *store_dir_select_algorithm
;
590 int sleep_after_fork
; /* microseconds */
591 time_t minimum_expiry_time
; /* seconds */
592 external_acl
*externalAclHelperList
;
610 acl_access
*cert_error
;
618 #if USE_LOADABLE_MODULES
619 wordlist
*loadable_module_names
;
623 SQUIDCEXTERN SquidConfig Config
;
625 struct SquidConfig2
{
628 int mangle_request_headers
;
630 uid_t effectiveUserID
;
631 gid_t effectiveGroupID
;
634 SQUIDCEXTERN SquidConfig2 Config2
;
636 struct _close_handler
{
662 /* ETag support is rudimantal;
663 * this struct is likely to change
664 * Note: "str" points to memory in HttpHeaderEntry (for now)
665 * so ETags should be used as tmp variables only (for now) */
668 const char *str
; /* quoted-string */
669 int weak
; /* true if it is a weak validator */
674 void *wrt_handle_data
;
676 dwrite_q
*write_q_tail
;
685 unsigned long *file_map
;
689 * Note: HttpBody is used only for messages with a small content that is
690 * known a priory (e.g., error messages).
700 #include "SquidString.h"
701 /* http header extention field */
703 class HttpHdrExtField
705 String name
; /* field-name from HTTP/1.1 (no column after name) */
706 String value
; /* field-value from HTTP/1.1 */
709 /* http cache control header field */
722 /* some fields can hold either time or etag specs (e.g. If-Range) */
725 ETag tag
; /* entity tag */
727 int valid
; /* true if struct is usable */
730 /* per field statistics */
732 class HttpHeaderFieldStat
736 HttpHeaderFieldStat() : aliveCount(0), seenCount(0), parsCount(0), errCount(0), repCount(0) {}
738 int aliveCount
; /* created but not destroyed (count) */
739 int seenCount
; /* #fields we've seen */
740 int parsCount
; /* #parsing attempts */
741 int errCount
; /* #pasring errors */
742 int repCount
; /* #repetitons */
745 /* compiled version of HttpHeaderFieldAttrs plus stats */
747 class HttpHeaderFieldInfo
751 HttpHeaderFieldInfo() : id (HDR_ACCEPT
), type (ftInvalid
) {}
756 HttpHeaderFieldStat stat
;
759 struct _http_state_flags
{
760 unsigned int proxying
:1;
761 unsigned int keepalive
:1;
762 unsigned int only_if_cached
:1;
763 unsigned int headers_parsed
:1;
764 unsigned int front_end_https
:2;
765 unsigned int originpeer
:1;
766 unsigned int keepalive_broken
:1;
767 unsigned int abuse_detected
:1;
768 unsigned int request_sent
:1;
769 unsigned int do_next_read
:1;
770 unsigned int consume_body_data
:1;
771 unsigned int chunked
:1;
774 struct _ipcache_addrs
{
776 unsigned char *bad_mask
;
779 unsigned char badcount
;
782 struct _domain_ping
{
784 int do_ping
; /* boolean */
788 struct _domain_type
{
794 #if USE_CACHE_DIGESTS
796 /* statistics for cache digests and other hit "predictors" */
798 struct _cd_guess_stats
{
799 /* public, read-only */
804 int close_hits
; /* tmp, remove it later */
825 int n_keepalives_sent
;
826 int n_keepalives_recv
;
830 time_t last_connect_failure
;
831 time_t last_connect_probe
;
832 int logged_state
; /* so we can print dead/revived msgs */
833 int conn_open
; /* current opened connections */
838 int counts
[ICP_END
+1];
851 domain_ping
*peer_domain
;
852 domain_type
*typelist
;
856 unsigned int proxy_only
:1;
857 unsigned int no_query
:1;
858 unsigned int background_ping
:1;
859 unsigned int no_digest
:1;
860 unsigned int default_parent
:1;
861 unsigned int roundrobin
:1;
862 unsigned int weighted_roundrobin
:1;
863 unsigned int mcast_responder
:1;
864 unsigned int closest_only
:1;
867 unsigned int htcp_oldsquid
:1;
868 unsigned int htcp_no_clr
:1;
869 unsigned int htcp_no_purge_clr
:1;
870 unsigned int htcp_only_clr
:1;
871 unsigned int htcp_forward_clr
:1;
873 unsigned int no_netdb_exchange
:1;
875 unsigned int no_delay
:1;
877 unsigned int allow_miss
:1;
879 unsigned int userhash
:1;
880 unsigned int sourcehash
:1;
881 unsigned int originserver
:1;
888 double avg_n_members
;
890 int n_replies_expected
;
895 unsigned int count_event_pending
:1;
896 unsigned int counting
:1;
899 #if USE_CACHE_DIGESTS
905 int tcp_up
; /* 0 if a connect() fails */
907 IpAddress addresses
[10];
915 double load_multiplier
;
916 double load_factor
; /* normalized weight value */
921 double load_multiplier
;
922 double load_factor
; /* normalized weight value */
927 double load_multiplier
;
928 double load_factor
; /* normalized weight value */
931 char *login
; /* Proxy authorization */
932 time_t connect_timeout
;
934 char *domain
; /* Forced domain */
949 SSL_SESSION
*sslSession
;
956 struct _net_db_name
{
957 hash_link hash
; /* must be first */
959 netdbEntry
*net_db_entry
;
962 struct _net_db_peer
{
963 const char *peername
;
970 hash_link hash
; /* must be first */
971 char network
[MAX_IPSTRLEN
];
976 time_t next_ping_time
;
977 time_t last_use_time
;
1000 struct request_flags
{
1001 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) {
1005 #if FOLLOW_X_FORWARDED_FOR
1006 done_follow_x_forwarded_for
= 0;
1007 #endif /* FOLLOW_X_FORWARDED_FOR */
1010 unsigned int range
:1;
1011 unsigned int nocache
:1;
1013 unsigned int auth
:1;
1014 unsigned int cachable
:1;
1015 unsigned int hierarchical
:1;
1016 unsigned int loopdetect
:1;
1017 unsigned int proxy_keepalive
:1;
1018 unsigned int proxying
:
1019 1; /* this should be killed, also in httpstateflags */
1020 unsigned int refresh
:1;
1021 unsigned int redirected
:1;
1022 unsigned int need_validation
:1;
1024 unsigned int nocache_hack
:1; /* for changing/ignoring no-cache requests */
1026 unsigned int accelerated
:1;
1027 unsigned int intercepted
:1; /**< transparently intercepted request */
1028 unsigned int spoof_client_ip
:1; /**< spoof client ip if possible */
1029 unsigned int internal
:1;
1030 unsigned int internalclient
:1;
1031 unsigned int must_keepalive
:1;
1032 unsigned int connection_auth
:1; /** Request wants connection oriented auth */
1033 unsigned int connection_auth_disabled
:1; /** Connection oriented auth can not be supported */
1034 unsigned int connection_proxy_auth
:1; /** Request wants connection oriented auth */
1035 unsigned int pinned
:1; /* Request sent on a pinned connection */
1036 unsigned int auth_sent
:1; /* Authentication forwarded */
1038 // When adding new flags, please update cloneAdaptationImmune() as needed.
1040 bool resetTCP() const;
1042 void clearResetTCP();
1043 void destinationIPLookupCompleted();
1044 bool destinationIPLookedUp() const;
1046 // returns a partial copy of the flags that includes only those flags
1047 // that are safe for a related (e.g., ICAP-adapted) request to inherit
1048 request_flags
cloneAdaptationImmune() const;
1050 #if FOLLOW_X_FORWARDED_FOR
1051 unsigned int done_follow_x_forwarded_for
;
1052 #endif /* FOLLOW_X_FORWARDED_FOR */
1055 unsigned int reset_tcp
:1;
1056 unsigned int destinationIPLookedUp_
:1;
1062 struct _link_list
*next
;
1065 struct _cachemgr_passwd
{
1068 cachemgr_passwd
*next
;
1072 const char *pattern
;
1073 regex_t compiled_pattern
;
1080 unsigned int icase
:1;
1081 unsigned int refresh_ims
:1;
1083 unsigned int override_expire
:1;
1084 unsigned int override_lastmod
:1;
1085 unsigned int reload_into_ims
:1;
1086 unsigned int ignore_reload
:1;
1087 unsigned int ignore_no_cache
:1;
1088 unsigned int ignore_no_store
:1;
1089 unsigned int ignore_private
:1;
1090 unsigned int ignore_auth
:1;
1096 * "very generic" histogram;
1097 * see important comments on hbase_f restrictions in StatHist.c
1106 hbase_f
*val_in
; /* e.g., log() for log-based histogram */
1107 hbase_f
*val_out
; /* e.g., exp() for log based histogram */
1111 * if you add a field to StatCounters,
1112 * you MUST sync statCountersInitSpecial, statCountersClean, and statCountersCopy
1115 struct _StatCounters
{
1126 kb_t hit_kbytes_out
;
1127 StatHist miss_svc_time
;
1128 StatHist nm_svc_time
;
1129 StatHist nh_svc_time
;
1130 StatHist hit_svc_time
;
1131 StatHist all_svc_time
;
1141 } all
, http
, ftp
, other
;
1154 int replies_dropped
;
1161 StatHist query_svc_time
;
1162 StatHist reply_svc_time
;
1187 #if USE_CACHE_DIGESTS
1189 cd_guess_stats guess
;
1192 StatHist on_xition_count
;
1204 struct timeval timestamp
;
1205 StatHist comm_icp_incoming
;
1206 StatHist comm_dns_incoming
;
1207 StatHist comm_http_incoming
;
1208 StatHist select_fds_hist
;
1233 int aborted_requests
;
1242 /* per header statistics */
1244 struct _HttpHeaderStat
{
1246 HttpHeaderMask
*owner_mask
;
1248 StatHist hdrUCountDistr
;
1249 StatHist fieldTypeDistr
;
1250 StatHist ccTypeDistr
;
1251 StatHist scTypeDistr
;
1257 int busyDestroyedCount
;
1261 struct _ClientInfo
{
1262 hash_link hash
; /* must be first */
1267 int result_hist
[LOG_TYPE_MAX
];
1271 kb_t hit_kbytes_out
;
1279 int n_established
; /* number of current established connections */
1283 struct _CacheDigest
{
1284 /* public, read-only */
1285 char *mask
; /* bit mask */
1286 int mask_size
; /* mask size in bytes */
1287 int capacity
; /* expected maximum for .count, not a hard limit */
1288 int bits_per_entry
; /* number of bits allocated for each entry from capacity */
1289 int count
; /* number of digested entries */
1290 int del_count
; /* number of deletions performed so far */
1294 struct _store_rebuild_data
{
1295 int objcount
; /* # objects successfully reloaded */
1296 int expcount
; /* # objects expired */
1297 int scancount
; /* # entries scanned or read from state file */
1298 int clashcount
; /* # swapfile clashes avoided */
1299 int dupcount
; /* # duplicates purged */
1300 int cancelcount
; /* # SWAP_LOG_DEL objects purged */
1301 int invalid
; /* # bad lines */
1302 int badflags
; /* # bad e->flags */
1309 char path
[MAXPATHLEN
];
1316 unsigned int syslog
;
1319 int syslog_priority
;
1322 class logformat_token
;
1326 logformat_token
*format
;
1333 logformat
*logFormat
;
1336 customlog_type type
;
1339 #endif /* SQUID_STRUCTS_H */