#include <Connection.h>

Inheritance diagram for Comm::Connection:
Collaboration diagram for Comm::Connection:

Public Member Functions

 Connection ()
 
 ~Connection ()
 
ConnectionPointer copyDetails () const
 
void close ()
 
void noteClosure ()
 
bool isOpen () const
 
void setAddrs (const Ip::Address &aLocal, const Ip::Address &aRemote)
 
CachePeergetPeer () const
 
void setPeer (CachePeer *p)
 
time_t startTime () const
 
time_t lifeTime () const
 
time_t timeLeft (const time_t idleTimeout) const
 
time_t connectTimeout (const time_t fwdStart) const
 
void noteStart ()
 
Security::NegotiationHistorytlsNegotiations ()
 
const
Security::NegotiationHistory
hasTlsNegotiations () const
 

Public Attributes

Ip::Address local
 
Ip::Address remote
 
hier_code peerType
 
int fd
 
tos_t tos
 
nfmark_t nfmark
 
nfmark_t nfConnmark = 0
 
int flags
 
char rfc931 [USER_IDENT_SZ]
 
Eui::Eui48 remoteEui48
 
Eui::Eui64 remoteEui64
 

Private Member Functions

 MEMPROXY_CLASS (Comm::Connection)
 
 Connection (const Connection &c)
 
Connectionoperator= (const Connection &c)
 

Private Attributes

CachePeerpeer_
 
time_t startTime_
 
Security::NegotiationHistorytlsHistory
 

Detailed Description

Store data about the physical and logical attributes of a connection.

Some link state can be infered from the data, however this is not an object for state data. But a semantic equivalent for FD with easily accessible cached properties not requiring repeated complex lookups.

Connection properties may be changed until the connection is opened. Properties should be considered read-only outside of the Comm layer code once the connection is open.

These objects should not be passed around directly, but a Comm::ConnectionPointer should be passed instead.

Definition at line 65 of file Connection.h.

Constructor & Destructor Documentation

Comm::Connection::Connection ( )

Definition at line 29 of file Connection.cc.

References rfc931.

Comm::Connection::~Connection ( )

Clear the connection properties and close any open socket.

Definition at line 43 of file Connection.cc.

References cbdataReferenceDone, debugs, and lost_conn.

Comm::Connection::Connection ( const Connection c)
private

These objects may not be exactly duplicated. Use copyDetails() instead.

Member Function Documentation

void Comm::Connection::close ( )

Close any open socket.

Definition at line 79 of file Connection.cc.

References comm_close, and isOpen().

Referenced by Mgr::StoreToCommWriter::Abort(), Ftp::Server::acceptDataConnection(), ConnStateData::afterClientRead(), ClientHttpRequest::callException(), Ssl::PeekingPeerConnector::checkForPeekAndSpliceMatched(), ConnStateData::clientAfterReadingRequests(), clientLifetimeTimeout(), clientNegotiateSSL(), ConnStateData::clientPinnedConnectionClosed(), ConnStateData::clientPinnedConnectionRead(), IdleConnList::closeN(), HelperServerBase::closePipesSafely(), HttpStateData::closeServer(), FwdState::closeServerConnection(), HelperServerBase::closeWritePipeSafely(), comm_reset_close(), commHalfClosedReader(), FwdState::connectDone(), Ftp::Server::connectedForData(), FwdState::connectedToPeer(), FwdState::dispatch(), Server::doClientRead(), ConnStateData::endingShutdown(), errorSendComplete(), IdleConnList::findAndClose(), Ftp::Gateway::ftpAcceptDataConnection(), ConnStateData::getSslContextDone(), gopherReadReply(), gopherSendComplete(), gopherTimeout(), PeerPoolMgr::handleOpenedConnection(), ConnStateData::handleRequestBodyData(), PeerPoolMgr::handleSecuredPeer(), Adaptation::Icap::Xaction::handleSecuredPeer(), helperReturnBuffer(), httpsCreate(), httpsSslBumpAccessCheckDone(), httpsSslBumpStep2AccessCheckDone(), idnsReadVC(), idnsReadVCHeader(), idnsSentQueryVC(), Ipc::ImportFdIntoComm(), TunnelStateData::informUserOfPeerError(), TunnelStateData::keepGoingAfterRead(), ConnStateData::kick(), ClientHttpRequest::noteBodyProducerAborted(), ConnStateData::parseTlsHandshake(), peerProbeConnectDone(), PconnPool::pop(), PconnPool::push(), Adaptation::Icap::ServiceRep::putConnection(), WhoisState::readReply(), ConnStateData::requestTimeout(), ConnStateData::sendControlMsg(), snmpClosePorts(), ClientRequestContext::sslBumpAccessCheckDone(), ClientHttpRequest::sslBumpEstablish(), ConnStateData::startPeekAndSplice(), ConnStateData::stopReceiving(), ConnStateData::stopSending(), Server::swanSong(), tunnelClientClosed(), tunnelErrorComplete(), tunnelServerClosed(), whoisTimeout(), TunnelStateData::writeClientDone(), TunnelStateData::writeServerDone(), HttpControlMsgSink::wroteControlMsg(), Ftp::Server::wroteEarlyReply(), and Ftp::Server::wroteReply().

