Rudiments
|
Inherits filedescriptor.
Inherited by modemclient, and socketclient.
Public Member Functions | |
client () | |
virtual | ~client () |
virtual void | setParameters (dictionary< const char *, const char * > *cd) |
void | setTimeoutSeconds (int32_t timeoutsec) |
void | setTimeoutMicroseconds (int32_t timeoutusec) |
void | setRetryWait (uint32_t retrywait) |
void | setTries (uint32_t tries) |
void | setVerboseConnectError (const char *error) |
int32_t | getTimeoutSeconds () |
int32_t | getTimeoutMicroseconds () |
uint32_t | getRetryWait () |
uint32_t | getTries () |
const char * | getVerboseConnectError () |
virtual int32_t | connect () |
Public Member Functions inherited from filedescriptor | |
filedescriptor () | |
virtual | ~filedescriptor () |
virtual bool | close () |
int32_t | getFileDescriptor () |
void | setFileDescriptor (int32_t filedesc) |
bool | setIsStream (bool isstream) |
bool | getIsStream () |
int32_t | duplicate () |
bool | duplicate (int32_t newfd) |
void | setSocketLayer (socketlayer *layer) |
socketlayer * | getSocketLayer () |
virtual bool | supportsBlockingAndNonBlockingModes () |
virtual bool | setNonBlockingMode (bool usenonblockingmode) |
virtual bool | getNonBlockingMode () |
virtual off64_t | getPosition () |
virtual off64_t | setPositionRelativeToBeginning (off64_t offset) |
virtual off64_t | setPositionRelativeToCurrent (off64_t offset) |
virtual off64_t | setPositionRelativeToEnd (off64_t offset) |
ssize_t | write (uint16_t number) |
ssize_t | write (uint32_t number) |
ssize_t | write (uint64_t number) |
ssize_t | write (int16_t number) |
ssize_t | write (int32_t number) |
ssize_t | write (int64_t number) |
ssize_t | write (float number) |
ssize_t | write (double number) |
ssize_t | write (byte_t character) |
ssize_t | write (char character) |
ssize_t | write (wchar_t character) |
ssize_t | writeUcs2 (ucs2_t character) |
ssize_t | write (bool value) |
ssize_t | write (const byte_t *string) |
ssize_t | write (const char *string) |
ssize_t | write (const wchar_t *string) |
ssize_t | writeUcs2 (const ucs2_t *string) |
ssize_t | write (const byte_t *string, size_t size) |
ssize_t | write (const char *string, size_t length) |
ssize_t | write (const wchar_t *string, size_t length) |
ssize_t | writeUcs2 (const ucs2_t *string, size_t length) |
ssize_t | write (const void *buffer, size_t size) |
ssize_t | write (uint16_t number, int32_t sec, int32_t usec) |
ssize_t | write (uint32_t number, int32_t sec, int32_t usec) |
ssize_t | write (uint64_t number, int32_t sec, int32_t usec) |
ssize_t | write (int16_t number, int32_t sec, int32_t usec) |
ssize_t | write (int32_t number, int32_t sec, int32_t usec) |
ssize_t | write (int64_t number, int32_t sec, int32_t usec) |
ssize_t | write (float number, int32_t sec, int32_t usec) |
ssize_t | write (double number, int32_t sec, int32_t usec) |
ssize_t | write (byte_t character, int32_t sec, int32_t usec) |
ssize_t | write (char character, int32_t sec, int32_t usec) |
ssize_t | write (wchar_t character, int32_t sec, int32_t usec) |
ssize_t | writeUcs2 (ucs2_t character, int32_t sec, int32_t usec) |
ssize_t | write (bool value, int32_t sec, int32_t usec) |
ssize_t | write (const byte_t *string, int32_t sec, int32_t usec) |
ssize_t | write (const char *string, int32_t sec, int32_t usec) |
ssize_t | write (const wchar_t *string, int32_t sec, int32_t usec) |
ssize_t | writeUcs2 (const ucs2_t *string, int32_t sec, int32_t usec) |
ssize_t | write (const byte_t *string, size_t size, int32_t sec, int32_t usec) |
ssize_t | write (const char *string, size_t length, int32_t sec, int32_t usec) |
ssize_t | write (const wchar_t *string, size_t length, int32_t sec, int32_t usec) |
ssize_t | writeUcs2 (const ucs2_t *string, size_t length, int32_t sec, int32_t usec) |
ssize_t | write (const void *buffer, size_t size, int32_t sec, int32_t usec) |
ssize_t | read (uint16_t *buffer) |
ssize_t | read (uint32_t *buffer) |
ssize_t | read (uint64_t *buffer) |
ssize_t | read (int16_t *buffer) |
ssize_t | read (int32_t *buffer) |
ssize_t | read (int64_t *buffer) |
ssize_t | read (float *buffer) |
ssize_t | read (double *buffer) |
ssize_t | read (byte_t *buffer) |
ssize_t | read (char *buffer) |
ssize_t | read (wchar_t *buffer) |
ssize_t | readUcs2 (ucs2_t *buffer) |
ssize_t | read (bool *buffer) |
ssize_t | read (byte_t *buffer, size_t size) |
ssize_t | read (char *buffer, size_t length) |
ssize_t | read (wchar_t *buffer, size_t length) |
ssize_t | readUcs2 (ucs2_t *buffer, size_t length) |
ssize_t | read (void *buf, size_t size) |
ssize_t | read (char **buffer, const char *terminator) |
ssize_t | read (char **buffer, const char *terminator, size_t maxbytes) |
ssize_t | read (uint16_t *buffer, int32_t sec, int32_t usec) |
ssize_t | read (uint32_t *buffer, int32_t sec, int32_t usec) |
ssize_t | read (uint64_t *buffer, int32_t sec, int32_t usec) |
ssize_t | read (int16_t *buffer, int32_t sec, int32_t usec) |
ssize_t | read (int32_t *buffer, int32_t sec, int32_t usec) |
ssize_t | read (int64_t *buffer, int32_t sec, int32_t usec) |
ssize_t | read (float *buffer, int32_t sec, int32_t usec) |
ssize_t | read (double *buffer, int32_t sec, int32_t usec) |
ssize_t | read (byte_t *buffer, int32_t sec, int32_t usec) |
ssize_t | read (char *buffer, int32_t sec, int32_t usec) |
ssize_t | read (wchar_t *buffer, int32_t sec, int32_t usec) |
ssize_t | readUcs2 (ucs2_t *buffer, int32_t sec, int32_t usec) |
ssize_t | read (bool *buffer, int32_t sec, int32_t usec) |
ssize_t | read (byte_t *buffer, size_t size, int32_t sec, int32_t usec) |
ssize_t | read (char *buffer, size_t length, int32_t sec, int32_t usec) |
ssize_t | read (wchar_t *buffer, size_t length, int32_t sec, int32_t usec) |
ssize_t | readUcs2 (ucs2_t *buffer, size_t length, int32_t sec, int32_t usec) |
ssize_t | read (void *buf, size_t size, int32_t sec, int32_t usec) |
ssize_t | read (char **buffer, const char *terminator, int32_t sec, int32_t usec) |
ssize_t | read (char **buffer, const char *terminator, size_t maxbytes, int32_t sec, int32_t usec) |
ssize_t | read (char **buffer, const char *terminator, size_t maxbytes, char escapechar, int32_t sec, int32_t usec) |
int32_t | waitForNonBlockingRead (int32_t sec, int32_t usec) |
int32_t | waitForNonBlockingWrite (int32_t sec, int32_t usec) |
void | setRetryInterruptedReads (bool retry) |
bool | getRetryInterruptedReads () |
void | setRetryInterruptedWrites (bool retry) |
bool | getRetryInterruptedWrites () |
void | setRetryInterruptedWaits (bool retry) |
bool | getRetryInterruptedWaits () |
void | setRetryInterruptedFcntl (bool retry) |
bool | getRetryInterruptedFcntl () |
void | setRetryInterruptedIoctl (bool retry) |
bool | getRetryInterruptedIoctl () |
void | setAllowShortReads (bool allow) |
bool | getAllowShortReads () |
void | setAllowShortWrites (bool allow) |
bool | getAllowShortWrites () |
virtual bool | passFileDescriptor (int32_t fd) |
virtual bool | receiveFileDescriptor (int32_t *fd) |
virtual bool | passSocket (int32_t sock) |
virtual bool | receiveSocket (int32_t *sock) |
void | setTranslateByteOrder (bool translate) |
bool | getTranslateByteOrder () |
virtual int32_t | fCntl (int32_t command, long arg) |
virtual int32_t | ioCtl (int32_t command, void *arg) |
bool | setNaglesAlgorithmEnabled (bool enabled) |
bool | getNaglesAlgorithmEnabled () |
bool | setSocketWriteBufferSize (int32_t size) |
bool | getSocketWriteBufferSize (int32_t *size) |
bool | setSocketReadBufferSize (int32_t size) |
bool | getSocketReadBufferSize (int32_t *size) |
bool | disableIPv4 () |
bool | enableIPv4 () |
const char * | getType () |
char * | getPeerAddress () |
bool | setWriteBufferSize (size_t size) |
size_t | getWriteBufferSize () |
bool | flushWriteBuffer (int32_t sec, int32_t usec) |
bool | setReadBufferSize (size_t size) |
size_t | getReadBufferSize () |
void | setMmapBufferingEnabled (bool enabled) |
bool | getMmapBufferingEnabled () |
bool | isCurrentBlockMmapBuffered () |
off64_t | getCurrentBlockOffset () |
bool | setCloseOnExec (bool close) |
bool | getCloseOnExec () |
Public Member Functions inherited from input | |
input () | |
virtual | ~input () |
ssize_t | read (char **buffer, const char *terminator) |
ssize_t | read (char **buffer, const char *terminator, size_t maxbytes) |
ssize_t | read (char **buffer, const char *terminator, int32_t sec, int32_t usec) |
ssize_t | read (char **buffer, const char *terminator, size_t maxbytes, int32_t sec, int32_t usec) |
ssize_t | read (char **buffer, const char *terminator, size_t maxbytes, char escapechar, int32_t sec, int32_t usec) |
Public Member Functions inherited from object | |
virtual | ~object () |
Public Member Functions inherited from output | |
output () | |
virtual | ~output () |
virtual ssize_t | printf (const char *format,...) |
virtual ssize_t | printf (const char *format, va_list *argp) |
virtual ssize_t | printf (const wchar_t *format,...) |
virtual ssize_t | printf (const wchar_t *format, va_list *argp) |
virtual ssize_t | printfUcs2 (const ucs2_t *format,...) |
virtual ssize_t | printfUcs2 (const ucs2_t *format, va_list *argp) |
void | safePrint (byte_t c) |
void | safePrint (const byte_t *str) |
void | safePrint (const byte_t *str, int32_t length) |
void | safePrint (char c) |
void | safePrint (const char *str) |
void | safePrint (const char *str, int32_t length) |
void | printBits (byte_t value) |
void | printBits (uint16_t value) |
void | printBits (uint32_t value) |
void | printBits (uint64_t value) |
void | printBits (char value) |
void | printBits (int16_t value) |
void | printBits (int32_t value) |
void | printBits (int64_t value) |
void | printBits (const byte_t *bits, uint64_t size) |
void | printHex (const byte_t *data, uint64_t size) |
void | printHex (const byte_t *data, uint64_t size, uint16_t indent) |
Additional Inherited Members | |
Static Public Member Functions inherited from filedescriptor | |
static bool | supportsPassAndReceiveFileDescriptor () |
static bool | supportsPassAndReceiveSocket () |
static bool | createPipe (filedescriptor *readfd, filedescriptor *writefd) |
static uint16_t | convertHostToNet (uint16_t value) |
static uint32_t | convertHostToNet (uint32_t value) |
static uint64_t | convertHostToNet (uint64_t value) |
static uint16_t | convertNetToHost (uint16_t value) |
static uint32_t | convertNetToHost (uint32_t value) |
static uint64_t | convertNetToHost (uint64_t value) |
static uint16_t | convertHostToLittleEndian (uint16_t value) |
static uint32_t | convertHostToLittleEndian (uint32_t value) |
static uint64_t | convertHostToLittleEndian (uint64_t value) |
static uint16_t | convertLittleEndianToHost (uint16_t value) |
static uint32_t | convertLittleEndianToHost (uint32_t value) |
static uint64_t | convertLittleEndianToHost (uint64_t value) |
The client class provides a base class for classes that implement the client side of a client-server communication model.
client::client | ( | ) |
Creates an instance of the client class.
|
virtual |
Deletes this instance of the client class.
|
virtual |
This method may be implemnted by a child class to open a connection to a server, presumably specified in the "cd" parameter of the setParameters() method.
This method return an int32_t instead of a bool so child classes that have non atomic connection procedures (such as a modem) can implement return codes other than success or failure (such as abort).
This implementation just returns RESULT_SUCCESS.
Reimplemented in unixsocketclient, modemclient, and inetsocketclient.
uint32_t client::getRetryWait | ( | ) |
Returns the number of seconds that connect() will wait after failing before trying again.
int32_t client::getTimeoutMicroseconds | ( | ) |
Returns the number of microseconds (in addition to the number of seconds set by setTimeoutSeconds()) that a connect() attempt will wait before giving up.
int32_t client::getTimeoutSeconds | ( | ) |
Returns the number of seconds that a connect() attempt will wait before giving up.
uint32_t client::getTries | ( | ) |
Returns the number of attemps that connect() will make before giving up.
const char* client::getVerboseConnectError | ( | ) |
Returns the verbose connect error.
|
virtual |
Queries "cd" for "timeoutsec", "timeoutusec", "retrywait" and "tries" and configures this instancec to use them when connect() is called.
Reimplemented in unixsocketclient, modemclient, and inetsocketclient.
void client::setRetryWait | ( | uint32_t | retrywait | ) |
Sets the number of seconds that connect() will wait after failing before trying again.
Defaults to 0.
void client::setTimeoutMicroseconds | ( | int32_t | timeoutusec | ) |
Sets the number of microseconds (in addition to the number of seconds set by setTimeoutSeconds()) that a connect() attempt will wait before giving up. If set to -1 then connect() will wait forever.
Defaults to -1.
void client::setTimeoutSeconds | ( | int32_t | timeoutsec | ) |
void client::setTries | ( | uint32_t | tries | ) |
void client::setVerboseConnectError | ( | const char * | error | ) |
Sets the verbose connect error. May be called by a child class to set the error that occurred during connect, if it is appropriate to give more information that would be given by error::getErrorString() or if no system-level error occurred.