3 * $Id: structs.h,v 1.575 2008/02/11 22:28:47 rousskov Exp $
6 * SQUID Web Proxy Cache http://www.squid-cache.org/
7 * ----------------------------------------------------------
9 * Squid is the result of efforts by numerous individuals from
10 * the Internet community; see the CONTRIBUTORS file for full
11 * details. Many organizations have provided support for Squid's
12 * development; see the SPONSORS file for full details. Squid is
13 * Copyrighted (C) 2001 by the Regents of the University of
14 * California; see the COPYRIGHT file for full details. Squid
15 * incorporates software developed and/or copyrighted by other
16 * sources; see the CREDITS file for full details.
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
34 #ifndef SQUID_STRUCTS_H
35 #define SQUID_STRUCTS_H
41 /* needed for various structures still in structs.h */
43 /* needed for the global config */
44 #include "HttpHeader.h"
48 char name
[ACL_NAME_SZ
];
52 struct _acl_deny_info_list
56 acl_name_list
*acl_list
;
57 acl_deny_info_list
*next
;
63 struct _header_mangler
65 acl_access
*access_list
;
71 struct _snmp_request_t
83 ACLChecklist
*acl_checklist
;
86 struct snmp_session session
;
128 #include "DelayConfig.h"
132 #include "ICMPConfig.h"
135 /* forward decl for SquidConfig, see RemovalPolicy.h */
137 class RemovalPolicySettings
;
149 /* These should be for the Store::Root instance.
150 * this needs pluggable parsing to be done smoothly.
167 int64_t readAheadGap
;
168 RemovalPolicySettings
*replPolicy
;
169 RemovalPolicySettings
*memPolicy
;
171 time_t negativeDnsTtl
;
172 time_t positiveDnsTtl
;
173 time_t shutdownLifetime
;
174 time_t backgroundPingRate
;
184 time_t persistent_request
;
188 int icp_query
; /* msec */
189 int icp_query_max
; /* msec */
190 int icp_query_min
; /* msec */
191 int mcast_icp_query
; /* msec */
198 time_t idns_retransmit
;
205 size_t maxRequestHeaderSize
;
206 int64_t maxRequestBodySize
;
207 size_t maxReplyHeaderSize
;
208 acl_size_t
*ReplyBodySize
;
228 http_port_list
*http
;
231 https_port_list
*https
;
264 IPAddress_list
*router
;
267 int forwarding_method
;
269 int assignment_method
;
282 char *as_whois_server
;
289 #if USE_USERAGENT_LOG
302 logformat
*logformats
;
304 customlog
*accesslogs
;
314 char *visible_appname_string
;
315 char *effectiveGroup
;
343 int redirectChildren
;
344 int redirectConcurrency
;
345 time_t authenticateGCInterval
;
346 time_t authenticateTTL
;
347 time_t authenticateIpTTL
;
359 size_t appendDomainLen
;
363 char *mimeTablePathname
;
365 char *visibleHostname
;
366 char *uniqueHostname
;
367 wordlist
*hostnameAliases
;
383 IPAddress udp_incoming
;
385 IPAddress udp_outgoing
;
388 IPAddress snmp_incoming
;
390 IPAddress snmp_outgoing
;
392 /* FIXME INET6 : this should really be a CIDR value */
393 IPAddress client_netmask
;
398 size_t udpMaxHitObjsz
;
399 wordlist
*hierarchy_stoplist
;
400 wordlist
*mcast_group_list
;
401 wordlist
*dns_testname_list
;
402 wordlist
*dns_nameservers
;
423 cachemgr_passwd
*passwd_list
;
427 int objectsPerBucket
;
428 int64_t avgObjectSize
;
429 int64_t maxObjectSize
;
430 int64_t minObjectSize
;
431 size_t maxInMemObjSize
;
459 int test_reachability
;
460 int half_closed_clients
;
468 int redir_rewrites_host
;
470 int nonhierarchical_direct
;
471 int strip_query_terms
;
472 int redirector_bypass
;
473 int ignore_unknown_nameservers
;
477 #if USE_CACHE_DIGESTS
479 int digest_generation
;
482 int log_ip_on_direct
;
484 int vary_ignore_expire
;
485 int pipeline_prefetch
;
488 int surrogate_is_remote
;
491 int request_entities
;
492 int detect_broken_server_pconns
;
493 int balance_on_multiple_ip
;
494 int relaxed_header_parser
;
496 int allow_underscore
;
499 int httpd_suppress_version_string
;
500 int global_internal_static
;
502 int debug_override_X
;
514 acl_access
*NeverDirect
;
515 acl_access
*AlwaysDirect
;
524 acl_access
*brokenPosts
;
527 acl_access
*identLookup
;
530 acl_access
*redirector
;
532 acl_address
*outgoing_address
;
533 acl_tos
*outgoing_tos
;
534 acl_tos
*clientside_tos
;
538 acl_access
*htcp_clr
;
542 acl_access
*ssl_bump
;
548 acl_deny_info_list
*denyInfoList
;
549 authConfig authConfiguration
;
567 RefCount
<class Store
> *swapDirs
;
581 char *errorDirectory
;
613 int max_open_disk_fds
;
615 int64_t rangeOffsetLimit
;
616 #if MULTICAST_MISS_STREAM
630 /* one access list per header type we know of */
631 header_mangler request_header_access
[HDR_ENUM_END
];
632 /* one access list per header type we know of */
633 header_mangler reply_header_access
[HDR_ENUM_END
];
636 #if USE_CACHE_DIGESTS
641 time_t rebuild_period
;
642 time_t rewrite_period
;
643 size_t swapout_chunk_size
;
644 int rebuild_chunk_percentage
;
653 int unclean_shutdown
;
660 wordlist
*ext_methods
;
670 char *store_dir_select_algorithm
;
671 int sleep_after_fork
; /* microseconds */
672 time_t minimum_expiry_time
; /* seconds */
673 external_acl
*externalAclHelperList
;
687 acl_access
*cert_error
;
703 int mangle_request_headers
;
707 uid_t effectiveUserID
;
708 gid_t effectiveGroupID
;
711 struct _close_handler
740 /* ETag support is rudimantal;
741 * this struct is likely to change
742 * Note: "str" points to memory in HttpHeaderEntry (for now)
743 * so ETags should be used as tmp variables only (for now) */
747 const char *str
; /* quoted-string */
748 int weak
; /* true if it is a weak validator */
754 void *wrt_handle_data
;
756 dwrite_q
*write_q_tail
;
766 unsigned long *file_map
;
770 * Note: HttpBody is used only for messages with a small content that is
771 * known a priory (e.g., error messages).
782 #include "SquidString.h"
783 /* http header extention field */
785 class HttpHdrExtField
787 String name
; /* field-name from HTTP/1.1 (no column after name) */
788 String value
; /* field-value from HTTP/1.1 */
791 /* http cache control header field */
804 /* some fields can hold either time or etag specs (e.g. If-Range) */
808 ETag tag
; /* entity tag */
810 int valid
; /* true if struct is usable */
813 /* per field statistics */
815 class HttpHeaderFieldStat
819 HttpHeaderFieldStat() : aliveCount(0), seenCount(0), parsCount(0), errCount(0), repCount(0){}
821 int aliveCount
; /* created but not destroyed (count) */
822 int seenCount
; /* #fields we've seen */
823 int parsCount
; /* #parsing attempts */
824 int errCount
; /* #pasring errors */
825 int repCount
; /* #repetitons */
828 /* compiled version of HttpHeaderFieldAttrs plus stats */
830 class HttpHeaderFieldInfo
834 HttpHeaderFieldInfo() : id (HDR_ACCEPT
), type (ftInvalid
){}
839 HttpHeaderFieldStat stat
;
842 struct _http_state_flags
845 unsigned int proxying
:
848 unsigned int keepalive
:
851 unsigned int only_if_cached
:
854 unsigned int headers_parsed
:
857 unsigned int front_end_https
:
860 unsigned int originpeer
:
863 unsigned int keepalive_broken
:
866 unsigned int abuse_detected
:
869 unsigned int request_sent
:
872 unsigned int do_next_read
:
875 unsigned int consume_body_data
:
878 unsigned int chunked
:1;
881 struct _ipcache_addrs
884 unsigned char *bad_mask
;
887 unsigned char badcount
;
893 int do_ping
; /* boolean */
904 #if USE_CACHE_DIGESTS
906 /* statistics for cache digests and other hit "predictors" */
908 struct _cd_guess_stats
910 /* public, read-only */
915 int close_hits
; /* tmp, remove it later */
936 int n_keepalives_sent
;
937 int n_keepalives_recv
;
941 time_t last_connect_failure
;
942 time_t last_connect_probe
;
943 int logged_state
; /* so we can print dead/revived msgs */
944 int conn_open
; /* current opened connections */
952 int counts
[ICP_END
+1];
970 domain_ping
*peer_domain
;
971 domain_type
*typelist
;
977 unsigned int proxy_only
:
980 unsigned int no_query
:
983 unsigned int background_ping
:
986 unsigned int no_digest
:
989 unsigned int default_parent
:
992 unsigned int roundrobin
:
995 unsigned int weighted_roundrobin
:
998 unsigned int mcast_responder
:
1001 unsigned int closest_only
:
1008 unsigned int htcp_oldsquid
:
1012 unsigned int no_netdb_exchange
:
1016 unsigned int no_delay
:
1020 unsigned int allow_miss
:
1028 unsigned int originserver
:
1038 double avg_n_members
;
1039 int n_times_counted
;
1040 int n_replies_expected
;
1047 unsigned int count_event_pending
:
1050 unsigned int counting
:
1058 #if USE_CACHE_DIGESTS
1064 int tcp_up
; /* 0 if a connect() fails */
1066 IPAddress addresses
[10];
1077 double load_multiplier
;
1078 double load_factor
; /* normalized weight value */
1084 char *login
; /* Proxy authorization */
1085 time_t connect_timeout
;
1087 char *domain
; /* Forced domain */
1101 SSL_CTX
*sslContext
;
1102 SSL_SESSION
*sslSession
;
1105 int front_end_https
;
1110 hash_link hash
; /* must be first */
1112 netdbEntry
*net_db_entry
;
1117 const char *peername
;
1125 hash_link hash
; /* must be first */
1126 char network
[MAX_IPSTRLEN
];
1131 time_t next_ping_time
;
1132 time_t last_use_time
;
1157 struct request_flags
1159 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),transparent(0),internal(0),internalclient(0),must_keepalive(0),destinationIPLookedUp_(0)
1173 unsigned int nocache
:
1182 unsigned int cachable
:
1185 unsigned int hierarchical
:
1188 unsigned int loopdetect
:
1191 unsigned int proxy_keepalive
:
1194 unsigned int proxying
:
1195 1; /* this should be killed, also in httpstateflags */
1197 unsigned int refresh
:
1200 unsigned int redirected
:
1203 unsigned int need_validation
:
1207 unsigned int nocache_hack
:
1208 1; /* for changing/ignoring no-cache requests */
1211 unsigned int accelerated
:
1214 unsigned int transparent
:
1218 unsigned int tproxy
:
1219 1; /* spoof client ip using tproxy */
1221 unsigned int internal
:
1224 unsigned int internalclient
:
1227 unsigned int must_keepalive
:
1230 // When adding new flags, please update cloneAdaptationImmune() as needed.
1232 bool resetTCP() const;
1234 void clearResetTCP();
1235 void destinationIPLookupCompleted();
1236 bool destinationIPLookedUp() const;
1238 // returns a partial copy of the flags that includes only those flags
1239 // that are safe for a related (e.g., ICAP-adapted) request to inherit
1240 request_flags
cloneAdaptationImmune() const;
1244 unsigned int reset_tcp
:
1247 unsigned int destinationIPLookedUp_
:
1255 struct _link_list
*next
;
1258 struct _cachemgr_passwd
1262 cachemgr_passwd
*next
;
1267 const char *pattern
;
1268 regex_t compiled_pattern
;
1280 unsigned int refresh_ims
:
1284 unsigned int override_expire
:
1287 unsigned int override_lastmod
:
1290 unsigned int reload_into_ims
:
1293 unsigned int ignore_reload
:
1296 unsigned int ignore_no_cache
:
1299 unsigned int ignore_no_store
:
1302 unsigned int ignore_private
:
1305 unsigned int ignore_auth
:
1315 * "very generic" histogram;
1316 * see important comments on hbase_f restrictions in StatHist.c
1326 hbase_f
*val_in
; /* e.g., log() for log-based histogram */
1327 hbase_f
*val_out
; /* e.g., exp() for log based histogram */
1331 * if you add a field to StatCounters,
1332 * you MUST sync statCountersInitSpecial, statCountersClean, and statCountersCopy
1335 struct _StatCounters
1348 kb_t hit_kbytes_out
;
1349 StatHist miss_svc_time
;
1350 StatHist nm_svc_time
;
1351 StatHist nh_svc_time
;
1352 StatHist hit_svc_time
;
1353 StatHist all_svc_time
;
1369 all
, http
, ftp
, other
;
1385 int replies_dropped
;
1392 StatHist query_svc_time
;
1393 StatHist reply_svc_time
;
1430 #if USE_CACHE_DIGESTS
1432 cd_guess_stats guess
;
1435 StatHist on_xition_count
;
1452 struct timeval timestamp
;
1453 StatHist comm_icp_incoming
;
1454 StatHist comm_dns_incoming
;
1455 StatHist comm_http_incoming
;
1456 StatHist select_fds_hist
;
1491 int aborted_requests
;
1503 /* per header statistics */
1505 struct _HttpHeaderStat
1508 HttpHeaderMask
*owner_mask
;
1510 StatHist hdrUCountDistr
;
1511 StatHist fieldTypeDistr
;
1512 StatHist ccTypeDistr
;
1513 StatHist scTypeDistr
;
1519 int busyDestroyedCount
;
1525 hash_link hash
; /* must be first */
1531 int result_hist
[LOG_TYPE_MAX
];
1535 kb_t hit_kbytes_out
;
1548 int n_established
; /* number of current established connections */
1554 /* public, read-only */
1555 char *mask
; /* bit mask */
1556 int mask_size
; /* mask size in bytes */
1557 int capacity
; /* expected maximum for .count, not a hard limit */
1558 int bits_per_entry
; /* number of bits allocated for each entry from capacity */
1559 int count
; /* number of digested entries */
1560 int del_count
; /* number of deletions performed so far */
1564 struct _store_rebuild_data
1566 int objcount
; /* # objects successfully reloaded */
1567 int expcount
; /* # objects expired */
1568 int scancount
; /* # entries scanned or read from state file */
1569 int clashcount
; /* # swapfile clashes avoided */
1570 int dupcount
; /* # duplicates purged */
1571 int cancelcount
; /* # SWAP_LOG_DEL objects purged */
1572 int invalid
; /* # bad lines */
1573 int badflags
; /* # bad e->flags */
1581 char path
[MAXPATHLEN
];
1589 unsigned int syslog
;
1594 int syslog_priority
;
1600 logformat_token
*format
;
1608 logformat
*logFormat
;
1611 customlog_type type
;
1614 #endif /* SQUID_STRUCTS_H */