A simple PeerConnector for Secure ICAP services. No SslBump capabilities. More...

Inheritance diagram for Ssl::IcapPeerConnector:
Collaboration diagram for Ssl::IcapPeerConnector:

Public Types

typedef CbcPointer< PeerConnectorPointer
 

Public Member Functions

 IcapPeerConnector (Adaptation::Icap::ServiceRep::Pointer &service, const Comm::ConnectionPointer &aServerConn, AsyncCall::Pointer &aCallback, AccessLogEntry::Pointer const &alp, const time_t timeout=0)
 
virtual bool initialize (Security::SessionPointer &)
 
virtual void noteNegotiationDone (ErrorState *error)
 
virtual Security::ContextPointer getTlsContext ()
 
bool canBeCalled (AsyncCall &call) const
 whether we can be called More...
 
void callStart (AsyncCall &call)
 
virtual void callEnd ()
 called right after the called job method More...
 
virtual void callException (const std::exception &e)
 called when the job throws during an async call More...
 
virtual void * toCbdata ()=0
 

Static Public Member Functions

static Pointer Start (AsyncJob *job)
 starts a freshly created job (i.e., makes the job asynchronous) More...
 

Protected Member Functions

virtual void start ()
 Preps connection and SSL state. Calls negotiate(). More...
 
virtual bool doneAll () const
 whether positive goal has been reached More...
 
virtual void swanSong ()
 
virtual const char * status () const
 internal cleanup; do not call directly More...
 
void commCloseHandler (const CommCloseCbParams &params)
 The comm_close callback handler. More...
 
void connectionClosed (const char *reason)
 Inform us that the connection is closed. Does the required clean-up. More...
 
bool prepareSocket ()
 
void setReadTimeout ()
 
void negotiate ()
 
bool sslFinalized ()
 
void handleNegotiateError (const int result)
 
void noteWantRead ()
 
bool checkForMissingCertificates ()
 
void startCertDownloading (SBuf &url)
 Start downloading procedure for the given URL. More...
 
void certDownloadingDone (SBuf &object, int status)
 Called by Downloader after a certificate object downloaded. More...
 
virtual void noteWantWrite ()
 
virtual void noteNegotiationError (const int result, const int ssl_error, const int ssl_lib_error)
 
Comm::ConnectionPointer const & serverConnection () const
 mimics FwdState to minimize changes to FwdState::initiate/negotiateSsl More...
 
void bail (ErrorState *error)
 Return an error to the PeerConnector caller. More...
 
void callBack ()
 
void bypassCertValidator ()
 If called the certificates validator will not used. More...
 
void recordNegotiationDetails ()
 
void deleteThis (const char *aReason)
 
void mustStop (const char *aReason)
 
bool done () const
 the job is destroyed in callEnd() when done() More...
 

Protected Attributes

HttpRequestPointer request
 peer connection trigger or cause More...
 
Comm::ConnectionPointer serverConn
 TCP connection to the peer. More...
 
AccessLogEntryPointer al
 info for the future access.log entry More...
 
AsyncCall::Pointer callback
 we call this with the results More...
 
const char * stopReason
 reason for forcing done() to be true More...
 
const char * typeName
 kid (leaf) class name, for debugging More...
 
AsyncCall::Pointer inCall
 the asynchronous call being handled, if any More...
 
const InstanceId< AsyncJobid
 job identifier More...
 

Private Member Functions

 CBDATA_CLASS (IcapPeerConnector)
 

Private Attributes

Adaptation::Icap::ServiceRep::Pointer icapService
 

Detailed Description

Definition at line 50 of file Xaction.cc.

Member Typedef Documentation

◆ Pointer

Definition at line 68 of file PeerConnector.h.

Constructor & Destructor Documentation

◆ IcapPeerConnector()

Ssl::IcapPeerConnector::IcapPeerConnector ( Adaptation::Icap::ServiceRep::Pointer service,
const Comm::ConnectionPointer aServerConn,
AsyncCall::Pointer aCallback,
AccessLogEntry::Pointer const &  alp,
const time_t  timeout = 0 
)
inline

Definition at line 53 of file Xaction.cc.

References error().

Member Function Documentation

◆ bail()

◆ bypassCertValidator()

