XBinder
Version 2.6.x
|
Stream functions are used for unbuffered stream operations. More...
Classes | |
struct | OSRTSTREAM |
The stream control block. More... | |
Typedefs | |
typedef long(* | OSRTStreamReadProc) (struct OSRTSTREAM *pStream, OSOCTET *pbuffer, size_t bufSize) |
Stream read function pointer type. More... | |
typedef long(* | OSRTStreamBlockingReadProc) (struct OSRTSTREAM *pStream, OSOCTET *pbuffer, size_t toReadBytes) |
Stream blockingRead function pointer type. More... | |
typedef long(* | OSRTStreamWriteProc) (struct OSRTSTREAM *pStream, const OSOCTET *data, size_t numocts) |
Stream write function pointer type. More... | |
typedef int(* | OSRTStreamFlushProc) (struct OSRTSTREAM *pStream) |
Stream flush function pointer type. More... | |
typedef int(* | OSRTStreamCloseProc) (struct OSRTSTREAM *pStream) |
Stream close function pointer type. More... | |
typedef int(* | OSRTStreamSkipProc) (struct OSRTSTREAM *pStream, size_t skipBytes) |
Stream skip function pointer type. More... | |
typedef int(* | OSRTStreamMarkProc) (struct OSRTSTREAM *pStream, size_t readAheadLimit) |
Stream mark function pointer type. More... | |
typedef int(* | OSRTStreamResetProc) (struct OSRTSTREAM *pStream) |
Stream reset function pointer type. More... | |
typedef int(* | OSRTStreamGetPosProc) (struct OSRTSTREAM *pStream, size_t *ppos) |
Stream get position function pointer type. More... | |
typedef int(* | OSRTStreamSetPosProc) (struct OSRTSTREAM *pStream, size_t pos) |
Stream set position function pointer type. More... | |
typedef struct OSRTSTREAM | OSRTSTREAM |
The stream control block. More... | |
Functions | |
EXTERNRT int | rtxStreamClose (OSCTXT *pctxt) |
This function closes the input or output stream and releases any system resources associated with the stream. More... | |
EXTERNRT int | rtxStreamFlush (OSCTXT *pctxt) |
This function flushes the output stream and forces any buffered output octets to be written out. More... | |
EXTERNRT int | rtxStreamInit (OSCTXT *pctxt) |
This function initializes a stream part of the context block. More... | |
EXTERNRT int | rtxStreamInitCtxtBuf (OSCTXT *pctxt) |
This function initializes a stream to use the context memory buffer for stream buffering. More... | |
EXTERNRT int | rtxStreamRemoveCtxtBuf (OSCTXT *pctxt) |
This function removes the use of a context memory buffer from a stream. More... | |
EXTERNRT long | rtxStreamRead (OSCTXT *pctxt, OSOCTET *pbuffer, size_t bufSize) |
This function reads up to 'bufsize' bytes of data from the input stream into an array of octets. More... | |
EXTERNRT long | rtxStreamBlockingRead (OSCTXT *pctxt, OSOCTET *pbuffer, size_t readBytes) |
This function reads up to 'bufsize' bytes of data from the input stream into an array of octets. More... | |
EXTERNRT int | rtxStreamSkip (OSCTXT *pctxt, size_t skipBytes) |
This function skips over and discards the specified amount of data octets from this input stream. More... | |
EXTERNRT long | rtxStreamWrite (OSCTXT *pctxt, const OSOCTET *data, size_t numocts) |
This function writes the specified amount of octets from the specified array to the output stream. More... | |
EXTERNRT int | rtxStreamGetIOBytes (OSCTXT *pctxt, size_t *pPos) |
This function returns the number of processed octets. More... | |
EXTERNRT int | rtxStreamMark (OSCTXT *pctxt, size_t readAheadLimit) |
Marks the current position in this input stream. More... | |
EXTERNRT int | rtxStreamReset (OSCTXT *pctxt) |
Repositions this stream to the position recorded by the last call to the rtxStreamMark function. More... | |
EXTERNRT OSBOOL | rtxStreamMarkSupported (OSCTXT *pctxt) |
Tests if this input stream supports the mark and reset methods. More... | |
EXTERNRT OSBOOL | rtxStreamIsOpened (OSCTXT *pctxt) |
Tests if this stream opened (for reading or writing). More... | |
EXTERNRT OSBOOL | rtxStreamIsReadable (OSCTXT *pctxt) |
Tests if this stream opened for reading. More... | |
EXTERNRT OSBOOL | rtxStreamIsWritable (OSCTXT *pctxt) |
Tests if this stream opened for writing. More... | |
EXTERNRT int | rtxStreamRelease (OSCTXT *pctxt) |
This function releases the stream's resources. More... | |
EXTERNRT void | rtxStreamSetCapture (OSCTXT *pctxt, OSRTMEMBUF *pmembuf) |
This function sets a capture buffer for the stream. More... | |
EXTERNRT OSRTMEMBUF * | rtxStreamGetCapture (OSCTXT *pctxt) |
This function returns the capture buffer currently assigned to the stream. More... | |
EXTERNRT int | rtxStreamGetPos (OSCTXT *pctxt, size_t *ppos) |
Get the current position in input stream. More... | |
EXTERNRT int | rtxStreamSetPos (OSCTXT *pctxt, size_t pos) |
Set the current position in input stream. More... | |
Stream functions are used for unbuffered stream operations.
All of the operations with streams are performed using a context block to maintain state information.
These functions may be used for any input/output operations with streams. Each stream should be initialized first by call to the rtxStreamInit
function. After initialization, the stream may be opened for reading or writing by calling one of the following functions:
rtxStreamFileOpen
rtxStreamFileAttach
rtxStreamSocketAttach
rtxStreamMemoryCreate
rtxStreamMemoryAttach
typedef struct OSRTSTREAM OSRTSTREAM |
The stream control block.
A user may implement a customized stream by defining read, skip, close functions for input streams and write, flush, close for output streams.
typedef long(* OSRTStreamBlockingReadProc) (struct OSRTSTREAM *pStream, OSOCTET *pbuffer, size_t toReadBytes) |
Stream blockingRead function pointer type.
A user may implement a customized read function for specific input streams. The blockingRead function is defined in the OSRTSTREAM control structure.
Definition at line 75 of file rtxStream.h.
typedef int(* OSRTStreamCloseProc) (struct OSRTSTREAM *pStream) |
Stream close function pointer type.
A user may implement a customized close function for any specific input or output streams. The close function is defined in the OSRTSTREAM control structure.
Definition at line 97 of file rtxStream.h.
typedef int(* OSRTStreamFlushProc) (struct OSRTSTREAM *pStream) |
Stream flush function pointer type.
A user may implement a customized flush function for any specific output streams. The flush function is defined in the OSRTSTREAM control structure.
Definition at line 90 of file rtxStream.h.
typedef int(* OSRTStreamGetPosProc) (struct OSRTSTREAM *pStream, size_t *ppos) |
Stream get position function pointer type.
A user may implement a customized function for a specific input stream type. The mark function is defined in the OSRTSTREAM control structure.
Definition at line 128 of file rtxStream.h.
typedef int(* OSRTStreamMarkProc) (struct OSRTSTREAM *pStream, size_t readAheadLimit) |
Stream mark function pointer type.
A user may implement a customized function for a specific input stream type. The mark function is defined in the OSRTSTREAM control structure.
Definition at line 113 of file rtxStream.h.
typedef long(* OSRTStreamReadProc) (struct OSRTSTREAM *pStream, OSOCTET *pbuffer, size_t bufSize) |
Stream read function pointer type.
A user may implement a customized read function for specific input streams. The read function is defined in the OSRTSTREAM control structure.
Definition at line 67 of file rtxStream.h.
typedef int(* OSRTStreamResetProc) (struct OSRTSTREAM *pStream) |
Stream reset function pointer type.
A user may implement a customized function for a specific input stream type. The reset function is defined in the OSRTSTREAM control structure.
Definition at line 120 of file rtxStream.h.
typedef int(* OSRTStreamSetPosProc) (struct OSRTSTREAM *pStream, size_t pos) |
Stream set position function pointer type.
A user may implement a customized function for a specific input stream type. The mark function is defined in the OSRTSTREAM control structure.
Definition at line 136 of file rtxStream.h.
typedef int(* OSRTStreamSkipProc) (struct OSRTSTREAM *pStream, size_t skipBytes) |
Stream skip function pointer type.
A user may implement a customized function for a specific input stream type. The skip function is defined in the OSRTSTREAM control structure.
Definition at line 105 of file rtxStream.h.
typedef long(* OSRTStreamWriteProc) (struct OSRTSTREAM *pStream, const OSOCTET *data, size_t numocts) |
Stream write function pointer type.
A user may implement a customized write function for any specific output streams. The write function is defined in the OSRTSTREAM control structure.
Definition at line 82 of file rtxStream.h.
EXTERNRT long rtxStreamBlockingRead | ( | OSCTXT * | pctxt, |
OSOCTET * | pbuffer, | ||
size_t | readBytes | ||
) |
This function reads up to 'bufsize' bytes of data from the input stream into an array of octets.
An attempt is made to read as many as bufsize octets, but a smaller number may be read, possibly zero. The number of octets actually read is returned as an integer. This functions blocks until input data is available, end of file is detected, or another error is occurred.
pctxt | Pointer to a context structure variable which has been initialized for stream operations via a call to rtxStreamInit. |
pbuffer | Pointer to a buffer to receive data. |
readBytes | Number of bytes to read. |
EXTERNRT int rtxStreamClose | ( | OSCTXT * | pctxt | ) |
This function closes the input or output stream and releases any system resources associated with the stream.
For output streams this function also flushes all internal buffers to the stream.
pctxt | Pointer to a context structure variable which has been initialized for stream operations via a call to rtxStreamInit . |
EXTERNRT int rtxStreamFlush | ( | OSCTXT * | pctxt | ) |
This function flushes the output stream and forces any buffered output octets to be written out.
pctxt | Pointer to a context structure variable which has been initialized for stream operations via a call to rtxStreamInit . |
EXTERNRT OSRTMEMBUF* rtxStreamGetCapture | ( | OSCTXT * | pctxt | ) |
This function returns the capture buffer currently assigned to the stream.
pctxt | Pointer to a context structure variable that has been initialized for stream operations. |
EXTERNRT int rtxStreamGetIOBytes | ( | OSCTXT * | pctxt, |
size_t * | pPos | ||
) |
This function returns the number of processed octets.
If the stream was opened as an input stream, then it returns the total number of read octets. If the stream was opened as an output stream, then it returns the total number of written octets. Otherwise, this function returns an error code.
pctxt | Pointer to a context structure variable which has been initialized for stream operations via a call to rtxStreamInit . |
pPos | Pointer to argument to receive total number of processed octets. |
EXTERNRT int rtxStreamGetPos | ( | OSCTXT * | pctxt, |
size_t * | ppos | ||
) |
Get the current position in input stream.
pctxt | Pointer to a context structure variable that has been initialized for stream operations. |
ppos | Pointer to a variable to receive position. |
EXTERNRT int rtxStreamInit | ( | OSCTXT * | pctxt | ) |
This function initializes a stream part of the context block.
This function should be called first before any operation with a stream.
pctxt | Pointer to context structure variable, for which stream to be initialized. |
EXTERNRT int rtxStreamInitCtxtBuf | ( | OSCTXT * | pctxt | ) |
This function initializes a stream to use the context memory buffer for stream buffering.
pctxt | Pointer to context structure variable, for which stream to be initialized. |
EXTERNRT OSBOOL rtxStreamIsOpened | ( | OSCTXT * | pctxt | ) |
Tests if this stream opened (for reading or writing).
pctxt | Pointer to a context structure variable that has been initialized for stream operations. |
EXTERNRT OSBOOL rtxStreamIsReadable | ( | OSCTXT * | pctxt | ) |
Tests if this stream opened for reading.
pctxt | Pointer to a context structure variable that has been initialized for stream operations. |
EXTERNRT OSBOOL rtxStreamIsWritable | ( | OSCTXT * | pctxt | ) |
Tests if this stream opened for writing.
pctxt | Pointer to a context structure variable that has been initialized for stream operations. |
EXTERNRT int rtxStreamMark | ( | OSCTXT * | pctxt, |
size_t | readAheadLimit | ||
) |
Marks the current position in this input stream.
A subsequent call to the rtxStreamReset function repositions this stream at the last marked position so that subsequent reads re-read the same bytes. The readAheadLimit
argument tells this input stream to allow many bytes to be read before the mark position gets invalidated.
pctxt | Pointer to a context structure variable that has been initialized for stream operations. |
readAheadLimit | The maximum limit of bytes that can be read before the mark position becomes invalid. |
EXTERNRT OSBOOL rtxStreamMarkSupported | ( | OSCTXT * | pctxt | ) |
Tests if this input stream supports the mark and reset methods.
Whether or not mark and reset are supported is an invariant property of a particular input stream instance. By default, it returns FALSE.
pctxt | Pointer to a context structure variable that has been initialized for stream operations. |
EXTERNRT long rtxStreamRead | ( | OSCTXT * | pctxt, |
OSOCTET * | pbuffer, | ||
size_t | bufSize | ||
) |
This function reads up to 'bufsize' bytes of data from the input stream into an array of octets.
An attempt is made to read as many as bufsize octets, but a smaller number may be read, possibly zero. The number of octets actually read is returned as an integer. This functions blocks until input data is available, end of file is detected, or another error is occurred.
pctxt | Pointer to a context structure variable which has been initialized for stream operations via a call to rtxStreamInit. |
pbuffer | Pointer to a buffer to receive data. |
bufSize | Size of the buffer. |
EXTERNRT int rtxStreamRelease | ( | OSCTXT * | pctxt | ) |
This function releases the stream's resources.
If it is opened for reading or writing it will be closed.
pctxt | Pointer to a context structure variable that has been initialized for stream operations. |
EXTERNRT int rtxStreamRemoveCtxtBuf | ( | OSCTXT * | pctxt | ) |
This function removes the use of a context memory buffer from a stream.
pctxt | Pointer to context structure variable which is assumed to contain an initialized stream with context buffering enabled. |
EXTERNRT int rtxStreamReset | ( | OSCTXT * | pctxt | ) |
Repositions this stream to the position recorded by the last call to the rtxStreamMark function.
pctxt | Pointer to a context structure variable that has been initialized for stream operations. |
EXTERNRT void rtxStreamSetCapture | ( | OSCTXT * | pctxt, |
OSRTMEMBUF * | pmembuf | ||
) |
This function sets a capture buffer for the stream.
This is used to record all data read from the stream.
pctxt | Pointer to a context structure variable that has been initialized for stream operations. |
pmembuf | Pointer to an initialized memory buffer structure. This argument may be set to NULL to disable capture if previously set. |
EXTERNRT int rtxStreamSetPos | ( | OSCTXT * | pctxt, |
size_t | pos | ||
) |
Set the current position in input stream.
pctxt | Pointer to a context structure variable that has been initialized for stream operations. |
pos | Stream position. |
EXTERNRT int rtxStreamSkip | ( | OSCTXT * | pctxt, |
size_t | skipBytes | ||
) |
This function skips over and discards the specified amount of data octets from this input stream.
pctxt | Pointer to a context structure variable which has been initialized for stream operations via a call to rtxStreamInit. |
skipBytes | The number of octets to be skipped. |
EXTERNRT long rtxStreamWrite | ( | OSCTXT * | pctxt, |
const OSOCTET * | data, | ||
size_t | numocts | ||
) |
This function writes the specified amount of octets from the specified array to the output stream.
pctxt | Pointer to a context structure variable which has been initialized for stream operations via a call to rtxStreamInit. |
data | The pointer to data to be written. |
numocts | The number of octets to write. |