time_t Comm::Connection::connectTimeout ( const time_t  fwdStart) const

Connection establishment timeout for callers that have already decided to connect(2), either for the first time or after checking EnoughTimeToReForward() during any re-forwarding attempts.

Returns
the time left for this connection to become connected
Parameters
fwdStartThe start time of the peer selection/connection process.

Definition at line 138 of file Connection.cc.

References Config, SquidConfig::connect, FwdState::ForwardTimeout(), min(), peerConnectTimeout(), and SquidConfig::Timeout.

Comm::ConnectionPointer Comm::Connection::copyDetails ( ) const

Copy an existing connections IP and properties. This excludes the FD. The new copy will be a closed connection.

Definition at line 57 of file Connection.cc.

References cbdataReference, fd, CachePeer::flags, flags, nfConnmark, nfmark, peer_, peerType, setAddrs(), startTime_, and tos.

Referenced by Ident::Start().

const Security::NegotiationHistory* Comm::Connection::hasTlsNegotiations ( ) const
inline

Definition at line 124 of file Connection.h.

References tlsHistory.

Referenced by Format::Format::assemble().

bool Comm::Connection::isOpen ( ) const
inline

determine whether this object describes an active connection or not.

Definition at line 87 of file Connection.h.

References fd.

Referenced by Comm::TcpAcceptor::acceptOne(), ClientHttpRequest::ClientHttpRequest(), and ClientHttpRequest::noteAdaptationAclCheckDone().

time_t Comm::Connection::lifeTime ( ) const
inline

The connection lifetime

Definition at line 109 of file Connection.h.

References squid_curtime, and startTime_.

Comm::Connection::MEMPROXY_CLASS ( Comm::Connection  )
private
void Comm::Connection::noteClosure ( )

Synchronize with Comm: Somebody closed our connection.

Definition at line 88 of file Connection.cc.

References isOpen(), p, and peerConnClosed().

void Comm::Connection::noteStart ( )
inline

Definition at line 121 of file Connection.h.

References squid_curtime, and startTime_.

Connection& Comm::Connection::operator= ( const Connection c)
private

These objects may not be exactly duplicated. Use copyDetails() instead.

void Comm::Connection::setAddrs ( const Ip::Address aLocal,
const Ip::Address aRemote 
)
inline

Alter the stored IP address pair. WARNING: Does not ensure matching IPv4/IPv6 are supplied.

Definition at line 92 of file Connection.h.

References local, and remote.

Referenced by Ftp::Client::connectDataChannel(), copyDetails(), Ftp::Server::createDataConnection(), and idnsInitVC().

void Comm::Connection::setPeer ( CachePeer p)

alter the stored CachePeer pointer. Perform appropriate CBDATA operations for locking the CachePeer pointer

Definition at line 107 of file Connection.cc.

References cbdataReference, and cbdataReferenceDone.

Referenced by PeerSelector::handlePath(), PeerPoolMgr::openNewConnection(), and peerProbeConnect().

time_t Comm::Connection::startTime ( ) const
inline

