Inheritance diagram for TunnelStateData:
Collaboration diagram for TunnelStateData:


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 &)
bool noConnections () const
const char * getHost () const
bool clientExpectsConnectResponse () const
 Whether the client sent a CONNECT request to us. More...
void startConnecting ()
void noteConnectFailure (const Comm::ConnectionPointer &conn)
 reacts to a failure to establish the given TCP connection More...
void notePeerReadyToShovel ()
 called when negotiations with the peer have been successfully completed 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 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 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)

Public Attributes

char * url
CbcPointer< ClientHttpRequesthttp
HttpRequest::Pointer request
AccessLogEntryPointer al
Comm::ConnectionList serverDestinations
Connection client
Connection server
 pointer for logging HTTP status More...
 pointer for logging Squid processing code More...
SBuf preReadClientData
SBuf preReadServerData
time_t startTime
bool waitingForConnectExchange
 Whether we are waiting for the CONNECT request/response exchange with the peer. More...
bool subscribed = false
 whether noteDestination() and noteDestinationsEnd() calls are allowed More...

Private Member Functions

 CBDATA_CHILD (TunnelStateData)
void usePinned ()
 send request on an existing connection dedicated to the requesting client More...
void connectedToPeer (Security::EncryptorAnswer &answer)
 callback handler after connection setup (including any encryption) More...
void tunnelEstablishmentDone (Http::TunnelerAnswer &answer)
 resumes operations after the (possibly failed) HTTP CONNECT exchange 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 68 of file

Constructor & Destructor Documentation

◆ TunnelStateData() [1/2]

◆ ~TunnelStateData()

TunnelStateData::~TunnelStateData ( )

Definition at line 322 of file

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

◆ TunnelStateData() [2/2]

TunnelStateData::TunnelStateData ( const TunnelStateData )

Member Function Documentation


TunnelStateData::CBDATA_CHILD ( TunnelStateData  )

◆ clientExpectsConnectResponse()

◆ connectedToPeer()

◆ connectToPeer()

void TunnelStateData::connectToPeer ( )

◆ copy()

void TunnelStateData::copy ( size_t  len,
Connection from,
Connection to,
IOCB completion 

◆ copyClientBytes()

◆ copyRead()

◆ copyServerBytes()

◆ getHost()

const char* TunnelStateData::getHost ( ) const

◆ keepGoingAfterRead()

bool TunnelStateData::keepGoingAfterRead ( size_t  len,
Comm::Flag  errcode,
int  xerrno,
Connection from,
Connection to 

◆ noConnections()

bool TunnelStateData::noConnections ( ) const

◆ noteConnectFailure()

◆ noteDestination()

void TunnelStateData::noteDestination ( Comm::ConnectionPointer  path)

Implements PeerSelectionInitiator.

Definition at line 1027 of file

References assert, serverDestinations, startConnecting(), and usePinned().

◆ noteDestinationsEnd()

void TunnelStateData::noteDestinationsEnd ( ErrorState error)

called when there will be no more noteDestination() calls

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 1050 of file

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

◆ notePeerReadyToShovel()

◆ operator=()

TunnelStateData& TunnelStateData::operator= ( const TunnelStateData )

◆ ReadClient()

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

Definition at line 424 of file

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

Referenced by copyClientBytes(), and tunnelDelayedClientRead().

◆ readClient()

◆ ReadServer()

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

Definition at line 379 of file

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

Referenced by copyServerBytes(), and tunnelDelayedServerRead().

◆ readServer()

◆ saveError()

void TunnelStateData::saveError ( ErrorState finalError)

Definition at line 1071 of file

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

Referenced by tunnelConnectDone().

◆ sendError()

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 1082 of file

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(), noteConnectFailure(), noteDestinationsEnd(), tunnelEstablishmentDone(), and usePinned().

◆ startConnecting()

void TunnelStateData::startConnecting ( )

starts connecting to the next hop, either for the first time or while recovering from the previous connect failure

Definition at line 1106 of file

References assert, commCbCall(), debugs, GetMarkingsToServer(), RefCount< C >::getRaw(), HttpRequest::hier, request, serverDestinations, Comm::ConnOpener::setHost(), AsyncJob::Start(), HierarchyLogEntry::startPeerClock(), startTime, tunnelConnectDone, and url.

Referenced by clientExpectsConnectResponse(), noteConnectFailure(), and noteDestination().

◆ startSelectingDestinations()

void PeerSelectionInitiator::startSelectingDestinations ( HttpRequest request,
const AccessLogEntry::Pointer ale,
StoreEntry entry 

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

Definition at line 193 of file

References peerSelect().

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

◆ toCbdata()

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

◆ tunnelEstablishmentDone()

◆ usePinned()

◆ WriteClientDone()

void TunnelStateData::WriteClientDone ( const Comm::ConnectionPointer ,
char *  buf,
size_t  len,
Comm::Flag  flag,
int  xerrno,
void *  data 

◆ writeClientDone()

◆ WriteServerDone()

void TunnelStateData::WriteServerDone ( const Comm::ConnectionPointer ,
char *  buf,
size_t  len,
Comm::Flag  flag,
int  xerrno,
void *  data 

◆ writeServerDone()

Member Data Documentation

◆ al

◆ client

◆ http

◆ logTag_ptr

LogTags* TunnelStateData::logTag_ptr

Definition at line 162 of file

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

◆ preReadClientData

SBuf TunnelStateData::preReadClientData

Definition at line 164 of file

Referenced by copyClientBytes(), and tunnelStartShoveling().

◆ preReadServerData

SBuf TunnelStateData::preReadServerData

Definition at line 165 of file

Referenced by copyServerBytes(), switchToTunnel(), and tunnelEstablishmentDone().

◆ request

◆ savedError

ErrorState* TunnelStateData::savedError = nullptr

◆ server

◆ serverDestinations

Comm::ConnectionList TunnelStateData::serverDestinations

◆ startTime

time_t TunnelStateData::startTime

object creation time, before any peer selection/connection attempts

Definition at line 166 of file

Referenced by noteConnectFailure(), and startConnecting().

◆ status_ptr

◆ subscribed

◆ url

char* TunnelStateData::url

Definition at line 85 of file

Referenced by startConnecting(), tunnelStart(), TunnelStateData(), and ~TunnelStateData().

◆ waitingForConnectExchange

bool TunnelStateData::waitingForConnectExchange

Definition at line 168 of file

Referenced by connectedToPeer(), tunnelEstablishmentDone(), and tunnelStartShoveling().

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






Web Site Translations