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
;
167 time_t negativeDnsTtl
;
168 time_t positiveDnsTtl
;
169 time_t shutdownLifetime
;
170 time_t backgroundPingRate
;
180 time_t persistent_request
;
184 int icp_query
; /* msec */
185 int icp_query_max
; /* msec */
186 int icp_query_min
; /* msec */
187 int mcast_icp_query
; /* msec */
194 time_t idns_retransmit
;
199 size_t maxRequestHeaderSize
;
200 int64_t maxRequestBodySize
;
201 size_t maxReplyHeaderSize
;
202 acl_size_t
*ReplyBodySize
;
219 http_port_list
*http
;
222 https_port_list
*https
;
249 IPAddress_list
*router
;
252 int forwarding_method
;
254 int assignment_method
;
265 char *as_whois_server
;
272 #if USE_USERAGENT_LOG
285 logformat
*logformats
;
287 customlog
*accesslogs
;
295 char *visible_appname_string
;
296 char *effectiveGroup
;
322 int redirectChildren
;
323 int redirectConcurrency
;
324 time_t authenticateGCInterval
;
325 time_t authenticateTTL
;
326 time_t authenticateIpTTL
;
336 size_t appendDomainLen
;
340 char *mimeTablePathname
;
342 char *visibleHostname
;
343 char *uniqueHostname
;
344 wordlist
*hostnameAliases
;
358 IPAddress udp_incoming
;
360 IPAddress udp_outgoing
;
363 IPAddress snmp_incoming
;
365 IPAddress snmp_outgoing
;
367 /* FIXME INET6 : this should really be a CIDR value */
368 IPAddress client_netmask
;
371 size_t udpMaxHitObjsz
;
372 wordlist
*hierarchy_stoplist
;
373 wordlist
*mcast_group_list
;
374 wordlist
*dns_nameservers
;
391 cachemgr_passwd
*passwd_list
;
395 int objectsPerBucket
;
396 int64_t avgObjectSize
;
397 int64_t maxObjectSize
;
398 int64_t minObjectSize
;
399 size_t maxInMemObjSize
;
423 int test_reachability
;
424 int half_closed_clients
;
432 int redir_rewrites_host
;
434 int nonhierarchical_direct
;
435 int strip_query_terms
;
436 int redirector_bypass
;
437 int ignore_unknown_nameservers
;
441 #if USE_CACHE_DIGESTS
443 int digest_generation
;
446 int log_ip_on_direct
;
448 int vary_ignore_expire
;
449 int pipeline_prefetch
;
452 int surrogate_is_remote
;
455 int request_entities
;
456 int detect_broken_server_pconns
;
457 int balance_on_multiple_ip
;
458 int relaxed_header_parser
;
460 int allow_underscore
;
463 int httpd_suppress_version_string
;
464 int global_internal_static
;
466 int debug_override_X
;
468 #if FOLLOW_X_FORWARDED_FOR
469 int acl_uses_indirect_client
;
470 int delay_pool_uses_indirect_client
;
471 int log_uses_indirect_client
;
472 #endif /* FOLLOW_X_FORWARDED_FOR */
476 int zph_preserve_miss_tos
;
478 int WIN32_IpAddrChangeMonitor
;
488 acl_access
*NeverDirect
;
489 acl_access
*AlwaysDirect
;
498 acl_access
*brokenPosts
;
501 acl_access
*identLookup
;
504 acl_access
*redirector
;
506 acl_address
*outgoing_address
;
507 acl_tos
*outgoing_tos
;
508 acl_tos
*clientside_tos
;
512 acl_access
*htcp_clr
;
516 acl_access
*ssl_bump
;
518 #if FOLLOW_X_FORWARDED_FOR
519 acl_access
*followXFF
;
520 #endif /* FOLLOW_X_FORWARDED_FOR */
523 acl_deny_info_list
*denyInfoList
;
524 authConfig authConfiguration
;
540 RefCount
<class Store
> *swapDirs
;
550 char *errorDirectory
;
552 char *errorDefaultLanguage
;
554 char *errorStylesheet
;
580 int max_open_disk_fds
;
582 int64_t rangeOffsetLimit
;
583 #if MULTICAST_MISS_STREAM
595 /* one access list per header type we know of */
596 header_mangler request_header_access
[HDR_ENUM_END
];
597 /* one access list per header type we know of */
598 header_mangler reply_header_access
[HDR_ENUM_END
];
601 #if USE_CACHE_DIGESTS
606 time_t rebuild_period
;
607 time_t rewrite_period
;
608 size_t swapout_chunk_size
;
609 int rebuild_chunk_percentage
;
616 int unclean_shutdown
;
621 wordlist
*ext_methods
;
629 char *store_dir_select_algorithm
;
630 int sleep_after_fork
; /* microseconds */
631 time_t minimum_expiry_time
; /* seconds */
632 external_acl
*externalAclHelperList
;
636 int zph_preserve_miss_tos_mask
;
651 acl_access
*cert_error
;
659 #if USE_LOADABLE_MODULES
660 wordlist
*loadable_module_names
;
664 SQUIDCEXTERN SquidConfig Config
;
671 int mangle_request_headers
;
673 uid_t effectiveUserID
;
674 gid_t effectiveGroupID
;
677 SQUIDCEXTERN SquidConfig2 Config2
;
679 struct _close_handler
708 /* ETag support is rudimantal;
709 * this struct is likely to change
710 * Note: "str" points to memory in HttpHeaderEntry (for now)
711 * so ETags should be used as tmp variables only (for now) */
715 const char *str
; /* quoted-string */
716 int weak
; /* true if it is a weak validator */
722 void *wrt_handle_data
;
724 dwrite_q
*write_q_tail
;
734 unsigned long *file_map
;
738 * Note: HttpBody is used only for messages with a small content that is
739 * known a priory (e.g., error messages).
750 #include "SquidString.h"
751 /* http header extention field */
753 class HttpHdrExtField
755 String name
; /* field-name from HTTP/1.1 (no column after name) */
756 String value
; /* field-value from HTTP/1.1 */
759 /* http cache control header field */
772 /* some fields can hold either time or etag specs (e.g. If-Range) */
776 ETag tag
; /* entity tag */
778 int valid
; /* true if struct is usable */
781 /* per field statistics */
783 class HttpHeaderFieldStat
787 HttpHeaderFieldStat() : aliveCount(0), seenCount(0), parsCount(0), errCount(0), repCount(0){}
789 int aliveCount
; /* created but not destroyed (count) */
790 int seenCount
; /* #fields we've seen */
791 int parsCount
; /* #parsing attempts */
792 int errCount
; /* #pasring errors */
793 int repCount
; /* #repetitons */
796 /* compiled version of HttpHeaderFieldAttrs plus stats */
798 class HttpHeaderFieldInfo
802 HttpHeaderFieldInfo() : id (HDR_ACCEPT
), type (ftInvalid
){}
807 HttpHeaderFieldStat stat
;
810 struct _http_state_flags
812 unsigned int proxying
:1;
813 unsigned int keepalive
:1;
814 unsigned int only_if_cached
:1;
815 unsigned int headers_parsed
:1;
816 unsigned int front_end_https
:2;
817 unsigned int originpeer
:1;
818 unsigned int keepalive_broken
:1;
819 unsigned int abuse_detected
:1;
820 unsigned int request_sent
:1;
821 unsigned int do_next_read
:1;
822 unsigned int consume_body_data
:1;
823 unsigned int chunked
:1;
826 struct _ipcache_addrs
829 unsigned char *bad_mask
;
832 unsigned char badcount
;
838 int do_ping
; /* boolean */
849 #if USE_CACHE_DIGESTS
851 /* statistics for cache digests and other hit "predictors" */
853 struct _cd_guess_stats
855 /* public, read-only */
860 int close_hits
; /* tmp, remove it later */
883 int n_keepalives_sent
;
884 int n_keepalives_recv
;
888 time_t last_connect_failure
;
889 time_t last_connect_probe
;
890 int logged_state
; /* so we can print dead/revived msgs */
891 int conn_open
; /* current opened connections */
897 int counts
[ICP_END
+1];
911 domain_ping
*peer_domain
;
912 domain_type
*typelist
;
917 unsigned int proxy_only
:1;
918 unsigned int no_query
:1;
919 unsigned int background_ping
:1;
920 unsigned int no_digest
:1;
921 unsigned int default_parent
:1;
922 unsigned int roundrobin
:1;
923 unsigned int weighted_roundrobin
:1;
924 unsigned int mcast_responder
:1;
925 unsigned int closest_only
:1;
928 unsigned int htcp_oldsquid
:1;
930 unsigned int no_netdb_exchange
:1;
932 unsigned int no_delay
:1;
934 unsigned int allow_miss
:1;
936 unsigned int userhash
:1;
937 unsigned int sourcehash
:1;
938 unsigned int originserver
:1;
946 double avg_n_members
;
948 int n_replies_expected
;
954 unsigned int count_event_pending
:1;
955 unsigned int counting
:1;
958 #if USE_CACHE_DIGESTS
964 int tcp_up
; /* 0 if a connect() fails */
966 IPAddress addresses
[10];
975 double load_multiplier
;
976 double load_factor
; /* normalized weight value */
982 double load_multiplier
;
983 double load_factor
; /* normalized weight value */
989 double load_multiplier
;
990 double load_factor
; /* normalized weight value */
993 char *login
; /* Proxy authorization */
994 time_t connect_timeout
;
996 char *domain
; /* Forced domain */
1010 SSL_CTX
*sslContext
;
1011 SSL_SESSION
*sslSession
;
1014 int front_end_https
;
1019 hash_link hash
; /* must be first */
1021 netdbEntry
*net_db_entry
;
1026 const char *peername
;
1034 hash_link hash
; /* must be first */
1035 char network
[MAX_IPSTRLEN
];
1040 time_t next_ping_time
;
1041 time_t last_use_time
;
1066 struct request_flags
1068 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)
1073 #if FOLLOW_X_FORWARDED_FOR
1074 done_follow_x_forwarded_for
= 0;
1075 #endif /* FOLLOW_X_FORWARDED_FOR */
1078 unsigned int range
:1;
1079 unsigned int nocache
:1;
1081 unsigned int auth
:1;
1082 unsigned int cachable
:1;
1083 unsigned int hierarchical
:1;
1084 unsigned int loopdetect
:1;
1085 unsigned int proxy_keepalive
:1;
1086 unsigned int proxying
:1; /* this should be killed, also in httpstateflags */
1087 unsigned int refresh
:1;
1088 unsigned int redirected
:1;
1089 unsigned int need_validation
:1;
1091 unsigned int nocache_hack
:1; /* for changing/ignoring no-cache requests */
1093 unsigned int accelerated
:1;
1094 unsigned int intercepted
:1; /**< transparently intercepted request */
1095 unsigned int spoof_client_ip
:1; /**< spoof client ip if possible */
1096 unsigned int internal
:1;
1097 unsigned int internalclient
:1;
1098 unsigned int must_keepalive
:1;
1100 // When adding new flags, please update cloneAdaptationImmune() as needed.
1102 bool resetTCP() const;
1104 void clearResetTCP();
1105 void destinationIPLookupCompleted();
1106 bool destinationIPLookedUp() const;
1108 // returns a partial copy of the flags that includes only those flags
1109 // that are safe for a related (e.g., ICAP-adapted) request to inherit
1110 request_flags
cloneAdaptationImmune() const;
1112 #if FOLLOW_X_FORWARDED_FOR
1113 unsigned int done_follow_x_forwarded_for
;
1114 #endif /* FOLLOW_X_FORWARDED_FOR */
1117 unsigned int reset_tcp
:1;
1118 unsigned int destinationIPLookedUp_
:1;
1125 struct _link_list
*next
;
1128 struct _cachemgr_passwd
1132 cachemgr_passwd
*next
;
1137 const char *pattern
;
1138 regex_t compiled_pattern
;
1146 unsigned int icase
:1;
1147 unsigned int refresh_ims
:1;
1149 unsigned int override_expire
:1;
1150 unsigned int override_lastmod
:1;
1151 unsigned int reload_into_ims
:1;
1152 unsigned int ignore_reload
:1;
1153 unsigned int ignore_no_cache
:1;
1154 unsigned int ignore_no_store
:1;
1155 unsigned int ignore_private
:1;
1156 unsigned int ignore_auth
:1;
1162 * "very generic" histogram;
1163 * see important comments on hbase_f restrictions in StatHist.c
1173 hbase_f
*val_in
; /* e.g., log() for log-based histogram */
1174 hbase_f
*val_out
; /* e.g., exp() for log based histogram */
1178 * if you add a field to StatCounters,
1179 * you MUST sync statCountersInitSpecial, statCountersClean, and statCountersCopy
1182 struct _StatCounters
1195 kb_t hit_kbytes_out
;
1196 StatHist miss_svc_time
;
1197 StatHist nm_svc_time
;
1198 StatHist nh_svc_time
;
1199 StatHist hit_svc_time
;
1200 StatHist all_svc_time
;
1212 } all
, http
, ftp
, other
;
1226 int replies_dropped
;
1233 StatHist query_svc_time
;
1234 StatHist reply_svc_time
;
1263 #if USE_CACHE_DIGESTS
1265 cd_guess_stats guess
;
1268 StatHist on_xition_count
;
1281 struct timeval timestamp
;
1282 StatHist comm_icp_incoming
;
1283 StatHist comm_dns_incoming
;
1284 StatHist comm_http_incoming
;
1285 StatHist select_fds_hist
;
1313 int aborted_requests
;
1323 /* per header statistics */
1325 struct _HttpHeaderStat
1328 HttpHeaderMask
*owner_mask
;
1330 StatHist hdrUCountDistr
;
1331 StatHist fieldTypeDistr
;
1332 StatHist ccTypeDistr
;
1333 StatHist scTypeDistr
;
1339 int busyDestroyedCount
;
1345 hash_link hash
; /* must be first */
1351 int result_hist
[LOG_TYPE_MAX
];
1355 kb_t hit_kbytes_out
;
1364 int n_established
; /* number of current established connections */
1370 /* public, read-only */
1371 char *mask
; /* bit mask */
1372 int mask_size
; /* mask size in bytes */
1373 int capacity
; /* expected maximum for .count, not a hard limit */
1374 int bits_per_entry
; /* number of bits allocated for each entry from capacity */
1375 int count
; /* number of digested entries */
1376 int del_count
; /* number of deletions performed so far */
1380 struct _store_rebuild_data
1382 int objcount
; /* # objects successfully reloaded */
1383 int expcount
; /* # objects expired */
1384 int scancount
; /* # entries scanned or read from state file */
1385 int clashcount
; /* # swapfile clashes avoided */
1386 int dupcount
; /* # duplicates purged */
1387 int cancelcount
; /* # SWAP_LOG_DEL objects purged */
1388 int invalid
; /* # bad lines */
1389 int badflags
; /* # bad e->flags */
1397 char path
[MAXPATHLEN
];
1405 unsigned int syslog
;
1408 int syslog_priority
;
1411 class logformat_token
;
1416 logformat_token
*format
;
1424 logformat
*logFormat
;
1427 customlog_type type
;
1430 #endif /* SQUID_STRUCTS_H */