rasdaman complete source
Public Member Functions | Protected Member Functions | List of all members
rnp::RnpClientJob Class Reference

#include <rnpcommunication.hh>

Inheritance diagram for rnp::RnpClientJob:
akg::NbClientJob akg::NbJob

Public Member Functions

 RnpClientJob () throw ()
 Default constructor. More...
 
void init (CommBuffer *transmitterBuffer, RnpBaseClientComm *newClientComm) throw ()
 
void processRequest () throw ()
 Call-back function for the Communicator. More...
 
CommBuffergetAnswerBuffer () throw ()
 
bool isAnswerOk () throw ()
 Returns 'true' if the answer was correctly received. More...
 
bool isInvalidFormat () throw ()
 Returns true if the format of the received message is not valid RNP and was discarded. More...
 
void clearAnswerBuffer () throw ()
 
- Public Member Functions inherited from akg::NbClientJob
 NbClientJob () throw ()
 Default constructor. More...
 
bool connectToServer (const char *serverHost, int serverPort) throw ()
 Returns 'true' if connection succeded. More...
 
void initOnAttach (Selector *pselector) throw ()
 
acceptStatus acceptConnection (ListenSocket &listenSocket) throw ()
 
- Public Member Functions inherited from akg::NbJob
virtual ~NbJob () throw ()
 
workingStatus getStatus () throw ()
 Returns the working status. More...
 
bool isOperationPending () throw ()
 
bool isAccepting () throw ()
 Returns true if the job is ready to accept a connection. More...
 
bool isReading () throw ()
 Returns true if the job is reading data. More...
 
bool isWriting () throw ()
 Returns true if the job is writing data. More...
 
bool isProcessing () throw ()
 Returns true if the job is processing. More...
 
bool readPartialMessage () throw ()
 
bool writePartialMessage () throw ()
 
void clearConnection () throw ()
 Clears the connection - closes the socket and removes it from the Selector. More...
 
int getSocket () throw ()
 Returns the OS file descriptor for the socket. More...
 
int getErrno () throw ()
 Returns the errno of the last socket operation. More...
 
virtual bool cleanUpIfTimeout () throw ()
 

Protected Member Functions

bool validateMessage () throw ()
 (See the explanations from NbJob) More...
 
void executeOnWriteReady () throw ()
 called when message is written More...
 
void specificCleanUpOnTimeout () throw ()
 called when timeout, it has to set the status apropriate and do other cleanup More...
 
void executeOnReadError () throw ()
 called when a read error occurs, usual a message and clean up More...
 
void executeOnWriteError () throw ()
 called when a write error occurs, usual a message and clean up More...
 
void resetState () throw ()
 Resets the object: clears the connection and marks the job as ready. More...
 
- Protected Member Functions inherited from akg::NbClientJob
void readyToReadAnswer () throw ()
 helper function, call it in 'executeOnWriteReady()' to switch to reading More...
 
- Protected Member Functions inherited from akg::NbJob
virtual void executeOnAccept () throw ()
 called when client is accepted, default does nothing More...
 
 NbJob (FileDescriptor &) throw ()
 Protected constructor, taking a FileDescriptor, usually a Socket. More...
 
bool setReading () throw ()
 Helper function for setting the job in read modus. More...
 
bool setWriting () throw ()
 Helper function for setting the job in write modus. More...
 
void action () throw ()
 Helper function which marks the current moment, so timeout counter is reset. More...
 

Additional Inherited Members

- Public Types inherited from akg::NbJob
enum  acceptStatus { acs_nopending = 0, acs_Iambusy = 1, acs_accepted = 2 }
 Status regarding accepting a new job. More...
 
enum  workingStatus {
  wks_notdefined = 0, wks_accepting = 1, wks_reading = 2, wks_writing = 3,
  wks_processing = 4
}
 Status during the lifetime of a job. More...
 
- Static Public Member Functions inherited from akg::NbJob
static void setCurrentTime () throw ()
 
static void setTimeoutInterval (time_t x) throw ()
 
static time_t getTimeoutInterval () throw ()
 Returns the timeout interval set for the jobs. More...
 
- Protected Attributes inherited from akg::NbClientJob
ClientSocket clientSocket
 
- Protected Attributes inherited from akg::NbJob
workingStatus status
 
FileDescriptorfdRef
 
SelectorselectorPtr
 
CommBuffercurrentBufferPtr
 
time_t lastActionTime
 
- Static Protected Attributes inherited from akg::NbJob
static time_t timeOutInterv
 
static time_t currentTime
 

Detailed Description

This class represents the RNP client job. It taker a CommBuffer, sends its data and receives the answer. Is directy owned and used by 'RnpBaseClientComm', so you don't have to worry about it Be aware that the transmitter buffer is freed after transmission!

Constructor & Destructor Documentation

rnp::RnpClientJob::RnpClientJob ( )
throw (
)

Default constructor.

Member Function Documentation

void rnp::RnpClientJob::clearAnswerBuffer ( )
throw (
)

Clears the answer buffer. Important if huge amount of data where received. The buffer is cleared by the next transmission, also.

void rnp::RnpClientJob::executeOnReadError ( )
throw (
)
protectedvirtual

called when a read error occurs, usual a message and clean up

Implements akg::NbJob.

void rnp::RnpClientJob::executeOnWriteError ( )
throw (
)
protectedvirtual

called when a write error occurs, usual a message and clean up

Implements akg::NbJob.

void rnp::RnpClientJob::executeOnWriteReady ( )
throw (
)
protectedvirtual

called when message is written

Implements akg::NbJob.

CommBuffer* rnp::RnpClientJob::getAnswerBuffer ( )
throw (
)

Returns a pointer to the buffer containing the answer. The buffer holds only the RNP message, without carrier header

void rnp::RnpClientJob::init ( CommBuffer transmitterBuffer,
RnpBaseClientComm newClientComm 
)
throw (
)

Initialization: takes the tarnsmitter buffer containing data to be send and a pointer to a Communicator object, which will coordinate the transmission Assert: transmitterBuffer!=0, newClientComm !=0

bool rnp::RnpClientJob::isAnswerOk ( )
throw (
)

Returns 'true' if the answer was correctly received.

bool rnp::RnpClientJob::isInvalidFormat ( )
throw (
)

Returns true if the format of the received message is not valid RNP and was discarded.

void rnp::RnpClientJob::processRequest ( )
throw (
)
virtual

Call-back function for the Communicator.

Implements akg::NbJob.

void rnp::RnpClientJob::resetState ( )
throw (
)
protected

Resets the object: clears the connection and marks the job as ready.

void rnp::RnpClientJob::specificCleanUpOnTimeout ( )
throw (
)
protectedvirtual

called when timeout, it has to set the status apropriate and do other cleanup

Implements akg::NbJob.

bool rnp::RnpClientJob::validateMessage ( )
throw (
)
protectedvirtual

(See the explanations from NbJob)

Implements akg::NbJob.


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