/*
- * $Id: structs.h,v 1.575 2008/02/11 22:28:47 rousskov Exp $
- *
- *
* SQUID Web Proxy Cache http://www.squid-cache.org/
* ----------------------------------------------------------
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
#include "config.h"
#include "RefCount.h"
#include "cbdata.h"
-
-/* needed for various structures still in structs.h */
#include "dlink.h"
+#include "err_type.h"
+
/* needed for the global config */
#include "HttpHeader.h"
-struct acl_name_list
-{
+/* for ICP_END */
+#include "icp_opcode.h"
+
+struct acl_name_list {
char name[ACL_NAME_SZ];
acl_name_list *next;
};
-struct acl_deny_info_list
-{
+struct acl_deny_info_list {
err_type err_page_id;
char *err_page_name;
acl_name_list *acl_list;
class acl_access;
-struct _header_mangler
-{
+struct _header_mangler {
acl_access *access_list;
char *replacement;
};
#if SQUID_SNMP
-struct _snmp_request_t
-{
+struct _snmp_request_t {
u_char *buf;
u_char *outbuf;
int len;
long reqid;
int outlen;
- IPAddress from;
+ IpAddress from;
struct snmp_pdu *PDU;
ACLChecklist *acl_checklist;
class ACLList;
-struct acl_address
-{
+struct acl_address {
acl_address *next;
ACLList *aclList;
- IPAddress addr;
+ IpAddress addr;
};
-struct acl_tos
-{
+struct acl_tos {
acl_tos *next;
ACLList *aclList;
int tos;
};
-struct acl_size_t
-{
+struct acl_size_t {
acl_size_t *next;
ACLList *aclList;
int64_t size;
};
-struct ushortlist
-{
+struct ushortlist {
u_short i;
ushortlist *next;
};
-struct relist
-{
+struct relist {
char *pattern;
regex_t regex;
relist *next;
#include "icmp/IcmpConfig.h"
#endif
+#if USE_ZPH_QOS
+#include "ip/QosConfig.h"
+#endif
+
/* forward decl for SquidConfig, see RemovalPolicy.h */
class RemovalPolicySettings;
class external_acl;
class Store;
-struct SquidConfig
-{
+struct SquidConfig {
- struct
- {
+ struct {
/* These should be for the Store::Root instance.
* this needs pluggable parsing to be done smoothly.
*/
} Swap;
size_t memMaxSize;
- struct
- {
+ struct {
int64_t min;
int pct;
int64_t max;
time_t shutdownLifetime;
time_t backgroundPingRate;
- struct
- {
+ struct {
time_t read;
time_t lifetime;
time_t connect;
int icp_query_max; /* msec */
int icp_query_min; /* msec */
int mcast_icp_query; /* msec */
-#if USE_IDENT
- time_t ident;
-#endif
#if !USE_DNSSERVERS
time_t idns_retransmit;
} Timeout;
size_t maxRequestHeaderSize;
int64_t maxRequestBodySize;
+ int64_t maxChunkedRequestBodySize;
size_t maxReplyHeaderSize;
acl_size_t *ReplyBodySize;
- struct
- {
+ struct {
u_short icp;
#if USE_HTCP
#endif
} Port;
- struct
- {
+ struct {
http_port_list *http;
#if USE_SSL
} Sockaddr;
#if SQUID_SNMP
- struct
- {
+ struct {
char *configFile;
char *agentInfo;
} Snmp;
#endif
#if USE_WCCP
- struct
- {
+ struct {
- IPAddress router;
+ IpAddress router;
- IPAddress address;
+ IpAddress address;
int version;
} Wccp;
#endif
#if USE_WCCPv2
- struct
- {
- IPAddress_list *router;
+ struct {
+ IpAddress_list *router;
- IPAddress address;
+ IpAddress address;
int forwarding_method;
int return_method;
int assignment_method;
char *as_whois_server;
- struct
- {
- char *log;
+ struct {
char *store;
char *swap;
#if USE_USERAGENT_LOG
customlog *accesslogs;
+#if ICAP_CLIENT
+ customlog *icaplogs;
+#endif
+
int rotateNumber;
} Log;
char *adminEmail;
char *visible_appname_string;
char *effectiveGroup;
- struct
- {
+ struct {
#if USE_DNSSERVERS
char *dnsserver;
#endif
time_t authenticateTTL;
time_t authenticateIpTTL;
- struct
- {
+ struct {
#if USE_SQUID_ESI
char *surrogate_id;
#endif
} Accel;
char *appendDomain;
size_t appendDomainLen;
- char *debugOptions;
char *pidFilename;
char *netdbFilename;
char *mimeTablePathname;
wordlist *hostnameAliases;
char *errHtmlText;
- struct
- {
+ struct {
char *host;
char *file;
time_t period;
u_short port;
} Announce;
- struct
- {
+ struct {
- IPAddress udp_incoming;
+ IpAddress udp_incoming;
- IPAddress udp_outgoing;
+ IpAddress udp_outgoing;
#if SQUID_SNMP
- IPAddress snmp_incoming;
+ IpAddress snmp_incoming;
- IPAddress snmp_outgoing;
+ IpAddress snmp_outgoing;
#endif
/* FIXME INET6 : this should really be a CIDR value */
- IPAddress client_netmask;
+ IpAddress client_netmask;
} Addrs;
size_t tcpRcvBufsz;
size_t udpMaxHitObjsz;
peer *peers;
int npeers;
- struct
- {
+ struct {
int size;
int low;
int high;
} ipcache;
- struct
- {
+ struct {
int size;
} fqdncache;
int minDirectHops;
int minDirectRtt;
cachemgr_passwd *passwd_list;
- struct
- {
+ struct {
int objectsPerBucket;
int64_t avgObjectSize;
int64_t maxObjectSize;
size_t maxInMemObjSize;
} Store;
- struct
- {
+ struct {
int high;
int low;
time_t period;
} Netdb;
- struct
- {
+ struct {
int log_udp;
int res_defnames;
int anonymizer;
int httpd_suppress_version_string;
int global_internal_static;
int dns_require_A;
- int debug_override_X;
#if FOLLOW_X_FORWARDED_FOR
int acl_uses_indirect_client;
int log_uses_indirect_client;
#endif /* FOLLOW_X_FORWARDED_FOR */
-#if USE_ZPH_QOS
- int zph_tos_parent;
- int zph_preserve_miss_tos;
-#endif
int WIN32_IpAddrChangeMonitor;
+ int memory_cache_first;
+ int memory_cache_disk;
} onoff;
+ int forward_max_tries;
+
class ACL *aclList;
- struct
- {
+ struct {
acl_access *http;
acl_access *icp;
acl_access *miss;
acl_access *snmp;
#endif
-
+#if HTTP_VIOLATIONS
acl_access *brokenPosts;
-#if USE_IDENT
-
- acl_access *identLookup;
#endif
-
acl_access *redirector;
acl_access *reply;
acl_address *outgoing_address;
acl_access *htcp;
acl_access *htcp_clr;
#endif
-
+
#if USE_SSL
acl_access *ssl_bump;
#endif
acl_access *followXFF;
#endif /* FOLLOW_X_FORWARDED_FOR */
+#if ICAP_CLIENT
+ acl_access* icap;
+#endif
} accessList;
acl_deny_info_list *denyInfoList;
authConfig authConfiguration;
- struct
- {
+ struct {
size_t list_width;
int list_wrap;
char *anon_user;
int passive;
int epsv_all;
+ int epsv;
int sanitycheck;
int telnet;
} Ftp;
refresh_t *Refresh;
- struct _cacheSwap
- {
+ struct _cacheSwap {
RefCount<class Store> *swapDirs;
int n_allocated;
int n_configured;
} cacheSwap;
- struct
- {
+ struct {
char *directory;
int use_short_names;
} icons;
char *errorDefaultLanguage;
int errorLogMissingLanguages;
#endif
+ char *errorStylesheet;
- struct
- {
+ struct {
int maxtries;
int onerror;
} retry;
- struct
- {
+ struct {
size_t limit;
} MemPools;
#if DELAY_POOLS
DelayConfig Delay;
#endif
- struct
- {
+ struct {
int icp_average;
int dns_average;
int http_average;
int64_t rangeOffsetLimit;
#if MULTICAST_MISS_STREAM
- struct
- {
+ struct {
- IPAddress addr;
+ IpAddress addr;
int ttl;
unsigned short port;
char *encode_key;
char *chroot_dir;
#if USE_CACHE_DIGESTS
- struct
- {
+ struct {
int bits_per_entry;
time_t rebuild_period;
time_t rewrite_period;
#endif
#if USE_SSL
- struct
- {
+ struct {
int unclean_shutdown;
char *ssl_engine;
} SSL;
wordlist *ext_methods;
- struct
- {
+ struct {
int high_rptm;
int high_pf;
size_t high_memory;
int sleep_after_fork; /* microseconds */
time_t minimum_expiry_time; /* seconds */
external_acl *externalAclHelperList;
+
#if USE_ZPH_QOS
- int zph_tos_local;
- int zph_tos_peer;
- int zph_preserve_miss_tos_mask;
+ QosConfig zph;
#endif
+
#if USE_SSL
- struct
- {
+ struct {
char *cert;
char *key;
int version;
SQUIDCEXTERN SquidConfig Config;
-struct SquidConfig2
-{
- struct
- {
+struct SquidConfig2 {
+ struct {
int enable_purge;
int mangle_request_headers;
} onoff;
SQUIDCEXTERN SquidConfig2 Config2;
-struct _close_handler
-{
+struct _close_handler {
PF *handler;
void *data;
close_handler *next;
};
-struct _dread_ctrl
-{
+struct _dread_ctrl {
int fd;
off_t offset;
int req_len;
void *client_data;
};
-struct _dwrite_q
-{
+struct _dwrite_q {
off_t file_offset;
char *buf;
size_t len;
* Note: "str" points to memory in HttpHeaderEntry (for now)
* so ETags should be used as tmp variables only (for now) */
-struct _ETag
-{
+struct _ETag {
const char *str; /* quoted-string */
int weak; /* true if it is a weak validator */
};
-struct _fde_disk
-{
+struct _fde_disk {
DWCB *wrt_handle;
void *wrt_handle_data;
dwrite_q *write_q;
off_t offset;
};
-struct _fileMap
-{
+struct _fileMap {
int max_n_files;
int n_files_in_map;
int toggle;
class MemBuf;
-struct _HttpBody
-{
+struct _HttpBody {
/* private */
MemBuf *mb;
};
/* some fields can hold either time or etag specs (e.g. If-Range) */
-struct _TimeOrTag
-{
+struct _TimeOrTag {
ETag tag; /* entity tag */
time_t time;
int valid; /* true if struct is usable */
{
public:
- HttpHeaderFieldStat() : aliveCount(0), seenCount(0), parsCount(0), errCount(0), repCount(0){}
+ HttpHeaderFieldStat() : aliveCount(0), seenCount(0), parsCount(0), errCount(0), repCount(0) {}
int aliveCount; /* created but not destroyed (count) */
int seenCount; /* #fields we've seen */
{
public:
- HttpHeaderFieldInfo() : id (HDR_ACCEPT), type (ftInvalid){}
+ HttpHeaderFieldInfo() : id (HDR_ACCEPT), type (ftInvalid) {}
http_hdr_type id;
String name;
HttpHeaderFieldStat stat;
};
-struct _http_state_flags
-{
+struct _http_state_flags {
unsigned int proxying:1;
unsigned int keepalive:1;
unsigned int only_if_cached:1;
unsigned int chunked:1;
};
-struct _ipcache_addrs
-{
- IPAddress *in_addrs;
+struct _ipcache_addrs {
+ IpAddress *in_addrs;
unsigned char *bad_mask;
unsigned char count;
unsigned char cur;
unsigned char badcount;
};
-struct _domain_ping
-{
+struct _domain_ping {
char *domain;
int do_ping; /* boolean */
domain_ping *next;
};
-struct _domain_type
-{
+struct _domain_type {
char *domain;
peer_t type;
domain_type *next;
/* statistics for cache digests and other hit "predictors" */
-struct _cd_guess_stats
-{
+struct _cd_guess_stats {
/* public, read-only */
int true_hits;
int false_hits;
class PeerDigest;
-struct peer
-{
+struct peer {
u_int index;
char *name;
char *host;
peer_t type;
- IPAddress in_addr;
+ IpAddress in_addr;
- struct
- {
+ struct {
int pings_sent;
int pings_acked;
int fetches;
int conn_open; /* current opened connections */
} stats;
- struct
- {
+ struct {
int version;
int counts[ICP_END+1];
u_short port;
} icp;
-#if USE_HTCP
- struct
- {
+#if USE_HTCP
+ struct {
double version;
int counts[2];
u_short port;
domain_type *typelist;
acl_access *access;
- struct
- {
+ struct {
unsigned int proxy_only:1;
unsigned int no_query:1;
unsigned int background_ping:1;
int weight;
int basetime;
- struct
- {
+ struct {
double avg_n_members;
int n_times_counted;
int n_replies_expected;
int ttl;
int id;
- struct
- {
+ struct {
unsigned int count_event_pending:1;
unsigned int counting:1;
} flags;
int tcp_up; /* 0 if a connect() fails */
- IPAddress addresses[10];
+ IpAddress addresses[10];
int n_addresses;
int rr_count;
peer *next;
int test_fd;
- struct
- {
+ struct {
unsigned int hash;
double load_multiplier;
double load_factor; /* normalized weight value */
} carp;
- struct
- {
+ struct {
unsigned int hash;
double load_multiplier;
double load_factor; /* normalized weight value */
} userhash;
- struct
- {
+ struct {
unsigned int hash;
double load_multiplier;
double load_factor; /* normalized weight value */
char *login; /* Proxy authorization */
time_t connect_timeout;
+ int connect_fail_limit;
int max_conn;
char *domain; /* Forced domain */
#if USE_SSL
int connection_auth;
};
-struct _net_db_name
-{
+struct _net_db_name {
hash_link hash; /* must be first */
net_db_name *next;
netdbEntry *net_db_entry;
};
-struct _net_db_peer
-{
+struct _net_db_peer {
const char *peername;
double hops;
double rtt;
time_t expires;
};
-struct _netdbEntry
-{
+struct _netdbEntry {
hash_link hash; /* must be first */
char network[MAX_IPSTRLEN];
int pings_sent;
};
-struct _iostats
-{
+struct _iostats {
- struct
- {
+ struct {
int reads;
int reads_deferred;
int read_hist[16];
};
-struct request_flags
-{
- 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),intercepted(0),spoof_client_ip(0),internal(0),internalclient(0),must_keepalive(0),destinationIPLookedUp_(0)
- {
+struct request_flags {
+ 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),intercepted(0),spoof_client_ip(0),internal(0),internalclient(0),must_keepalive(0),destinationIPLookedUp_(0) {
#if HTTP_VIOLATIONS
nocache_hack = 0;
#endif
#if FOLLOW_X_FORWARDED_FOR
- done_follow_x_forwarded_for = 0;
+ done_follow_x_forwarded_for = 0;
#endif /* FOLLOW_X_FORWARDED_FOR */
}
unsigned int hierarchical:1;
unsigned int loopdetect:1;
unsigned int proxy_keepalive:1;
- unsigned int proxying:1; /* this should be killed, also in httpstateflags */
+unsigned int proxying:
+ 1; /* this should be killed, also in httpstateflags */
unsigned int refresh:1;
unsigned int redirected:1;
unsigned int need_validation:1;
unsigned int connection_proxy_auth:1; /** Request wants connection oriented auth */
unsigned int pinned:1; /* Request sent on a pinned connection */
unsigned int auth_sent:1; /* Authentication forwarded */
+ unsigned int no_direct:1; /* Deny direct forwarding unless overriden by always_direct. Used in accelerator mode */
// When adding new flags, please update cloneAdaptationImmune() as needed.
unsigned int destinationIPLookedUp_:1;
};
-struct _link_list
-{
+struct _link_list {
void *ptr;
struct _link_list *next;
};
-struct _cachemgr_passwd
-{
+struct _cachemgr_passwd {
char *passwd;
wordlist *actions;
cachemgr_passwd *next;
};
-struct _refresh_t
-{
+struct _refresh_t {
const char *pattern;
regex_t compiled_pattern;
time_t min;
time_t max;
refresh_t *next;
- struct
- {
+ struct {
unsigned int icase:1;
unsigned int refresh_ims:1;
#if HTTP_VIOLATIONS
unsigned int ignore_reload:1;
unsigned int ignore_no_cache:1;
unsigned int ignore_no_store:1;
+ unsigned int ignore_must_revalidate:1;
unsigned int ignore_private:1;
unsigned int ignore_auth:1;
#endif
};
/*
- * "very generic" histogram;
+ * "very generic" histogram;
* see important comments on hbase_f restrictions in StatHist.c
*/
-struct _StatHist
-{
+struct _StatHist {
int *bins;
int capacity;
double min;
};
/*
- * if you add a field to StatCounters,
+ * if you add a field to StatCounters,
* you MUST sync statCountersInitSpecial, statCountersClean, and statCountersCopy
*/
-struct _StatCounters
-{
+struct _StatCounters {
- struct
- {
+ struct {
int clients;
int requests;
int hits;
StatHist all_svc_time;
} client_http;
- struct
- {
+ struct {
- struct
- {
+ struct {
int requests;
int errors;
kb_t kbytes_in;
} all , http, ftp, other;
} server;
- struct
- {
+ struct {
int pkts_sent;
int queries_sent;
int replies_sent;
int times_used;
} icp;
- struct
- {
+ struct {
int pkts_sent;
int pkts_recv;
} htcp;
- struct
- {
+ struct {
int requests;
} unlink;
- struct
- {
+ struct {
StatHist svc_time;
} dns;
- struct
- {
+ struct {
int times_used;
kb_t kbytes_sent;
kb_t kbytes_recv;
StatHist on_xition_count;
} cd;
- struct
- {
+ struct {
int times_used;
} netdb;
int page_faults;
- int select_loops;
+ unsigned long int select_loops;
int select_fds;
double select_time;
double cputime;
StatHist comm_http_incoming;
StatHist select_fds_hist;
- struct
- {
- struct
- {
+ struct {
+ struct {
int opens;
int closes;
int reads;
int unlinks;
} disk;
- struct
- {
+ struct {
int accepts;
int sockets;
int connects;
} syscalls;
int aborted_requests;
- struct
- {
+ struct {
int files_cleaned;
int outs;
int ins;
/* per header statistics */
-struct _HttpHeaderStat
-{
+struct _HttpHeaderStat {
const char *label;
HttpHeaderMask *owner_mask;
};
-struct _ClientInfo
-{
- hash_link hash; /* must be first */
-
- IPAddress addr;
-
- struct
- {
- int result_hist[LOG_TYPE_MAX];
- int n_requests;
- kb_t kbytes_in;
- kb_t kbytes_out;
- kb_t hit_kbytes_out;
- } Http, Icp;
-
- struct
- {
- time_t time;
- int n_req;
- int n_denied;
- } cutoff;
- int n_established; /* number of current established connections */
- time_t last_seen;
-};
-
-struct _CacheDigest
-{
+struct _CacheDigest {
/* public, read-only */
char *mask; /* bit mask */
int mask_size; /* mask size in bytes */
};
-struct _store_rebuild_data
-{
+struct _store_rebuild_data {
int objcount; /* # objects successfully reloaded */
int expcount; /* # objects expired */
int scancount; /* # entries scanned or read from state file */
int zero_object_sz;
};
-struct _Logfile
-{
+struct _Logfile {
int fd;
char path[MAXPATHLEN];
char *buf;
size_t bufsz;
size_t offset;
- struct
- {
+ struct {
unsigned int fatal;
unsigned int syslog;
} flags;
class logformat_token;
-struct _logformat
-{
+struct _logformat {
char *name;
logformat_token *format;
logformat *next;
};
-struct _customlog
-{
+struct _customlog {
char *filename;
ACLList *aclList;
logformat *logFormat;