Inheritance diagram for TunnelStateData:
Collaboration diagram for TunnelStateData:

Classes

class  Connection
 
class  MyAnswerDialer
 Gives Security::PeerConnector access to Answer in the TunnelStateData callback dialer. More...
 

Public Member Functions

 TunnelStateData (ClientHttpRequest *)
 
virtual ~TunnelStateData ()
 
 TunnelStateData (const TunnelStateData &)
 
TunnelStateDataoperator= (const TunnelStateData &)
 
void readConnectResponse ()
 Starts reading peer response to our CONNECT request. More...
 
void connectExchangeCheckpoint ()
 Called when we may be done handling a CONNECT exchange with the peer. More...
 
bool noConnections () const
 
const char * getHost () const
 
bool waitingForConnectRequest () const
 Whether we are writing a CONNECT request to a peer. More...
 
bool waitingForConnectResponse () const
 Whether we are reading a CONNECT response from a peer. More...
 
bool waitingForConnectExchange () const
 Whether we are waiting for the CONNECT request/response exchange with the peer. More...
 
bool clientExpectsConnectResponse () const
 Whether the client sent a CONNECT request to us. More...
 
void informUserOfPeerError (const char *errMsg, size_t)
 
void startConnecting ()
 
void noteConnectFailure (const Comm::ConnectionPointer &conn)
 reacts to a failure to establish the given TCP connection More...
 
void copyRead (Connection &from, IOCB *completion)
 
void connectToPeer ()
 continue to set up connection to a peer, going async for SSL peers More...
 
virtual void noteDestination (Comm::ConnectionPointer conn) override
 called when a new unique destination has been found More...
 
virtual void noteDestinationsEnd (ErrorState *selectionError) override
 
void saveError (ErrorState *finalError)
 remembers an error to be used if there will be no more connection attempts More...
 
void sendError (ErrorState *finalError, const char *reason)
 
bool keepGoingAfterRead (size_t len, Comm::Flag errcode, int xerrno, Connection &from, Connection &to)
 
void copy (size_t len, Connection &from, Connection &to, IOCB *)
 
void handleConnectResponse (const size_t chunkSize)
 
void readServer (char *buf, size_t len, Comm::Flag errcode, int xerrno)
 
void readClient (char *buf, size_t len, Comm::Flag errcode, int xerrno)
 
void writeClientDone (char *buf, size_t len, Comm::Flag flag, int xerrno)
 
void writeServerDone (char *buf, size_t len, Comm::Flag flag, int xerrno)
 
void readConnectResponseDone (char *buf, size_t len, Comm::Flag errcode, int xerrno)
 Called when we read [a part of] CONNECT response from the peer. More...
 
void copyClientBytes ()
 
void copyServerBytes ()
 
void startSelectingDestinations (HttpRequest *request, const AccessLogEntry::Pointer &ale, StoreEntry *entry)
 
virtual void * toCbdata ()=0
 

Static Public Member Functions

static void ReadClient (const Comm::ConnectionPointer &, char *buf, size_t len, Comm::Flag errcode, int xerrno, void *data)
 
static void ReadServer (const Comm::ConnectionPointer &, char *buf, size_t len, Comm::Flag errcode, int xerrno, void *data)
 
static void WriteClientDone (const Comm::ConnectionPointer &, char *buf, size_t len, Comm::Flag flag, int xerrno, void *data)
 
static void WriteServerDone (const Comm::ConnectionPointer &, char *buf, size_t len, Comm::Flag flag, int xerrno, void *data)
 
static void ReadConnectResponseDone (const Comm::ConnectionPointer &, char *buf, size_t len, Comm::Flag errcode, int xerrno, void *data)
 

Public Attributes

char * url
 
CbcPointer< ClientHttpRequesthttp
 
HttpRequest::Pointer request
 
AccessLogEntryPointer al
 
Comm::ConnectionList serverDestinations
 
Connection client
 
Connection server
 
intstatus_ptr
 pointer for logging HTTP status More...
 
LogTagslogTag_ptr
 pointer for logging Squid processing code More...
 
MemBufconnectRespBuf
 accumulates peer CONNECT response when we need it More...
 
bool connectReqWriting
 whether we are writing a CONNECT request to a peer More...
 
SBuf preReadClientData
 
SBuf preReadServerData
 
time_t startTime
 object creation time, before any peer selection/connection attempts More...
 
bool subscribed = false
 whether noteDestination() and noteDestinationsEnd() calls are allowed More...
 

Private Member Functions

 CBDATA_CHILD (TunnelStateData)
 
void connectedToPeer (Security::EncryptorAnswer &answer)
 callback handler after connection setup (including any encryption) More...
 

Private Attributes

ErrorStatesavedError = nullptr
 details of the "last tunneling attempt" failure (if it failed) More...
 

Detailed Description

TunnelStateData is the state engine performing the tasks for setup of a TCP tunnel from an existing open client FD to a server then shuffling binary data between the resulting FD pair.

Definition at line 66 of file tunnel.cc.

Constructor & Destructor Documentation

TunnelStateData::~TunnelStateData ( )
virtual

Definition at line 334 of file tunnel.cc.

References assert, connectRespBuf, debugs, noConnections(), savedError, serverDestinations, url, and xfree.

TunnelStateData::TunnelStateData ( const TunnelStateData )

Member Function Documentation

