#include <Forwarder.h>

Inheritance diagram for Snmp::Forwarder:
Collaboration diagram for Snmp::Forwarder:

Public Types

typedef CbcPointer< AsyncJobPointer

Public Member Functions

 Forwarder (const Pdu &aPdu, const Session &aSession, int aFd, const Ip::Address &anAddress)
virtual void callException (const std::exception &e)
 called when the job throws during an async call More...
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 * toCbdata ()=0

Static Public Member Functions

static void HandleRemoteAck (unsigned int requestId)
 finds and calls the right Forwarder upon Coordinator's response More...
static Pointer Start (AsyncJob *job)
 starts a freshly created job (i.e., makes the job asynchronous) More...

Protected Types

typedef std::map< unsigned int, AsyncCall::PointerRequestsMap
 maps request->id to Forwarder::handleRemoteAck callback More...

Protected Member Functions

virtual void swanSong ()
 removes our cleanup handler of the client connection socket More...
virtual void handleTimeout ()
virtual void handleException (const std::exception &e)
 terminate with an error More...
virtual void start ()
 called by AsyncStart; do not call directly More...
virtual bool doneAll () const
 whether positive goal has been reached More...
virtual void handleError ()
void deleteThis (const char *aReason)
void mustStop (const char *aReason)
bool done () const
 the job is destroyed in callEnd() when done() More...
virtual const char * status () const
 internal cleanup; do not call directly More...

Protected Attributes

Request::Pointer request
const double timeout
 response wait timeout in seconds 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...

Static Protected Attributes

static RequestsMap TheRequestsMap
 pending Coordinator requests More...
static unsigned int LastRequestId = 0
 last requestId used More...

Private Member Functions

 CBDATA_CLASS (Forwarder)
void noteCommClosed (const CommCloseCbParams &params)
 called when the client socket gets closed by some external force More...
void sendError (int error)
 send error SNMP response More...

Private Attributes

int fd
 client connection descriptor More...
AsyncCall::Pointer closer
 comm_close handler for the connection More...

Detailed Description

Forwards a single client SNMP request to Coordinator. Waits for an ACK from Coordinator Send the data unit with an error response if forwarding fails.

Definition at line 27 of file Forwarder.h.

Member Typedef Documentation

◆ Pointer

Definition at line 34 of file AsyncJob.h.

◆ RequestsMap

typedef std::map<unsigned int, AsyncCall::Pointer> Ipc::Forwarder::RequestsMap

Definition at line 66 of file Forwarder.h.

Constructor & Destructor Documentation

◆ Forwarder()

Snmp::Forwarder::Forwarder ( const Pdu aPdu,
const Session aSession,
int  aFd,
const Ip::Address anAddress 

Definition at line 24 of file Forwarder.cc.

References asyncCall(), closer, comm_add_close_handler(), debugs, fd, HERE(), Must, and noteCommClosed().

Member Function Documentation

◆ callEnd()

void AsyncJob::callEnd ( )

◆ callException()

void Ipc::Forwarder::callException ( const std::exception &  e)

Reimplemented from AsyncJob.

Definition at line 136 of file Forwarder.cc.

References AsyncJob::callException(), DBG_CRITICAL, debugs, Ipc::Forwarder::handleException(), and HERE().

◆ callStart()

void AsyncJob::callStart ( AsyncCall call)

◆ canBeCalled()

bool AsyncJob::canBeCalled ( AsyncCall call) const

Definition at line 101 of file AsyncJob.cc.

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

Referenced by AsyncJob::swanSong().


Snmp::Forwarder::CBDATA_CLASS ( Forwarder  )

◆ deleteThis()

void AsyncJob::deleteThis ( const char *  aReason)

◆ done()

◆ doneAll()

bool Ipc::Forwarder::doneAll ( ) const

Reimplemented from AsyncJob.

Definition at line 78 of file Forwarder.cc.

References debugs, HERE(), and Ipc::Forwarder::request.

◆ handleError()

void Ipc::Forwarder::handleError ( )

Reimplemented in Mgr::Forwarder.

Definition at line 116 of file Forwarder.cc.

References AsyncJob::mustStop().

Referenced by Ipc::Forwarder::start().

◆ handleException()

void Snmp::Forwarder::handleException ( const std::exception &  e)

Reimplemented from Ipc::Forwarder.

Definition at line 68 of file Forwarder.cc.

References debugs, fd, Ipc::Forwarder::handleException(), HERE(), sendError(), and SNMP_ERR_GENERR.

◆ HandleRemoteAck()

void Ipc::Forwarder::HandleRemoteAck ( unsigned int  requestId)

◆ handleTimeout()

void Snmp::Forwarder::handleTimeout ( )

Reimplemented from Ipc::Forwarder.

Definition at line 61 of file Forwarder.cc.

References Ipc::Forwarder::handleTimeout(), sendError(), and SNMP_ERR_RESOURCEUNAVAILABLE.

◆ mustStop()

void AsyncJob::mustStop ( const char *  aReason)

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(), Http::Tunneler::handleConnectionClosure(), 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(), 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().

◆ noteCommClosed()

void Snmp::Forwarder::noteCommClosed ( const CommCloseCbParams params)

Definition at line 52 of file Forwarder.cc.

References debugs, fd, CommCommonCbParams::fd, HERE(), Must, and AsyncJob::mustStop().

Referenced by Forwarder().

◆ sendError()

◆ Start()

◆ start()

◆ status()

◆ swanSong()

void Snmp::Forwarder::swanSong ( )

Reimplemented from Ipc::Forwarder.

Definition at line 38 of file Forwarder.cc.

References closer, comm_remove_close_handler(), fd, NULL, and Ipc::Forwarder::swanSong().

◆ toCbdata()

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

Member Data Documentation

◆ closer

AsyncCall::Pointer Snmp::Forwarder::closer

Definition at line 47 of file Forwarder.h.

Referenced by Forwarder(), and swanSong().

◆ fd

int Snmp::Forwarder::fd

Definition at line 46 of file Forwarder.h.

Referenced by Forwarder(), handleException(), noteCommClosed(), sendError(), and swanSong().

◆ id

const InstanceId<AsyncJob> AsyncJob::id

Definition at line 72 of file AsyncJob.h.

◆ inCall

◆ LastRequestId

unsigned int Ipc::Forwarder::LastRequestId = 0

Definition at line 69 of file Forwarder.h.

Referenced by Ipc::Forwarder::start().

◆ request

◆ stopReason

const char* AsyncJob::stopReason

◆ TheRequestsMap

Ipc::Forwarder::RequestsMap Ipc::Forwarder::TheRequestsMap

Definition at line 67 of file Forwarder.h.

Referenced by Ipc::Forwarder::DequeueRequest(), and Ipc::Forwarder::start().

◆ timeout

const double Ipc::Forwarder::timeout

Definition at line 63 of file Forwarder.h.

Referenced by Ipc::Forwarder::start().

◆ typeName

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






Web Site Translations