From: Amos Jeffries Date: Tue, 8 Jun 2010 14:03:24 +0000 (+1200) Subject: Utilize comm/forward.h for small pre-definitions X-Git-Tag: take08~55^2~124^2~136 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f9b72e0ce08abc5a8be1574fc0eabe4a818499ec;p=thirdparty%2Fsquid.git Utilize comm/forward.h for small pre-definitions --- diff --git a/src/CommCalls.cc b/src/CommCalls.cc index ce5b8028ef..73a65daf91 100644 --- a/src/CommCalls.cc +++ b/src/CommCalls.cc @@ -1,5 +1,6 @@ #include "squid.h" #include "fde.h" +#include "comm/Connection.h" #include "CommCalls.h" /* CommCommonCbParams */ diff --git a/src/CommCalls.h b/src/CommCalls.h index 9dc02f0f03..c78c8e6e87 100644 --- a/src/CommCalls.h +++ b/src/CommCalls.h @@ -6,10 +6,10 @@ #ifndef SQUID_COMMCALLS_H #define SQUID_COMMCALLS_H -#include "comm.h" -#include "comm/Connection.h" #include "base/AsyncCall.h" #include "base/AsyncJobCalls.h" +#include "comm/comm_err_t.h" +#include "comm/forward.h" /* CommCalls implement AsyncCall interface for comm_* callbacks. * The classes cover two call dialer kinds: @@ -21,6 +21,10 @@ * - I/O (IOCB). */ +typedef void IOACB(int fd, int nfd, Comm::ConnectionPointer details, comm_err_t flag, int xerrno, void *data); +typedef void CNCB(Comm::ConnectionPointer conn, Comm::PathsPointer paths, comm_err_t status, int xerrno, void *data); +typedef void IOCB(int fd, char *, size_t size, comm_err_t flag, int xerrno, void *data); + /* * TODO: When there are no function-pointer-based callbacks left, all * this complexity can be removed. Jobs that need comm services will just @@ -68,7 +72,7 @@ public: void print(std::ostream &os) const; public: - Comm::Connection::Pointer details; + Comm::ConnectionPointer details; int nfd; // TODO: rename to fdNew or somesuch }; @@ -83,8 +87,8 @@ public: void print(std::ostream &os) const; public: - Comm::Connection::Pointer conn; - Vector *paths; + Comm::ConnectionPointer conn; + Comm::PathsPointer paths; }; // read/write (I/O) parameters diff --git a/src/PeerSelectState.h b/src/PeerSelectState.h index e4fb65755f..a84aa6e7c9 100644 --- a/src/PeerSelectState.h +++ b/src/PeerSelectState.h @@ -35,16 +35,17 @@ #include "Array.h" #include "cbdata.h" -#include "comm/Connection.h" +#include "comm/forward.h" +#include "hier_code.h" #include "ip/Address.h" #include "PingData.h" class HttpRequest; class StoreEntry; -typedef void PSC(Vector *, void *); +typedef void PSC(Comm::PathsPointer, void *); -SQUIDCEXTERN void peerSelect(Vector *, HttpRequest *, StoreEntry *, PSC *, void *data); +SQUIDCEXTERN void peerSelect(Comm::PathsPointer, HttpRequest *, StoreEntry *, PSC *, void *data); SQUIDCEXTERN void peerSelectInit(void); /** @@ -78,8 +79,8 @@ public: PSC *callback; void *callback_data; - Vector *paths; ///< the callers paths array. to be filled with our final results. - FwdServer *servers; ///< temporary linked list of peers we will pass back. + Comm::PathsPointer paths; ///< the callers paths array. to be filled with our final results. + FwdServer *servers; ///< temporary linked list of peers we will pass back. /* * Why are these Ip::Address instead of peer *? Because a diff --git a/src/adaptation/icap/Xaction.cc b/src/adaptation/icap/Xaction.cc index e9cf3c9f29..d8ea10f1bf 100644 --- a/src/adaptation/icap/Xaction.cc +++ b/src/adaptation/icap/Xaction.cc @@ -116,7 +116,7 @@ void Adaptation::Icap::Xaction::openConnection() disableRetries(); // we only retry pconn failures - Comm::Connection::Pointer conn = new Comm::Connection; + Comm::ConnectionPointer conn = new Comm::Connection; // TODO: where do we get the DNS info for the ICAP server host ?? // Ip::Address will do a BLOCKING lookup if s.cfg().host is a hostname diff --git a/src/client_side.cc b/src/client_side.cc index 09e40afbe1..301d017ede 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -3054,7 +3054,7 @@ connStateCreate(const Ip::Address &peer, const Ip::Address &me, int fd, http_por /** Handle a new connection on HTTP socket. */ void -httpAccept(int sock, int newfd, Comm::Connection::Pointer details, +httpAccept(int sock, int newfd, Comm::ConnectionPointer details, comm_err_t flag, int xerrno, void *data) { http_port_list *s = (http_port_list *)data; @@ -3117,7 +3117,7 @@ httpAccept(int sock, int newfd, Comm::Connection::Pointer details, /** Create SSL connection structure and update fd_table */ static SSL * -httpsCreate(int newfd, Comm::Connection::Pointer details, SSL_CTX *sslContext) +httpsCreate(int newfd, Comm::ConnectionPointer details, SSL_CTX *sslContext) { SSL *ssl = SSL_new(sslContext); @@ -3260,7 +3260,7 @@ clientNegotiateSSL(int fd, void *data) /** handle a new HTTPS connection */ static void -httpsAccept(int sock, int newfd, Comm::Connection::Pointer details, +httpsAccept(int sock, int newfd, Comm::ConnectionPointer details, comm_err_t flag, int xerrno, void *data) { https_port_list *s = (https_port_list *)data; diff --git a/src/comm.cc b/src/comm.cc index 5629cda156..18ca3ae634 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1153,7 +1153,7 @@ comm_close_complete(int fd, void *data) * Close the socket fd in use by a connection. */ void -_comm_close(Comm::Connection::Pointer conn, char const *file, int line) +_comm_close(Comm::ConnectionPointer conn, char const *file, int line) { _comm_close(conn->fd, file, line); conn->fd = -1; diff --git a/src/comm.h b/src/comm.h index 2c452d55d3..f7f9a390f0 100644 --- a/src/comm.h +++ b/src/comm.h @@ -2,20 +2,17 @@ #define __COMM_H__ #include "squid.h" -#include "Array.h" #include "AsyncEngine.h" #include "base/AsyncCall.h" +#include "CommCalls.h" #include "comm/comm_err_t.h" -#include "comm/Connection.h" +#include "comm/forward.h" #include "ip/Address.h" #include "StoreIOBuffer.h" #define COMMIO_FD_READCB(fd) (&commfd_table[(fd)].readcb) #define COMMIO_FD_WRITECB(fd) (&commfd_table[(fd)].writecb) -typedef void CNCB(Comm::Connection::Pointer conn, Vector *paths, comm_err_t status, int xerrno, void *data); -typedef void IOCB(int fd, char *, size_t size, comm_err_t flag, int xerrno, void *data); - /* comm.c */ extern bool comm_iocallbackpending(void); /* inline candidate */ @@ -25,7 +22,7 @@ SQUIDCEXTERN int commUnsetNonBlocking(int fd); SQUIDCEXTERN void commSetCloseOnExec(int fd); SQUIDCEXTERN void commSetTcpKeepalive(int fd, int idle, int interval, int timeout); extern void _comm_close(int fd, char const *file, int line); -extern void _comm_close(Comm::Connection::Pointer conn, char const *file, int line); +extern void _comm_close(Comm::ConnectionPointer conn, char const *file, int line); #define comm_close(x) (_comm_close((x), __FILE__, __LINE__)) SQUIDCEXTERN void comm_reset_close(int fd); #if LINGERING_CLOSE @@ -84,8 +81,7 @@ SQUIDCEXTERN void comm_select_init(void); SQUIDCEXTERN comm_err_t comm_select(int); SQUIDCEXTERN void comm_quick_poll_required(void); -#include "comm/Connection.h" -typedef void IOACB(int fd, int nfd, Comm::Connection::Pointer details, comm_err_t flag, int xerrno, void *data); +//typedef void IOACB(int fd, int nfd, Comm::ConnectionPointer details, comm_err_t flag, int xerrno, void *data); extern void comm_add_close_handler(int fd, PF *, void *); extern void comm_add_close_handler(int fd, AsyncCall::Pointer &); extern void comm_remove_close_handler(int fd, PF *, void *); diff --git a/src/comm/ConnectStateData.cc b/src/comm/ConnectStateData.cc index 6ded18815d..65271dc23c 100644 --- a/src/comm/ConnectStateData.cc +++ b/src/comm/ConnectStateData.cc @@ -1,5 +1,6 @@ #include "config.h" #include "comm/ConnectStateData.h" +#include "comm/Connection.h" #include "comm.h" #include "CommCalls.h" #include "fde.h" @@ -8,7 +9,7 @@ CBDATA_CLASS_INIT(ConnectStateData); -ConnectStateData::ConnectStateData(Vector *paths, AsyncCall::Pointer handler) : +ConnectStateData::ConnectStateData(Comm::PathsPointer paths, AsyncCall::Pointer handler) : host(NULL), connect_timeout(Config.Timeout.connect), paths(paths), @@ -19,7 +20,7 @@ ConnectStateData::ConnectStateData(Vector *paths, Asy connstart(0) {} -ConnectStateData::ConnectStateData(Comm::Connection::Pointer c, AsyncCall::Pointer handler) : +ConnectStateData::ConnectStateData(Comm::ConnectionPointer c, AsyncCall::Pointer handler) : host(NULL), connect_timeout(Config.Timeout.connect), paths(NULL), @@ -72,7 +73,7 @@ ConnectStateData::callCallback(comm_err_t status, int xerrno) void ConnectStateData::connect() { - Comm::Connection::Pointer active; + Comm::ConnectionPointer active; /* handle connecting to one single path */ /* mainly used by components other than forwarding */ @@ -83,7 +84,7 @@ ConnectStateData::connect() if (solo != NULL) { active = solo; } else if (paths) { - Vector::iterator i = paths->begin(); + Comm::Paths::iterator i = paths->begin(); if (connstart == 0) { connstart = squid_curtime; diff --git a/src/comm/ConnectStateData.h b/src/comm/ConnectStateData.h index 72aa1537ef..bfdce43cfb 100644 --- a/src/comm/ConnectStateData.h +++ b/src/comm/ConnectStateData.h @@ -1,11 +1,10 @@ #ifndef _SQUID_SRC_COMM_CONNECTSTATEDATA_H #define _SQUID_SRC_COMM_CONNECTSTATEDATA_H -#include "Array.h" #include "base/AsyncCall.h" #include "cbdata.h" #include "comm/comm_err_t.h" -#include "comm/Connection.h" +#include "comm/forward.h" /** * State engine handling the opening of a remote outbound connection @@ -15,10 +14,10 @@ class ConnectStateData { public: /** open first working of a set of connections */ - ConnectStateData(Vector *paths, AsyncCall::Pointer handler); + ConnectStateData(Comm::PathsPointer paths, AsyncCall::Pointer handler); /** attempt to open one connection. */ - ConnectStateData(Comm::Connection::Pointer, AsyncCall::Pointer handler); + ConnectStateData(Comm::ConnectionPointer, AsyncCall::Pointer handler); ~ConnectStateData(); @@ -63,9 +62,9 @@ public: time_t connect_timeout; private: - Vector *paths; ///< forwarding paths to be tried. front of the list is the current being opened. - Comm::Connection::Pointer solo; ///< single connection currently being opened. - AsyncCall::Pointer callback; ///< handler to be called on connection completion. + Comm::PathsPointer paths; ///< forwarding paths to be tried. front of the list is the current being opened. + Comm::ConnectionPointer solo; ///< single connection currently being opened. + AsyncCall::Pointer callback; ///< handler to be called on connection completion. int total_tries; ///< total number of connection attempts over all destinations so far. int fail_retries; ///< number of retries current destination has been tried. diff --git a/src/comm/Connection.cc b/src/comm/Connection.cc index 29701ddc31..951dc519c5 100644 --- a/src/comm/Connection.cc +++ b/src/comm/Connection.cc @@ -31,6 +31,8 @@ Comm::Connection::operator =(const Comm::Connection &c) /* ensure we have a cbdata reference to _peer not a straight ptr copy. */ _peer = cbdataReference(c._peer); + + return *this; } Comm::Connection::~Connection() diff --git a/src/comm/Connection.h b/src/comm/Connection.h index 0d2a0d8ba0..9c325dc421 100644 --- a/src/comm/Connection.h +++ b/src/comm/Connection.h @@ -65,13 +65,11 @@ namespace Comm { * outside of the Comm layer code. * * These objects must not be passed around directly, - * but a Comm::Connection::Pointer must be passed instead. + * but a Comm::ConnectionPointer must be passed instead. */ class Connection : public RefCountable { public: - typedef RefCount Pointer; - /** standard empty connection creation */ Connection(); diff --git a/src/comm/ListenStateData.cc b/src/comm/ListenStateData.cc index 93ae47688a..50a1eedb2d 100644 --- a/src/comm/ListenStateData.cc +++ b/src/comm/ListenStateData.cc @@ -186,7 +186,7 @@ Comm::ListenStateData::acceptNext() } void -Comm::ListenStateData::notify(int newfd, comm_err_t errcode, int xerrno, Comm::Connection::Pointer connDetails) +Comm::ListenStateData::notify(int newfd, comm_err_t errcode, int xerrno, Comm::ConnectionPointer connDetails) { // listener socket handlers just abandon the port with COMM_ERR_CLOSING // it should only happen when this object is deleted... diff --git a/src/comm/ListenStateData.h b/src/comm/ListenStateData.h index a83f8e2ece..6372d2f661 100644 --- a/src/comm/ListenStateData.h +++ b/src/comm/ListenStateData.h @@ -3,7 +3,9 @@ #include "config.h" #include "base/AsyncCall.h" -#include "comm.h" +#include "comm/comm_err_t.h" +#include "comm/forward.h" + #if HAVE_MAP #include #endif @@ -23,7 +25,7 @@ public: void subscribe(AsyncCall::Pointer &call); void acceptNext(); - void notify(int newfd, comm_err_t, int xerrno, Comm::Connection::Pointer); + void notify(int newfd, comm_err_t, int xerrno, Comm::ConnectionPointer); int fd; diff --git a/src/comm/Makefile.am b/src/comm/Makefile.am index 9487b38503..00be9af925 100644 --- a/src/comm/Makefile.am +++ b/src/comm/Makefile.am @@ -18,4 +18,5 @@ libcomm_la_SOURCES= \ Connection.cc \ Connection.h \ comm_err_t.h \ - comm_internal.h + comm_internal.h \ + forward.h diff --git a/src/comm/forward.h b/src/comm/forward.h new file mode 100644 index 0000000000..eb30b5ea59 --- /dev/null +++ b/src/comm/forward.h @@ -0,0 +1,18 @@ +#ifndef _SQUID_COMM_FORWARD_H +#define _SQUID_COMM_FORWARD_H + +#include "Array.h" +#include "RefCount.h" + +namespace Comm { + +class Connection; + +typedef RefCount ConnectionPointer; + +typedef Vector Paths; +typedef Vector* PathsPointer; + +}; // namespace Comm + +#endif /* _SQUID_COMM_FORWARD_H */ diff --git a/src/dns_internal.cc b/src/dns_internal.cc index c963c88fa5..dfe7803c29 100644 --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@ -699,7 +699,7 @@ idnsDoSendQueryVC(nsvc *vc) } static void -idnsInitVCConnected(Comm::Connection::Pointer conn, Vector *unused, comm_err_t status, int xerrno, void *data) +idnsInitVCConnected(Comm::ConnectionPointer conn, Comm::PathsPointer unused, comm_err_t status, int xerrno, void *data) { nsvc * vc = (nsvc *)data; @@ -738,7 +738,7 @@ idnsInitVC(int ns) vc->msg = new MemBuf; vc->busy = 1; - Comm::Connection::Pointer conn = new Comm::Connection; + Comm::ConnectionPointer conn = new Comm::Connection; if (!Config.Addrs.udp_outgoing.IsNoAddr()) conn->local = Config.Addrs.udp_outgoing; diff --git a/src/forward.cc b/src/forward.cc index 554da055c5..a5e3afb83e 100644 --- a/src/forward.cc +++ b/src/forward.cc @@ -35,6 +35,7 @@ #include "acl/FilledChecklist.h" #include "acl/Gadgets.h" #include "CacheManager.h" +#include "comm/Connection.h" #include "comm/ConnectStateData.h" #include "CommCalls.h" #include "event.h" @@ -360,7 +361,7 @@ FwdState::complete() /**** CALLBACK WRAPPERS ************************************************************/ static void -fwdStartCompleteWrapper(Vector *unused, void *data) +fwdStartCompleteWrapper(Comm::PathsPointer unused, void *data) { FwdState *fwd = (FwdState *) data; fwd->startComplete(); @@ -390,7 +391,7 @@ fwdNegotiateSSLWrapper(int fd, void *data) #endif void -fwdConnectDoneWrapper(Comm::Connection::Pointer conn, Vector *paths, comm_err_t status, int xerrno, void *data) +fwdConnectDoneWrapper(Comm::ConnectionPointer conn, Comm::PathsPointer paths, comm_err_t status, int xerrno, void *data) { FwdState *fwd = (FwdState *) data; fwd->connectDone(conn, paths, status, xerrno); @@ -663,7 +664,7 @@ FwdState::initiateSSL() #endif void -FwdState::connectDone(Comm::Connection::Pointer conn, Vector *result_paths, comm_err_t status, int xerrno) +FwdState::connectDone(Comm::ConnectionPointer conn, Comm::PathsPointer result_paths, comm_err_t status, int xerrno) { assert(result_paths == &paths); @@ -740,7 +741,7 @@ FwdState::connectStart() if (n_tries == 0) // first attempt request->hier.first_conn_start = current_time; - Comm::Connection::Pointer conn = paths[0]; + Comm::ConnectionPointer conn = paths[0]; /* connection timeout */ int ctimeout; @@ -1075,7 +1076,7 @@ FwdState::reforwardableStatus(http_status s) * - address of the client for which we made the connection */ void -FwdState::pconnPush(Comm::Connection::Pointer conn, const peer *_peer, const HttpRequest *req, const char *domain, Ip::Address &client_addr) +FwdState::pconnPush(Comm::ConnectionPointer conn, const peer *_peer, const HttpRequest *req, const char *domain, Ip::Address &client_addr) { if (_peer) { fwdPconnPool->push(conn->fd, _peer->name, _peer->http_port, domain, client_addr); @@ -1188,7 +1189,7 @@ aclMapTOS(acl_tos * head, ACLChecklist * ch) } void -getOutgoingAddress(HttpRequest * request, Comm::Connection::Pointer conn) +getOutgoingAddress(HttpRequest * request, Comm::ConnectionPointer conn) { /* skip if an outgoing address is already set. */ if (!conn->local.IsAnyAddr()) return; diff --git a/src/forward.h b/src/forward.h index a5e30a3a2b..7463efc43d 100644 --- a/src/forward.h +++ b/src/forward.h @@ -28,14 +28,14 @@ public: bool reforwardableStatus(http_status s); void serverClosed(int fd); void connectStart(); - void connectDone(Comm::Connection::Pointer conn, Vector *paths, comm_err_t status, int xerrno); + void connectDone(Comm::ConnectionPointer conn, Comm::PathsPointer paths, comm_err_t status, int xerrno); void connectTimeout(int fd); void initiateSSL(); void negotiateSSL(int fd); bool checkRetry(); bool checkRetriable(); void dispatch(); - void pconnPush(Comm::Connection::Pointer conn, const peer *_peer, const HttpRequest *req, const char *domain, Ip::Address &client_addr); + void pconnPush(Comm::ConnectionPointer conn, const peer *_peer, const HttpRequest *req, const char *domain, Ip::Address &client_addr); bool dontRetry() { return flags.dont_retry; } @@ -45,7 +45,7 @@ public: void ftpPasvFailed(bool val) { flags.ftp_pasv_failed = val; } - Comm::Connection::Pointer conn() const { return paths[0]; }; + Comm::ConnectionPointer conn() const { return paths[0]; }; private: // hidden for safer management of self; use static fwdStart @@ -89,7 +89,7 @@ private: } flags; /** possible paths which may be tried (in sequence stored) */ - Vector paths; + Comm::Paths paths; // NP: keep this last. It plays with private/public CBDATA_CLASS2(FwdState); diff --git a/src/ftp.cc b/src/ftp.cc index c12131668e..edda02653a 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -2412,7 +2412,7 @@ ftpReadEPSV(FtpStateData* ftpState) debugs(9, 3, HERE << "connecting to " << ftpState->data.host << ", port " << ftpState->data.port); - Comm::Connection::Pointer conn = new Comm::Connection; + Comm::ConnectionPointer conn = new Comm::Connection; conn->remote = fd_table[ftpState->ctrl.fd].ipaddr; // TODO: do we have a better info source than fd_table? conn->remote.SetPort(port); conn->fd = fd; @@ -2697,7 +2697,7 @@ ftpReadPasv(FtpStateData * ftpState) debugs(9, 3, HERE << "connecting to " << ftpState->data.host << ", port " << ftpState->data.port); - Comm::Connection::Pointer conn = new Comm::Connection; + Comm::ConnectionPointer conn = new Comm::Connection; conn->remote = ipaddr; conn->remote.SetPort(port); conn->fd = ftpState->data.fd; @@ -2710,7 +2710,7 @@ ftpReadPasv(FtpStateData * ftpState) } void -FtpStateData::ftpPasvCallback(Comm::Connection::Pointer conn, Vector *unused, comm_err_t status, int xerrno, void *data) +FtpStateData::ftpPasvCallback(Comm::ConnectionPointer conn, Comm::PathsPointer unused, comm_err_t status, int xerrno, void *data) { FtpStateData *ftpState = (FtpStateData *)data; debugs(9, 3, HERE); diff --git a/src/icp_v2.cc b/src/icp_v2.cc index 2afd304e89..c53738cd43 100644 --- a/src/icp_v2.cc +++ b/src/icp_v2.cc @@ -36,19 +36,19 @@ */ #include "squid.h" -#include "Store.h" -#include "comm.h" -#include "ICP.h" -#include "HttpRequest.h" -#include "acl/FilledChecklist.h" -#include "acl/Acl.h" #include "AccessLogEntry.h" -#include "wordlist.h" -#include "SquidTime.h" -#include "SwapDir.h" +#include "acl/Acl.h" +#include "acl/FilledChecklist.h" +#include "comm/Connection.h" +#include "HttpRequest.h" #include "icmp/net_db.h" +#include "ICP.h" #include "ip/Address.h" #include "rfc1738.h" +#include "Store.h" +#include "SquidTime.h" +#include "SwapDir.h" +#include "wordlist.h" /// \ingroup ServerProtocolICPInternal2 static void icpLogIcp(const Ip::Address &, log_type, int, const char *, int); diff --git a/src/ident/AclIdent.cc b/src/ident/AclIdent.cc index 216c40c7d2..2d0b508316 100644 --- a/src/ident/AclIdent.cc +++ b/src/ident/AclIdent.cc @@ -42,6 +42,7 @@ #include "acl/RegexData.h" #include "acl/UserData.h" #include "client_side.h" +#include "comm/Connection.h" #include "ident/AclIdent.h" #include "ident/Ident.h" diff --git a/src/ident/Ident.cc b/src/ident/Ident.cc index 7a5e959c05..5fdf12159a 100644 --- a/src/ident/Ident.cc +++ b/src/ident/Ident.cc @@ -117,7 +117,7 @@ Ident::Timeout(int fd, void *data) } void -Ident::ConnectDone(Comm::Connection::Pointer conn, Vector *unused, comm_err_t status, int xerrno, void *data) +Ident::ConnectDone(Comm::ConnectionPointer conn, Comm::PathsPointer unused, comm_err_t status, int xerrno, void *data) { IdentStateData *state = (IdentStateData *)data; @@ -217,7 +217,7 @@ CBDATA_TYPE(IdentStateData); * start a TCP connection to the peer host on port 113 */ void -Ident::Start(Comm::Connection::Pointer conn, IDCB * callback, void *data) +Ident::Start(Comm::ConnectionPointer conn, IDCB * callback, void *data) { IdentStateData *state; char key1[IDENT_KEY_SZ]; diff --git a/src/ident/Ident.h b/src/ident/Ident.h index 84124ed2e0..623018f415 100644 --- a/src/ident/Ident.h +++ b/src/ident/Ident.h @@ -14,7 +14,7 @@ #if USE_IDENT #include "cbdata.h" -#include "comm/Connection.h" +#include "comm/forward.h" namespace Ident { @@ -27,7 +27,7 @@ namespace Ident * Self-registers with a global ident lookup manager, * will call Ident::Init() itself if the manager has not been initialized already. */ -void Start(Comm::Connection::Pointer conn, IDCB * callback, void *cbdata); +void Start(Comm::ConnectionPointer conn, IDCB * callback, void *cbdata); /** \ingroup IdentAPI diff --git a/src/ipc.cc b/src/ipc.cc index 5336b3d12d..5ecc9e2145 100644 --- a/src/ipc.cc +++ b/src/ipc.cc @@ -31,7 +31,7 @@ */ #include "squid.h" -#include "comm.h" +#include "comm/Connection.h" #include "fde.h" #include "ip/Address.h" #include "rfc1738.h" diff --git a/src/log/ModTcp.cc b/src/log/ModTcp.cc index 8fef051459..c56ea0f96e 100644 --- a/src/log/ModTcp.cc +++ b/src/log/ModTcp.cc @@ -33,6 +33,7 @@ #include "squid.h" #include "comm.h" +#include "comm/Connection.h" #include "log/File.h" #include "log/ModTcp.h" #include "Parsing.h" diff --git a/src/log/ModUdp.cc b/src/log/ModUdp.cc index bc83cf4df0..3310e32c1a 100644 --- a/src/log/ModUdp.cc +++ b/src/log/ModUdp.cc @@ -32,6 +32,7 @@ #include "squid.h" #include "comm.h" +#include "comm/Connection.h" #include "log/File.h" #include "log/ModUdp.h" #include "Parsing.h" diff --git a/src/neighbors.cc b/src/neighbors.cc index 532719139f..82ea74e033 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1359,9 +1359,9 @@ peerProbeConnect(peer * p) return ret;/* don't probe to often */ /* for each IP address of this peer. find one that we can connect to and probe it. */ - Vector *paths = new Vector; + Comm::PathsPointer paths = new Comm::Paths; for (int i = 0; i < p->n_addresses; i++) { - Comm::Connection::Pointer conn = new Comm::Connection; + Comm::ConnectionPointer conn = new Comm::Connection; conn->remote = p->addresses[i]; conn->remote.SetPort(p->http_port); getOutgoingAddress(NULL, conn); @@ -1381,7 +1381,7 @@ peerProbeConnect(peer * p) } static void -peerProbeConnectDone(Comm::Connection::Pointer conn, Vector *unused, comm_err_t status, int xerrno, void *data) +peerProbeConnectDone(Comm::ConnectionPointer conn, Comm::PathsPointer unused, comm_err_t status, int xerrno, void *data) { peer *p = (peer*)data; diff --git a/src/peer_select.cc b/src/peer_select.cc index b51ff16f75..b4088c8d35 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -124,7 +124,7 @@ peerSelectIcpPing(HttpRequest * request, int direct, StoreEntry * entry) void -peerSelect(Vector *paths, +peerSelect(Comm::PathsPointer paths, HttpRequest * request, StoreEntry * entry, PSC * callback, @@ -253,7 +253,7 @@ peerSelectDnsResults(const ipcache_addrs *ia, const DnsLookupDetails &details, v assert(ia->cur < ia->count); // loop over each result address, adding to the possible destinations. - Comm::Connection::Pointer p; + Comm::ConnectionPointer p; int ip = ia->cur; for (int n = 0; n < ia->count; n++, ip++) { if (ip >= ia->count) ip = 0; // looped back to zero. diff --git a/src/protos.h b/src/protos.h index fe2d6b9477..e8a15b19b1 100644 --- a/src/protos.h +++ b/src/protos.h @@ -405,8 +405,8 @@ SQUIDCEXTERN void peerDigestNeeded(PeerDigest * pd); SQUIDCEXTERN void peerDigestNotePeerGone(PeerDigest * pd); SQUIDCEXTERN void peerDigestStatsReport(const PeerDigest * pd, StoreEntry * e); -#include "comm/Connection.h" -extern void getOutgoingAddress(HttpRequest * request, Comm::Connection::Pointer conn); +#include "comm/forward.h" +extern void getOutgoingAddress(HttpRequest * request, Comm::ConnectionPointer conn); unsigned long getOutgoingTOS(HttpRequest * request); SQUIDCEXTERN void urnStart(HttpRequest *, StoreEntry *); diff --git a/src/snmp_core.cc b/src/snmp_core.cc index 8e6adaf494..dec9c8aa11 100644 --- a/src/snmp_core.cc +++ b/src/snmp_core.cc @@ -33,6 +33,7 @@ #include "acl/FilledChecklist.h" #include "cache_snmp.h" #include "comm.h" +#include "comm/Connection.h" #include "compat/strsep.h" #include "ip/Address.h" diff --git a/src/tunnel.cc b/src/tunnel.cc index 41b965171d..eb887bc20a 100644 --- a/src/tunnel.cc +++ b/src/tunnel.cc @@ -68,7 +68,7 @@ public: char *host; /* either request->host or proxy host */ u_short port; HttpRequest *request; - Vector *paths; + Comm::PathsPointer paths; class Connection { @@ -558,12 +558,12 @@ tunnelErrorComplete(int fdnotused, void *data, size_t sizenotused) static void -tunnelConnectDone(Comm::Connection::Pointer unused, Vector *paths, comm_err_t status, int xerrno, void *data) +tunnelConnectDone(Comm::ConnectionPointer unused, Comm::PathsPointer paths, comm_err_t status, int xerrno, void *data) { TunnelStateData *tunnelState = (TunnelStateData *)data; HttpRequest *request = tunnelState->request; ErrorState *err = NULL; - Comm::Connection::Pointer conn = (*paths)[0]; + Comm::ConnectionPointer conn = (*paths)[0]; assert(tunnelState->paths == paths); @@ -713,7 +713,7 @@ tunnelProxyConnected(int fd, void *data) } static void -tunnelPeerSelectComplete(Vector *peer_paths, void *data) +tunnelPeerSelectComplete(Comm::PathsPointer peer_paths, void *data) { TunnelStateData *tunnelState = (TunnelStateData *)data; HttpRequest *request = tunnelState->request; diff --git a/src/wccp.cc b/src/wccp.cc index 9f0f514798..86a8fe49dc 100644 --- a/src/wccp.cc +++ b/src/wccp.cc @@ -33,11 +33,13 @@ * */ #include "squid.h" -#include "comm.h" -#include "event.h" #if USE_WCCP +#include "comm.h" +#include "comm/Connection.h" +#include "event.h" + #define WCCP_PORT 2048 #define WCCP_REVISION 0 #define WCCP_ACTIVE_CACHES 32 diff --git a/src/wccp2.cc b/src/wccp2.cc index d4769339d0..199d7e9624 100644 --- a/src/wccp2.cc +++ b/src/wccp2.cc @@ -35,6 +35,7 @@ #if USE_WCCPv2 #include "comm.h" +#include "comm/Connection.h" #include "compat/strsep.h" #include "event.h" #include "ip/Address.h"