void Security::PeerConnector::bypassCertValidator ( )
inlineprotectedinherited

◆ callBack()

◆ callEnd()

void AsyncJob::callEnd ( )
virtualinherited

◆ callException()

◆ callStart()

void AsyncJob::callStart ( AsyncCall call)
inherited

◆ canBeCalled()

bool AsyncJob::canBeCalled ( AsyncCall call) const
inherited

Definition at line 101 of file AsyncJob.cc.

References AsyncCall::cancel(), debugs, HERE(), AsyncJob::inCall, and NULL.

Referenced by AsyncJob::swanSong().

◆ CBDATA_CLASS()

Ssl::IcapPeerConnector::CBDATA_CLASS ( IcapPeerConnector  )
private

◆ certDownloadingDone()

◆ checkForMissingCertificates()

bool Security::PeerConnector::checkForMissingCertificates ( )
protectedinherited

◆ commCloseHandler()

void Security::PeerConnector::commCloseHandler ( const CommCloseCbParams params)
protectedinherited

◆ connectionClosed()

void Security::PeerConnector::connectionClosed ( const char *  reason)
protectedinherited

◆ deleteThis()

void AsyncJob::deleteThis ( const char *  aReason)
protectedinherited

◆ done()

◆ doneAll()

bool Security::PeerConnector::doneAll ( ) const
protectedvirtualinherited

◆ getTlsContext()

virtual Security::ContextPointer Ssl::IcapPeerConnector::getTlsContext ( )
inlinevirtual

Must implemented by the kid classes to return the TLS context object to use for building the encryption context objects.

Implements Security::PeerConnector.

Definition at line 65 of file Xaction.cc.

◆ handleNegotiateError()

void Security::PeerConnector::handleNegotiateError ( const int  result)
protectedinherited

Called when the negotiation step aborted because data needs to be transferred to/from server or on error. In the first case setups the appropriate Comm::SetSelect handler. In second case fill an error and report to the PeerConnector caller.

Definition at line 395 of file PeerConnector.cc.

References DBG_IMPORTANT, debugs, Comm::Connection::fd, fd_table, Must, Security::PeerConnector::noteNegotiationError(), Security::PeerConnector::noteWantRead(), Security::PeerConnector::noteWantWrite(), Security::PeerConnector::recordNegotiationDetails(), and Security::PeerConnector::serverConnection().

Referenced by Security::PeerConnector::negotiate(), and Security::PeerConnector::CbDialer::~CbDialer().

◆ initialize()

bool Ssl::IcapPeerConnector::initialize ( Security::SessionPointer serverSession)
virtual

◆ mustStop()

void AsyncJob::mustStop ( const char *  aReason)
protectedinherited

Definition at line 69 of file AsyncJob.cc.

References debugs, AsyncJob::inCall, Must, NULL, AsyncJob::stopReason, and AsyncJob::typeName.

Referenced by HttpStateData::abortAll(), Ftp::Client::abortAll(), Comm::TcpAcceptor::acceptOne(), Adaptation::Ecap::XactionRep::adaptationAborted(), Adaptation::AccessCheck::callBack(), AsyncJob::callException(), Security::PeerConnector::connectionClosed(), HttpStateData::continueAfterParsingHeader(), Ftp::Client::ctrlClosed(), Adaptation::Iterator::handleAdaptationBlock(), Adaptation::Iterator::handleAdaptationError(), Log::TcpLogger::handleClosure(), Adaptation::Icap::Xaction::handleCommClosed(), Mgr::Forwarder::handleError(), Ipc::Forwarder::handleError(), Ipc::Forwarder::handleException(), Ipc::Inquirer::handleException(), HttpStateData::handleMoreRequestBodyAvailable(), Ipc::Inquirer::handleRemoteAck(), Ipc::Forwarder::handleTimeout(), HttpStateData::httpStateConnClosed(), HttpStateData::httpTimeout(), Comm::ConnOpener::noteAbort(), Adaptation::Icap::ModXact::noteBodyConsumerAborted(), Snmp::Forwarder::noteCommClosed(), Snmp::Inquirer::noteCommClosed(), Mgr::Inquirer::noteCommClosed(), Mgr::Forwarder::noteCommClosed(), Mgr::StoreToCommWriter::noteCommClosed(), Adaptation::Icap::Xaction::noteCommRead(), Rock::HeaderUpdater::noteDoneReading(), Adaptation::Iterator::noteInitiatorAborted(), Adaptation::Icap::Xaction::noteInitiatorAborted(), Adaptation::Ecap::XactionRep::noteInitiatorAborted(), HttpStateData::readReply(), Comm::ConnOpener::sendAnswer(), Rock::Rebuild::start(), Security::PeerConnector::start(), HttpStateData::start(), Ipc::UdsSender::timedout(), and HttpStateData::wroteLast().

◆ negotiate()

void Security::PeerConnector::negotiate ( )
protectedinherited

◆ noteNegotiationDone()

void Ssl::IcapPeerConnector::noteNegotiationDone ( ErrorState error)
virtual

Called when the SSL negotiation to the server completed and the certificates validated using the cert validator.

Parameters
errorif not NULL the SSL negotiation was aborted with an error

Reimplemented from Security::PeerConnector.

Definition at line 728 of file Xaction.cc.

References fd_table, and Security::MaybeGetSessionResumeData().

◆ noteNegotiationError()

void Security::PeerConnector::noteNegotiationError ( const int  result,
const int  ssl_error,
const int  ssl_lib_error 
)
protectedvirtualinherited

Called when the SSL_connect function aborts with an SSL negotiation error

Parameters
resultthe SSL_connect return code
ssl_errorthe error code returned from the SSL_get_error function
ssl_lib_errorthe error returned from the ERR_Get_Error function

Reimplemented in Ssl::PeekingPeerConnector.

Definition at line 499 of file PeerConnector.cc.

References Security::PeerConnector::al, Security::PeerConnector::bail(), DBG_IMPORTANT, debugs, ERR_SECURE_CONNECT_FAIL, Security::ErrorString(), Comm::Connection::fd, fd_table, ErrorState::NewForwarding(), Security::PeerConnector::noteNegotiationDone(), NULL, Security::PeerConnector::request, Security::PeerConnector::serverConnection(), SQUID_ERR_SSL_HANDSHAKE, and ssl_ex_index_ssl_error_detail.

Referenced by Security::PeerConnector::handleNegotiateError(), Ssl::PeekingPeerConnector::noteNegotiationError(), and Security::PeerConnector::CbDialer::~CbDialer().

◆ noteWantRead()

void Security::PeerConnector::noteWantRead ( )
protectedinherited

◆ noteWantWrite()

void Security::PeerConnector::noteWantWrite ( )
protectedvirtualinherited

◆ prepareSocket()

bool Security::PeerConnector::prepareSocket ( )
protectedinherited

Sets up TCP socket-related notification callbacks if things go wrong. If socket already closed return false, else install the comm_close handler to monitor the socket.

Definition at line 86 of file PeerConnector.cc.

References Security::PeerConnector::closeHandler, comm_add_close_handler(), Security::PeerConnector::commCloseHandler(), Security::PeerConnector::connectionClosed(), debugs, fd_table, Comm::IsConnOpen(), JobCallback, and Security::PeerConnector::serverConnection().

Referenced by Security::PeerConnector::start(), and Security::PeerConnector::CbDialer::~CbDialer().

◆ recordNegotiationDetails()

◆ serverConnection()

◆ setReadTimeout()

void Security::PeerConnector::setReadTimeout ( )
protectedinherited

◆ sslFinalized()

◆ Start()

◆ start()

void Security::PeerConnector::start ( )
protectedvirtualinherited

◆ startCertDownloading()

◆ status()

const char * Security::PeerConnector::status ( ) const
protectedvirtualinherited

◆ swanSong()

◆ toCbdata()

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

Member Data Documentation

◆ al

◆ callback

◆ icapService

Adaptation::Icap::ServiceRep::Pointer Ssl::IcapPeerConnector::icapService
private

Definition at line 70 of file Xaction.cc.

◆ id

const InstanceId<AsyncJob> AsyncJob::id
protectedinherited

Definition at line 72 of file AsyncJob.h.

◆ inCall

◆ request

◆ serverConn

◆ stopReason

const char* AsyncJob::stopReason
protectedinherited

◆ typeName


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors