From: Francesco Chemolli Date: Tue, 4 Sep 2012 15:15:51 +0000 (+0200) Subject: Moved CachePeer to own header file. X-Git-Tag: sourceformat-review-1~6^2~26 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a011edeebcc4ae326443e0565fc464b0781e56fd;p=thirdparty%2Fsquid.git Moved CachePeer to own header file. --- diff --git a/src/CachePeer.h b/src/CachePeer.h new file mode 100644 index 0000000000..e4ff4d2435 --- /dev/null +++ b/src/CachePeer.h @@ -0,0 +1,206 @@ +#ifndef SQUID_CACHEPEER_H_ +#define SQUID_CACHEPEER_H_ +/* + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * This program is free software; you can redistribute it and/or modify + * 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 "enums.h" +#include "icp_opcode.h" +#include "ip/Address.h" + +#if USE_SSL +#include +#endif + +class domain_ping; +class domain_type; +class acl_access; +class PeerDigest; + +class CachePeer { +public: + u_int index; + char *name; + char *host; + peer_t type; + + Ip::Address 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 probe_start; + time_t last_query; + time_t last_reply; + time_t last_connect_failure; + time_t last_connect_probe; + int logged_state; /* so we can print dead/revived msgs */ + int conn_open; /* current opened connections */ + } stats; + + struct { + int version; + int counts[ICP_END+1]; + unsigned short port; + } icp; + +#if USE_HTCP + struct { + double version; + int counts[2]; + unsigned short port; + } htcp; +#endif + + unsigned 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 background_ping:1; + unsigned int no_digest:1; + unsigned int default_parent:1; + unsigned int roundrobin:1; + unsigned int weighted_roundrobin:1; + unsigned int mcast_responder:1; + unsigned int closest_only:1; +#if USE_HTCP + unsigned int htcp:1; + unsigned int htcp_oldsquid:1; + unsigned int htcp_no_clr:1; + unsigned int htcp_no_purge_clr:1; + unsigned int htcp_only_clr:1; + unsigned int htcp_forward_clr:1; +#endif + unsigned int no_netdb_exchange:1; +#if USE_DELAY_POOLS + unsigned int no_delay:1; +#endif + unsigned int allow_miss:1; + unsigned int carp:1; + struct { + unsigned int set:1; //If false, whole url is to be used. Overrides others + unsigned int scheme:1; + unsigned int host:1; + unsigned int port:1; + unsigned int path:1; + unsigned int params:1; + } carp_key; +#if USE_AUTH + unsigned int userhash:1; +#endif + unsigned int sourcehash:1; + unsigned int originserver:1; + unsigned int no_tproxy:1; +#if PEER_MULTICAST_SIBLINGS + unsigned int mcast_siblings:1; +#endif + } options; + + int weight; + int basetime; + + 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; + char *digest_url; +#endif + + int tcp_up; /* 0 if a connect() fails */ + + Ip::Address addresses[10]; + int n_addresses; + int rr_count; + CachePeer *next; + int testing_now; + + struct { + unsigned int hash; + double load_multiplier; + double load_factor; /* normalized weight value */ + } carp; +#if USE_AUTH + struct { + unsigned int hash; + double load_multiplier; + double load_factor; /* normalized weight value */ + } userhash; +#endif + struct { + unsigned int hash; + double load_multiplier; + double load_factor; /* normalized weight value */ + } sourcehash; + + char *login; /* Proxy authorization */ + time_t connect_timeout; + int connect_fail_limit; + int max_conn; + char *domain; /* Forced domain */ +#if USE_SSL + + int use_ssl; + char *sslcert; + char *sslkey; + int sslversion; + char *ssloptions; + char *sslcipher; + char *sslcafile; + char *sslcapath; + char *sslcrlfile; + char *sslflags; + char *ssldomain; + SSL_CTX *sslContext; + SSL_SESSION *sslSession; +#endif + + int front_end_https; + int connection_auth; +}; + +#endif /* SQUID_CACHEPEER_H_ */ diff --git a/src/SquidConfig.h b/src/SquidConfig.h index 247223fe6e..835cc3e4f9 100644 --- a/src/SquidConfig.h +++ b/src/SquidConfig.h @@ -41,6 +41,10 @@ #include "structs.h" #include "YesNoNone.h" +#if USE_SSL +#include +#endif + class acl_access; class acl_deny_info_list; class acl_size_t; diff --git a/src/acl/FilledChecklist.h b/src/acl/FilledChecklist.h index fef5bc1d68..bdc6c4a978 100644 --- a/src/acl/FilledChecklist.h +++ b/src/acl/FilledChecklist.h @@ -9,8 +9,9 @@ #include "ssl/support.h" #endif -class ExternalACLEntry; +class CachePeer; class ConnStateData; +class ExternalACLEntry; class HttpRequest; /** \ingroup ACLAPI diff --git a/src/acl/PeerName.cc b/src/acl/PeerName.cc index 0d7b584823..52eed51889 100644 --- a/src/acl/PeerName.cc +++ b/src/acl/PeerName.cc @@ -3,6 +3,7 @@ #include "acl/RegexData.h" #include "acl/StringData.h" #include "acl/Checklist.h" +#include "CachePeer.h" int ACLPeerNameStrategy::match (ACLData * &data, ACLFilledChecklist *checklist) diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 0c094891a1..60fd38f849 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -37,6 +37,7 @@ #include "anyp/PortCfg.h" #include "AuthReg.h" #include "base/RunnersRegistry.h" +#include "CachePeer.h" #include "cache_cf.h" #include "ConfigParser.h" #include "CpuAffinityMap.h" diff --git a/src/carp.cc b/src/carp.cc index 32ef25a5e4..37e916c1b5 100644 --- a/src/carp.cc +++ b/src/carp.cc @@ -33,6 +33,7 @@ */ #include "squid.h" +#include "CachePeer.h" #include "HttpRequest.h" #include "mgr/Registration.h" #include "neighbors.h" diff --git a/src/client_side.cc b/src/client_side.cc index 4be187455a..61c85f1e2d 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -83,6 +83,7 @@ #include "anyp/PortCfg.h" #include "base/Subscription.h" #include "base/TextException.h" +#include "CachePeer.h" #include "ChunkedCodingParser.h" #include "client_db.h" #include "client_side_reply.h" diff --git a/src/comm/ConnOpener.cc b/src/comm/ConnOpener.cc index 080e7f1ca3..d0272af305 100644 --- a/src/comm/ConnOpener.cc +++ b/src/comm/ConnOpener.cc @@ -3,6 +3,7 @@ */ #include "squid.h" +#include "CachePeer.h" #include "comm/ConnOpener.h" #include "comm/Connection.h" #include "comm/Loops.h" @@ -19,6 +20,8 @@ #include #endif +class CachePeer; + CBDATA_NAMESPACED_CLASS_INIT(Comm, ConnOpener); Comm::ConnOpener::ConnOpener(Comm::ConnectionPointer &c, AsyncCall::Pointer &handler, time_t ctimeout) : diff --git a/src/comm/Connection.cc b/src/comm/Connection.cc index 50eaa814f4..e73923285f 100644 --- a/src/comm/Connection.cc +++ b/src/comm/Connection.cc @@ -1,10 +1,12 @@ #include "squid.h" +#include "CachePeer.h" #include "cbdata.h" #include "comm.h" #include "comm/Connection.h" #include "fde.h" #include "SquidTime.h" +class CachePeer; bool Comm::IsConnOpen(const Comm::ConnectionPointer &conn) { diff --git a/src/fde.h b/src/fde.h index a78cff4cd3..b0f2ee17d4 100644 --- a/src/fde.h +++ b/src/fde.h @@ -34,6 +34,10 @@ #include "ip/Address.h" #include "structs.h" +#if USE_SSL +#include +#endif + #if USE_DELAY_POOLS class ClientInfo; #endif diff --git a/src/forward.cc b/src/forward.cc index e287cbfe92..471f5be26c 100644 --- a/src/forward.cc +++ b/src/forward.cc @@ -35,6 +35,7 @@ #include "acl/FilledChecklist.h" #include "acl/Gadgets.h" #include "anyp/PortCfg.h" +#include "CachePeer.h" #include "CacheManager.h" #include "client_side.h" #include "comm/Connection.h" diff --git a/src/htcp.cc b/src/htcp.cc index 7a5f2baacf..43e7720798 100644 --- a/src/htcp.cc +++ b/src/htcp.cc @@ -35,6 +35,7 @@ #include "AccessLogEntry.h" #include "acl/Acl.h" #include "acl/FilledChecklist.h" +#include "CachePeer.h" #include "comm.h" #include "comm/Connection.h" #include "comm/Loops.h" diff --git a/src/http.cc b/src/http.cc index 959d439a66..2fbdbd76b4 100644 --- a/src/http.cc +++ b/src/http.cc @@ -39,6 +39,7 @@ #include "base64.h" #include "base/AsyncJobCalls.h" #include "base/TextException.h" +#include "CachePeer.h" #include "client_side.h" #include "comm/Connection.h" #include "comm/Write.h" diff --git a/src/icmp/net_db.cc b/src/icmp/net_db.cc index c0b1c52816..f0b0c3b30a 100644 --- a/src/icmp/net_db.cc +++ b/src/icmp/net_db.cc @@ -39,6 +39,7 @@ */ #include "squid.h" +#include "CachePeer.h" #include "cbdata.h" #include "disk.h" #include "event.h" diff --git a/src/log/access_log.cc b/src/log/access_log.cc index 6822faa86c..019c3ca2a6 100644 --- a/src/log/access_log.cc +++ b/src/log/access_log.cc @@ -32,10 +32,10 @@ #include "squid.h" #include "AccessLogEntry.h" -#include "Store.h" -#include "errorpage.h" -#include "err_detail_type.h" #include "acl/Checklist.h" +#include "CachePeer.h" +#include "err_detail_type.h" +#include "errorpage.h" #include "errorpage.h" #include "format/Token.h" #include "globals.h" @@ -51,6 +51,7 @@ #include "rfc1738.h" #include "SquidConfig.h" #include "SquidTime.h" +#include "Store.h" #if USE_SQUID_EUI #include "eui/Eui48.h" diff --git a/src/neighbors.cc b/src/neighbors.cc index eadbdfe637..a2a1bb41a1 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -34,6 +34,7 @@ #include "acl/FilledChecklist.h" #include "anyp/PortCfg.h" #include "CacheDigest.h" +#include "CachePeer.h" #include "comm/Connection.h" #include "comm/ConnOpener.h" #include "event.h" diff --git a/src/peer_digest.cc b/src/peer_digest.cc index 6810276103..e399c3c4d6 100644 --- a/src/peer_digest.cc +++ b/src/peer_digest.cc @@ -34,6 +34,7 @@ #include "squid.h" #if USE_CACHE_DIGESTS #include "CacheDigest.h" +#include "CachePeer.h" #include "event.h" #include "forward.h" #include "globals.h" diff --git a/src/peer_select.cc b/src/peer_select.cc index c2df90d8f7..ae61be4faf 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -32,6 +32,7 @@ #include "squid.h" #include "acl/FilledChecklist.h" +#include "CachePeer.h" #include "carp.h" #include "client_side.h" #include "DnsLookupDetails.h" diff --git a/src/peer_sourcehash.cc b/src/peer_sourcehash.cc index 86a9b0b108..53b78611c4 100644 --- a/src/peer_sourcehash.cc +++ b/src/peer_sourcehash.cc @@ -33,6 +33,7 @@ */ #include "squid.h" +#include "CachePeer.h" #include "HttpRequest.h" #include "mgr/Registration.h" #include "neighbors.h" diff --git a/src/peer_userhash.cc b/src/peer_userhash.cc index ac3fd05ca9..7345199a9a 100644 --- a/src/peer_userhash.cc +++ b/src/peer_userhash.cc @@ -37,6 +37,7 @@ #if USE_AUTH #include "auth/UserRequest.h" +#include "CachePeer.h" #include "globals.h" #include "HttpRequest.h" #include "mgr/Registration.h" diff --git a/src/snmp_agent.cc b/src/snmp_agent.cc index 45d9c1fe59..632d3f2d6a 100644 --- a/src/snmp_agent.cc +++ b/src/snmp_agent.cc @@ -31,6 +31,7 @@ */ #include "squid.h" +#include "CachePeer.h" #include "cache_snmp.h" #include "globals.h" #include "mem_node.h" diff --git a/src/snmp_core.cc b/src/snmp_core.cc index ef10fdec06..8e187c6e60 100644 --- a/src/snmp_core.cc +++ b/src/snmp_core.cc @@ -32,6 +32,7 @@ #include "squid.h" #include "acl/FilledChecklist.h" #include "base/CbcPointer.h" +#include "CachePeer.h" #include "client_db.h" #include "comm.h" #include "comm/Connection.h" diff --git a/src/ssl/context_storage.cc b/src/ssl/context_storage.cc index a1ffb0f3e5..6237a264d1 100644 --- a/src/ssl/context_storage.cc +++ b/src/ssl/context_storage.cc @@ -9,6 +9,9 @@ #if HAVE_LIMITS #include #endif +#if USE_SSL +#include +#endif Ssl::CertificateStorageAction::CertificateStorageAction(const Mgr::Command::Pointer &cmd) : Mgr::Action(cmd) diff --git a/src/ssl/context_storage.h b/src/ssl/context_storage.h index 6aa01c9ae0..07a1637652 100644 --- a/src/ssl/context_storage.h +++ b/src/ssl/context_storage.h @@ -17,6 +17,8 @@ #if HAVE_LIST #include #endif +#include + /// TODO: Replace on real size. #define SSL_CTX_SIZE 1024 diff --git a/src/stat.cc b/src/stat.cc index e1daab5e42..c78cf1b003 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -32,6 +32,7 @@ #include "squid.h" #include "CacheDigest.h" +#include "CachePeer.h" #include "client_side_request.h" #include "client_side.h" #include "comm/Connection.h" diff --git a/src/structs.h b/src/structs.h index c02b2ed82e..375ac0791f 100644 --- a/src/structs.h +++ b/src/structs.h @@ -44,10 +44,6 @@ /* for ICP_END */ #include "icp_opcode.h" -#if USE_SSL -#include -#endif - #define PEER_MULTICAST_SIBLINGS 1 struct acl_name_list { @@ -218,166 +214,6 @@ public: class PeerDigest; -class CachePeer { -public: - u_int index; - char *name; - char *host; - peer_t type; - - Ip::Address 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 probe_start; - time_t last_query; - time_t last_reply; - time_t last_connect_failure; - time_t last_connect_probe; - int logged_state; /* so we can print dead/revived msgs */ - int conn_open; /* current opened connections */ - } stats; - - struct { - int version; - int counts[ICP_END+1]; - unsigned short port; - } icp; - -#if USE_HTCP - struct { - double version; - int counts[2]; - unsigned short port; - } htcp; -#endif - - unsigned 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 background_ping:1; - unsigned int no_digest:1; - unsigned int default_parent:1; - unsigned int roundrobin:1; - unsigned int weighted_roundrobin:1; - unsigned int mcast_responder:1; - unsigned int closest_only:1; -#if USE_HTCP - unsigned int htcp:1; - unsigned int htcp_oldsquid:1; - unsigned int htcp_no_clr:1; - unsigned int htcp_no_purge_clr:1; - unsigned int htcp_only_clr:1; - unsigned int htcp_forward_clr:1; -#endif - unsigned int no_netdb_exchange:1; -#if USE_DELAY_POOLS - unsigned int no_delay:1; -#endif - unsigned int allow_miss:1; - unsigned int carp:1; - struct { - unsigned int set:1; //If false, whole url is to be used. Overrides others - unsigned int scheme:1; - unsigned int host:1; - unsigned int port:1; - unsigned int path:1; - unsigned int params:1; - } carp_key; -#if USE_AUTH - unsigned int userhash:1; -#endif - unsigned int sourcehash:1; - unsigned int originserver:1; - unsigned int no_tproxy:1; -#if PEER_MULTICAST_SIBLINGS - unsigned int mcast_siblings:1; -#endif - } options; - - int weight; - int basetime; - - 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; - char *digest_url; -#endif - - int tcp_up; /* 0 if a connect() fails */ - - Ip::Address addresses[10]; - int n_addresses; - int rr_count; - CachePeer *next; - int testing_now; - - struct { - unsigned int hash; - double load_multiplier; - double load_factor; /* normalized weight value */ - } carp; -#if USE_AUTH - struct { - unsigned int hash; - double load_multiplier; - double load_factor; /* normalized weight value */ - } userhash; -#endif - struct { - unsigned int hash; - double load_multiplier; - double load_factor; /* normalized weight value */ - } sourcehash; - - char *login; /* Proxy authorization */ - time_t connect_timeout; - int connect_fail_limit; - int max_conn; - char *domain; /* Forced domain */ -#if USE_SSL - - int use_ssl; - char *sslcert; - char *sslkey; - int sslversion; - char *ssloptions; - char *sslcipher; - char *sslcafile; - char *sslcapath; - char *sslcrlfile; - char *sslflags; - char *ssldomain; - SSL_CTX *sslContext; - SSL_SESSION *sslSession; -#endif - - int front_end_https; - int connection_auth; -}; class netdbEntry; diff --git a/src/tunnel.cc b/src/tunnel.cc index b1ed03c7b8..7ddf0df8f8 100644 --- a/src/tunnel.cc +++ b/src/tunnel.cc @@ -32,24 +32,24 @@ */ #include "squid.h" -#include "errorpage.h" -#include "HttpRequest.h" -#include "fde.h" +#include "acl/FilledChecklist.h" #include "Array.h" +#include "CachePeer.h" +#include "client_side_request.h" +#include "client_side.h" #include "comm.h" #include "comm/Connection.h" #include "comm/ConnOpener.h" #include "comm/Write.h" -#include "client_side_request.h" -#include "acl/FilledChecklist.h" -#include "client_side.h" -#include "MemBuf.h" +#include "errorpage.h" +#include "fde.h" #include "http.h" +#include "HttpRequest.h" +#include "MemBuf.h" #include "PeerSelectState.h" #include "SquidConfig.h" #include "StatCounters.h" #include "tools.h" - #if USE_DELAY_POOLS #include "DelayId.h" #endif