The time the connection started

Definition at line 106 of file Connection.h.

References startTime_.

Referenced by PeerPoolMgr::handleOpenedConnection().

time_t Comm::Connection::timeLeft ( const time_t  idleTimeout) const

The time left for this connection

Definition at line 120 of file Connection.cc.

References Config, min(), SquidConfig::pconnLifetime, and SquidConfig::Timeout.

Referenced by IdleConnList::push(), and ConnStateData::readNextRequest().

Security::NegotiationHistory * Comm::Connection::tlsNegotiations ( )

Definition at line 130 of file Connection.cc.

Referenced by clientNegotiateSSL(), and ConnStateData::parseTlsHandshake().

Member Data Documentation

int Comm::Connection::fd

Socket used by this connection. Negative if not open.

Definition at line 144 of file Connection.h.

Referenced by Ftp::Server::AcceptCtrlConnection(), Ftp::Server::acceptDataConnection(), AddOpenedHttpSocket(), ConnStateData::afterClientRead(), ClientInfo::applyQuota(), Format::Format::assemble(), IdleConnList::clearHandlers(), ConnStateData::clientAfterReadingRequests(), ClientHttpRequest::ClientHttpRequest(), ClientRequestContext::clientRedirectDone(), clientTunnelOnError(), Server::clientWriteDone(), HelperServerBase::closePipesSafely(), HttpStateData::closeServer(), FwdState::closeServerConnection(), HelperServerBase::closeWritePipeSafely(), comm_import_opened(), comm_init_opened(), comm_open_listener(), comm_openex(), comm_poll_udp_incoming(), comm_read_base(), comm_reset_close(), comm_select_udp_incoming(), commHalfClosedCheck(), commHalfClosedReader(), commSetConnTimeout(), Ipc::UdsOp::conn(), Ftp::Server::connectedForData(), FwdState::connectStart(), copyDetails(), CreateSession(), StoreEntry::delayAwareRead(), DeferredReadManager::delayRead(), FwdState::dispatch(), Server::doClientRead(), Ip::Qos::doNfmarkLocalMiss(), ConnStateData::doPeekAndSpliceStep(), Ip::Qos::doTosLocalMiss(), errorSendComplete(), fdIsUdpListen(), fdIsUdpListener(), IdleConnList::findIndexOf(), Mgr::Forwarder::Forwarder(), ftpOpenListenSocket(), ConnStateData::getSslContextDone(), ConnStateData::getSslContextStart(), Ip::Qos::getTosFromServer(), gopherSendComplete(), gopherStart(), Ipc::Coordinator::handleCacheMgrRequest(), PeerPoolMgr::handleOpenedConnection(), PeerPoolMgr::handleSecuredPeer(), Adaptation::Icap::Xaction::handleSecuredPeer(), Ipc::Coordinator::handleSharedListenRequest(), helperHandleRead(), helperOpenServers(), helperStatefulHandleRead(), helperStatefulOpenServers(), htcpIncomingConnectionOpened(), htcpOpenPorts(), htcpSend(), htcpSocketShutdown(), httpAccept(), httpsAccept(), httpsEstablish(), HttpStateData::HttpStateData(), icpConnectionShutdown(), icpIncomingConnectionOpened(), icpOpenPorts(), idnsDoSendQueryVC(), idnsInitVCConnected(), idnsSentQueryVC(), Ipc::ImportFdIntoComm(), Ssl::PeekingPeerConnector::initialize(), Mgr::Inquirer::Inquirer(), Snmp::Inquirer::Inquirer(), IdleConnList::isAvailable(), isOpen(), ConnStateData::isOpen(), ConnStateData::kick(), DeferredReadManager::kickARead(), Ftp::Gateway::listenForDataChannel(), Ftp::Server::listenForDataConnection(), HttpStateData::maybeReadVirginBody(), mcastJoinGroups(), neighborsUdpPing(), Ip::Intercept::NetfilterInterception(), ClientHttpRequest::noteAdaptationAclCheckDone(), Snmp::Inquirer::noteCommClosed(), Adaptation::Icap::Xaction::noteCommConnected(), Adaptation::Icap::ServiceRep::noteConnectionUse(), Comm::TcpAcceptor::oldAccept(), operator<<(), helper::packStatsInto(), ConnStateData::parseTlsHandshake(), peerCountMcastPeersStart(), ConnStateData::pinConnection(), HttpStateData::processReplyBody(), PconnPool::push(), ConnStateData::readNextRequest(), Comm::ReadNow(), HttpStateData::readReply(), Ftp::Server::readUploadData(), Mgr::Request::Request(), Mgr::Action::respond(), MessageBucket::scheduleWrite(), ClientInfo::scheduleWrite(), send_announce(), Ip::Qos::setSockNfmark(), Ip::Qos::setSockTos(), Ipc::SharedListenJoined(), snmpPortOpened(), ConnStateData::splice(), ConnStateData::sslCrtdHandleReply(), ConnStateData::start(), ConnStateData::startPeekAndSplice(), statClientRequests(), Server::stopReading(), ConnStateData::storeTlsContextToCache(), Mgr::StoreToCommWriter::StoreToCommWriter(), switchToTunnel(), CommIoCbParams::syncWithComm(), tlsAttemptHandshake(), tunnelConnectDone(), tunnelConnectedWriteDone(), tunnelConnectReqWriteDone(), TunnelStateData::TunnelStateData(), FwdState::unregister(), ConnStateData::whenClientIpKnown(), and whoisStart().

