#include <Xaction.h>

Inheritance diagram for Adaptation::Icap::Xaction:
Collaboration diagram for Adaptation::Icap::Xaction:

Public Types

typedef CbcPointer< AsyncJobPointer
 

Public Member Functions

 Xaction (const char *aTypeName, ServiceRep::Pointer &aService)
 
 ~Xaction () override
 
void disableRetries ()
 
void disableRepeats (const char *reason)
 
bool retriable () const
 
bool repeatable () const
 
void noteCommConnected (const CommConnectCbParams &io)
 called when the connection attempt to an ICAP service completes (successfully or not) More...
 
void noteCommWrote (const CommIoCbParams &io)
 
void noteCommRead (const CommIoCbParams &io)
 
void noteCommTimedout (const CommTimeoutCbParams &io)
 
void noteCommClosed (const CommCloseCbParams &io)
 
void callException (const std::exception &e) override
 called when the job throws during an async call More...
 
void callEnd () override
 called right after the called job method More...
 
virtual void clearError ()
 clear stored error details, if any; used for retries/repeats More...
 
virtual AccessLogEntry::Pointer masterLogEntry ()
 
void dnsLookupDone (std::optional< Ip::Address >)
 
ServiceRepservice ()
 
void initiator (const CbcPointer< Initiator > &i)
 sets initiator More...
 
bool canBeCalled (AsyncCall &call) const
 whether we can be called More...
 
void callStart (AsyncCall &call)
 
void handleStopRequest ()
 process external request to terminate now (i.e. during this async call) More...
 
virtual void * toCbdata ()=0
 

Static Public Member Functions

static void Start (const Pointer &job)
 
static void RegisterWithCacheManager ()
 

Public Attributes

HttpRequesticapRequest
 sent (or at least created) ICAP request More...
 
HttpReply::Pointer icapReply
 received ICAP reply, if any More...
 
int attempts
 the number of times we tried to get to the service, including this time More...
 
const InstanceId< AsyncJobid
 job identifier More...
 

Protected Member Functions

void start () override
 called by AsyncStart; do not call directly More...
 
void noteInitiatorAborted () override
 
virtual void startShoveling ()=0
 starts sending/receiving ICAP messages More...
 
virtual void handleCommWrote (size_t sz)=0
 
virtual void handleCommRead (size_t sz)=0
 
void handleSecuredPeer (Security::EncryptorAnswer &answer)
 
virtual void detailError (const ErrorDetailPointer &)
 record error detail if possible More...
 
void openConnection ()
 
void closeConnection ()
 
bool haveConnection () const
 
void scheduleRead ()
 
void scheduleWrite (MemBuf &buf)
 
void updateTimeout ()
 
void cancelRead ()
 
bool parseHttpMsg (Http::Message *msg)
 
bool mayReadMore () const
 
virtual bool doneReading () const
 
virtual bool doneWriting () const
 
bool doneWithIo () const
 
bool doneAll () const override
 whether positive goal has been reached More...
 
void swanSong () override
 
const char * status () const override
 internal cleanup; do not call directly More...
 
virtual void fillPendingStatus (MemBuf &buf) const
 
virtual void fillDoneStatus (MemBuf &buf) const
 
virtual bool fillVirginHttpHeader (MemBuf &) const
 
void setOutcome (const XactOutcome &xo)
 
virtual void finalizeLogInfo ()
 
void sendAnswer (const Answer &answer)
 
void tellQueryAborted (bool final)
 
void clearInitiator ()
 
void deleteThis (const char *aReason)
 
void mustStop (const char *aReason)
 
bool done () const
 the job is destroyed in callEnd() when done() More...
 

Static Protected Member Functions

static void ReportAllJobs (StoreEntry *)
 writes a cache manager report about all jobs existing in this worker More...
 

Protected Attributes

Adaptation::Icap::ServiceRep::Pointer theService
 
SBuf readBuf
 
bool commEof
 
bool reuseConnection
 
bool isRetriable
 can retry on persistent connection failures More...
 
bool isRepeatable
 can repeat if no or unsatisfactory response More...
 
bool ignoreLastWrite
 
bool waitingForDns
 expecting a ipcache_nbgethostbyname() callback More...
 
AsyncCall::Pointer reader
 
AsyncCall::Pointer writer
 
AccessLogEntry::Pointer alep
 icap.log entry More...
 
AccessLogEntryal
 short for *alep More...
 
timeval icap_tr_start
 
timeval icap_tio_start
 
timeval icap_tio_finish
 
CbcPointer< InitiatortheInitiator
 
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...
 
bool started_ = false
 Start() has finished successfully. More...
 
bool swanSang_ = false
 swanSong() was called More...
 

Private Member Functions

void useTransportConnection (const Comm::ConnectionPointer &)
 
void useIcapConnection (const Comm::ConnectionPointer &)
 react to the availability of a fully-ready ICAP connection More...
 
void dieOnConnectionFailure ()
 
void tellQueryAborted ()
 
void maybeLog ()
 
virtual void finalizedInCbdataChild ()=0
 hack: ensure CBDATA_CHILD() after a toCbdata()-defining CBDATA_INTERMEDIATE() More...
 

Private Attributes

JobWait< Comm::ConnOpenertransportWait
 waits for a transport connection to the ICAP server to be established/opened More...
 
JobWait< Ssl::IcapPeerConnectorencryptionWait
 waits for the established transport connection to be secured/encrypted More...
 
Comm::ConnectionPointer connection
 open and, if necessary, secured connection to the ICAP server (or nil) More...
 
AsyncCall::Pointer closer
 

Detailed Description

Definition at line 43 of file Xaction.h.

Member Typedef Documentation

◆ Pointer

Definition at line 34 of file AsyncJob.h.

Constructor & Destructor Documentation

◆ Xaction()

Adaptation::Icap::Xaction::Xaction ( const char *  aTypeName,
ServiceRep::Pointer aService 
)

◆ ~Xaction()

Adaptation::Icap::Xaction::~Xaction ( )
override

Definition at line 97 of file Xaction.cc.

References debugs, and HTTPMSGUNLOCK().

Member Function Documentation

◆ callEnd()

void Adaptation::Icap::Xaction::callEnd ( )
overridevirtual

called right after the called job method

Reimplemented from AsyncJob.

Definition at line 381 of file Xaction.cc.

References AsyncJob::callEnd(), and debugs.

◆ callException()

void Adaptation::Icap::Xaction::callException ( const std::exception &  e)
overridevirtual

Reimplemented from AsyncJob.

Definition at line 374 of file Xaction.cc.

References AsyncJob::callException(), and Adaptation::Icap::xoError.

Referenced by Adaptation::Icap::ModXact::callException().

◆ callStart()

void AsyncJob::callStart ( AsyncCall call)
inherited

◆ canBeCalled()

bool AsyncJob::canBeCalled ( AsyncCall call) const
inherited

Definition at line 117 of file AsyncJob.cc.

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

◆ cancelRead()

void Adaptation::Icap::Xaction::cancelRead ( )
protected

Definition at line 488 of file Xaction.cc.

References Must, and Comm::ReadCancel().

◆ clearError()

virtual void Adaptation::Icap::Xaction::clearError ( )
inlinevirtual

Reimplemented in Adaptation::Icap::ModXact.

Definition at line 118 of file Xaction.h.

Referenced by Adaptation::Icap::Launcher::launchXaction().

◆ clearInitiator()

void Adaptation::Initiate::clearInitiator ( )
protectedinherited

Definition at line 74 of file Initiate.cc.

◆ closeConnection()

void Adaptation::Icap::Xaction::closeConnection ( )
protected

◆ deleteThis()

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

◆ detailError()

virtual void Adaptation::Icap::Xaction::detailError ( const ErrorDetailPointer )
inlineprotectedvirtual

Reimplemented in Adaptation::Icap::ModXact.

Definition at line 82 of file Xaction.h.

◆ dieOnConnectionFailure()

void Adaptation::Icap::Xaction::dieOnConnectionFailure ( )
private

Definition at line 308 of file Xaction.cc.

References debugs, MakeNamedErrorDetail(), and TexcHere.

Referenced by dnsLookupDone().

◆ disableRepeats()

void Adaptation::Icap::Xaction::disableRepeats ( const char *  reason)

Definition at line 125 of file Xaction.cc.

References debugs.

Referenced by Adaptation::Icap::Launcher::launchXaction().

◆ disableRetries()

void Adaptation::Icap::Xaction::disableRetries ( )

Definition at line 118 of file Xaction.cc.

References debugs.

Referenced by Adaptation::Icap::Launcher::launchXaction().

◆ dnsLookupDone()

◆ done()

bool AsyncJob::done ( ) const
protectedinherited

◆ doneAll()

bool Adaptation::Icap::Xaction::doneAll ( ) const
overrideprotectedvirtual

Reimplemented from AsyncJob.

Definition at line 390 of file Xaction.cc.

References AsyncJob::doneAll().

Referenced by Adaptation::Icap::ModXact::doneAll().

◆ doneReading()

bool Adaptation::Icap::Xaction::doneReading ( ) const
protectedvirtual

Reimplemented in Adaptation::Icap::ModXact, and Adaptation::Icap::OptXact.

Definition at line 524 of file Xaction.cc.

◆ doneWithIo()

bool Adaptation::Icap::Xaction::doneWithIo ( ) const
protected

Definition at line 534 of file Xaction.cc.

◆ doneWriting()

bool Adaptation::Icap::Xaction::doneWriting ( ) const
protectedvirtual

Reimplemented in Adaptation::Icap::ModXact.

Definition at line 529 of file Xaction.cc.

◆ fillDoneStatus()

void Adaptation::Icap::Xaction::fillDoneStatus ( MemBuf buf) const
protectedvirtual

Reimplemented in Adaptation::Icap::ModXact.

Definition at line 668 of file Xaction.cc.

References MemBuf::append(), and Packable::appendf().

Referenced by Adaptation::Icap::ModXact::fillDoneStatus().

◆ fillPendingStatus()

void Adaptation::Icap::Xaction::fillPendingStatus ( MemBuf buf) const
protectedvirtual

Reimplemented in Adaptation::Icap::ModXact.

Definition at line 650 of file Xaction.cc.

References MemBuf::append(), and Packable::appendf().

Referenced by Adaptation::Icap::ModXact::fillPendingStatus().

◆ fillVirginHttpHeader()

bool Adaptation::Icap::Xaction::fillVirginHttpHeader ( MemBuf ) const
protectedvirtual

Reimplemented in Adaptation::Icap::ModXact.

Definition at line 677 of file Xaction.cc.

◆ finalizedInCbdataChild()

virtual void CbdataParent::finalizedInCbdataChild ( )
privatepure virtualinherited

◆ finalizeLogInfo()

◆ handleCommRead()

virtual void Adaptation::Icap::Xaction::handleCommRead ( size_t  sz)
protectedpure virtual

◆ handleCommWrote()

virtual void Adaptation::Icap::Xaction::handleCommWrote ( size_t  sz)
protectedpure virtual

◆ handleSecuredPeer()

◆ handleStopRequest()

void AsyncJob::handleStopRequest ( )
inlineinherited

Definition at line 73 of file AsyncJob.h.

References AsyncJob::mustStop().

◆ haveConnection()

bool Adaptation::Icap::Xaction::haveConnection ( ) const
protected

Definition at line 541 of file Xaction.cc.

◆ initiator()

void Adaptation::Initiate::initiator ( const CbcPointer< Initiator > &  i)
inherited

Definition at line 54 of file Initiate.cc.

References Must, and CbcPointer< Cbc >::valid().

Referenced by Adaptation::Initiator::initiateAdaptation().

◆ masterLogEntry()

AccessLogEntry::Pointer Adaptation::Icap::Xaction::masterLogEntry ( )
virtual

Reimplemented in Adaptation::Icap::ModXact.

Definition at line 105 of file Xaction.cc.

References Store::nil.

◆ maybeLog()

void Adaptation::Icap::Xaction::maybeLog ( )
private

Definition at line 605 of file Xaction.cc.

References IcapLogfileStatus, icapLogLog(), and LOG_ENABLE.

◆ mayReadMore()

bool Adaptation::Icap::Xaction::mayReadMore ( ) const
protected

Definition at line 518 of file Xaction.cc.

◆ mustStop()

◆ noteCommClosed()

void Adaptation::Icap::Xaction::noteCommClosed ( const CommCloseCbParams io)

Definition at line 361 of file Xaction.cc.

References MakeNamedErrorDetail().

Referenced by useIcapConnection().

◆ noteCommConnected()

void Adaptation::Icap::Xaction::noteCommConnected ( const CommConnectCbParams io)

Definition at line 255 of file Xaction.cc.

References CommCommonCbParams::conn, CommCommonCbParams::flag, and Comm::OK.

Referenced by dnsLookupDone().

◆ noteCommRead()

◆ noteCommTimedout()

void Adaptation::Icap::Xaction::noteCommTimedout ( const CommTimeoutCbParams io)

Definition at line 349 of file Xaction.cc.

References assert, debugs, and Here.

Referenced by updateTimeout().

◆ noteCommWrote()

void Adaptation::Icap::Xaction::noteCommWrote ( const CommIoCbParams io)

Definition at line 331 of file Xaction.cc.

References debugs, CommCommonCbParams::flag, Must, Comm::OK, and CommIoCbParams::size.

Referenced by scheduleWrite().

◆ noteInitiatorAborted()

void Adaptation::Icap::Xaction::noteInitiatorAborted ( )
overrideprotectedvirtual

Implements Adaptation::Initiate.

Definition at line 547 of file Xaction.cc.

References debugs, MakeNamedErrorDetail(), and Adaptation::Icap::xoGone.

◆ openConnection()

◆ parseHttpMsg()

bool Adaptation::Icap::Xaction::parseHttpMsg ( Http::Message msg)
protected

◆ RegisterWithCacheManager()

void AsyncJob::RegisterWithCacheManager ( )
staticinherited

Definition at line 215 of file AsyncJob.cc.

References Mgr::RegisterAction(), and AsyncJob::ReportAllJobs().

Referenced by mainInitialize().

◆ repeatable()

bool Adaptation::Icap::Xaction::repeatable ( ) const
inline

Definition at line 53 of file Xaction.h.

References isRepeatable.

◆ ReportAllJobs()

void AsyncJob::ReportAllJobs ( StoreEntry e)
staticprotectedinherited

Definition at line 198 of file AsyncJob.cc.

References AllJobs().

Referenced by AsyncJob::RegisterWithCacheManager().

◆ retriable()

bool Adaptation::Icap::Xaction::retriable ( ) const
inline

Definition at line 52 of file Xaction.h.

References isRetriable.

◆ scheduleRead()

void Adaptation::Icap::Xaction::scheduleRead ( )
protected

Definition at line 415 of file Xaction.cc.

References JobCallback, Must, noteCommRead(), and Comm::Read().

◆ scheduleWrite()

void Adaptation::Icap::Xaction::scheduleWrite ( MemBuf buf)
protected

Definition at line 318 of file Xaction.cc.

References JobCallback, Must, noteCommWrote(), and Comm::Write().

◆ sendAnswer()

void Adaptation::Initiate::sendAnswer ( const Answer answer)
protectedinherited

Definition at line 79 of file Initiate.cc.

References Adaptation::Initiator::noteAdaptationAnswer(), and ScheduleCallHere.

◆ service()

Adaptation::Icap::ServiceRep & Adaptation::Icap::Xaction::service ( )

Definition at line 112 of file Xaction.cc.

References Must.

◆ setOutcome()

void Adaptation::Icap::Xaction::setOutcome ( const XactOutcome xo)
protected

Definition at line 561 of file Xaction.cc.

References debugs, and Adaptation::Icap::xoUnknown.

◆ start()

void Adaptation::Icap::Xaction::start ( )
overrideprotectedvirtual

Reimplemented from AsyncJob.

Definition at line 132 of file Xaction.cc.

References AsyncJob::start().

Referenced by Adaptation::Icap::ModXact::start(), and Adaptation::Icap::OptXact::start().

◆ Start()

◆ startShoveling()

virtual void Adaptation::Icap::Xaction::startShoveling ( )
protectedpure virtual

◆ status()

const char * Adaptation::Icap::Xaction::status ( ) const
overrideprotectedvirtual

for debugging, starts with space

Reimplemented from AsyncJob.

Definition at line 636 of file Xaction.cc.

References MemBuf::append(), Packable::appendf(), MemBuf::content(), MemBuf::reset(), and MemBuf::terminate().

Referenced by Adaptation::Icap::ModXact::ModXact().

◆ swanSong()

void Adaptation::Icap::Xaction::swanSong ( )
overrideprotectedvirtual

Reimplemented from AsyncJob.

Definition at line 574 of file Xaction.cc.

References Adaptation::Initiate::swanSong().

Referenced by Adaptation::Icap::ModXact::swanSong(), and Adaptation::Icap::OptXact::swanSong().

◆ tellQueryAborted() [1/2]

void Adaptation::Icap::Xaction::tellQueryAborted ( )
private

Definition at line 592 of file Xaction.cc.

References CallJobHere1.

◆ tellQueryAborted() [2/2]

void Adaptation::Initiate::tellQueryAborted ( bool  final)
protectedinherited

Definition at line 87 of file Initiate.cc.

References Adaptation::Answer::Error().

◆ toCbdata()

virtual void * CbdataParent::toCbdata ( )
pure virtualinherited

◆ updateTimeout()

void Adaptation::Icap::Xaction::updateTimeout ( )
protected

◆ useIcapConnection()

void Adaptation::Icap::Xaction::useIcapConnection ( const Comm::ConnectionPointer conn)
private

◆ useTransportConnection()

void Adaptation::Icap::Xaction::useTransportConnection ( const Comm::ConnectionPointer conn)
private

React to the availability of a transport connection to the ICAP service. The given connection may (or may not) be secured already.

Definition at line 270 of file Xaction.cc.

References assert, asyncCallback, conn, Adaptation::Icap::Config::connect_timeout(), fd_table, handleSecuredPeer(), Comm::IsConnOpen(), and Adaptation::Icap::TheConfig.

Member Data Documentation

◆ al

AccessLogEntry& Adaptation::Icap::Xaction::al
protected

Definition at line 152 of file Xaction.h.

◆ alep

AccessLogEntry::Pointer Adaptation::Icap::Xaction::alep
protected

Definition at line 151 of file Xaction.h.

◆ attempts

int Adaptation::Icap::Xaction::attempts

Definition at line 67 of file Xaction.h.

Referenced by Adaptation::Icap::Launcher::launchXaction().

◆ closer

AsyncCall::Pointer Adaptation::Icap::Xaction::closer
private

Definition at line 168 of file Xaction.h.

◆ commEof

bool Adaptation::Icap::Xaction::commEof
protected

◆ connection

Comm::ConnectionPointer Adaptation::Icap::Xaction::connection
private

Definition at line 166 of file Xaction.h.

◆ encryptionWait

JobWait<Ssl::IcapPeerConnector> Adaptation::Icap::Xaction::encryptionWait
private

Definition at line 163 of file Xaction.h.

◆ icap_tio_finish

timeval Adaptation::Icap::Xaction::icap_tio_finish
protected

Definition at line 156 of file Xaction.h.

Referenced by Xaction().

◆ icap_tio_start

timeval Adaptation::Icap::Xaction::icap_tio_start
protected

Definition at line 155 of file Xaction.h.

Referenced by Xaction().

◆ icap_tr_start

timeval Adaptation::Icap::Xaction::icap_tr_start
protected

Definition at line 154 of file Xaction.h.

Referenced by Xaction().

◆ icapReply

HttpReply::Pointer Adaptation::Icap::Xaction::icapReply

Definition at line 64 of file Xaction.h.

Referenced by Adaptation::Icap::ModXact::ModXact().

◆ icapRequest

HttpRequest* Adaptation::Icap::Xaction::icapRequest

Definition at line 63 of file Xaction.h.

Referenced by Xaction().

◆ id

const InstanceId<AsyncJob> AsyncJob::id
inherited

Definition at line 75 of file AsyncJob.h.

◆ ignoreLastWrite

bool Adaptation::Icap::Xaction::ignoreLastWrite
protected

Definition at line 145 of file Xaction.h.

◆ inCall

AsyncCall::Pointer AsyncJob::inCall
protectedinherited

◆ isRepeatable

bool Adaptation::Icap::Xaction::isRepeatable
protected

Definition at line 144 of file Xaction.h.

Referenced by repeatable().

◆ isRetriable

bool Adaptation::Icap::Xaction::isRetriable
protected

Definition at line 143 of file Xaction.h.

Referenced by retriable().

◆ readBuf

SBuf Adaptation::Icap::Xaction::readBuf
protected

Definition at line 140 of file Xaction.h.

◆ reader

AsyncCall::Pointer Adaptation::Icap::Xaction::reader
protected

Definition at line 148 of file Xaction.h.

◆ reuseConnection

bool Adaptation::Icap::Xaction::reuseConnection
protected

Definition at line 142 of file Xaction.h.

◆ started_

bool AsyncJob::started_ = false
protectedinherited

Definition at line 88 of file AsyncJob.h.

Referenced by AsyncJob::~AsyncJob(), AsyncJob::callEnd(), and AsyncJob::Start().

◆ stopReason

const char* AsyncJob::stopReason
protectedinherited

◆ swanSang_

bool AsyncJob::swanSang_ = false
protectedinherited

Definition at line 89 of file AsyncJob.h.

Referenced by AsyncJob::~AsyncJob(), and AsyncJob::callEnd().

◆ theInitiator

CbcPointer<Initiator> Adaptation::Initiate::theInitiator
protectedinherited

Definition at line 51 of file Initiate.h.

◆ theService

Adaptation::Icap::ServiceRep::Pointer Adaptation::Icap::Xaction::theService
protected

Definition at line 138 of file Xaction.h.

◆ transportWait

JobWait<Comm::ConnOpener> Adaptation::Icap::Xaction::transportWait
private

Definition at line 160 of file Xaction.h.

◆ typeName

const char* AsyncJob::typeName
protectedinherited

◆ waitingForDns

bool Adaptation::Icap::Xaction::waitingForDns
protected

Definition at line 146 of file Xaction.h.

◆ writer

AsyncCall::Pointer Adaptation::Icap::Xaction::writer
protected

Definition at line 149 of file Xaction.h.


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors