rasdaman complete source
|
#include <rnpcommunication.hh>
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... | |
CommBuffer * | getAnswerBuffer () 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 () |
![]() | |
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 () |
![]() | |
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... | |
![]() | |
void | readyToReadAnswer () throw () |
helper function, call it in 'executeOnWriteReady()' to switch to reading More... | |
![]() | |
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 | |
![]() | |
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 void | setCurrentTime () throw () |
static void | setTimeoutInterval (time_t x) throw () |
static time_t | getTimeoutInterval () throw () |
Returns the timeout interval set for the jobs. More... | |
![]() | |
ClientSocket | clientSocket |
![]() | |
workingStatus | status |
FileDescriptor & | fdRef |
Selector * | selectorPtr |
CommBuffer * | currentBufferPtr |
time_t | lastActionTime |
![]() | |
static time_t | timeOutInterv |
static time_t | currentTime |
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!
rnp::RnpClientJob::RnpClientJob | ( | ) | ||
throw | ( | |||
) |
Default constructor.
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.
|
protectedvirtual |
called when a read error occurs, usual a message and clean up
Implements akg::NbJob.
|
protectedvirtual |
called when a write error occurs, usual a message and clean up
Implements akg::NbJob.
|
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.
|
virtual |
Call-back function for the Communicator.
Implements akg::NbJob.
|
protected |
Resets the object: clears the connection and marks the job as ready.
|
protectedvirtual |
called when timeout, it has to set the status apropriate and do other cleanup
Implements akg::NbJob.
|
protectedvirtual |
(See the explanations from NbJob)
Implements akg::NbJob.