]> git.ipfire.org Git - thirdparty/squid.git/blob - src/structs.h
- Separated raw HTTP headers from their "compiled" values. Squid is now
[thirdparty/squid.git] / src / structs.h
1
2
3 struct _acl_ip_data {
4 struct in_addr addr1; /* if addr2 non-zero then its a range */
5 struct in_addr addr2;
6 struct in_addr mask;
7 #ifndef USE_SPLAY_TREE
8 acl_ip_data *next;
9 #endif
10 };
11
12 struct _acl_time_data {
13 int weekbits;
14 int start;
15 int stop;
16 acl_time_data *next;
17 };
18
19 struct _acl_name_list {
20 char name[ACL_NAME_SZ];
21 acl_name_list *next;
22 };
23
24 struct _acl_proxy_auth {
25 char *filename;
26 time_t last_time;
27 time_t change_time;
28 int check_interval;
29 hash_table *hash;
30 };
31
32 struct _acl_deny_info_list {
33 int err_page_id;
34 char *err_page_name;
35 acl_name_list *acl_list;
36 acl_deny_info_list *next;
37 };
38
39 #if USE_ARP_ACL
40 struct _acl_arp_data {
41 unsigned char eth[6];
42 #ifndef USE_SPLAY_TREE
43 acl_arp_data *next;
44 #endif
45 };
46
47 #endif
48
49 struct _String {
50 /* never reference these directly! */
51 unsigned short int size; /* buffer size; 64K limit */
52 unsigned short int len; /* current length */
53 char *buf;
54 };
55
56 #if SQUID_SNMP
57 struct _snmp_request_t {
58 u_char *buf;
59 u_char *outbuf;
60 int len;
61 int sock;
62 long reqid;
63 int outlen;
64 struct sockaddr_in from;
65 struct snmp_pdu *PDU;
66 aclCheck_t *acl_checklist;
67 u_char *community;
68 };
69
70 typedef struct _viewEntry {
71 char viewName[32];
72 int viewIndex;
73 int viewType;
74 int viewSubtreeLen;
75 oid viewSubtree[32];
76 struct _viewEntry *next;
77 } viewEntry;
78
79 typedef struct _communityEntry {
80 char name[64];
81 int readView;
82 int writeView;
83 struct _acl_access *acls;
84 struct _communityEntry *next;
85 } communityEntry;
86
87 typedef struct _usecEntry {
88 u_char userName[32];
89 int userLen;
90 int qoS;
91 u_char authKey[16];
92 u_char privKey[16];
93 int noauthReadView;
94 int noauthWriteView;
95 int authReadView;
96 int authWriteView;
97 struct _usecEntry *next;
98 } usecEntry;
99
100 #endif
101
102 struct _acl {
103 char name[ACL_NAME_SZ];
104 squid_acl type;
105 void *data;
106 char *cfgline;
107 struct _acl *next;
108 };
109
110 struct _acl_list {
111 int op;
112 struct _acl *acl;
113 struct _acl_list *next;
114 };
115
116 struct _acl_access {
117 int allow;
118 struct _acl_list *acl_list;
119 char *cfgline;
120 struct _acl_access *next;
121 };
122
123
124 struct _aclCheck_t {
125 const struct _acl_access *access_list;
126 struct in_addr src_addr;
127 struct in_addr dst_addr;
128 request_t *request;
129 char ident[ICP_IDENT_SZ];
130 char browser[BROWSERNAMELEN];
131 acl_lookup_state state[ACL_ENUM_MAX];
132 PF *callback;
133 void *callback_data;
134 };
135
136 struct _aio_result_t {
137 int aio_return;
138 int aio_errno;
139 };
140
141 struct _wordlist {
142 char *key;
143 struct _wordlist *next;
144 };
145
146 struct _intlist {
147 int i;
148 struct _intlist *next;
149 };
150
151 struct _ushortlist {
152 u_short i;
153 struct _ushortlist *next;
154 };
155
156 struct _relist {
157 char *pattern;
158 regex_t regex;
159 struct _relist *next;
160 };
161
162 struct _SquidConfig {
163 struct {
164 size_t maxSize;
165 int highWaterMark;
166 int lowWaterMark;
167 } Mem , Swap;
168 struct {
169 char *relayHost;
170 u_short relayPort;
171 } Wais;
172 struct {
173 size_t min;
174 int pct;
175 size_t max;
176 } quickAbort;
177 time_t referenceAge;
178 time_t negativeTtl;
179 time_t negativeDnsTtl;
180 time_t positiveDnsTtl;
181 time_t shutdownLifetime;
182 time_t neighborTimeout;
183 struct {
184 time_t read;
185 time_t lifetime;
186 time_t connect;
187 time_t request;
188 time_t pconn;
189 time_t siteSelect;
190 time_t deadPeer;
191 } Timeout;
192 size_t maxRequestSize;
193 struct {
194 ushortlist *http;
195 u_short icp;
196 #if USE_HTCP
197 u_short htcp;
198 #endif
199 #if SQUID_SNMP
200 u_short snmp;
201 #endif
202 } Port;
203 #if SQUID_SNMP
204 struct {
205 char *configFile;
206 char *agentInfo;
207 char *mibPath;
208 char *trap_community;
209 char *trap_sink;
210 u_short localPort;
211 int do_queueing;
212 int conf_authtraps;
213 wordlist *snmpconf;
214 viewEntry *views;
215 usecEntry *users;
216 communityEntry *communities;
217 } Snmp;
218 #endif
219 char *as_whois_server;
220 struct {
221 char *log;
222 char *access;
223 char *store;
224 char *swap;
225 char *useragent;
226 int rotateNumber;
227 } Log;
228 char *adminEmail;
229 char *effectiveUser;
230 char *effectiveGroup;
231 struct {
232 char *dnsserver;
233 char *redirect;
234 char *pinger;
235 char *unlinkd;
236 } Program;
237 int dnsChildren;
238 int redirectChildren;
239 struct {
240 char *host;
241 u_short port;
242 } Accel;
243 char *appendDomain;
244 size_t appendDomainLen;
245 char *debugOptions;
246 char *pidFilename;
247 char *mimeTablePathname;
248 char *visibleHostname;
249 char *errHtmlText;
250 struct {
251 char *host;
252 char *file;
253 time_t period;
254 u_short port;
255 } Announce;
256 struct {
257 struct in_addr tcp_incoming;
258 struct in_addr tcp_outgoing;
259 struct in_addr udp_incoming;
260 struct in_addr udp_outgoing;
261 struct in_addr snmp_incoming;
262 struct in_addr snmp_outgoing;
263 struct in_addr client_netmask;
264 } Addrs;
265 size_t tcpRcvBufsz;
266 size_t udpMaxHitObjsz;
267 wordlist *cache_stoplist;
268 wordlist *hierarchy_stoplist;
269 wordlist *mcast_group_list;
270 wordlist *dns_testname_list;
271 wordlist *dns_nameservers;
272 relist *cache_stop_relist;
273 peer *peers;
274 int npeers;
275 struct {
276 int size;
277 int low;
278 int high;
279 } ipcache;
280 int minDirectHops;
281 cachemgr_passwd *passwd_list;
282 struct {
283 int objectsPerBucket;
284 size_t avgObjectSize;
285 size_t maxObjectSize;
286 } Store;
287 struct {
288 int high;
289 int low;
290 time_t period;
291 } Netdb;
292 struct {
293 int log_udp;
294 int enable_purge;
295 int res_defnames;
296 int anonymizer;
297 int client_db;
298 int query_icmp;
299 int icp_hit_stale;
300 int buffered_logs;
301 #if ALLOW_SOURCE_PING
302 int source_ping;
303 #endif
304 int common_log;
305 int log_mime_hdrs;
306 int ident_lookup;
307 int log_fqdn;
308 int announce;
309 int accel_with_proxy;
310 int mem_pools;
311 int test_reachability;
312 } onoff;
313 struct _acl *aclList;
314 struct {
315 struct _acl_access *http;
316 struct _acl_access *icp;
317 struct _acl_access *miss;
318 struct _acl_access *NeverDirect;
319 struct _acl_access *AlwaysDirect;
320 struct _acl_access *ASlists;
321 } accessList;
322 struct _acl_deny_info_list *denyInfoList;
323 struct {
324 size_t list_width;
325 int list_wrap;
326 char *anon_user;
327 } Ftp;
328 refresh_t *Refresh;
329 struct _cacheSwap {
330 SwapDir *swapDirs;
331 int n_allocated;
332 int n_configured;
333 } cacheSwap;
334 char *fake_ua;
335 struct {
336 char *directory;
337 } icons;
338 char *errorDirectory;
339 struct {
340 time_t timeout;
341 int maxtries;
342 } retry;
343 struct {
344 size_t limit;
345 } MemPools;
346 };
347
348 struct _SquidConfig2 {
349 struct {
350 char *prefix;
351 int on;
352 } Accel;
353 };
354
355 struct _close_handler {
356 PF *handler;
357 void *data;
358 close_handler *next;
359 };
360
361 struct _dread_ctrl {
362 int fd;
363 off_t offset;
364 int req_len;
365 char *buf;
366 int end_of_file;
367 DRCB *handler;
368 void *client_data;
369 };
370
371 struct _dnsserver_t {
372 int id;
373 int flags;
374 int inpipe;
375 int outpipe;
376 time_t answer;
377 off_t offset;
378 size_t size;
379 char ip_inbuf[DNS_INBUF_SZ];
380 struct timeval dispatch_time;
381 void *data;
382 };
383
384 struct _dnsStatData {
385 int requests;
386 int replies;
387 int hist[DefaultDnsChildrenMax];
388 };
389
390 struct _dwrite_q {
391 off_t file_offset;
392 char *buf;
393 int len;
394 off_t buf_offset;
395 struct _dwrite_q *next;
396 FREE *free_func;
397 };
398
399 struct _fde {
400 unsigned int type;
401 unsigned int open;
402 u_short local_port;
403 u_short remote_port;
404 char ipaddr[16]; /* dotted decimal address of peer */
405 char desc[FD_DESC_SZ];
406 int flags;
407 int bytes_read;
408 int bytes_written;
409 int uses; /* ie # req's over persistent conn */
410 struct _fde_disk {
411 DWCB *wrt_handle;
412 void *wrt_handle_data;
413 dwrite_q *write_q;
414 dwrite_q *write_q_tail;
415 off_t offset;
416 } disk;
417 PF *read_handler;
418 void *read_data;
419 PF *write_handler;
420 void *write_data;
421 PF *timeout_handler;
422 time_t timeout;
423 void *timeout_data;
424 void *lifetime_data;
425 close_handler *close_handler; /* linked list */
426 DEFER *defer_check; /* check if we should defer read */
427 void *defer_data;
428 CommWriteStateData *rwstate; /* State data for comm_write */
429 time_t connect_timeout;
430 };
431
432 struct _fileMap {
433 int max_n_files;
434 int n_files_in_map;
435 int toggle;
436 int nwords;
437 unsigned long *file_map;
438 };
439
440 struct _hash_link {
441 char *key;
442 struct _hash_link *next;
443 void *item;
444 };
445
446 struct _hash_table {
447 int valid;
448 hash_link **buckets;
449 HASHCMP *cmp;
450 HASHHASH *hash;
451 unsigned int size;
452 unsigned int current_slot;
453 hash_link *current_ptr;
454 };
455
456 /* http status line */
457 struct _HttpStatusLine {
458 /* public, read only */
459 double version;
460 const char *reason; /* points to a _constant_ string (default or supplied), never free()d */
461 http_status status;
462 };
463
464 /*
465 * Note: HttpBody is used only for messages with a small text content that is
466 * known a priory (e.g., error messages).
467 */
468 struct _HttpBody {
469 /* private, never dereference these */
470 char *buf; /* null terminating _text_ buffer, not for binary stuff */
471 FREE *freefunc; /* used to free() .buf */
472 int size;
473 };
474
475 /* http header extention field */
476 struct _HttpHdrExtField {
477 String name; /* field-name from HTTP/1.1 (no column after name) */
478 String value; /* field-value from HTTP/1.1 */
479 };
480
481 /* http cache control header field */
482 struct _HttpHdrCc {
483 int mask;
484 int max_age;
485 };
486
487 /* http byte-range-spec */
488 struct _HttpHdrRangeSpec {
489 size_t offset;
490 size_t length;
491 };
492
493 /* There may be more than one byte range specified in the request.
494 * This object holds all range specs in order of their appearence
495 * in the request because we SHOULD preserve that order.
496 */
497 struct _HttpHdrRange {
498 Stack specs;
499 };
500
501 /* http content-range header field */
502 struct _HttpHdrContRange {
503 HttpHdrRangeSpec spec;
504 size_t elength; /* entity length, not content length */
505 };
506
507
508 /* per field statistics */
509 struct _HttpHeaderFieldStat {
510 int aliveCount; /* created but not destroyed (count) */
511 int seenCount; /* #fields we've seen */
512 int parsCount; /* #parsing attempts */
513 int errCount; /* #pasring errors */
514 int repCount; /* #repetitons */
515 };
516
517 /* constant attributes of http header fields */
518 struct _HttpHeaderFieldAttrs {
519 const char *name;
520 http_hdr_type id;
521 field_type type;
522 };
523
524 /* compiled version of HttpHeaderFieldAttrs plus stats */
525 struct _HttpHeaderFieldInfo {
526 http_hdr_type id;
527 String name;
528 field_type type;
529 HttpHeaderFieldStat stat;
530 };
531
532 struct _HttpHeaderEntry {
533 http_hdr_type id;
534 String name;
535 String value;
536 };
537
538 struct _HttpHeader {
539 /* protected, do not use these, use interface functions instead */
540 Array entries; /* parsed fields in raw format */
541 HttpHeaderMask mask; /* bit set <=> entry present */
542 };
543
544 struct _HttpReply {
545 /* unsupported, writable, may disappear/change in the future */
546 int hdr_sz; /* sums _stored_ status-line, headers, and <CRLF> */
547
548 /* public, readable; never update these or their .hdr equivalents directly */
549 int content_length;
550 time_t date;
551 time_t last_modified;
552 time_t expires;
553 String content_type;
554 HttpHdrCc *cache_control;
555 HttpHdrContRange *content_range;
556 short int pconn_keep_alive;
557
558 /* public, readable */
559 HttpMsgParseState pstate; /* the current parsing state */
560
561 /* public, writable, but use httpReply* interfaces when possible */
562 HttpStatusLine sline;
563 HttpHeader header;
564 HttpBody body; /* for small constant memory-resident text bodies only */
565 };
566
567
568 struct _HttpStateData {
569 StoreEntry *entry;
570 request_t *request;
571 char *reply_hdr;
572 int reply_hdr_state;
573 peer *peer; /* peer request made to */
574 int eof; /* reached end-of-object? */
575 request_t *orig_request;
576 int fd;
577 int flags;
578 };
579
580 struct _icpUdpData {
581 struct sockaddr_in address;
582 void *msg;
583 size_t len;
584 icpUdpData *next;
585 #ifndef LESS_TIMING
586 struct timeval start;
587 #endif
588 log_type logcode;
589 protocol_t proto;
590 };
591
592 struct _icp_ping_data {
593 struct timeval start;
594 struct timeval stop;
595 int n_sent;
596 int n_recv;
597 int n_replies_expected;
598 int timeout;
599 int w_rtt;
600 int p_rtt;
601 };
602
603 struct _HierarchyLogEntry {
604 hier_code code;
605 char host[SQUIDHOSTNAMELEN];
606 icp_ping_data icp;
607 };
608
609 struct _AccessLogEntry {
610 const char *url;
611 struct {
612 method_t method;
613 int code;
614 const char *content_type;
615 } http;
616 struct {
617 icp_opcode opcode;
618 } icp;
619 struct {
620 struct in_addr caddr;
621 size_t size;
622 log_type code;
623 int msec;
624 const char *ident;
625 } cache;
626 struct _HierarchyLogEntry hier;
627 struct {
628 char *request;
629 char *reply;
630 } headers;
631 struct {
632 const char *method_str;
633 } private;
634 };
635
636 struct _clientHttpRequest {
637 ConnStateData *conn;
638 request_t *request; /* Parsed URL ... */
639 char *uri;
640 char *log_uri;
641 struct {
642 char *buf;
643 off_t offset;
644 size_t size;
645 } out;
646 size_t req_sz;
647 StoreEntry *entry;
648 StoreEntry *old_entry;
649 log_type log_type;
650 http_status http_code;
651 int accel;
652 int internal; /* Set to true on /squid-internal/ request, to prevent looping */
653 struct timeval start;
654 float http_ver;
655 int redirect_state;
656 aclCheck_t *acl_checklist; /* need ptr back so we can unreg if needed */
657 clientHttpRequest *next;
658 struct _AccessLogEntry al;
659 };
660
661 struct _ConnStateData {
662 int fd;
663 struct {
664 char *buf;
665 off_t offset;
666 size_t size;
667 } in;
668 clientHttpRequest *chr;
669 struct sockaddr_in peer;
670 struct sockaddr_in me;
671 struct in_addr log_addr;
672 struct {
673 int fd;
674 char ident[ICP_IDENT_SZ];
675 IDCB *callback;
676 int state;
677 void *callback_data;
678 } ident;
679 CommWriteStateData *commWriteState;
680 int nrequests;
681 int persistent;
682 struct {
683 int n;
684 time_t until;
685 } defer;
686 };
687
688 struct _dlink_node {
689 void *data;
690 dlink_node *prev;
691 dlink_node *next;
692 };
693
694 struct _dlink_list {
695 dlink_node *head;
696 dlink_node *tail;
697 };
698
699 struct _ipcache_addrs {
700 struct in_addr *in_addrs;
701 unsigned char *bad_mask;
702 unsigned char count;
703 unsigned char cur;
704 unsigned char badcount;
705 };
706
707 struct _ip_pending {
708 IPH *handler;
709 void *handlerData;
710 ip_pending *next;
711 };
712
713 struct _ipcache_entry {
714 /* first two items must be equivalent to hash_link in hash.h */
715 char *name;
716 struct _ipcache_entry *next;
717 time_t lastref;
718 time_t expires;
719 ipcache_addrs addrs;
720 ip_pending *pending_head;
721 char *error_message;
722 dlink_node lru;
723 u_char locks;
724 ipcache_status_t status:3;
725 };
726
727 struct _fqdn_pending {
728 FQDNH *handler;
729 void *handlerData;
730 fqdn_pending *next;
731 };
732
733 struct _fqdncache_entry {
734 /* first two items must be equivalent to hash_link in hash.h */
735 char *name;
736 struct _fqdncache_entry *next;
737 time_t lastref;
738 time_t expires;
739 unsigned char name_count;
740 char *names[FQDN_MAX_NAMES + 1];
741 fqdn_pending *pending_head;
742 char *error_message;
743 dlink_node lru;
744 unsigned char locks;
745 fqdncache_status_t status:3;
746 };
747
748 struct _domain_ping {
749 char *domain;
750 int do_ping; /* boolean */
751 struct _domain_ping *next;
752 };
753
754 struct _domain_type {
755 char *domain;
756 peer_t type;
757 struct _domain_type *next;
758 };
759
760 struct _peer {
761 char *host;
762 peer_t type;
763 struct sockaddr_in in_addr;
764 struct {
765 int pings_sent;
766 int pings_acked;
767 int fetches;
768 int rtt;
769 int counts[ICP_END];
770 int ignored_replies;
771 int n_keepalives_sent;
772 int n_keepalives_recv;
773 time_t last_query;
774 time_t last_reply;
775 int logged_state; /* so we can print dead/revived msgs */
776 } stats;
777 u_short icp_port;
778 #if USE_HTCP
779 u_short htcp_port;
780 #endif
781 u_short http_port;
782 int icp_version;
783 struct _domain_ping *pinglist;
784 struct _domain_type *typelist;
785 struct _acl_list *acls;
786 int options;
787 int weight;
788 struct {
789 double avg_n_members;
790 int n_times_counted;
791 int n_replies_expected;
792 int ttl;
793 u_num32 reqnum;
794 int flags;
795 } mcast;
796 int tcp_up; /* 0 if a connect() fails */
797 time_t last_fail_time;
798 struct in_addr addresses[10];
799 int n_addresses;
800 int rr_count;
801 struct _peer *next;
802 int ip_lookup_pending;
803 int ck_conn_event_pend;
804 int test_fd;
805 };
806
807 struct _net_db_name {
808 char *name;
809 net_db_name *htbl_next;
810 net_db_name *next;
811 netdbEntry *net_db_entry;
812 };
813
814 struct _net_db_peer {
815 char *peername;
816 double hops;
817 double rtt;
818 time_t expires;
819 };
820
821 struct _netdbEntry {
822 char *key;
823 netdbEntry *next;
824 char network[16];
825 int pings_sent;
826 int pings_recv;
827 double hops;
828 double rtt;
829 time_t next_ping_time;
830 time_t last_use_time;
831 int link_count;
832 net_db_name *hosts;
833 net_db_peer *peers;
834 int n_peers_alloc;
835 int n_peers;
836 };
837
838 struct _ps_state {
839 request_t *request;
840 StoreEntry *entry;
841 int always_direct;
842 int never_direct;
843 PSC *callback;
844 PSC *fail_callback;
845 void *callback_data;
846 peer *first_parent_miss;
847 peer *closest_parent_miss;
848 peer *single_parent;
849 icp_ping_data icp;
850 aclCheck_t *acl_checklist;
851 };
852
853 struct _pingerEchoData {
854 struct in_addr to;
855 unsigned char opcode;
856 int psize;
857 char payload[8192];
858 };
859
860 struct _pingerReplyData {
861 struct in_addr from;
862 unsigned char opcode;
863 int rtt;
864 int hops;
865 int psize;
866 char payload[8192];
867 };
868
869 struct _icp_common_t {
870 unsigned char opcode; /* opcode */
871 unsigned char version; /* version number */
872 unsigned short length; /* total length (bytes) */
873 u_num32 reqnum; /* req number (req'd for UDP) */
874 u_num32 flags;
875 u_num32 pad;
876 u_num32 shostid; /* sender host id */
877 };
878
879 struct _iostats {
880 struct {
881 int reads;
882 int reads_deferred;
883 int read_hist[16];
884 int writes;
885 int write_hist[16];
886 } Http, Ftp, Gopher, Wais;
887 };
888
889 /* auto-growing memory-resident buffer with printf interface */
890 struct _MemBuf {
891 /* public, read-only */
892 char *buf;
893 mb_size_t size; /* used space, does not count 0-terminator */
894
895 /* private, stay away; use interface function instead */
896 mb_size_t max_capacity; /* when grows: assert(new_capacity <= max_capacity) */
897 mb_size_t capacity; /* allocated space */
898 FREE *freefunc; /* what to use to free the buffer, NULL after memBufFreeFunc() is called */
899 };
900
901 /* see Packer.c for description */
902 struct _Packer {
903 /* protected, use interface functions instead */
904 append_f append;
905 vprintf_f vprintf;
906 void *real_handler; /* first parameter to real append and vprintf */
907 };
908
909
910 struct _mem_node {
911 char *data;
912 int len;
913 mem_node *next;
914 };
915
916 struct _mem_hdr {
917 mem_node *head;
918 mem_node *tail;
919 int origin_offset;
920 };
921
922 /* keep track each client receiving data from that particular StoreEntry */
923 struct _store_client {
924 int type;
925 off_t copy_offset;
926 off_t seen_offset;
927 size_t copy_size;
928 char *copy_buf;
929 STCB *callback;
930 void *callback_data;
931 StoreEntry *entry; /* ptr to the parent StoreEntry, argh! */
932 int swapin_fd;
933 int disk_op_in_progress;
934 struct _store_client *next;
935 };
936
937
938 /* This structure can be freed while object is purged out from memory */
939 struct _MemObject {
940 method_t method;
941 char *url;
942 mem_hdr *data;
943 off_t inmem_hi;
944 off_t inmem_lo;
945 struct _store_client *clients;
946 int nclients;
947 struct {
948 off_t queue_offset; /* relative to in-mem data */
949 off_t done_offset; /* relative to swap file with meta headers! */
950 int fd;
951 void *ctrl;
952 } swapout;
953 HttpReply *reply;
954 request_t *request;
955 struct timeval start_ping;
956 IRCB *icp_reply_callback;
957 void *ircb_data;
958 int fd; /* FD of client creating this entry */
959 struct {
960 STABH *callback;
961 void *data;
962 } abort;
963 char *log_url;
964 dlink_node lru;
965 u_num32 reqnum;
966 ssize_t object_sz;
967 size_t swap_hdr_sz;
968 };
969
970 struct _StoreEntry {
971 /* first two items must be same as hash_link in hash.h */
972 const cache_key *key;
973 struct _StoreEntry *next;
974 MemObject *mem_obj;
975 time_t timestamp;
976 time_t lastref;
977 time_t expires;
978 time_t lastmod;
979 size_t swap_file_sz;
980 u_short refcount;
981 u_short flag;
982
983 int swap_file_number;
984 dlink_node lru;
985 u_char lock_count; /* Assume < 256! */
986 mem_status_t mem_status:3;
987 ping_status_t ping_status:3;
988 store_status_t store_status:3;
989 swap_status_t swap_status:3;
990 };
991
992 struct _SwapDir {
993 char *path;
994 int l1;
995 int l2;
996 int cur_size;
997 int max_size;
998 int read_only;
999 int suggest;
1000 fileMap *map;
1001 int swaplog_fd;
1002 };
1003
1004 struct _request_t {
1005 method_t method;
1006 protocol_t protocol;
1007 char login[MAX_LOGIN_SZ];
1008 char host[SQUIDHOSTNAMELEN + 1];
1009 u_short port;
1010 String urlpath;
1011 int link_count; /* free when zero */
1012 int flags;
1013 HttpHdrCc *cache_control; /* not used yet */
1014 time_t max_age;
1015 float http_ver;
1016 time_t ims;
1017 int imslen;
1018 int max_forwards;
1019 struct in_addr client_addr;
1020 char *headers;
1021 size_t headers_sz;
1022 char *body;
1023 size_t body_sz;
1024 struct _HierarchyLogEntry hier;
1025 err_type err_type;
1026 };
1027
1028 struct _cachemgr_passwd {
1029 char *passwd;
1030 wordlist *actions;
1031 struct _cachemgr_passwd *next;
1032 };
1033
1034 struct _refresh_t {
1035 char *pattern;
1036 regex_t compiled_pattern;
1037 time_t min;
1038 int pct;
1039 time_t max;
1040 struct _refresh_t *next;
1041 };
1042
1043 struct _CommWriteStateData {
1044 char *buf;
1045 size_t size;
1046 off_t offset;
1047 CWCB *handler;
1048 void *handler_data;
1049 FREE *free_func;
1050 };
1051
1052 struct _ErrorState {
1053 err_type type;
1054 int page_id;
1055 http_status http_status;
1056 request_t *request;
1057 char *url;
1058 int xerrno;
1059 char *host;
1060 u_short port;
1061 char *dnsserver_msg;
1062 time_t ttl;
1063 struct in_addr src_addr;
1064 char *redirect_url;
1065 ERCB *callback;
1066 void *callback_data;
1067 int flags;
1068 struct {
1069 char *request;
1070 char *reply;
1071 } ftp;
1072 char *request_hdrs;
1073 };
1074
1075 /*
1076 * "very generic" histogram;
1077 * see important comments on hbase_f restrictions in StatHist.c
1078 */
1079 struct _StatHist {
1080 int *bins;
1081 int capacity;
1082 double min;
1083 double max;
1084 double scale;
1085 hbase_f val_in; /* e.g., log() for log-based histogram */
1086 hbase_f val_out; /* e.g., exp() for log based histogram */
1087 };
1088
1089 /*
1090 * if you add a field to StatCounters,
1091 * you MUST sync statCountersInitSpecial, statCountersClean, and statCountersCopy
1092 */
1093 struct _StatCounters {
1094 struct {
1095 int requests;
1096 int hits;
1097 int errors;
1098 kb_t kbytes_in;
1099 kb_t kbytes_out;
1100 kb_t hit_kbytes_out;
1101 StatHist miss_svc_time;
1102 StatHist nm_svc_time;
1103 StatHist hit_svc_time;
1104 StatHist all_svc_time;
1105 } client_http;
1106 struct {
1107 struct {
1108 int requests;
1109 int errors;
1110 kb_t kbytes_in;
1111 kb_t kbytes_out;
1112 } all , http, ftp, other;
1113 } server;
1114 struct {
1115 int pkts_sent;
1116 int pkts_recv;
1117 int hits_sent;
1118 int hits_recv;
1119 kb_t kbytes_sent;
1120 kb_t kbytes_recv;
1121 StatHist query_svc_time;
1122 StatHist reply_svc_time;
1123 } icp;
1124 struct {
1125 int requests;
1126 } unlink;
1127 struct {
1128 StatHist svc_time;
1129 } dns;
1130 int page_faults;
1131 int select_loops;
1132 double cputime;
1133 struct timeval timestamp;
1134 };
1135
1136 struct _tlv {
1137 char type;
1138 int length;
1139 void *value;
1140 struct _tlv *next;
1141 };
1142
1143 struct _storeSwapLogData {
1144 char op;
1145 int swap_file_number;
1146 time_t timestamp;
1147 time_t lastref;
1148 time_t expires;
1149 time_t lastmod;
1150 size_t swap_file_sz;
1151 u_short refcount;
1152 u_short flags;
1153 unsigned char key[MD5_DIGEST_CHARS];
1154 };
1155
1156 /* object to track per-action memory usage (e.g. #idle objects) */
1157 struct _MemMeter {
1158 size_t level; /* current level (count or volume) */
1159 size_t hwater_level; /* high water mark */
1160 time_t hwater_stamp; /* timestamp of last high water mark change */
1161 };
1162
1163 /* object to track per-pool memory usage (alloc = inuse+idle) */
1164 struct _MemPoolMeter {
1165 MemMeter alloc;
1166 MemMeter inuse;
1167 MemMeter idle;
1168 gb_t saved;
1169 };
1170
1171 /* a pool is a [growing] space for objects of the same size */
1172 struct _MemPool {
1173 const char *label;
1174 size_t obj_size;
1175 Stack pstack; /* stack for free pointers */
1176 MemPoolMeter meter;
1177 };
1178
1179 struct _ClientInfo {
1180 char *key;
1181 struct client_info *next;
1182 struct in_addr addr;
1183 struct {
1184 int result_hist[LOG_TYPE_MAX];
1185 int n_requests;
1186 } Http, Icp;
1187 struct {
1188 time_t time;
1189 int n_req;
1190 int n_denied;
1191 } cutoff;
1192 };