3 * $Id: structs.h,v 1.430 2002/09/15 06:40:58 robertc 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
51 struct _acl_user_data
{
54 unsigned int case_insensitive
:1;
55 unsigned int required
:1;
59 struct _acl_user_ip_data
{
62 unsigned int strict
:1;
67 struct in_addr addr1
; /* if addr2 non-zero then its a range */
70 acl_ip_data
*next
; /* used for parsing, not for storing */
73 struct _acl_time_data
{
80 struct _acl_name_list
{
81 char name
[ACL_NAME_SZ
];
85 struct _acl_proxy_auth_match_cache
{
91 struct _auth_user_hash_pointer
{
92 /* first two items must be same as hash_link */
94 auth_user_hash_pointer
*next
;
95 auth_user_t
*auth_user
;
96 dlink_node link
; /* other hash entries that point to the same auth_user */
99 struct _auth_user_ip_t
{
101 /* IP addr this user authenticated from */
102 struct in_addr ipaddr
;
103 time_t ip_expiretime
;
106 struct _auth_user_t
{
107 /* extra fields for proxy_auth */
108 /* this determines what scheme owns the user data. */
109 auth_type_t auth_type
;
110 /* the index +1 in the authscheme_list to the authscheme entry */
112 /* we only have one username associated with a given auth_user struct */
113 auth_user_hash_pointer
*usernamehash
;
114 /* we may have many proxy-authenticate strings that decode to the same user */
115 dlink_list proxy_auth_list
;
116 dlink_list proxy_match_cache
;
117 /* what ip addresses has this user been seen at?, plus a list length cache */
121 /* how many references are outstanding to this instance */
123 /* the auth scheme has it's own private data area */
125 /* the auth_user_request structures that link to this. Yes it could be a splaytree
126 * but how many requests will a single username have in parallel? */
130 struct _auth_user_request_t
{
131 /* this is the object passed around by client_side and acl functions */
132 /* it has request specific data, and links to user specific data */
134 auth_user_t
*auth_user
;
135 /* return a message on the 407 error pages */
137 /* any scheme specific request related data */
139 /* how many 'processes' are working on this data */
145 * This defines an auth scheme module
148 struct _authscheme_entry
{
151 AUTHSADDHEADER
*AddHeader
;
152 AUTHSADDTRAILER
*AddTrailer
;
153 AUTHSAUTHED
*authenticated
;
154 AUTHSAUTHUSER
*authAuthenticate
;
155 AUTHSCONFIGURED
*configured
;
157 AUTHSFIXERR
*authFixHeader
;
159 AUTHSFREECONFIG
*freeconfig
;
160 AUTHSUSERNAME
*authUserUsername
;
161 AUTHSONCLOSEC
*oncloseconnection
; /*optional */
162 AUTHSCONNLASTHEADER
*authConnLastHeader
;
163 AUTHSDECODE
*decodeauth
;
164 AUTHSDIRECTION
*getdirection
;
167 AUTHSREQFREE
*requestFree
;
168 AUTHSSHUTDOWN
*donefunc
;
169 AUTHSSTART
*authStart
;
170 AUTHSSTATS
*authStats
;
174 * This is a configured auth scheme
177 /* private data types */
179 /* pointer to the authscheme_list's string entry */
181 /* the scheme id in the authscheme_list */
183 /* the scheme's configuration details. */
187 struct _acl_deny_info_list
{
190 acl_name_list
*acl_list
;
191 acl_deny_info_list
*next
;
196 struct _acl_arp_data
{
203 /* never reference these directly! */
204 unsigned short int size
; /* buffer size; 64K limit */
205 unsigned short int len
; /* current length */
209 struct _header_mangler
{
210 acl_access
*access_list
;
216 acl_access
*access_list
;
220 struct _http_version_t
{
227 struct _snmp_request_t
{
234 struct sockaddr_in from
;
235 struct snmp_pdu
*PDU
;
236 aclCheck_t
*acl_checklist
;
243 char name
[ACL_NAME_SZ
];
263 struct _acl_address
{
276 const acl_access
*accessList
;
277 struct in_addr src_addr
;
278 struct in_addr dst_addr
;
279 struct in_addr my_addr
;
280 unsigned short my_port
;
282 /* for acls that look at reply data */
284 ConnStateData
*conn
; /* hack for ident and NTLM */
285 char rfc931
[USER_IDENT_SZ
];
286 auth_user_request_t
*auth_user_request
;
287 acl_lookup_state state
[ACL_ENUM_MAX
];
289 char *snmp_community
;
293 external_acl_entry
*extacl_entry
;
323 struct _sockaddr_in_list
{
324 struct sockaddr_in s
;
325 sockaddr_in_list
*next
;
329 struct _https_port_list
{
330 https_port_list
*next
;
331 struct sockaddr_in s
;
347 /* malloc()'d only as far as used (class * sizeof(delaySpec)!
348 * order of elements very important!
350 struct _delaySpecSet
{
352 delaySpec individual
;
356 struct _delayConfig
{
357 unsigned short pools
;
358 unsigned short initial
;
359 unsigned char *class;
360 delaySpecSet
**rates
;
366 struct _RemovalPolicySettings
{
371 struct _SquidConfig
{
389 RemovalPolicySettings
*replPolicy
;
390 RemovalPolicySettings
*memPolicy
;
392 time_t negativeDnsTtl
;
393 time_t positiveDnsTtl
;
394 time_t shutdownLifetime
;
395 time_t backgroundPingRate
;
402 time_t persistent_request
;
406 int icp_query
; /* msec */
407 int icp_query_max
; /* msec */
408 int icp_query_min
; /* msec */
409 int mcast_icp_query
; /* msec */
414 time_t idns_retransmit
;
418 size_t maxRequestHeaderSize
;
419 size_t maxRequestBodySize
;
420 dlink_list ReplyBodySize
;
431 sockaddr_in_list
*http
;
433 https_port_list
*https
;
444 struct in_addr router
;
445 struct in_addr incoming
;
446 struct in_addr outgoing
;
450 char *as_whois_server
;
456 #if USE_USERAGENT_LOG
469 char *effectiveGroup
;
486 int redirectChildren
;
487 time_t authenticateGCInterval
;
488 time_t authenticateTTL
;
489 time_t authenticateIpTTL
;
496 size_t appendDomainLen
;
499 char *mimeTablePathname
;
501 char *visibleHostname
;
502 char *uniqueHostname
;
503 wordlist
*hostnameAliases
;
512 struct in_addr udp_incoming
;
513 struct in_addr udp_outgoing
;
515 struct in_addr snmp_incoming
;
516 struct in_addr snmp_outgoing
;
518 struct in_addr client_netmask
;
521 size_t udpMaxHitObjsz
;
522 wordlist
*hierarchy_stoplist
;
523 wordlist
*mcast_group_list
;
524 wordlist
*dns_testname_list
;
525 wordlist
*dns_nameservers
;
538 cachemgr_passwd
*passwd_list
;
540 int objectsPerBucket
;
541 size_t avgObjectSize
;
542 size_t maxObjectSize
;
543 size_t minObjectSize
;
544 size_t maxInMemObjSize
;
561 #if ALLOW_SOURCE_PING
568 int accel_with_proxy
;
570 int test_reachability
;
571 int half_closed_clients
;
576 int redir_rewrites_host
;
578 int nonhierarchical_direct
;
579 int strip_query_terms
;
580 int redirector_bypass
;
581 int ignore_unknown_nameservers
;
584 #if USE_CACHE_DIGESTS
585 int digest_generation
;
587 int log_ip_on_direct
;
589 int vary_ignore_expire
;
590 int pipeline_prefetch
;
600 acl_access
*NeverDirect
;
601 acl_access
*AlwaysDirect
;
607 acl_access
*brokenPosts
;
609 acl_access
*identLookup
;
611 acl_access
*redirector
;
613 acl_address
*outgoing_address
;
614 acl_tos
*outgoing_tos
;
616 acl_deny_info_list
*denyInfoList
;
638 char *errorDirectory
;
657 int max_open_disk_fds
;
659 size_t rangeOffsetLimit
;
660 #if MULTICAST_MISS_STREAM
668 header_mangler header_access
[HDR_ENUM_END
];
671 #if USE_CACHE_DIGESTS
674 time_t rebuild_period
;
675 time_t rewrite_period
;
676 size_t swapout_chunk_size
;
677 int rebuild_chunk_percentage
;
682 int unclean_shutdown
;
685 wordlist
*ext_methods
;
691 char *store_dir_select_algorithm
;
692 int sleep_after_fork
; /* microseconds */
693 external_acl
*externalAclHelperList
;
696 struct _SquidConfig2
{
704 uid_t effectiveUserID
;
705 gid_t effectiveGroupID
;
708 struct _close_handler
{
724 struct _dnsserver_t
{
731 char ip_inbuf
[DNS_INBUF_SZ
];
732 struct timeval dispatch_time
;
746 /* ETag support is rudimantal;
747 * this struct is likely to change
748 * Note: "str" points to memory in HttpHeaderEntry (for now)
749 * so ETags should be used as tmp variables only (for now) */
751 const char *str
; /* quoted-string */
752 int weak
; /* true if it is a weak validator */
759 struct in_addr local_addr
;
761 char ipaddr
[16]; /* dotted decimal address of peer */
762 char desc
[FD_DESC_SZ
];
765 unsigned int close_request
:1;
766 unsigned int write_daemon
:1;
767 unsigned int closing
:1;
768 unsigned int socket_eof
:1;
769 unsigned int nolinger
:1;
770 unsigned int nonblocking
:1;
772 unsigned int called_connect
:1;
773 unsigned int nodelay
:1;
774 unsigned int close_on_exec
:1;
775 unsigned int read_pending
:1;
779 int uses
; /* ie # req's over persistent conn */
782 void *wrt_handle_data
;
784 dwrite_q
*write_q_tail
;
795 close_handler
*closeHandler
; /* linked list */
796 DEFER
*defer_check
; /* check if we should defer read */
798 CommWriteStateData
*rwstate
; /* State data for comm_write */
799 READ_HANDLER
*read_method
;
800 WRITE_HANDLER
*write_method
;
812 unsigned long *file_map
;
815 /* auto-growing memory-resident buffer with printf interface */
816 /* note: when updating this struct, update MemBufNULL #define */
818 /* public, read-only */
820 mb_size_t size
; /* used space, does not count 0-terminator */
822 /* private, stay away; use interface function instead */
823 mb_size_t max_capacity
; /* when grows: assert(new_capacity <= max_capacity) */
824 mb_size_t capacity
; /* allocated space */
825 unsigned stolen
:1; /* the buffer has been stolen for use by someone else */
828 /* see Packer.c for description */
830 /* protected, use interface functions instead */
833 void *real_handler
; /* first parameter to real append and vprintf */
836 /* http status line */
837 struct _HttpStatusLine
{
838 /* public, read only */
839 http_version_t version
;
840 const char *reason
; /* points to a _constant_ string (default or supplied), never free()d */
845 * Note: HttpBody is used only for messages with a small content that is
846 * known a priory (e.g., error messages).
853 /* http header extention field */
854 struct _HttpHdrExtField
{
855 String name
; /* field-name from HTTP/1.1 (no column after name) */
856 String value
; /* field-value from HTTP/1.1 */
859 /* http cache control header field */
867 /* http byte-range-spec */
868 struct _HttpHdrRangeSpec
{
873 /* There may be more than one byte range specified in the request.
874 * This object holds all range specs in order of their appearence
875 * in the request because we SHOULD preserve that order.
877 struct _HttpHdrRange
{
881 /* http content-range header field */
882 struct _HttpHdrContRange
{
883 HttpHdrRangeSpec spec
;
884 ssize_t elength
; /* entity length, not content length */
887 /* some fields can hold either time or etag specs (e.g. If-Range) */
889 ETag tag
; /* entity tag */
891 int valid
; /* true if struct is usable */
894 /* data for iterating thru range specs */
895 struct _HttpHdrRangeIter
{
897 const HttpHdrRangeSpec
*spec
; /* current spec at pos */
898 ssize_t debt_size
; /* bytes left to send from the current spec */
899 ssize_t prefix_size
; /* the size of the incoming HTTP msg prefix */
900 String boundary
; /* boundary for multipart responses */
903 /* constant attributes of http header fields */
904 struct _HttpHeaderFieldAttrs
{
910 /* per field statistics */
911 struct _HttpHeaderFieldStat
{
912 int aliveCount
; /* created but not destroyed (count) */
913 int seenCount
; /* #fields we've seen */
914 int parsCount
; /* #parsing attempts */
915 int errCount
; /* #pasring errors */
916 int repCount
; /* #repetitons */
919 /* compiled version of HttpHeaderFieldAttrs plus stats */
920 struct _HttpHeaderFieldInfo
{
924 HttpHeaderFieldStat stat
;
927 struct _HttpHeaderEntry
{
934 /* protected, do not use these, use interface functions instead */
935 Array entries
; /* parsed fields in raw format */
936 HttpHeaderMask mask
; /* bit set <=> entry present */
937 http_hdr_owner_type owner
; /* request or reply */
938 int len
; /* length when packed, not counting terminating '\0' */
942 /* unsupported, writable, may disappear/change in the future */
943 int hdr_sz
; /* sums _stored_ status-line, headers, and <CRLF> */
945 /* public, readable; never update these or their .hdr equivalents directly */
948 time_t last_modified
;
951 HttpHdrCc
*cache_control
;
952 HttpHdrContRange
*content_range
;
953 short int keep_alive
;
955 /* public, readable */
956 HttpMsgParseState pstate
; /* the current parsing state */
958 /* public, writable, but use httpReply* interfaces when possible */
959 HttpStatusLine sline
;
961 HttpBody body
; /* for small constant memory-resident text bodies only */
965 struct _http_state_flags
{
966 unsigned int proxying
:1;
967 unsigned int keepalive
:1;
968 unsigned int only_if_cached
:1;
971 struct _HttpStateData
{
975 size_t reply_hdr_size
;
977 peer
*_peer
; /* peer request made to */
978 int eof
; /* reached end-of-object? */
979 request_t
*orig_request
;
981 http_state_flags flags
;
986 struct sockaddr_in address
;
991 struct timeval start
;
994 struct timeval queue_time
;
998 struct timeval start
;
1002 int n_replies_expected
;
1003 int timeout
; /* msec */
1009 struct _HierarchyLogEntry
{
1011 char host
[SQUIDHOSTNAMELEN
];
1013 char cd_host
[SQUIDHOSTNAMELEN
]; /* the host of selected by cd peer */
1014 peer_select_alg_t alg
; /* peer selection algorithm */
1015 lookup_t cd_lookup
; /* cd prediction: none, miss, hit */
1016 int n_choices
; /* #peers we selected from (cd only) */
1017 int n_ichoices
; /* #peers with known rtt we selected from (cd only) */
1018 struct timeval peer_select_start
;
1019 struct timeval store_complete_stop
;
1022 struct _AccessLogEntry
{
1027 const char *content_type
;
1028 http_version_t version
;
1034 struct in_addr caddr
;
1039 const char *authuser
;
1046 const char *method_str
;
1048 HierarchyLogEntry hier
;
1051 struct _clientStreamNode
{
1053 dlink_list
*head
; /* sucks I know, but hey, the interface is limited */
1056 CSD
*detach
; /* tell this node the next one downstream wants no more data */
1058 void *data
; /* Context for the node */
1059 char *readbuf
; /* where *this* node wants its data returned; */
1060 size_t readlen
; /* how much data *this* node can handle */
1061 off_t readoff
; /* where *this* node wants it's data read from in the stream */
1064 struct _clientHttpRequest
{
1065 ConnStateData
*conn
;
1066 request_t
*request
; /* Parsed URL ... */
1073 HttpHdrRangeIter range_iter
; /* data for iterating thru range specs */
1074 size_t req_sz
; /* raw request size on input, not current request size */
1076 StoreEntry
*old_entry
;
1078 struct timeval start
;
1079 http_version_t http_ver
;
1082 unsigned int accel
:1;
1083 unsigned int internal
:1;
1084 unsigned int done_copying
:1;
1085 unsigned int purging
:1;
1092 dlink_list client_stream
;
1095 struct _ConnStateData
{
1103 size_t size_left
; /* How much body left to process */
1104 request_t
*request
; /* Parameters passed to clientReadBody */
1110 auth_type_t auth_type
; /* Is this connection based authentication ? if so
1111 * what type it is. */
1112 /* note this is ONLY connection based because NTLM is against HTTP spec */
1113 /* the user details for connection based authentication */
1114 auth_user_request_t
*auth_user_request
;
1115 void *currentobject
; /* used by the owner of the connection. Opaque otherwise */
1116 struct sockaddr_in peer
;
1117 struct sockaddr_in me
;
1118 struct in_addr log_addr
;
1119 char rfc931
[USER_IDENT_SZ
];
1127 struct _ipcache_addrs
{
1128 struct in_addr
*in_addrs
;
1129 unsigned char *bad_mask
;
1130 unsigned char count
;
1132 unsigned char badcount
;
1135 struct _domain_ping
{
1137 int do_ping
; /* boolean */
1141 struct _domain_type
{
1147 #if USE_CACHE_DIGESTS
1149 short int current
; /* current version */
1150 short int required
; /* minimal version that can safely handle current version */
1153 /* digest control block; used for transmission and storage */
1154 struct _StoreDigestCBlock
{
1160 unsigned char bits_per_entry
;
1161 unsigned char hash_func_count
;
1162 short int reserved_short
;
1163 int reserved
[32 - 6];
1166 struct _DigestFetchState
{
1169 StoreEntry
*old_entry
;
1171 store_client
*old_sc
;
1182 char buf
[SM_PAGE_SIZE
];
1184 digest_read_state_t state
;
1187 /* statistics for cache digests and other hit "predictors" */
1188 struct _cd_guess_stats
{
1189 /* public, read-only */
1194 int close_hits
; /* tmp, remove it later */
1197 struct _PeerDigest
{
1198 peer
*peer
; /* pointer back to peer structure, argh */
1199 CacheDigest
*cd
; /* actual digest structure */
1200 String host
; /* copy of peer->host */
1201 const char *req_result
; /* text status of the last request */
1203 unsigned int needed
:1; /* there were requests for this digest */
1204 unsigned int usable
:1; /* can be used for lookups */
1205 unsigned int requested
:1; /* in process of receiving [fresh] digest */
1208 /* all times are absolute unless augmented with _delay */
1209 time_t initialized
; /* creation */
1210 time_t needed
; /* first lookup/use by a peer */
1211 time_t next_check
; /* next scheduled check/refresh event */
1212 time_t retry_delay
; /* delay before re-checking _invalid_ digest */
1213 time_t requested
; /* requested a fresh copy of a digest */
1214 time_t req_delay
; /* last request response time */
1215 time_t received
; /* received the current copy of a digest */
1216 time_t disabled
; /* disabled for good */
1219 cd_guess_stats guess
;
1233 struct sockaddr_in in_addr
;
1239 int ignored_replies
;
1240 int n_keepalives_sent
;
1241 int n_keepalives_recv
;
1245 time_t last_connect_failure
;
1246 time_t last_connect_probe
;
1247 int logged_state
; /* so we can print dead/revived msgs */
1248 int conn_open
; /* current opened connections */
1252 int counts
[ICP_END
];
1263 domain_ping
*peer_domain
;
1264 domain_type
*typelist
;
1267 unsigned int proxy_only
:1;
1268 unsigned int no_query
:1;
1269 unsigned int background_ping
:1;
1270 unsigned int no_digest
:1;
1271 unsigned int default_parent
:1;
1272 unsigned int roundrobin
:1;
1273 unsigned int weighted_roundrobin
:1;
1274 unsigned int mcast_responder
:1;
1275 unsigned int closest_only
:1;
1277 unsigned int htcp
:1;
1279 unsigned int no_netdb_exchange
:1;
1281 unsigned int no_delay
:1;
1283 unsigned int allow_miss
:1;
1285 unsigned int carp
:1;
1291 double avg_n_members
;
1292 int n_times_counted
;
1293 int n_replies_expected
;
1297 unsigned int count_event_pending
:1;
1298 unsigned int counting
:1;
1301 #if USE_CACHE_DIGESTS
1305 int tcp_up
; /* 0 if a connect() fails */
1306 struct in_addr addresses
[10];
1315 double load_multiplier
;
1316 double load_factor
; /* normalized weight value */
1319 char *login
; /* Proxy authorization */
1320 time_t connect_timeout
;
1324 struct _net_db_name
{
1325 hash_link hash
; /* must be first */
1327 netdbEntry
*net_db_entry
;
1330 struct _net_db_peer
{
1331 const char *peername
;
1337 struct _netdbEntry
{
1338 hash_link hash
; /* must be first */
1344 time_t next_ping_time
;
1345 time_t last_use_time
;
1360 void *callback_data
;
1363 * Why are these struct sockaddr_in instead of peer *? Because a
1364 * peer structure can become invalid during the peer selection
1365 * phase, specifically after a reconfigure. Thus we need to lookup
1366 * the peer * based on the address when we are finally ready to
1367 * reference the peer structure.
1369 struct sockaddr_in first_parent_miss
;
1370 struct sockaddr_in closest_parent_miss
;
1372 * ->hit and ->secho can be peer* because they should only be
1373 * accessed during the thread when they are set
1377 #if ALLOW_SOURCE_PING
1381 aclCheck_t
*acl_checklist
;
1385 struct _pingerEchoData
{
1387 unsigned char opcode
;
1389 char payload
[PINGER_PAYLOAD_SZ
];
1392 struct _pingerReplyData
{
1393 struct in_addr from
;
1394 unsigned char opcode
;
1398 char payload
[PINGER_PAYLOAD_SZ
];
1403 struct _icp_common_t
{
1404 unsigned char opcode
; /* opcode */
1405 unsigned char version
; /* version number */
1406 unsigned short length
; /* total length (bytes) */
1407 u_int32_t reqnum
; /* req number (req'd for UDP) */
1410 u_int32_t shostid
; /* sender host id */
1420 } Http
, Ftp
, Gopher
, Wais
;
1424 char data
[SM_PAGE_SIZE
];
1435 /* keep track each client receiving data from that particular StoreEntry */
1436 struct _store_client
{
1443 void *callback_data
;
1444 #if STORE_CLIENT_LIST_DEBUG
1447 StoreEntry
*entry
; /* ptr to the parent StoreEntry, argh! */
1448 storeIOState
*swapin_sio
;
1450 unsigned int disk_io_pending
:1;
1451 unsigned int store_copying
:1;
1452 unsigned int copy_event_pending
:1;
1461 /* Removal policies */
1463 struct _RemovalPolicyNode
{
1467 struct _RemovalPolicy
{
1470 void (*Free
) (RemovalPolicy
* policy
);
1471 void (*Add
) (RemovalPolicy
* policy
, StoreEntry
* entry
, RemovalPolicyNode
* node
);
1472 void (*Remove
) (RemovalPolicy
* policy
, StoreEntry
* entry
, RemovalPolicyNode
* node
);
1473 void (*Referenced
) (RemovalPolicy
* policy
, const StoreEntry
* entry
, RemovalPolicyNode
* node
);
1474 void (*Dereferenced
) (RemovalPolicy
* policy
, const StoreEntry
* entry
, RemovalPolicyNode
* node
);
1475 RemovalPolicyWalker
*(*WalkInit
) (RemovalPolicy
* policy
);
1476 RemovalPurgeWalker
*(*PurgeInit
) (RemovalPolicy
* policy
, int max_scan
);
1477 void (*Stats
) (RemovalPolicy
* policy
, StoreEntry
* entry
);
1480 struct _RemovalPolicyWalker
{
1481 RemovalPolicy
*_policy
;
1483 const StoreEntry
*(*Next
) (RemovalPolicyWalker
* walker
);
1484 void (*Done
) (RemovalPolicyWalker
* walker
);
1487 struct _RemovalPurgeWalker
{
1488 RemovalPolicy
*_policy
;
1490 int scanned
, max_scan
, locked
;
1491 StoreEntry
*(*Next
) (RemovalPurgeWalker
* walker
);
1492 void (*Done
) (RemovalPurgeWalker
* walker
);
1495 /* This structure can be freed while object is purged out from memory */
1505 off_t queue_offset
; /* relative to in-mem data */
1506 mem_node
*memnode
; /* which node we're currently paging out */
1511 struct timeval start_ping
;
1512 IRCB
*ping_reply_callback
;
1514 int fd
; /* FD of client creating this entry */
1520 RemovalPolicyNode repl
;
1524 #if URL_CHECKSUM_DEBUG
1525 unsigned int chksum
;
1527 const char *vary_headers
;
1530 struct _StoreEntry
{
1531 hash_link hash
; /* must be first */
1533 RemovalPolicyNode repl
;
1534 /* START OF ON-DISK STORE_META_STD TLV field */
1539 size_t swap_file_sz
;
1542 /* END OF ON-DISK STORE_META_STD */
1543 sfileno swap_filen
:25;
1545 u_short lock_count
; /* Assume < 65536! */
1546 mem_status_t mem_status
:3;
1547 ping_status_t ping_status
:3;
1548 store_status_t store_status
:3;
1549 swap_status_t swap_status
:3;
1558 int index
; /* This entry's index into the swapDirs array */
1559 ssize_t max_objsize
;
1560 RemovalPolicy
*repl
;
1564 unsigned int selected
:1;
1565 unsigned int read_only
:1;
1567 STINIT
*init
; /* Initialise the fs */
1568 STNEWFS
*newfs
; /* Create a new fs */
1569 STDUMP
*dump
; /* Dump fs config snippet */
1570 STFREE
*freefs
; /* Free the fs data */
1571 STDBLCHECK
*dblcheck
; /* Double check the obj integrity */
1572 STSTATFS
*statfs
; /* Dump fs statistics */
1573 STMAINTAINFS
*maintainfs
; /* Replacement maintainence */
1574 STCHECKOBJ
*checkobj
; /* Check if the fs will store an object */
1575 /* These two are notifications */
1576 STREFOBJ
*refobj
; /* Reference this object */
1577 STUNREFOBJ
*unrefobj
; /* Unreference this object */
1578 STCALLBACK
*callback
; /* Handle pending callbacks */
1579 STSYNC
*sync
; /* Sync the directory */
1581 STOBJCREATE
*create
;
1586 STOBJUNLINK
*unlink
;
1593 STLOGCLEANSTART
*start
;
1594 STLOGCLEANNEXTENTRY
*nextentry
;
1595 STLOGCLEANWRITE
*write
;
1596 STLOGCLEANDONE
*done
;
1599 int writes_since_clean
;
1607 struct _request_flags
{
1608 unsigned int range
:1;
1609 unsigned int nocache
:1;
1611 unsigned int auth
:1;
1612 unsigned int cachable
:1;
1613 unsigned int hierarchical
:1;
1614 unsigned int loopdetect
:1;
1615 unsigned int proxy_keepalive
:1;
1616 unsigned int proxying
:1;
1617 unsigned int refresh
:1;
1618 unsigned int redirected
:1;
1619 unsigned int need_validation
:1;
1621 unsigned int nocache_hack
:1; /* for changing/ignoring no-cache requests */
1623 unsigned int accelerated
:1;
1624 unsigned int internal
:1;
1625 unsigned int internalclient
:1;
1626 unsigned int body_sent
:1;
1627 unsigned int reset_tcp
:1;
1632 struct _link_list
*next
;
1635 struct _storeIOState
{
1638 StoreEntry
*e
; /* Need this so the FS layers can play god */
1640 size_t st_size
; /* do stat(2) after read open */
1641 off_t offset
; /* current on-disk offset pointer */
1642 STFNCB
*file_callback
; /* called on delayed sfileno assignments */
1644 void *callback_data
;
1647 void *callback_data
;
1650 unsigned int closing
:1; /* debugging aid */
1657 protocol_t protocol
;
1658 char login
[MAX_LOGIN_SZ
];
1659 char host
[SQUIDHOSTNAMELEN
+ 1];
1660 auth_user_request_t
*auth_user_request
;
1664 int link_count
; /* free when zero */
1665 request_flags flags
;
1666 HttpHdrCc
*cache_control
;
1667 HttpHdrRange
*range
;
1668 http_version_t http_ver
;
1672 /* these in_addr's could probably be sockaddr_in's */
1673 struct in_addr client_addr
;
1674 struct in_addr my_addr
;
1675 unsigned short my_port
;
1677 ConnStateData
*body_connection
; /* used by clientReadBody() */
1679 HierarchyLogEntry hier
;
1681 char *peer_login
; /* Configured peer login:password */
1682 time_t lastmod
; /* Used on refreshes */
1683 const char *vary_headers
; /* Used when varying entities are detected. Changes how the store key is calculated */
1686 struct _cachemgr_passwd
{
1689 cachemgr_passwd
*next
;
1693 const char *pattern
;
1694 regex_t compiled_pattern
;
1700 unsigned int icase
:1;
1702 unsigned int override_expire
:1;
1703 unsigned int override_lastmod
:1;
1704 unsigned int reload_into_ims
:1;
1705 unsigned int ignore_reload
:1;
1710 struct _CommWriteStateData
{
1719 struct _ErrorState
{
1722 http_status httpStatus
;
1723 auth_user_request_t
*auth_user_request
;
1729 char *dnsserver_msg
;
1731 struct in_addr src_addr
;
1734 void *callback_data
;
1736 unsigned int flag_cbdata
:1;
1739 wordlist
*server_msg
;
1747 * "very generic" histogram;
1748 * see important comments on hbase_f restrictions in StatHist.c
1756 hbase_f
*val_in
; /* e.g., log() for log-based histogram */
1757 hbase_f
*val_out
; /* e.g., exp() for log based histogram */
1761 * if you add a field to StatCounters,
1762 * you MUST sync statCountersInitSpecial, statCountersClean, and statCountersCopy
1764 struct _StatCounters
{
1774 kb_t hit_kbytes_out
;
1775 StatHist miss_svc_time
;
1776 StatHist nm_svc_time
;
1777 StatHist nh_svc_time
;
1778 StatHist hit_svc_time
;
1779 StatHist all_svc_time
;
1787 } all
, http
, ftp
, other
;
1799 int replies_dropped
;
1806 StatHist query_svc_time
;
1807 StatHist reply_svc_time
;
1824 #if USE_CACHE_DIGESTS
1825 cd_guess_stats guess
;
1827 StatHist on_xition_count
;
1837 struct timeval timestamp
;
1838 StatHist comm_icp_incoming
;
1839 StatHist comm_dns_incoming
;
1840 StatHist comm_http_incoming
;
1841 StatHist select_fds_hist
;
1868 int aborted_requests
;
1876 /* per header statistics */
1877 struct _HttpHeaderStat
{
1879 HttpHeaderMask
*owner_mask
;
1881 StatHist hdrUCountDistr
;
1882 StatHist fieldTypeDistr
;
1883 StatHist ccTypeDistr
;
1888 int busyDestroyedCount
;
1900 * Do we need to have the dirn in here? I don't think so, since we already
1903 struct _storeSwapLogData
{
1910 size_t swap_file_sz
;
1913 unsigned char key
[MD5_DIGEST_CHARS
];
1916 struct _ClientInfo
{
1917 hash_link hash
; /* must be first */
1918 struct in_addr addr
;
1920 int result_hist
[LOG_TYPE_MAX
];
1924 kb_t hit_kbytes_out
;
1931 int n_established
; /* number of current established connections */
1934 struct _CacheDigest
{
1935 /* public, read-only */
1936 char *mask
; /* bit mask */
1937 size_t mask_size
; /* mask size in bytes */
1938 int capacity
; /* expected maximum for .count, not a hard limit */
1939 int bits_per_entry
; /* number of bits allocated for each entry from capacity */
1940 int count
; /* number of digested entries */
1941 int del_count
; /* number of deletions performed so far */
1945 peer
*_peer
; /* NULL --> origin server */
1960 http_status last_status
;
1963 unsigned int dont_retry
:1;
1964 unsigned int ftp_pasv_failed
:1;
1969 struct _htcpReplyData
{
1975 /* cache-to-origin */
1985 struct _helper_request
{
1991 struct _helper_stateful_request
{
1994 int placeholder
; /* if 1, this is a dummy request waiting for a stateful helper
1995 * to become available for deferred requests.*/
2004 const char *id_name
;
2008 time_t last_queue_warn
;
2017 struct _helper_stateful
{
2021 const char *id_name
;
2026 HLPSAVAIL
*IsAvailable
;
2027 HLPSONEQ
*OnEmptyQueue
;
2028 time_t last_queue_warn
;
2037 struct _helper_server
{
2045 struct timeval dispatch_time
;
2046 struct timeval answer_time
;
2049 helper_request
*request
;
2050 struct _helper_flags
{
2051 unsigned int alive
:1;
2052 unsigned int busy
:1;
2053 unsigned int closing
:1;
2054 unsigned int shutdown
:1;
2062 struct _helper_stateful_server
{
2070 struct timeval dispatch_time
;
2071 struct timeval answer_time
;
2074 statefulhelper
*parent
;
2075 helper_stateful_request
*request
;
2076 struct _helper_stateful_flags
{
2077 unsigned int alive
:1;
2078 unsigned int busy
:1;
2079 unsigned int closing
:1;
2080 unsigned int shutdown
:1;
2081 stateful_helper_reserve_t reserved
;
2090 int deferred_requests
; /* current number of deferred requests */
2091 void *data
; /* State data used by the calling routines */
2095 * use this when you need to pass callback data to a blocking
2096 * operation, but you don't want to add that pointer to cbdata
2098 struct _generic_cbdata
{
2102 struct _store_rebuild_data
{
2103 int objcount
; /* # objects successfully reloaded */
2104 int expcount
; /* # objects expired */
2105 int scancount
; /* # entries scanned or read from state file */
2106 int clashcount
; /* # swapfile clashes avoided */
2107 int dupcount
; /* # duplicates purged */
2108 int cancelcount
; /* # SWAP_LOG_DEL objects purged */
2109 int invalid
; /* # bad lines */
2110 int badflags
; /* # bad e->flags */
2116 * This defines an fs type
2119 struct _storefs_entry
{
2120 const char *typestr
;
2121 STFSPARSE
*parsefunc
;
2122 STFSRECONFIGURE
*reconfigurefunc
;
2123 STFSSHUTDOWN
*donefunc
;
2127 * This defines an repl type
2130 struct _storerepl_entry
{
2131 const char *typestr
;
2132 REMOVALPOLICYCREATE
*create
;
2136 * Async disk IO - this defines a async disk io queue
2139 struct _diskd_queue
{
2140 int smsgid
; /* send sysvmsg id */
2141 int rmsgid
; /* recv sysvmsg id */
2142 int wfd
; /* queue file descriptor ? */
2143 int away
; /* number of requests away */
2144 int sent_count
; /* number of messages sent */
2145 int recv_count
; /* number of messages received */
2147 char *buf
; /* shm buffer */
2149 int id
; /* sysvshm id */
2155 char path
[MAXPATHLEN
];
2160 unsigned int fatal
:1;
2164 struct cache_dir_option
{
2166 void (*parse
) (SwapDir
* sd
, const char *option
, const char *value
, int reconfiguring
);
2167 void (*dump
) (StoreEntry
* e
, const char *option
, SwapDir
* sd
);
2170 #endif /* SQUID_STRUCTS_H */