Waits for and receives incoming IPC messages; kids handle the messages. More...

#include <Port.h>

Inheritance diagram for Ipc::Port:
Collaboration diagram for Ipc::Port:

Public Types

typedef CbcPointer< AsyncJobPointer

Public Member Functions

 Port (const String &aListenAddr)
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 String MakeAddr (const char *proccessLabel, int id)
 calculates IPC message address for strand id of processLabel type More...
static String CoordinatorAddr ()
 get the IPC message address for coordinator process More...
static Pointer Start (AsyncJob *job)
 starts a freshly created job (i.e., makes the job asynchronous) More...

Public Attributes

struct sockaddr_un address
 UDS address from path; treat as read-only. More...

Protected Member Functions

virtual void start ()=0
 called by AsyncStart; do not call directly More...
virtual bool doneAll () const
 whether positive goal has been reached More...
void doListen ()
 read the next incoming message More...
virtual void receive (const TypedMsgHdr &message)=0
 handle IPC message just
virtual void timedout ()
 called after setTimeout() if timed out More...
Comm::ConnectionPointerconn ()
 creates if needed and returns raw UDS socket descriptor More...
void setTimeout (int seconds, const char *handlerName)
 call timedout() if no UDS messages in a given number of seconds More...
void clearTimeout ()
 remove previously set timeout, if any More...
void setOptions (int newOptions)
 changes socket options More...
void deleteThis (const char *aReason)
void mustStop (const char *aReason)
bool done () const
 the job is destroyed in callEnd() when done() More...
virtual void swanSong ()
virtual const char * status () const
 internal cleanup; do not call directly More...

Protected Attributes

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

void noteRead (const CommIoCbParams &params)

Private Attributes

TypedMsgHdr buf
 msghdr struct filled by Comm More...

Detailed Description

Definition at line 21 of file Port.h.

Member Typedef Documentation

Definition at line 34 of file AsyncJob.h.

Constructor & Destructor Documentation

Ipc::Port::Port ( const String aListenAddr)

Definition at line 24 of file Port.cc.

References COMM_DOBIND, COMM_NONBLOCKING, and Ipc::UdsOp::setOptions().

Member Function Documentation

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

Definition at line 101 of file AsyncJob.cc.

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

void Ipc::UdsOp::clearTimeout ( )

Definition at line 62 of file UdsOp.cc.

References commUnsetConnTimeout(), and conn.

Comm::ConnectionPointer & Ipc::UdsOp::conn ( )

Definition at line 41 of file UdsOp.cc.

References COMM_DOBIND, comm_open_uds(), Comm::Connection::fd, Comm::IsConnOpen(), Must, and NULL.

void AsyncJob::deleteThis ( const char *  aReason)
void Ipc::Port::doListen ( )

Definition at line 36 of file Port.cc.

References buf, comm_read(), conn, debugs, HERE(), JobCallback, and noteRead().

bool AsyncJob::done ( ) const

Definition at line 90 of file AsyncJob.cc.

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

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

bool Ipc::Port::doneAll ( ) const

Reimplemented from AsyncJob.

Definition at line 46 of file Port.cc.

String Ipc::Port::MakeAddr ( const char *  proccessLabel,
int  id 
void Ipc::Port::noteRead ( const CommIoCbParams params)

Definition at line 76 of file Port.cc.

References assert, buf, CommIoCbParams::buf, CommCommonCbParams::conn, debugs, CommCommonCbParams::flag, HERE(), and Comm::OK.

Referenced by doListen().

virtual void Ipc::Port::receive ( const TypedMsgHdr message)
protectedpure virtual

Implemented in Ipc::Coordinator, and Ipc::Strand.

void Ipc::UdsOp::setOptions ( int  newOptions)

Definition at line 35 of file UdsOp.cc.

Referenced by Port().

void Ipc::UdsOp::setTimeout ( int  seconds,
const char *  handlerName 

Definition at line 54 of file UdsOp.cc.

References asyncCall(), commSetConnTimeout(), conn, handler(), and Ipc::UdsOp::noteTimeout().

void Ipc::Port::start ( )
protectedpure virtual

Reimplemented from AsyncJob.

Implemented in Ipc::Coordinator, and Ipc::Strand.

Definition at line 30 of file Port.cc.

References AsyncJob::start().

Referenced by Ipc::Strand::start(), and Ipc::Coordinator::start().

virtual void Ipc::UdsOp::timedout ( )

Reimplemented in Ipc::UdsSender, and Ipc::Strand.

Definition at line 39 of file UdsOp.h.

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

Member Data Documentation

struct sockaddr_un Ipc::UdsOp::address

Definition at line 36 of file UdsOp.h.

Referenced by Ipc::UdsSender::UdsSender().

TypedMsgHdr Ipc::Port::buf

Definition at line 45 of file Port.h.

const InstanceId<AsyncJob> AsyncJob::id

Definition at line 70 of file AsyncJob.h.

AsyncCall::Pointer AsyncJob::inCall
const char* AsyncJob::stopReason

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






Web Site Translations