📄 structs.h
字号:
/* public, read-only */ char *buf; mb_size_t size; /* used space, does not count 0-terminator */ /* private, stay away; use interface function instead */ mb_size_t max_capacity; /* when grows: assert(new_capacity <= max_capacity) */ mb_size_t capacity; /* allocated space */ FREE *freefunc; /* what to use to free the buffer, NULL after memBufFreeFunc() is called */};/* see Packer.c for description */struct _Packer { /* protected, use interface functions instead */ append_f append; vprintf_f vprintf; void *real_handler; /* first parameter to real append and vprintf */};/* http status line */struct _HttpStatusLine { /* public, read only */ float version; const char *reason; /* points to a _constant_ string (default or supplied), never free()d */ http_status status;};/* * Note: HttpBody is used only for messages with a small content that is * known a priory (e.g., error messages). */struct _HttpBody { /* private */ MemBuf mb;};/* http header extention field */struct _HttpHdrExtField { String name; /* field-name from HTTP/1.1 (no column after name) */ String value; /* field-value from HTTP/1.1 */};/* http cache control header field */struct _HttpHdrCc { int mask; int max_age;};/* http byte-range-spec */struct _HttpHdrRangeSpec { size_t offset; size_t length;};/* There may be more than one byte range specified in the request. * This object holds all range specs in order of their appearence * in the request because we SHOULD preserve that order. */struct _HttpHdrRange { Stack specs;};/* http content-range header field */struct _HttpHdrContRange { HttpHdrRangeSpec spec; size_t elength; /* entity length, not content length */};/* some fields can hold either time or etag specs (e.g. If-Range) */struct _TimeOrTag { ETag tag; /* entity tag */ time_t time; int valid; /* true if struct is usable */};/* data for iterating thru range specs */struct _HttpHdrRangeIter { HttpHdrRangePos pos; const HttpHdrRangeSpec *spec; /* current spec at pos */ size_t debt_size; /* bytes left to send from the current spec */ size_t prefix_size; /* the size of the incoming HTTP msg prefix */ String boundary; /* boundary for multipart responses */};/* constant attributes of http header fields */struct _HttpHeaderFieldAttrs { const char *name; http_hdr_type id; field_type type;};/* per field statistics */struct _HttpHeaderFieldStat { int aliveCount; /* created but not destroyed (count) */ int seenCount; /* #fields we've seen */ int parsCount; /* #parsing attempts */ int errCount; /* #pasring errors */ int repCount; /* #repetitons */};/* compiled version of HttpHeaderFieldAttrs plus stats */struct _HttpHeaderFieldInfo { http_hdr_type id; String name; field_type type; HttpHeaderFieldStat stat;};struct _HttpHeaderEntry { http_hdr_type id; String name; String value;};struct _HttpHeader { /* protected, do not use these, use interface functions instead */ Array entries; /* parsed fields in raw format */ HttpHeaderMask mask; /* bit set <=> entry present */ http_hdr_owner_type owner; /* request or reply */ int len; /* length when packed, not counting terminating '\0' */};struct _HttpReply { /* unsupported, writable, may disappear/change in the future */ int hdr_sz; /* sums _stored_ status-line, headers, and <CRLF> */ /* public, readable; never update these or their .hdr equivalents directly */ int content_length; time_t date; time_t last_modified; time_t expires; String content_type; HttpHdrCc *cache_control; HttpHdrContRange *content_range; short int keep_alive; /* public, readable */ HttpMsgParseState pstate; /* the current parsing state */ /* public, writable, but use httpReply* interfaces when possible */ HttpStatusLine sline; HttpHeader header; HttpBody body; /* for small constant memory-resident text bodies only */};struct _http_state_flags { unsigned int proxying:1; unsigned int keepalive:1; unsigned int only_if_cached:1;};struct _HttpStateData { StoreEntry *entry; request_t *request; char *reply_hdr; int reply_hdr_state; peer *peer; /* peer request made to */ int eof; /* reached end-of-object? */ request_t *orig_request; int fd; http_state_flags flags; FwdState *fwd;};struct _icpUdpData { struct sockaddr_in address; void *msg; size_t len; icpUdpData *next;#ifndef LESS_TIMING struct timeval start;#endif log_type logcode; struct timeval queue_time;};struct _ping_data { struct timeval start; struct timeval stop; int n_sent; int n_recv; int n_replies_expected; int timeout; /* msec */ int timedout; int w_rtt; int p_rtt;};struct _HierarchyLogEntry { hier_code code; char host[SQUIDHOSTNAMELEN]; ping_data ping; char cd_host[SQUIDHOSTNAMELEN]; /* the host of selected by cd peer */ peer_select_alg_t alg; /* peer selection algorithm */ lookup_t cd_lookup; /* cd prediction: none, miss, hit */ int n_choices; /* #peers we selected from (cd only) */ int n_ichoices; /* #peers with known rtt we selected from (cd only) */ struct timeval peer_select_start; struct timeval store_complete_stop;};struct _AccessLogEntry { const char *url; struct { method_t method; int code; const char *content_type; float version; } http; struct { icp_opcode opcode; } icp; struct { struct in_addr caddr; size_t size; log_type code; int msec; const char *ident; } cache; struct { char *request; char *reply; } headers; struct { const char *method_str; } private; HierarchyLogEntry hier;};struct _clientHttpRequest { ConnStateData *conn; request_t *request; /* Parsed URL ... */ char *uri; char *log_uri; struct { off_t offset; size_t size; } out; HttpHdrRangeIter range_iter; /* data for iterating thru range specs */ size_t req_sz; /* raw request size on input, not current request size */ StoreEntry *entry; StoreEntry *old_entry; log_type log_type;#if USE_CACHE_DIGESTS const char *lookup_type; /* temporary hack: storeGet() result: HIT/MISS/NONE */#endif http_status http_code; struct timeval start; float http_ver; int redirect_state; aclCheck_t *acl_checklist; /* need ptr back so we can unreg if needed */ clientHttpRequest *next; AccessLogEntry al; struct { unsigned int accel:1; unsigned int internal:1; unsigned int done_copying:1; } flags; struct { http_status status; char *location; } redirect; dlink_node active;};struct _ConnStateData { int fd; struct { char *buf; off_t offset; size_t size; } in; clientHttpRequest *chr; struct sockaddr_in peer; struct sockaddr_in me; struct in_addr log_addr; char ident[USER_IDENT_SZ]; int nrequests; int persistent; struct { int n; time_t until; } defer;};struct _ipcache_addrs { struct in_addr *in_addrs; unsigned char *bad_mask; unsigned char count; unsigned char cur; unsigned char badcount;};struct _ip_pending { IPH *handler; void *handlerData; ip_pending *next;};struct _ipcache_entry { /* first two items must be equivalent to hash_link */ char *name; ipcache_entry *next; time_t lastref; time_t expires; ipcache_addrs addrs; ip_pending *pending_head; char *error_message; struct timeval request_time; dlink_node lru; u_char locks; ipcache_status_t status:3;};struct _fqdn_pending { FQDNH *handler; void *handlerData; fqdn_pending *next;};struct _fqdncache_entry { /* first two items must be equivalent to hash_link */ char *name; fqdncache_entry *next; time_t lastref; time_t expires; unsigned char name_count; char *names[FQDN_MAX_NAMES + 1]; fqdn_pending *pending_head; char *error_message; struct timeval request_time; dlink_node lru; unsigned char locks; fqdncache_status_t status:3;};struct _domain_ping { char *domain; int do_ping; /* boolean */ domain_ping *next;};struct _domain_type { char *domain; peer_t type; domain_type *next;};#if USE_CACHE_DIGESTSstruct _Version { short int current; /* current version */ short int required; /* minimal version that can safely handle current version */};/* digest control block; used for transmission and storage */struct _StoreDigestCBlock { Version ver; int capacity; int count; int del_count; int mask_size; unsigned char bits_per_entry; unsigned char hash_func_count; short int reserved_short; int reserved[32 - 6];};struct _DigestFetchState { PeerDigest *pd; StoreEntry *entry; StoreEntry *old_entry; request_t *request; int offset; int mask_offset; time_t start_time; time_t resp_time; time_t expires; struct { int msg; int bytes; } sent, recv;};/* statistics for cache digests and other hit "predictors" */struct _cd_guess_stats { /* public, read-only */ int true_hits; int false_hits; int true_misses; int false_misses; int close_hits; /* tmp, remove it later */};struct _PeerDigest { peer *peer; /* pointer back to peer structure, argh */ CacheDigest *cd; /* actual digest structure */ String host; /* copy of peer->host */ const char *req_result; /* text status of the last request */ struct { unsigned int needed:1; /* there were requests for this digest */ unsigned int usable:1; /* can be used for lookups */ unsigned int requested:1; /* in process of receiving [fresh] digest */ } flags; struct { /* all times are absolute unless augmented with _delay */ time_t initialized; /* creation */ time_t needed; /* first lookup/use by a peer */ time_t next_check; /* next scheduled check/refresh event */ time_t retry_delay; /* delay before re-checking _invalid_ digest */ time_t requested; /* requested a fresh copy of a digest */ time_t req_delay; /* last request response time */ time_t received; /* received the current copy of a digest */ time_t disabled; /* disabled for good */ } times; struct { cd_guess_stats guess; int used_count; struct { int msgs; kb_t kbytes; } sent, recv; } stats;};#endifstruct _peer { char *host; peer_t type; struct sockaddr_in in_addr; struct { int pings_sent; int pings_acked; int fetches; int rtt; int ignored_replies; int n_keepalives_sent; int n_keepalives_recv; time_t last_query; time_t last_reply; int logged_state; /* so we can print dead/revived msgs */ } stats; struct { int version; int counts[ICP_END]; u_short port; } icp;#if USE_HTCP struct { double version; int counts[2]; u_short port; } htcp;#endif u_short http_port; domain_ping *peer_domain; domain_type *typelist; acl_access *access; struct { unsigned int proxy_only:1; unsigned int no_query:1; unsigned int no_digest:1; unsigned int default_parent:1; unsigned int roundrobin:1; unsigned int mcast_responder:1; unsigned int closest_only:1;#if USE_HTCP unsigned int htcp:1;#endif unsigned int no_netdb_exchange:1;#if DELAY_POOLS unsigned int no_delay:1;#endif } options; int weight; struct { double avg_n_members; int n_times_counted; int n_replies_expected; int ttl; int id; struct { unsigned int count_event_pending:1; unsigned int counting:1; } flags; } mcast;#if USE_CACHE_DIGESTS PeerDigest *digest;#endif int tcp_up; /* 0 if a connect() fails */ time_t last_fail_time; struct in_addr addresses[10]; int n_addresses; int rr_count; peer *next; int test_fd;#if USE_CARP struct { unsigned long hash; unsigned long load_multiplier; float load_factor; } carp;#endif char *login; /* Proxy authorization */};struct _net_db_name { char *name; net_db_name *htbl_next; net_db_name *next; netdbEntry *net_db_entry;};struct _net_db_peer { char *peername; double hops; double rtt; time_t expires;};struct _netdbEntry { /* first two items must be equivalent to hash_link */ char *key; netdbEntry *next; char network[16]; int pings_sent; int pings_recv; double hops; double rtt; time_t next_ping_time; time_t last_use_time; int link_count; net_db_name *hosts; net_db_peer *peers; int n_peers_alloc; int n_peers;};struct _ps_state { request_t *request; StoreEntry *entry; int always_direct; int never_direct; int direct; PSC *callback; void *callback_data; FwdServer *servers; /* * Why are these struct sockaddr_in instead of peer *? Because a * peer structure can become invalid during the peer selection * phase, specifically after a reconfigure. Thus we need to lookup * the peer * based on the address when we are finally ready to * reference the peer structure. */ struct sockaddr_in first_parent_miss; struct sockaddr_in closest_parent_miss; /* * ->hit and ->secho can be peer* because they should only be * accessed during the thread when they are set */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -