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
38 /* needed for the global config */
39 #include "HttpHeader.h"
42 #include "icp_opcode.h"
44 struct acl_name_list
{
45 char name
[ACL_NAME_SZ
];
49 struct acl_deny_info_list
{
52 acl_name_list
*acl_list
;
53 acl_deny_info_list
*next
;
59 struct _header_mangler
{
60 acl_access
*access_list
;
68 struct _snmp_request_t
{
79 ACLChecklist
*acl_checklist
;
82 struct snmp_session session
;
120 #include "DelayConfig.h"
124 #include "icmp/IcmpConfig.h"
128 #include "ip/QosConfig.h"
131 /* forward decl for SquidConfig, see RemovalPolicy.h */
133 class RemovalPolicySettings
;
140 /* These should be for the Store::Root instance.
141 * this needs pluggable parsing to be done smoothly.
153 int64_t readAheadGap
;
154 RemovalPolicySettings
*replPolicy
;
155 RemovalPolicySettings
*memPolicy
;
159 time_t negativeDnsTtl
;
160 time_t positiveDnsTtl
;
161 time_t shutdownLifetime
;
162 time_t backgroundPingRate
;
171 time_t persistent_request
;
175 int icp_query
; /* msec */
176 int icp_query_max
; /* msec */
177 int icp_query_min
; /* msec */
178 int mcast_icp_query
; /* msec */
182 time_t idns_retransmit
;
187 size_t maxRequestHeaderSize
;
188 int64_t maxRequestBodySize
;
189 int64_t maxChunkedRequestBodySize
;
190 size_t maxReplyHeaderSize
;
191 acl_size_t
*ReplyBodySize
;
206 http_port_list
*http
;
209 https_port_list
*https
;
233 IpAddress_list
*router
;
236 int forwarding_method
;
238 int assignment_method
;
249 char *as_whois_server
;
254 #if USE_USERAGENT_LOG
267 logformat
*logformats
;
269 customlog
*accesslogs
;
281 char *visible_appname_string
;
282 char *effectiveGroup
;
307 int redirectChildren
;
308 int redirectConcurrency
;
309 time_t authenticateGCInterval
;
310 time_t authenticateTTL
;
311 time_t authenticateIpTTL
;
320 size_t appendDomainLen
;
323 char *mimeTablePathname
;
325 char *visibleHostname
;
326 char *uniqueHostname
;
327 wordlist
*hostnameAliases
;
339 IpAddress udp_incoming
;
341 IpAddress udp_outgoing
;
344 IpAddress snmp_incoming
;
346 IpAddress snmp_outgoing
;
348 /* FIXME INET6 : this should really be a CIDR value */
349 IpAddress client_netmask
;
352 size_t udpMaxHitObjsz
;
353 wordlist
*hierarchy_stoplist
;
354 wordlist
*mcast_group_list
;
355 wordlist
*dns_nameservers
;
370 cachemgr_passwd
*passwd_list
;
373 int objectsPerBucket
;
374 int64_t avgObjectSize
;
375 int64_t maxObjectSize
;
376 int64_t minObjectSize
;
377 size_t maxInMemObjSize
;
399 int test_reachability
;
400 int half_closed_clients
;
408 int redir_rewrites_host
;
410 int nonhierarchical_direct
;
411 int strip_query_terms
;
412 int redirector_bypass
;
413 int ignore_unknown_nameservers
;
417 #if USE_CACHE_DIGESTS
419 int digest_generation
;
422 int log_ip_on_direct
;
424 int vary_ignore_expire
;
425 int pipeline_prefetch
;
428 int surrogate_is_remote
;
431 int request_entities
;
432 int detect_broken_server_pconns
;
433 int balance_on_multiple_ip
;
434 int relaxed_header_parser
;
436 int allow_underscore
;
439 int httpd_suppress_version_string
;
440 int global_internal_static
;
443 #if FOLLOW_X_FORWARDED_FOR
444 int acl_uses_indirect_client
;
445 int delay_pool_uses_indirect_client
;
446 int log_uses_indirect_client
;
447 #endif /* FOLLOW_X_FORWARDED_FOR */
449 int WIN32_IpAddrChangeMonitor
;
450 int memory_cache_first
;
451 int memory_cache_disk
;
454 int forward_max_tries
;
462 acl_access
*NeverDirect
;
463 acl_access
*AlwaysDirect
;
472 acl_access
*brokenPosts
;
474 acl_access
*redirector
;
476 acl_address
*outgoing_address
;
477 acl_tos
*outgoing_tos
;
478 acl_tos
*clientside_tos
;
482 acl_access
*htcp_clr
;
486 acl_access
*ssl_bump
;
488 #if FOLLOW_X_FORWARDED_FOR
489 acl_access
*followXFF
;
490 #endif /* FOLLOW_X_FORWARDED_FOR */
496 acl_deny_info_list
*denyInfoList
;
497 authConfig authConfiguration
;
512 RefCount
<class Store
> *swapDirs
;
521 char *errorDirectory
;
523 char *errorDefaultLanguage
;
524 int errorLogMissingLanguages
;
526 char *errorStylesheet
;
549 int max_open_disk_fds
;
551 int64_t rangeOffsetLimit
;
552 #if MULTICAST_MISS_STREAM
563 /* one access list per header type we know of */
564 header_mangler request_header_access
[HDR_ENUM_END
];
565 /* one access list per header type we know of */
566 header_mangler reply_header_access
[HDR_ENUM_END
];
569 #if USE_CACHE_DIGESTS
573 time_t rebuild_period
;
574 time_t rewrite_period
;
575 size_t swapout_chunk_size
;
576 int rebuild_chunk_percentage
;
582 int unclean_shutdown
;
587 wordlist
*ext_methods
;
594 char *store_dir_select_algorithm
;
595 int sleep_after_fork
; /* microseconds */
596 time_t minimum_expiry_time
; /* seconds */
597 external_acl
*externalAclHelperList
;
615 acl_access
*cert_error
;
623 #if USE_LOADABLE_MODULES
624 wordlist
*loadable_module_names
;
628 SQUIDCEXTERN SquidConfig Config
;
630 struct SquidConfig2
{
633 int mangle_request_headers
;
635 uid_t effectiveUserID
;
636 gid_t effectiveGroupID
;
639 SQUIDCEXTERN SquidConfig2 Config2
;
641 struct _close_handler
{
667 /* ETag support is rudimantal;
668 * this struct is likely to change
669 * Note: "str" points to memory in HttpHeaderEntry (for now)
670 * so ETags should be used as tmp variables only (for now) */
673 const char *str
; /* quoted-string */
674 int weak
; /* true if it is a weak validator */
679 void *wrt_handle_data
;
681 dwrite_q
*write_q_tail
;
690 unsigned long *file_map
;
694 * Note: HttpBody is used only for messages with a small content that is
695 * known a priory (e.g., error messages).
705 #include "SquidString.h"
706 /* http header extention field */
708 class HttpHdrExtField
710 String name
; /* field-name from HTTP/1.1 (no column after name) */
711 String value
; /* field-value from HTTP/1.1 */
714 /* http cache control header field */
727 /* some fields can hold either time or etag specs (e.g. If-Range) */
730 ETag tag
; /* entity tag */
732 int valid
; /* true if struct is usable */
735 /* per field statistics */
737 class HttpHeaderFieldStat
741 HttpHeaderFieldStat() : aliveCount(0), seenCount(0), parsCount(0), errCount(0), repCount(0) {}
743 int aliveCount
; /* created but not destroyed (count) */
744 int seenCount
; /* #fields we've seen */
745 int parsCount
; /* #parsing attempts */
746 int errCount
; /* #pasring errors */
747 int repCount
; /* #repetitons */
750 /* compiled version of HttpHeaderFieldAttrs plus stats */
752 class HttpHeaderFieldInfo
756 HttpHeaderFieldInfo() : id (HDR_ACCEPT
), type (ftInvalid
) {}
761 HttpHeaderFieldStat stat
;
764 struct _http_state_flags
{
765 unsigned int proxying
:1;
766 unsigned int keepalive
:1;
767 unsigned int only_if_cached
:1;
768 unsigned int headers_parsed
:1;
769 unsigned int front_end_https
:2;
770 unsigned int originpeer
:1;
771 unsigned int keepalive_broken
:1;
772 unsigned int abuse_detected
:1;
773 unsigned int request_sent
:1;
774 unsigned int do_next_read
:1;
775 unsigned int consume_body_data
:1;
776 unsigned int chunked
:1;
779 struct _ipcache_addrs
{
781 unsigned char *bad_mask
;
784 unsigned char badcount
;
787 struct _domain_ping
{
789 int do_ping
; /* boolean */
793 struct _domain_type
{
799 #if USE_CACHE_DIGESTS
801 /* statistics for cache digests and other hit "predictors" */
803 struct _cd_guess_stats
{
804 /* public, read-only */
809 int close_hits
; /* tmp, remove it later */
830 int n_keepalives_sent
;
831 int n_keepalives_recv
;
835 time_t last_connect_failure
;
836 time_t last_connect_probe
;
837 int logged_state
; /* so we can print dead/revived msgs */
838 int conn_open
; /* current opened connections */
843 int counts
[ICP_END
+1];
856 domain_ping
*peer_domain
;
857 domain_type
*typelist
;
861 unsigned int proxy_only
:1;
862 unsigned int no_query
:1;
863 unsigned int background_ping
:1;
864 unsigned int no_digest
:1;
865 unsigned int default_parent
:1;
866 unsigned int roundrobin
:1;
867 unsigned int weighted_roundrobin
:1;
868 unsigned int mcast_responder
:1;
869 unsigned int closest_only
:1;
872 unsigned int htcp_oldsquid
:1;
873 unsigned int htcp_no_clr
:1;
874 unsigned int htcp_no_purge_clr
:1;
875 unsigned int htcp_only_clr
:1;
876 unsigned int htcp_forward_clr
:1;
878 unsigned int no_netdb_exchange
:1;
880 unsigned int no_delay
:1;
882 unsigned int allow_miss
:1;
884 unsigned int userhash
:1;
885 unsigned int sourcehash
:1;
886 unsigned int originserver
:1;
893 double avg_n_members
;
895 int n_replies_expected
;
900 unsigned int count_event_pending
:1;
901 unsigned int counting
:1;
904 #if USE_CACHE_DIGESTS
910 int tcp_up
; /* 0 if a connect() fails */
912 IpAddress addresses
[10];
920 double load_multiplier
;
921 double load_factor
; /* normalized weight value */
926 double load_multiplier
;
927 double load_factor
; /* normalized weight value */
932 double load_multiplier
;
933 double load_factor
; /* normalized weight value */
936 char *login
; /* Proxy authorization */
937 time_t connect_timeout
;
938 int connect_fail_limit
;
940 char *domain
; /* Forced domain */
955 SSL_SESSION
*sslSession
;
962 struct _net_db_name
{
963 hash_link hash
; /* must be first */
965 netdbEntry
*net_db_entry
;
968 struct _net_db_peer
{
969 const char *peername
;
976 hash_link hash
; /* must be first */
977 char network
[MAX_IPSTRLEN
];
982 time_t next_ping_time
;
983 time_t last_use_time
;
1006 struct request_flags
{
1007 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) {
1011 #if FOLLOW_X_FORWARDED_FOR
1012 done_follow_x_forwarded_for
= 0;
1013 #endif /* FOLLOW_X_FORWARDED_FOR */
1016 unsigned int range
:1;
1017 unsigned int nocache
:1;
1019 unsigned int auth
:1;
1020 unsigned int cachable
:1;
1021 unsigned int hierarchical
:1;
1022 unsigned int loopdetect
:1;
1023 unsigned int proxy_keepalive
:1;
1024 unsigned int proxying
:
1025 1; /* this should be killed, also in httpstateflags */
1026 unsigned int refresh
:1;
1027 unsigned int redirected
:1;
1028 unsigned int need_validation
:1;
1030 unsigned int nocache_hack
:1; /* for changing/ignoring no-cache requests */
1032 unsigned int accelerated
:1;
1033 unsigned int intercepted
:1; /**< transparently intercepted request */
1034 unsigned int spoof_client_ip
:1; /**< spoof client ip if possible */
1035 unsigned int internal
:1;
1036 unsigned int internalclient
:1;
1037 unsigned int must_keepalive
:1;
1038 unsigned int connection_auth
:1; /** Request wants connection oriented auth */
1039 unsigned int connection_auth_disabled
:1; /** Connection oriented auth can not be supported */
1040 unsigned int connection_proxy_auth
:1; /** Request wants connection oriented auth */
1041 unsigned int pinned
:1; /* Request sent on a pinned connection */
1042 unsigned int auth_sent
:1; /* Authentication forwarded */
1043 unsigned int no_direct
:1; /* Deny direct forwarding unless overriden by always_direct. Used in accelerator mode */
1045 // When adding new flags, please update cloneAdaptationImmune() as needed.
1047 bool resetTCP() const;
1049 void clearResetTCP();
1050 void destinationIPLookupCompleted();
1051 bool destinationIPLookedUp() const;
1053 // returns a partial copy of the flags that includes only those flags
1054 // that are safe for a related (e.g., ICAP-adapted) request to inherit
1055 request_flags
cloneAdaptationImmune() const;
1057 #if FOLLOW_X_FORWARDED_FOR
1058 unsigned int done_follow_x_forwarded_for
;
1059 #endif /* FOLLOW_X_FORWARDED_FOR */
1062 unsigned int reset_tcp
:1;
1063 unsigned int destinationIPLookedUp_
:1;
1069 struct _link_list
*next
;
1072 struct _cachemgr_passwd
{
1075 cachemgr_passwd
*next
;
1079 const char *pattern
;
1080 regex_t compiled_pattern
;
1087 unsigned int icase
:1;
1088 unsigned int refresh_ims
:1;
1090 unsigned int override_expire
:1;
1091 unsigned int override_lastmod
:1;
1092 unsigned int reload_into_ims
:1;
1093 unsigned int ignore_reload
:1;
1094 unsigned int ignore_no_cache
:1;
1095 unsigned int ignore_no_store
:1;
1096 unsigned int ignore_must_revalidate
:1;
1097 unsigned int ignore_private
:1;
1098 unsigned int ignore_auth
:1;
1104 * "very generic" histogram;
1105 * see important comments on hbase_f restrictions in StatHist.c
1114 hbase_f
*val_in
; /* e.g., log() for log-based histogram */
1115 hbase_f
*val_out
; /* e.g., exp() for log based histogram */
1119 * if you add a field to StatCounters,
1120 * you MUST sync statCountersInitSpecial, statCountersClean, and statCountersCopy
1123 struct _StatCounters
{
1134 kb_t hit_kbytes_out
;
1135 StatHist miss_svc_time
;
1136 StatHist nm_svc_time
;
1137 StatHist nh_svc_time
;
1138 StatHist hit_svc_time
;
1139 StatHist all_svc_time
;
1149 } all
, http
, ftp
, other
;
1162 int replies_dropped
;
1169 StatHist query_svc_time
;
1170 StatHist reply_svc_time
;
1195 #if USE_CACHE_DIGESTS
1197 cd_guess_stats guess
;
1200 StatHist on_xition_count
;
1207 unsigned long int select_loops
;
1212 struct timeval timestamp
;
1213 StatHist comm_icp_incoming
;
1214 StatHist comm_dns_incoming
;
1215 StatHist comm_http_incoming
;
1216 StatHist select_fds_hist
;
1241 int aborted_requests
;
1250 /* per header statistics */
1252 struct _HttpHeaderStat
{
1254 HttpHeaderMask
*owner_mask
;
1256 StatHist hdrUCountDistr
;
1257 StatHist fieldTypeDistr
;
1258 StatHist ccTypeDistr
;
1259 StatHist scTypeDistr
;
1265 int busyDestroyedCount
;
1269 struct _CacheDigest
{
1270 /* public, read-only */
1271 char *mask
; /* bit mask */
1272 int mask_size
; /* mask size in bytes */
1273 int capacity
; /* expected maximum for .count, not a hard limit */
1274 int bits_per_entry
; /* number of bits allocated for each entry from capacity */
1275 int count
; /* number of digested entries */
1276 int del_count
; /* number of deletions performed so far */
1280 struct _store_rebuild_data
{
1281 int objcount
; /* # objects successfully reloaded */
1282 int expcount
; /* # objects expired */
1283 int scancount
; /* # entries scanned or read from state file */
1284 int clashcount
; /* # swapfile clashes avoided */
1285 int dupcount
; /* # duplicates purged */
1286 int cancelcount
; /* # SWAP_LOG_DEL objects purged */
1287 int invalid
; /* # bad lines */
1288 int badflags
; /* # bad e->flags */
1295 char path
[MAXPATHLEN
];
1302 unsigned int syslog
;
1305 int syslog_priority
;
1308 class logformat_token
;
1312 logformat_token
*format
;
1319 logformat
*logFormat
;
1322 customlog_type type
;
1325 #endif /* SQUID_STRUCTS_H */