Ip::Address Comm::Connection::local

Address/Port for the Squid end of a TCP link.

Definition at line 135 of file Connection.h.

Referenced by Format::Format::assemble(), clientHttpConnectionsOpen(), clientTunnelOnError(), comm_import_opened(), comm_init_opened(), comm_open_listener(), comm_openex(), Ftp::Client::connectDataChannel(), Ftp::Server::createDataConnection(), Log::TcpLogger::doConnect(), ConnStateData::fakeAConnectRequest(), FindListeningPortAddressInConn(), IdleConnList::findUseable(), ftpOpenListenSocket(), ftpReadList(), ftpReadRetr(), ftpSendPORT(), GetMarkingsToServer(), Ip::Qos::getNfConnmark(), getOutgoingAddress(), ClientRequestContext::hostHeaderIpVerify(), ClientRequestContext::hostHeaderVerify(), htcpClosePorts(), htcpIncomingConnectionOpened(), htcpOpenPorts(), htcpSocketShutdown(), icpClosePorts(), icpConnectionShutdown(), icpHandleUdp(), icpIncomingConnectionOpened(), icpOpenPorts(), idnsInitVC(), Ip::Intercept::IpfInterception(), Ftp::Gateway::listenForDataChannel(), Ftp::Server::listenForDataConnection(), logAcceptError(), Ip::Intercept::Lookup(), Ip::Intercept::NetfilterInterception(), Comm::TcpAcceptor::oldAccept(), Ipc::Coordinator::openListenSocket(), operator<<(), ConnStateData::parseProxy1p0(), ConnStateData::parseProxy2p0(), Ip::Intercept::PfInterception(), ConnStateData::postHttpsAccept(), prepareAcceleratedURL(), prepareTransparentURL(), ConnStateData::proxyProtocolValidateClient(), PeerSelector::resolveSelected(), send_announce(), setAddrs(), Ipc::SharedListenJoined(), snmpClosePorts(), snmpOpenPorts(), snmpPortOpened(), Ident::Start(), Ipc::StartListening(), statClientRequests(), and ConnStateData::whenClientIpKnown().

nfmark_t Comm::Connection::nfConnmark = 0

Netfilter CONNMARK value previously retrieved from this connection In case of FTP, the CONNMARK will NOT be applied to data connections, for one main reason: the CONNMARK could be set by a third party like iptables and overwriting it in squid may cause side effects and break CONNMARK-based policy. In other words, data connection is related to control connection, but it's not the same.

Definition at line 160 of file Connection.h.

Referenced by Comm::TcpAcceptor::acceptOne(), and copyDetails().

nfmark_t Comm::Connection::nfmark

Netfilter MARK values currently sent on this connection In case of FTP, the MARK will be sent on data connections as well.

Definition at line 152 of file Connection.h.

Referenced by Format::Format::assemble(), Ftp::Client::connectDataChannel(), copyDetails(), GetMarkingsToServer(), Ftp::Gateway::listenForDataChannel(), and Ip::Qos::setSockNfmark().

CachePeer* Comm::Connection::peer_
private

cache_peer data object (if any)

Definition at line 174 of file Connection.h.

Referenced by copyDetails().

hier_code Comm::Connection::peerType

Hierarchy code for this connection link

Definition at line 141 of file Connection.h.

Referenced by copyDetails(), PeerSelector::handlePath(), PeerPoolMgr::openNewConnection(), operator<<(), and HierarchyLogEntry::resetPeerNotes().

Ip::Address Comm::Connection::remote

Address for the Remote end of a TCP link.

Definition at line 138 of file Connection.h.

Referenced by Ftp::Server::acceptDataConnection(), Format::Format::assemble(), ClientHttpRequest::calloutsError(), ClientRequestContext::clientAccessCheckDone(), clientProcessRequest(), clientTunnelOnError(), Ftp::Client::connectDataChannel(), ConnStateData::ConnStateData(), constructHelperQuery(), ErrorState::Convert(), Ftp::Server::createDataConnection(), Adaptation::Icap::Xaction::dnsLookupDone(), Log::TcpLogger::doConnect(), ESIContext::fail(), Ftp::Gateway::ftpAcceptDataConnection(), ftpReadList(), ftpReadRetr(), AccessLogEntry::getLogClientIp(), Ip::Qos::getNfConnmark(), getOutgoingAddress(), ConnStateData::getSslContextDone(), ClientRequestContext::hostHeaderVerifyFailed(), idnsInitVC(), Ipc::ImportFdIntoComm(), Ip::Intercept::IpfInterception(), PconnPool::key(), logAcceptError(), ClientHttpRequest::logRequest(), Ip::Intercept::Lookup(), PeerSelector::noteIp(), Comm::TcpAcceptor::oldAccept(), PeerPoolMgr::openNewConnection(), operator<<(), ConnStateData::parseProxy1p0(), ConnStateData::parseProxy2p0(), peerProbeConnect(), Ip::Intercept::PfInterception(), ConnStateData::pinConnection(), ConnStateData::postHttpsAccept(), clientReplyContext::processMiss(), clientReplyContext::processOnlyIfCachedMiss(), clientReplyContext::processReplyAccessResult(), ConnStateData::proxyProtocolValidateClient(), clientReplyContext::purgeFoundObject(), clientReplyContext::purgeRequest(), PeerSelector::resolveSelected(), clientReplyContext::sendBodyTooLargeError(), clientReplyContext::sendPreconditionFailedError(), ConnStateData::serveDelayedError(), setAddrs(), Ip::Qos::setSockTos(), Log::Format::SquidNative(), Ident::Start(), statClientRequests(), ConnStateData::swanSong(), tunnelConnectDone(), and ConnStateData::whenClientIpKnown().

Eui::Eui48 Comm::Connection::remoteEui48

Definition at line 168 of file Connection.h.

Referenced by Format::Format::assemble(), and Comm::TcpAcceptor::oldAccept().

Eui::Eui64 Comm::Connection::remoteEui64

Definition at line 169 of file Connection.h.

Referenced by Format::Format::assemble(), and Comm::TcpAcceptor::oldAccept().

time_t Comm::Connection::startTime_
private

The time the connection object was created

Definition at line 177 of file Connection.h.

Referenced by copyDetails(), lifeTime(), noteStart(), and startTime().

Security::NegotiationHistory* Comm::Connection::tlsHistory
private

TLS connection details

Definition at line 180 of file Connection.h.

Referenced by hasTlsNegotiations().

tos_t Comm::Connection::tos

Quality of Service TOS values currently sent on this connection

Definition at line 147 of file Connection.h.

Referenced by Format::Format::assemble(), Ftp::Client::connectDataChannel(), copyDetails(), GetMarkingsToServer(), Ftp::Gateway::listenForDataChannel(), and Ip::Qos::setSockTos().


The documentation for this class was generated from the following files:

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors