#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::Pointer
RequestsMap
 maps request->id to Forwarder::handleRemoteAck callback More...
 

Protected Member Functions

virtual void cleanup ()
 perform cleanup actions 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 void swanSong ()
 
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

Definition at line 34 of file AsyncJob.h.

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

Definition at line 67 of file Forwarder.h.

Constructor & Destructor Documentation

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

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

Reimplemented from AsyncJob.

Definition at line 142 of file Forwarder.cc.

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

void AsyncJob::callStart ( AsyncCall call)
inherited
bool AsyncJob::canBeCalled ( AsyncCall call) const
inherited

Definition at line 101 of file AsyncJob.cc.

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

Snmp::Forwarder::CBDATA_CLASS ( Forwarder  )
private
void Snmp::Forwarder::cleanup ( )
protectedvirtual

removes our cleanup handler of the client connection socket

Reimplemented from Ipc::Forwarder.

Definition at line 38 of file Forwarder.cc.

References comm_remove_close_handler(), and NULL.

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

Definition at line 90 of file AsyncJob.cc.

References AsyncJob::doneAll(), NULL, and AsyncJob::stopReason.

Referenced by AsyncJob::callEnd(), and Downloader::downloadFinished().

bool Ipc::Forwarder::doneAll ( ) const
protectedvirtualinherited

Reimplemented from AsyncJob.

Definition at line 86 of file Forwarder.cc.

References debugs, HERE(), and request().

void Ipc::Forwarder::handleError ( )
protectedvirtualinherited

Reimplemented in Mgr::Forwarder.

Definition at line 122 of file Forwarder.cc.

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

Reimplemented from Ipc::Forwarder.

Definition at line 67 of file Forwarder.cc.

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

void Ipc::Forwarder::HandleRemoteAck ( unsigned int  requestId)
staticinherited
void Snmp::Forwarder::handleTimeout ( )
protectedvirtual

Reimplemented from Ipc::Forwarder.

Definition at line 60 of file Forwarder.cc.

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

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

Definition at line 51 of file Forwarder.cc.

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

Referenced by Forwarder().

void Ipc::Forwarder::start ( )
protectedvirtualinherited
void Ipc::Forwarder::swanSong ( )
protectedvirtualinherited

Reimplemented from AsyncJob.

Definition at line 74 of file Forwarder.cc.

References debugs, HERE(), and request().

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

Member Data Documentation

AsyncCall::Pointer Snmp::Forwarder::closer
private

Definition at line 47 of file Forwarder.h.

Referenced by Forwarder().

int Snmp::Forwarder::fd
private

Definition at line 46 of file Forwarder.h.

Referenced by Forwarder().

const InstanceId<AsyncJob> AsyncJob::id
protectedinherited

Definition at line 70 of file AsyncJob.h.

AsyncCall::Pointer AsyncJob::inCall
protectedinherited
unsigned int Ipc::Forwarder::LastRequestId = 0
staticprotectedinherited

Definition at line 70 of file Forwarder.h.

Request::Pointer Ipc::Forwarder::request
protectedinherited

Definition at line 63 of file Forwarder.h.

const char* AsyncJob::stopReason
protectedinherited
Ipc::Forwarder::RequestsMap Ipc::Forwarder::TheRequestsMap
staticprotectedinherited

Definition at line 68 of file Forwarder.h.

const double Ipc::Forwarder::timeout
protectedinherited

Definition at line 64 of file Forwarder.h.


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors