attempts to send an IPC message a few times, with a timeout More...

#include <UdsOp.h>

Inheritance diagram for Ipc::UdsSender:
Collaboration diagram for Ipc::UdsSender:

Public Types

typedef CbcPointer< AsyncJobPointer

Public Member Functions

 UdsSender (const String &pathAddr, const TypedMsgHdr &aMessage)
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...

Public Attributes

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

Protected Member Functions

virtual void swanSong ()
virtual void start ()
 called by AsyncStart; do not call directly More...
virtual bool doneAll () const
 whether positive goal has been reached More...
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 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 startSleep ()
 pause for a while before resending the message More...
void cancelSleep ()
 stop sleeping (or do nothing if we were not) More...
void delayedRetry ()
 make another sending attempt after a pause More...
void write ()
 schedule writing More...
void wrote (const CommIoCbParams &params)
 done writing or error More...
 UdsSender (const UdsSender &)
UdsSenderoperator= (const UdsSender &)

Static Private Member Functions

static void DelayedRetry (void *data)
 legacy wrapper for Ipc::UdsSender::delayedRetry() More...

Private Attributes

TypedMsgHdr message
 what to send More...
int retries
 how many times to try after a write error More...
int timeout
 total time to send the message More...
bool sleeping
 whether we are waiting to retry a failed write More...
bool writing
 whether Comm started and did not finish writing More...

Detailed Description

Definition at line 67 of file UdsOp.h.

Member Typedef Documentation

Definition at line 34 of file AsyncJob.h.

Constructor & Destructor Documentation

Ipc::UdsSender::UdsSender ( const String pathAddr,
const TypedMsgHdr aMessage 

Definition at line 84 of file

References Ipc::UdsOp::address, Ipc::TypedMsgHdr::address(), and message.

Ipc::UdsSender::UdsSender ( const UdsSender )

Member Function Documentation

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

Definition at line 101 of file

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

void Ipc::UdsSender::cancelSleep ( )

Definition at line 149 of file

References debugs.

Ipc::UdsSender::CBDATA_CLASS ( UdsSender  )
void Ipc::UdsOp::clearTimeout ( )

Definition at line 62 of file

References commUnsetConnTimeout(), and conn.

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

Definition at line 41 of file

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

void Ipc::UdsSender::DelayedRetry ( void *  data)

Definition at line 159 of file

References assert, data, delayedRetry(), JobCallback, ScheduleCallHere, and CbcPointer< Cbc >::valid().

Referenced by startSleep().

void Ipc::UdsSender::delayedRetry ( )

Definition at line 173 of file

References debugs, and HERE().

Referenced by DelayedRetry().

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

Definition at line 90 of file

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

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

bool Ipc::UdsSender::doneAll ( ) const

Reimplemented from AsyncJob.

Definition at line 112 of file

References AsyncJob::doneAll().

UdsSender& Ipc::UdsSender::operator= ( const UdsSender )
void Ipc::UdsOp::setOptions ( int  newOptions)

Definition at line 35 of file

Referenced by Ipc::Port::Port().

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

Definition at line 54 of file

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

void Ipc::UdsSender::start ( )

Reimplemented from AsyncJob.

Definition at line 104 of file

References AsyncJob::start().

void Ipc::UdsSender::startSleep ( )

Definition at line 139 of file

References DelayedRetry(), eventAdd(), and Must.

void Ipc::UdsSender::swanSong ( )

Reimplemented from AsyncJob.

Definition at line 95 of file

References AsyncJob::swanSong().

void Ipc::UdsSender::timedout ( )

Reimplemented from Ipc::UdsOp.

Definition at line 182 of file

References debugs, and HERE().

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited
void Ipc::UdsSender::write ( )

Definition at line 117 of file

References conn, debugs, HERE(), JobCallback, NULL, Comm::Write(), and wrote().

void Ipc::UdsSender::wrote ( const CommIoCbParams params)

Definition at line 127 of file

References conn, CommCommonCbParams::conn, debugs, CommCommonCbParams::flag, HERE(), Comm::OK, and retries.

Referenced by write().

Member Data Documentation

struct sockaddr_un Ipc::UdsOp::address

Definition at line 36 of file UdsOp.h.

Referenced by UdsSender().

const InstanceId<AsyncJob> AsyncJob::id

Definition at line 70 of file AsyncJob.h.

AsyncCall::Pointer AsyncJob::inCall
TypedMsgHdr Ipc::UdsSender::message

Definition at line 90 of file UdsOp.h.

Referenced by UdsSender().

int Ipc::UdsSender::retries

Definition at line 91 of file UdsOp.h.

bool Ipc::UdsSender::sleeping

Definition at line 93 of file UdsOp.h.

const char* AsyncJob::stopReason
int Ipc::UdsSender::timeout

Definition at line 92 of file UdsOp.h.

bool Ipc::UdsSender::writing

Definition at line 94 of file UdsOp.h.

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






Web Site Translations