]> git.ipfire.org Git - thirdparty/squid.git/blame - src/structs.h
From: Arjan de Vet <Arjan.deVet@nl.cis.philips.com>
[thirdparty/squid.git] / src / structs.h
CommitLineData
a8258824 1
2struct _acl_ip_data {
3 struct in_addr addr1; /* if addr2 non-zero then its a range */
4 struct in_addr addr2;
5 struct in_addr mask;
6#ifndef USE_SPLAY_TREE
7 struct _acl_ip_data *next;
8#endif
9};
10
11struct _acl_time_data {
12 int weekbits;
13 int start;
14 int stop;
15 struct _acl_time_data *next;
16};
17
18struct _acl_name_list {
19 char name[ACL_NAME_SZ];
20 struct _acl_name_list *next;
21};
22
afe95a7e 23struct _acl_proxy_auth {
24 char *filename;
25 time_t last_time;
26 time_t change_time;
27 int check_interval;
28 hash_table *hash;
29};
30
a8258824 31struct _acl_deny_info_list {
32 char url[MAX_URL];
33 struct _acl_name_list *acl_list;
34 struct _acl_deny_info_list *next;
35};
36
37struct _acl {
38 char name[ACL_NAME_SZ];
39 squid_acl type;
40 void *data;
41 char *cfgline;
42 struct _acl *next;
43};
44
45struct _acl_list {
46 int op;
47 struct _acl *acl;
48 struct _acl_list *next;
49};
50
51struct _acl_access {
52 int allow;
53 struct _acl_list *acl_list;
54 char *cfgline;
55 struct _acl_access *next;
56};
57
58struct _aclCheck_t {
59 const struct _acl_access *access_list;
60 struct in_addr src_addr;
61 struct in_addr dst_addr;
62 request_t *request;
63 char ident[ICP_IDENT_SZ];
64 char browser[BROWSERNAMELEN];
65 acl_lookup_state state[ACL_ENUM_MAX];
66 PF *callback;
67 void *callback_data;
68};
69
70struct _aio_result_t {
71 int aio_return;
72 int aio_errno;
73};
74
75struct _wordlist {
76 char *key;
77 struct _wordlist *next;
78};
79
80struct _intlist {
81 int i;
82 struct _intlist *next;
83};
84
85struct _ushortlist {
86 u_short i;
87 struct _ushortlist *next;
88};
89
90struct _relist {
91 char *pattern;
92 regex_t regex;
93 struct _relist *next;
94};
95
a8258824 96struct _SquidConfig {
97 struct {
9906e724 98 size_t maxSize;
a8258824 99 int highWaterMark;
100 int lowWaterMark;
101 } Mem , Swap;
102 struct {
103 char *relayHost;
104 u_short relayPort;
105 } Wais;
106 struct {
9906e724 107 size_t min;
a8258824 108 int pct;
9906e724 109 size_t max;
a8258824 110 } quickAbort;
111 time_t referenceAge;
112 time_t negativeTtl;
113 time_t negativeDnsTtl;
114 time_t positiveDnsTtl;
115 time_t shutdownLifetime;
116 time_t neighborTimeout;
a8258824 117 struct {
118 time_t read;
a8258824 119 time_t lifetime;
120 time_t connect;
121 time_t request;
603a02fd 122 time_t pconn;
a8258824 123 } Timeout;
9906e724 124 size_t maxRequestSize;
a8258824 125 struct {
126 ushortlist *http;
127 u_short icp;
678c6099 128#ifdef SQUID_SNMP
129 u_short snmp;
130#endif
a8258824 131 } Port;
132 struct {
133 char *log;
134 char *access;
135 char *store;
136 char *swap;
137 char *useragent;
138 int rotateNumber;
a8258824 139 } Log;
a8258824 140 char *adminEmail;
141 char *effectiveUser;
142 char *effectiveGroup;
143 struct {
144 char *dnsserver;
145 char *redirect;
146 char *pinger;
147 char *unlinkd;
148 } Program;
149 int dnsChildren;
150 int redirectChildren;
a8258824 151 struct {
152 char *host;
153 u_short port;
a8258824 154 } Accel;
155 char *appendDomain;
156 size_t appendDomainLen;
157 char *debugOptions;
158 char *pidFilename;
159 char *mimeTablePathname;
160 char *visibleHostname;
161 char *errHtmlText;
162 struct {
163 char *host;
164 char *file;
165 time_t period;
a8258824 166 u_short port;
167 } Announce;
168 struct {
169 struct in_addr tcp_incoming;
170 struct in_addr tcp_outgoing;
171 struct in_addr udp_incoming;
678c6099 172#ifdef SQUID_SNMP
173 struct in_addr snmp_incoming;
6a54c60e 174#endif /* SQUID_SNMP */
a8258824 175 struct in_addr udp_outgoing;
176 struct in_addr client_netmask;
177 } Addrs;
9906e724 178 size_t tcpRcvBufsz;
179 size_t udpMaxHitObjsz;
a8258824 180 wordlist *cache_stoplist;
181 wordlist *hierarchy_stoplist;
182 wordlist *mcast_group_list;
183 wordlist *dns_testname_list;
184 relist *cache_stop_relist;
40a1495e 185 peer *peers;
186 int npeers;
a8258824 187 struct {
89de058c 188 int size;
a8258824 189 int low;
190 int high;
191 } ipcache;
192 int minDirectHops;
193 cachemgr_passwd *passwd_list;
194 struct {
195 int objectsPerBucket;
9906e724 196 size_t avgObjectSize;
197 size_t maxObjectSize;
a8258824 198 } Store;
199 struct {
200 int high;
201 int low;
202 time_t period;
203 } Netdb;
204 struct {
205 int log_udp;
206 int enable_purge;
207 int res_defnames;
208 int anonymizer;
209 int client_db;
210 int query_icmp;
88738790 211 int icp_hit_stale;
78f1250a 212 int buffered_logs;
9b312a19 213 int source_ping;
214 int common_log;
215 int log_mime_hdrs;
216 int ident_lookup;
217 int single_parent_bypass;
17a0a4ee 218 int log_fqdn;
219 int announce;
220 int accel_with_proxy;
221 } onoff;
a8258824 222 struct _acl *aclList;
223 struct {
224 struct _acl_access *http;
225 struct _acl_access *icp;
226 struct _acl_access *miss;
227 struct _acl_access *NeverDirect;
228 struct _acl_access *AlwaysDirect;
229 } accessList;
230 struct _acl_deny_info_list *denyInfoList;
231 struct {
232 size_t list_width;
233 int list_wrap;
234 char *icon_prefix;
235 char *icon_suffix;
236 char *anon_user;
237 } Ftp;
238 refresh_t *Refresh;
239 struct _cacheSwap {
a47b9029 240 SwapDir *swapDirs;
241 int n_allocated;
242 int n_configured;
a8258824 243 } cacheSwap;
88738790 244 char *fake_ua;
365cb147 245 struct {
246 char *directory;
247 char *content_type;
248 } icons;
9b312a19 249 char *errorDirectory;
a8258824 250};
251
252struct _SquidConfig2 {
253 struct {
254 char *prefix;
255 int on;
256 } Accel;
257};
258
259struct _close_handler {
260 PF *handler;
261 void *data;
262 close_handler *next;
263};
264
265struct _dread_ctrl {
266 int fd;
267 off_t offset;
268 int req_len;
269 char *buf;
270 int end_of_file;
271 DRCB *handler;
272 void *client_data;
273};
274
275struct _dnsserver_t {
276 int id;
277 int flags;
278 int inpipe;
279 int outpipe;
280 time_t answer;
78f1250a 281 off_t offset;
282 size_t size;
a8258824 283 char *ip_inbuf;
284 struct timeval dispatch_time;
285 void *data;
286};
287
288struct _dnsStatData {
289 int requests;
290 int replies;
291 int hist[DefaultDnsChildrenMax];
292};
293
294struct _dwrite_q {
295 char *buf;
296 int len;
78f1250a 297 off_t cur_offset;
a8258824 298 struct _dwrite_q *next;
c6ac1aae 299 FREE *free;
a8258824 300};
301
a8258824 302struct _fde {
303 unsigned int type;
304 unsigned int open;
305 u_short local_port;
306 u_short remote_port;
307 char ipaddr[16]; /* dotted decimal address of peer */
308 char desc[FD_DESC_SZ];
309 int flags;
310 int bytes_read;
311 int bytes_written;
b716a8ad 312 int uses; /* ie # req's over persistent conn */
a8258824 313 struct _fde_disk {
314 DWCB *wrt_handle;
315 void *wrt_handle_data;
316 dwrite_q *write_q;
317 dwrite_q *write_q_tail;
711982d8 318 off_t offset;
a8258824 319 } disk;
320 PF *read_handler;
321 void *read_data;
322 PF *write_handler;
323 void *write_data;
324 PF *timeout_handler;
325 time_t timeout;
326 void *timeout_data;
327 void *lifetime_data;
328 close_handler *close_handler; /* linked list */
da2b3a17 329 DEFER *defer_check; /* check if we should defer read */
70a9dab4 330 void *defer_data;
a8258824 331 CommWriteStateData *rwstate; /* State data for comm_write */
332};
333
334struct _fileMap {
335 int max_n_files;
336 int n_files_in_map;
337 int last_file_number_allocated;
338 int toggle;
339 int nwords;
340 unsigned long *file_map;
341};
342
343struct _fqdncache_entry {
344 /* first two items must be equivalent to hash_link in hash.h */
345 char *name;
346 struct _fqdncache_entry *next;
347 time_t lastref;
348 time_t expires;
349 unsigned char name_count;
350 char *names[FQDN_MAX_NAMES + 1];
351 struct _fqdn_pending *pending_head;
352 char *error_message;
353 unsigned char locks;
354 fqdncache_status_t status:3;
355};
356
357struct _hash_link {
358 char *key;
359 struct _hash_link *next;
360 void *item;
361};
362
363struct _hash_table {
364 int valid;
365 hash_link **buckets;
366 HASHCMP *cmp;
367 HASHHASH *hash;
368 unsigned int size;
369 unsigned int current_slot;
370 hash_link *current_ptr;
371};
372
373struct _http_reply {
374 double version;
375 int code;
376 int content_length;
377 int hdr_sz;
378 int cache_control;
379 int misc_headers;
380 time_t date;
381 time_t expires;
382 time_t last_modified;
383 char content_type[HTTP_REPLY_FIELD_SZ];
384 char user_agent[HTTP_REPLY_FIELD_SZ << 2];
385};
386
387struct _HttpStateData {
388 StoreEntry *entry;
389 request_t *request;
390 char *reply_hdr;
391 int reply_hdr_state;
392 peer *neighbor; /* neighbor request made to */
393 int eof; /* reached end-of-object? */
394 request_t *orig_request;
395 int fd; /* needed as identifier for ipcache */
603a02fd 396 int flags;
a8258824 397};
398
399struct _icpUdpData {
400 struct sockaddr_in address;
401 void *msg;
402 size_t len;
403 icpUdpData *next;
404#ifndef LESS_TIMING
405 struct timeval start;
406#endif
407 log_type logcode;
408 protocol_t proto;
409};
410
411struct _icp_ping_data {
412 struct timeval start;
413 struct timeval stop;
414 int n_sent;
415 int n_recv;
416 int n_replies_expected;
417 int timeout;
418 int w_rtt;
b3264694 419 int p_rtt;
a8258824 420};
421
422struct _HierarchyLogEntry {
423 hier_code code;
424 char host[SQUIDHOSTNAMELEN];
425 struct _icp_ping_data icp;
426};
427
428struct _AccessLogEntry {
429 const char *url;
430 struct {
431 method_t method;
432 int code;
433 const char *content_type;
434 } http;
435 struct {
436 icp_opcode opcode;
437 } icp;
438 struct {
439 struct in_addr caddr;
440 size_t size;
441 log_type code;
442 int msec;
443 const char *ident;
444 } cache;
445 struct _HierarchyLogEntry hier;
446 struct {
447 char *request;
448 char *reply;
449 } headers;
450 struct {
451 const char *method_str;
452 } private;
453};
454
455struct _clientHttpRequest {
456 ConnStateData *conn;
457 request_t *request; /* Parsed URL ... */
458 char *url;
88738790 459 char *log_url;
a8258824 460 struct {
461 char *buf;
78f1250a 462 off_t offset;
463 size_t size;
a8258824 464 } out;
465 size_t req_sz;
466 StoreEntry *entry;
467 StoreEntry *old_entry;
468 log_type log_type;
9b312a19 469 http_status http_code;
a8258824 470 int accel;
471 struct timeval start;
472 float http_ver;
473 int redirect_state;
474 aclCheck_t *acl_checklist; /* need ptr back so we can unreg if needed */
475 clientHttpRequest *next;
476 struct _AccessLogEntry al;
477};
478
479struct _ConnStateData {
480 int fd;
481 struct {
482 char *buf;
78f1250a 483 off_t offset;
484 size_t size;
a8258824 485 } in;
486 clientHttpRequest *chr;
487 struct sockaddr_in peer;
488 struct sockaddr_in me;
489 struct in_addr log_addr;
490 struct {
491 int fd;
492 char ident[ICP_IDENT_SZ];
493 IDCB *callback;
494 int state;
495 } ident;
496 CommWriteStateData *commWriteState;
497 int nrequests;
498 int persistent;
da2b3a17 499 struct {
500 int n;
501 time_t until;
502 } defer;
a8258824 503};
504
505struct _ipcache_addrs {
506 unsigned char count;
507 unsigned char cur;
508 struct in_addr *in_addrs;
509};
510
511struct _ipcache_entry {
512 /* first two items must be equivalent to hash_link in hash.h */
513 char *name;
514 struct _ipcache_entry *next;
515 time_t lastref;
516 time_t expires;
517 ipcache_addrs addrs;
518 struct _ip_pending *pending_head;
519 char *error_message;
520 unsigned char locks;
521 ipcache_status_t status:3;
522};
523
524struct _ext_table_entry {
525 char *name;
526 char *mime_type;
527 char *mime_encoding;
528 char *icon;
529};
530
531struct _domain_ping {
532 char *domain;
533 int do_ping; /* boolean */
534 struct _domain_ping *next;
535};
536
537struct _domain_type {
538 char *domain;
539 peer_t type;
540 struct _domain_type *next;
541};
542
543struct _peer {
544 char *host;
545 peer_t type;
546 struct sockaddr_in in_addr;
547 struct {
548 int pings_sent;
549 int pings_acked;
550 int ack_deficit;
551 int fetches;
552 int rtt;
553 int counts[ICP_OP_END];
554 int ignored_replies;
555 } stats;
556 u_short icp_port;
557 u_short http_port;
558 int icp_version;
559 struct _domain_ping *pinglist;
560 struct _domain_type *typelist;
561 struct _acl_list *acls;
562 int options;
563 int weight;
564 struct {
565 double avg_n_members;
566 int n_times_counted;
567 int n_replies_expected;
568 int ttl;
569 int reqnum;
570 int flags;
571 } mcast;
572 int tcp_up; /* 0 if a connect() fails */
573 time_t last_fail_time;
574 struct in_addr addresses[10];
575 int n_addresses;
576 int rr_count;
577 struct _peer *next;
578 int ip_lookup_pending;
88738790 579 int ck_conn_event_pend;
a8258824 580 int test_fd;
581};
582
583struct _net_db_name {
584 char *name;
585 struct _net_db_name *next;
586};
587
588struct _net_db_peer {
589 char *peername;
590 double hops;
591 double rtt;
592 time_t expires;
593};
594
595struct _netdbEntry {
596 char *key;
597 struct _net_db *next;
598 char network[16];
599 int pings_sent;
600 int pings_recv;
601 double hops;
602 double rtt;
603 time_t next_ping_time;
604 time_t last_use_time;
605 int link_count;
606 net_db_name *hosts;
607 net_db_peer *peers;
608 int n_peers_alloc;
609 int n_peers;
610};
611
612struct _ps_state {
613 request_t *request;
614 StoreEntry *entry;
615 int always_direct;
616 int never_direct;
617 PSC *callback;
618 PSC *fail_callback;
619 void *callback_data;
620 peer *first_parent_miss;
621 peer *closest_parent_miss;
622 icp_ping_data icp;
623 aclCheck_t *acl_checklist;
624};
625
626struct _pingerEchoData {
627 struct in_addr to;
628 unsigned char opcode;
629 int psize;
630 char payload[8192];
631};
632
633struct _pingerReplyData {
634 struct in_addr from;
635 unsigned char opcode;
636 int rtt;
637 int hops;
638 int psize;
639 char payload[8192];
640};
641
642struct _icp_common_t {
643 unsigned char opcode; /* opcode */
644 unsigned char version; /* version number */
645 unsigned short length; /* total length (bytes) */
646 u_num32 reqnum; /* req number (req'd for UDP) */
647 u_num32 flags;
648 u_num32 pad;
649 /* u_num32 auth[ICP_AUTH_SIZE]; authenticator (old) */
650 u_num32 shostid; /* sender host id */
651};
652
653struct _Stack {
654 void **base;
655 void **top;
656 int stack_size;
657};
658
659struct _proto_stat {
660 char protoname[25];
661 int object_count;
662 struct _usage {
663 int max;
664 int avg;
665 int min;
666 int now;
667 } kb;
668 unsigned int hit;
669 unsigned int miss;
670 float hitratio;
671 unsigned int transferrate;
672 unsigned int refcount;
673 unsigned int transferbyte;
674};
675
676struct _Meta_data {
677 int hot_vm;
678 int store_entries;
679 int mem_obj_count;
680 int mem_data_count;
681 int ipcache_count;
682 int fqdncache_count;
683 int netdb_addrs;
684 int netdb_hosts;
685 int netdb_peers;
686 int url_strings;
687 int misc;
688 int client_info;
689};
690
691struct _cacheinfo {
692 protocol_t(*proto_id) (const char *url);
693 void (*proto_newobject) (struct _cacheinfo * c, protocol_t proto_id, int len, int flag);
694 void (*proto_purgeobject) (struct _cacheinfo * c, protocol_t proto_id, int len);
695 void (*proto_touchobject) (struct _cacheinfo * c, protocol_t proto_id, int len);
696 void (*proto_count) (struct _cacheinfo * obj, protocol_t proto_id,
697 log_type);
698 proto_stat proto_stat_data[PROTO_MAX + 1];
699};
700
701struct _iostats {
702 struct {
703 int reads;
704 int reads_deferred;
705 int read_hist[16];
706 int writes;
707 int write_hist[16];
708 } Http, Ftp, Gopher, Wais;
709};
710
711struct _mem_node {
712 char *data;
713 int len;
714 mem_node *next;
715};
716
717struct _mem_hdr {
718 mem_node *head;
719 mem_node *tail;
720 int origin_offset;
721};
722
723/* Memory allocator routines for fixed size blocks */
724struct _stmem_stats {
725 int max_pages;
726 int total_pages_allocated;
78f1250a 727 size_t page_size;
a8258824 728 int n_pages_in_use;
729 Stack free_page_stack;
730};
731
732/* keep track each client receiving data from that particular StoreEntry */
733struct _store_client {
43329771 734 int type;
a8258824 735 off_t copy_offset;
736 off_t seen_offset;
737 size_t copy_size;
738 char *copy_buf;
739 STCB *callback;
740 void *callback_data;
6a54c60e 741 MemObject *mem; /* ptr to the parent structure, argh! */
8350fe9b 742 short swapin_fd;
43329771 743 struct _store_client *next;
a8258824 744};
745
746
747/* This structure can be freed while object is purged out from memory */
748struct _MemObject {
749 mem_hdr *data;
8350fe9b 750 off_t inmem_hi;
751 off_t inmem_lo;
a8258824 752 struct _store_client *clients;
753 int nclients;
8350fe9b 754 struct {
1c2cc744 755 off_t queue_offset;
756 off_t done_offset;
8350fe9b 757 int fd;
758 } swapout;
a8258824 759 struct _http_reply *reply;
760 request_t *request;
761 struct timeval start_ping;
762 IRCB *icp_reply_callback;
763 void *ircb_data;
764 int fd; /* FD of client creating this entry */
765 struct {
766 STABH *callback;
767 void *data;
768 } abort;
88738790 769 char *log_url;
a8258824 770};
771
772/* A cut down structure for store manager */
773struct _StoreEntry {
774 /* first two items must be same as hash_link in hash.h */
775 char *key;
776 struct sentry *next;
777 char *url;
778 MemObject *mem_obj;
779 u_num32 flag;
780 u_num32 refcount;
781 time_t timestamp;
782 time_t lastref;
783 time_t expires;
784 time_t lastmod;
785 int object_len;
786 int swap_file_number;
787 mem_status_t mem_status:3;
788 ping_status_t ping_status:3;
789 store_status_t store_status:3;
790 swap_status_t swap_status:3;
791 method_t method:4;
792 unsigned char lock_count; /* Assume < 256! */
793};
794
795struct _SwapDir {
796 char *path;
797 int l1;
798 int l2;
799 int cur_size;
800 int max_size;
801 int read_only;
802 int suggest;
803 fileMap *map;
804 int swaplog_fd;
805};
806
807struct _request_t {
808 method_t method;
809 protocol_t protocol;
810 char login[MAX_LOGIN_SZ];
811 char host[SQUIDHOSTNAMELEN + 1];
812 u_short port;
813 char urlpath[MAX_URL];
814 int link_count; /* free when zero */
815 int flags;
816 time_t max_age;
817 float http_ver;
818 time_t ims;
819 int imslen;
820 int max_forwards;
821 struct in_addr client_addr;
822 char *headers;
823 size_t headers_sz;
824 char *body;
825 size_t body_sz;
826 struct _HierarchyLogEntry hier;
827};
828
829struct _cachemgr_passwd {
830 char *passwd;
831 long actions;
832 struct _cachemgr_passwd *next;
833};
834
835struct _refresh_t {
836 char *pattern;
837 regex_t compiled_pattern;
838 time_t min;
839 int pct;
840 time_t max;
841 struct _refresh_t *next;
842};
843
844struct _CommWriteStateData {
845 char *buf;
846 size_t size;
847 off_t offset;
848 CWCB *handler;
849 void *handler_data;
850 FREE *free;
851};
9b312a19 852
853struct _ErrorState {
854 err_type type;
855 http_status http_status;
856 request_t *request;
857 char *url;
858 int errno;
859 char *host;
860 u_short port;
861 char *dnsserver_msg;
862 time_t ttl;
863 struct in_addr src_addr;
864 char *redirect_url;
865 ERCB *callback;
866 void *callback_data;
867};