3 * $Id: structs.h,v 1.561 2007/08/13 17:20:51 hno 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
40 /* needed for various structures still in structs.h */
42 /* needed for the global config */
43 #include "HttpHeader.h"
47 char name
[ACL_NAME_SZ
];
51 struct _acl_deny_info_list
55 acl_name_list
*acl_list
;
56 acl_deny_info_list
*next
;
62 struct _header_mangler
64 acl_access
*access_list
;
70 struct _snmp_request_t
79 struct sockaddr_in from
;
82 ACLChecklist
*acl_checklist
;
85 struct snmp_session session
;
126 struct _sockaddr_in_list
129 struct sockaddr_in s
;
130 sockaddr_in_list
*next
;
133 struct _http_port_list
135 http_port_list
*next
;
137 struct sockaddr_in s
;
138 char *protocol
; /* protocol name */
139 char *name
; /* visible name */
140 char *defaultsite
; /* default web site */
142 unsigned int transparent
:
143 1; /* transparent proxy */
146 1; /* HTTP accelerator */
149 1; /* uses host header */
151 int vport
; /* virtual port support, -1 for dynamic, >0 static*/
152 int disable_pmtu_discovery
;
155 1; /* spoof client ip using tproxy */
162 struct _https_port_list
164 http_port_list http
; /* must be first */
183 #include "DelayConfig.h"
186 /* forward decl for SquidConfig, see RemovalPolicy.h */
188 class RemovalPolicySettings
;
200 /* These should be for the Store::Root instance.
201 * this needs pluggable parsing to be done smoothly.
218 int64_t readAheadGap
;
219 RemovalPolicySettings
*replPolicy
;
220 RemovalPolicySettings
*memPolicy
;
222 time_t negativeDnsTtl
;
223 time_t positiveDnsTtl
;
224 time_t shutdownLifetime
;
225 time_t backgroundPingRate
;
235 time_t persistent_request
;
239 int icp_query
; /* msec */
240 int icp_query_max
; /* msec */
241 int icp_query_min
; /* msec */
242 int mcast_icp_query
; /* msec */
249 time_t idns_retransmit
;
256 size_t maxRequestHeaderSize
;
257 int64_t maxRequestBodySize
;
258 size_t maxReplyHeaderSize
;
259 acl_size_t
*ReplyBodySize
;
279 http_port_list
*http
;
282 https_port_list
*https
;
303 struct IN_ADDR router
;
305 struct IN_ADDR address
;
315 sockaddr_in_list
*router
;
317 struct IN_ADDR address
;
318 int forwarding_method
;
320 int assignment_method
;
329 char *as_whois_server
;
336 #if USE_USERAGENT_LOG
349 logformat
*logformats
;
351 customlog
*accesslogs
;
361 char *visible_appname_string
;
362 char *effectiveGroup
;
394 int redirectChildren
;
395 int redirectConcurrency
;
396 time_t authenticateGCInterval
;
397 time_t authenticateTTL
;
398 time_t authenticateIpTTL
;
410 size_t appendDomainLen
;
413 char *mimeTablePathname
;
415 char *visibleHostname
;
416 char *uniqueHostname
;
417 wordlist
*hostnameAliases
;
433 struct IN_ADDR udp_incoming
;
435 struct IN_ADDR udp_outgoing
;
438 struct IN_ADDR snmp_incoming
;
440 struct IN_ADDR snmp_outgoing
;
443 struct IN_ADDR client_netmask
;
448 size_t udpMaxHitObjsz
;
449 wordlist
*hierarchy_stoplist
;
450 wordlist
*mcast_group_list
;
451 wordlist
*dns_testname_list
;
452 wordlist
*dns_nameservers
;
473 cachemgr_passwd
*passwd_list
;
477 int objectsPerBucket
;
478 size_t avgObjectSize
;
479 int64_t maxObjectSize
;
480 int64_t minObjectSize
;
481 size_t maxInMemObjSize
;
504 #if ALLOW_SOURCE_PING
514 int test_reachability
;
515 int half_closed_clients
;
523 int redir_rewrites_host
;
525 int nonhierarchical_direct
;
526 int strip_query_terms
;
527 int redirector_bypass
;
528 int ignore_unknown_nameservers
;
532 #if USE_CACHE_DIGESTS
534 int digest_generation
;
537 int log_ip_on_direct
;
539 int vary_ignore_expire
;
540 int pipeline_prefetch
;
543 int surrogate_is_remote
;
546 int request_entities
;
547 int detect_broken_server_pconns
;
548 int balance_on_multiple_ip
;
549 int relaxed_header_parser
;
551 int allow_underscore
;
554 int httpd_suppress_version_string
;
555 int global_internal_static
;
567 acl_access
*NeverDirect
;
568 acl_access
*AlwaysDirect
;
577 acl_access
*brokenPosts
;
580 acl_access
*identLookup
;
583 acl_access
*redirector
;
585 acl_address
*outgoing_address
;
586 acl_tos
*outgoing_tos
;
587 acl_tos
*clientside_tos
;
591 acl_access
*htcp_clr
;
597 acl_deny_info_list
*denyInfoList
;
598 authConfig authConfiguration
;
615 RefCount
<class Store
> *swapDirs
;
629 char *errorDirectory
;
661 int max_open_disk_fds
;
663 int64_t rangeOffsetLimit
;
664 #if MULTICAST_MISS_STREAM
678 /* one access list per header type we know of */
679 header_mangler request_header_access
[HDR_ENUM_END
];
680 /* one access list per header type we know of */
681 header_mangler reply_header_access
[HDR_ENUM_END
];
684 #if USE_CACHE_DIGESTS
689 time_t rebuild_period
;
690 time_t rewrite_period
;
691 size_t swapout_chunk_size
;
692 int rebuild_chunk_percentage
;
701 int unclean_shutdown
;
708 wordlist
*ext_methods
;
718 char *store_dir_select_algorithm
;
719 int sleep_after_fork
; /* microseconds */
720 time_t minimum_expiry_time
; /* seconds */
721 external_acl
*externalAclHelperList
;
741 #ifdef SO_ACCEPTFILTER
752 int mangle_request_headers
;
756 uid_t effectiveUserID
;
757 gid_t effectiveGroupID
;
760 struct _close_handler
786 char ip_inbuf
[DNS_INBUF_SZ
];
788 struct timeval dispatch_time
;
803 /* ETag support is rudimantal;
804 * this struct is likely to change
805 * Note: "str" points to memory in HttpHeaderEntry (for now)
806 * so ETags should be used as tmp variables only (for now) */
810 const char *str
; /* quoted-string */
811 int weak
; /* true if it is a weak validator */
817 void *wrt_handle_data
;
819 dwrite_q
*write_q_tail
;
829 unsigned long *file_map
;
833 * Note: HttpBody is used only for messages with a small content that is
834 * known a priory (e.g., error messages).
845 #include "SquidString.h"
846 /* http header extention field */
848 class HttpHdrExtField
850 String name
; /* field-name from HTTP/1.1 (no column after name) */
851 String value
; /* field-value from HTTP/1.1 */
854 /* http cache control header field */
867 /* some fields can hold either time or etag specs (e.g. If-Range) */
871 ETag tag
; /* entity tag */
873 int valid
; /* true if struct is usable */
876 /* per field statistics */
878 class HttpHeaderFieldStat
882 HttpHeaderFieldStat() : aliveCount(0), seenCount(0), parsCount(0), errCount(0), repCount(0){}
884 int aliveCount
; /* created but not destroyed (count) */
885 int seenCount
; /* #fields we've seen */
886 int parsCount
; /* #parsing attempts */
887 int errCount
; /* #pasring errors */
888 int repCount
; /* #repetitons */
891 /* compiled version of HttpHeaderFieldAttrs plus stats */
893 class HttpHeaderFieldInfo
897 HttpHeaderFieldInfo() : id (HDR_ACCEPT
), type (ftInvalid
){}
902 HttpHeaderFieldStat stat
;
905 struct _http_state_flags
908 unsigned int proxying
:
911 unsigned int keepalive
:
914 unsigned int only_if_cached
:
917 unsigned int headers_parsed
:
920 unsigned int front_end_https
:
923 unsigned int originpeer
:
926 unsigned int keepalive_broken
:
929 unsigned int abuse_detected
:
932 unsigned int request_sent
:
935 unsigned int do_next_read
:
938 unsigned int consume_body_data
:
942 struct _ipcache_addrs
945 struct IN_ADDR
*in_addrs
;
946 unsigned char *bad_mask
;
949 unsigned char badcount
;
955 int do_ping
; /* boolean */
966 #if USE_CACHE_DIGESTS
968 /* statistics for cache digests and other hit "predictors" */
970 struct _cd_guess_stats
972 /* public, read-only */
977 int close_hits
; /* tmp, remove it later */
988 struct sockaddr_in in_addr
;
997 int n_keepalives_sent
;
998 int n_keepalives_recv
;
1002 time_t last_connect_failure
;
1003 time_t last_connect_probe
;
1004 int logged_state
; /* so we can print dead/revived msgs */
1005 int conn_open
; /* current opened connections */
1013 int counts
[ICP_END
+1];
1031 domain_ping
*peer_domain
;
1032 domain_type
*typelist
;
1038 unsigned int proxy_only
:
1041 unsigned int no_query
:
1044 unsigned int background_ping
:
1047 unsigned int no_digest
:
1050 unsigned int default_parent
:
1053 unsigned int roundrobin
:
1056 unsigned int weighted_roundrobin
:
1059 unsigned int mcast_responder
:
1062 unsigned int closest_only
:
1069 unsigned int htcp_oldsquid
:
1073 unsigned int no_netdb_exchange
:
1077 unsigned int no_delay
:
1081 unsigned int allow_miss
:
1089 unsigned int originserver
:
1099 double avg_n_members
;
1100 int n_times_counted
;
1101 int n_replies_expected
;
1108 unsigned int count_event_pending
:
1111 unsigned int counting
:
1119 #if USE_CACHE_DIGESTS
1125 int tcp_up
; /* 0 if a connect() fails */
1127 struct IN_ADDR addresses
[10];
1138 double load_multiplier
;
1139 double load_factor
; /* normalized weight value */
1145 char *login
; /* Proxy authorization */
1146 time_t connect_timeout
;
1148 char *domain
; /* Forced domain */
1162 SSL_CTX
*sslContext
;
1163 SSL_SESSION
*sslSession
;
1166 int front_end_https
;
1171 hash_link hash
; /* must be first */
1173 netdbEntry
*net_db_entry
;
1178 const char *peername
;
1186 hash_link hash
; /* must be first */
1192 time_t next_ping_time
;
1193 time_t last_use_time
;
1204 struct _pingerEchoData
1208 unsigned char opcode
;
1210 char payload
[PINGER_PAYLOAD_SZ
];
1213 struct _pingerReplyData
1216 struct IN_ADDR from
;
1217 unsigned char opcode
;
1221 char payload
[PINGER_PAYLOAD_SZ
];
1242 struct request_flags
1244 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)
1258 unsigned int nocache
:
1267 unsigned int cachable
:
1270 unsigned int hierarchical
:
1273 unsigned int loopdetect
:
1276 unsigned int proxy_keepalive
:
1279 unsigned int proxying
:
1280 1; /* this should be killed, also in httpstateflags */
1282 unsigned int refresh
:
1285 unsigned int redirected
:
1288 unsigned int need_validation
:
1292 unsigned int nocache_hack
:
1293 1; /* for changing/ignoring no-cache requests */
1296 unsigned int accelerated
:
1299 unsigned int transparent
:
1303 unsigned int tproxy
:
1304 1; /* spoof client ip using tproxy */
1306 unsigned int internal
:
1309 unsigned int internalclient
:
1312 unsigned int must_keepalive
:
1315 // When adding new flags, please update cloneAdaptationImmune() as needed.
1317 bool resetTCP() const;
1319 void clearResetTCP();
1320 void destinationIPLookupCompleted();
1321 bool destinationIPLookedUp() const;
1323 // returns a partial copy of the flags that includes only those flags
1324 // that are safe for a related (e.g., ICAP-adapted) request to inherit
1325 request_flags
cloneAdaptationImmune() const;
1329 unsigned int reset_tcp
:
1332 unsigned int destinationIPLookedUp_
:
1340 struct _link_list
*next
;
1343 struct _cachemgr_passwd
1347 cachemgr_passwd
*next
;
1352 const char *pattern
;
1353 regex_t compiled_pattern
;
1365 unsigned int refresh_ims
:
1369 unsigned int override_expire
:
1372 unsigned int override_lastmod
:
1375 unsigned int reload_into_ims
:
1378 unsigned int ignore_reload
:
1381 unsigned int ignore_no_cache
:
1384 unsigned int ignore_no_store
:
1387 unsigned int ignore_private
:
1390 unsigned int ignore_auth
:
1400 * "very generic" histogram;
1401 * see important comments on hbase_f restrictions in StatHist.c
1411 hbase_f
*val_in
; /* e.g., log() for log-based histogram */
1412 hbase_f
*val_out
; /* e.g., exp() for log based histogram */
1416 * if you add a field to StatCounters,
1417 * you MUST sync statCountersInitSpecial, statCountersClean, and statCountersCopy
1420 struct _StatCounters
1433 kb_t hit_kbytes_out
;
1434 StatHist miss_svc_time
;
1435 StatHist nm_svc_time
;
1436 StatHist nh_svc_time
;
1437 StatHist hit_svc_time
;
1438 StatHist all_svc_time
;
1454 all
, http
, ftp
, other
;
1470 int replies_dropped
;
1477 StatHist query_svc_time
;
1478 StatHist reply_svc_time
;
1515 #if USE_CACHE_DIGESTS
1517 cd_guess_stats guess
;
1520 StatHist on_xition_count
;
1537 struct timeval timestamp
;
1538 StatHist comm_icp_incoming
;
1539 StatHist comm_dns_incoming
;
1540 StatHist comm_http_incoming
;
1541 StatHist select_fds_hist
;
1583 int aborted_requests
;
1595 /* per header statistics */
1597 struct _HttpHeaderStat
1600 HttpHeaderMask
*owner_mask
;
1602 StatHist hdrUCountDistr
;
1603 StatHist fieldTypeDistr
;
1604 StatHist ccTypeDistr
;
1605 StatHist scTypeDistr
;
1611 int busyDestroyedCount
;
1617 hash_link hash
; /* must be first */
1619 struct IN_ADDR addr
;
1623 int result_hist
[LOG_TYPE_MAX
];
1627 kb_t hit_kbytes_out
;
1640 int n_established
; /* number of current established connections */
1646 /* public, read-only */
1647 char *mask
; /* bit mask */
1648 size_t mask_size
; /* mask size in bytes */
1649 int capacity
; /* expected maximum for .count, not a hard limit */
1650 int bits_per_entry
; /* number of bits allocated for each entry from capacity */
1651 int count
; /* number of digested entries */
1652 int del_count
; /* number of deletions performed so far */
1656 struct _store_rebuild_data
1658 int objcount
; /* # objects successfully reloaded */
1659 int expcount
; /* # objects expired */
1660 int scancount
; /* # entries scanned or read from state file */
1661 int clashcount
; /* # swapfile clashes avoided */
1662 int dupcount
; /* # duplicates purged */
1663 int cancelcount
; /* # SWAP_LOG_DEL objects purged */
1664 int invalid
; /* # bad lines */
1665 int badflags
; /* # bad e->flags */
1673 char path
[MAXPATHLEN
];
1681 unsigned int syslog
;
1686 int syslog_priority
;
1692 logformat_token
*format
;
1700 logformat
*logFormat
;
1703 customlog_type type
;
1706 #endif /* SQUID_STRUCTS_H */