TunnelStateData::CBDATA_CHILD ( TunnelStateData  )
private
void TunnelStateData::connectToPeer ( )
void TunnelStateData::copy ( size_t  len,
Connection from,
Connection to,
IOCB completion 
)
const char* TunnelStateData::getHost ( ) const
inline
void TunnelStateData::handleConnectResponse ( const size_t  chunkSize)
void TunnelStateData::informUserOfPeerError ( const char *  errMsg,
size_t  sz 
)
bool TunnelStateData::keepGoingAfterRead ( size_t  len,
Comm::Flag  errcode,
int  xerrno,
Connection from,
Connection to 
)
bool TunnelStateData::noConnections ( ) const
void TunnelStateData::noteDestination ( Comm::ConnectionPointer  path)
overridevirtual

Implements PeerSelectionInitiator.

Definition at line 1216 of file tunnel.cc.

References serverDestinations, and startConnecting().

void TunnelStateData::noteDestinationsEnd ( ErrorState error)
overridevirtual

called when there will be no more noteDestination() calls

Parameters
erroris a possible reason why no destinations were found; it is guaranteed to be nil if there was at least one noteDestination() call

Implements PeerSelectionInitiator.

Definition at line 1227 of file tunnel.cc.

References ERR_CANNOT_FORWARD, RefCount< C >::getRaw(), Must, request, savedError, Http::scServiceUnavailable, sendError(), serverDestinations, and PeerSelectionInitiator::subscribed.

TunnelStateData& TunnelStateData::operator= ( const TunnelStateData )
void TunnelStateData::ReadClient ( const Comm::ConnectionPointer ,
char *  buf,
size_t  len,
Comm::Flag  errcode,
int  xerrno,
void *  data 
)
static

Definition at line 562 of file tunnel.cc.

References assert, cbdataReferenceValid(), and readClient().

Referenced by copyClientBytes(), and tunnelDelayedClientRead().

void TunnelStateData::ReadConnectResponseDone ( const Comm::ConnectionPointer ,
char *  buf,
size_t  len,
Comm::Flag  errcode,
int  xerrno,
void *  data 
)
static

Definition at line 478 of file tunnel.cc.

References assert, cbdataReferenceValid(), and readConnectResponseDone().

Referenced by readConnectResponse().

void TunnelStateData::ReadServer ( const Comm::ConnectionPointer c,
char *  buf,
size_t  len,
Comm::Flag  errcode,
int  xerrno,
void *  data 
)
static

Definition at line 392 of file tunnel.cc.

References assert, cbdataReferenceValid(), debugs, HERE(), and readServer().

Referenced by copyServerBytes(), and tunnelDelayedServerRead().

void TunnelStateData::saveError ( ErrorState finalError)

Definition at line 1248 of file tunnel.cc.

References assert, debugs, error(), and savedError.

Referenced by tunnelConnectDone().

void TunnelStateData::sendError ( ErrorState finalError,
const char *  reason 
)

Starts sending the given error message to the client, leading to the eventual transaction termination. Call with savedError to send savedError.

Definition at line 1259 of file tunnel.cc.

References assert, ErrorState::callback, ErrorState::callback_data, client, TunnelStateData::Connection::conn, debugs, errorSend(), HttpRequest::hier, ErrorState::httpStatus, request, savedError, status_ptr, HierarchyLogEntry::stopPeerClock(), PeerSelectionInitiator::subscribed, and tunnelErrorComplete.

Referenced by connectedToPeer(), informUserOfPeerError(), noteConnectFailure(), noteDestinationsEnd(), and startConnecting().

void TunnelStateData::startConnecting ( )
void PeerSelectionInitiator::startSelectingDestinations ( HttpRequest request,
const AccessLogEntry::Pointer ale,
StoreEntry entry 
)
inherited

Initiates asynchronous peer selection that eventually results in zero or more noteDestination() calls and exactly one noteDestinationsEnd() call.

Definition at line 182 of file peer_select.cc.

References peerSelect(), and PeerSelectionInitiator::subscribed.

Referenced by FwdState::start(), and tunnelStart().

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited
bool TunnelStateData::waitingForConnectExchange ( ) const
inline
bool TunnelStateData::waitingForConnectRequest ( ) const
inline
bool TunnelStateData::waitingForConnectResponse ( ) const
inline
void TunnelStateData::WriteClientDone ( const Comm::ConnectionPointer ,
char *  buf,
size_t  len,
Comm::Flag  flag,
int  xerrno,
void *  data 
)
static
void TunnelStateData::WriteServerDone ( const Comm::ConnectionPointer ,
char *  buf,
size_t  len,
Comm::Flag  flag,
int  xerrno,
void *  data 
)
static

Member Data Documentation

AccessLogEntryPointer TunnelStateData::al

Definition at line 92 of file tunnel.cc.

Referenced by connectToPeer(), tunnelRelayConnectRequest(), and TunnelStateData().

bool TunnelStateData::connectReqWriting
LogTags* TunnelStateData::logTag_ptr

Definition at line 174 of file tunnel.cc.

Referenced by informUserOfPeerError(), tunnelStartShoveling(), and TunnelStateData().

SBuf TunnelStateData::preReadClientData

Definition at line 177 of file tunnel.cc.

Referenced by copyClientBytes(), and tunnelStartShoveling().

SBuf TunnelStateData::preReadServerData

Definition at line 178 of file tunnel.cc.

Referenced by copyServerBytes(), and switchToTunnel().

ErrorState* TunnelStateData::savedError = nullptr
private
Comm::ConnectionList TunnelStateData::serverDestinations
time_t TunnelStateData::startTime

Definition at line 179 of file tunnel.cc.

Referenced by noteConnectFailure(), and startConnecting().

char* TunnelStateData::url

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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors