ASN1C C/C++ Common Runtime  ASN1C v7.4.x
Functions
Memory stream functions.

Functions

int rtxStreamMemoryCreate (OSCTXT *pctxt, OSUINT16 flags)
 
int rtxStreamMemoryAttach (OSCTXT *pctxt, OSOCTET *pMemBuf, size_t bufSize, OSUINT16 flags)
 
OSOCTET * rtxStreamMemoryGetBuffer (OSCTXT *pctxt, size_t *pSize)
 
int rtxStreamMemoryCreateReader (OSCTXT *pctxt, OSOCTET *pMemBuf, size_t bufSize)
 
int rtxStreamMemoryCreateWriter (OSCTXT *pctxt, OSOCTET *pMemBuf, size_t bufSize)
 
int rtxStreamMemoryResetWriter (OSCTXT *pctxt)
 

Detailed Description

Memory stream functions are used for memory stream operations.

Function Documentation

◆ rtxStreamMemoryAttach()

int rtxStreamMemoryAttach ( OSCTXT pctxt,
OSOCTET *  pMemBuf,
size_t  bufSize,
OSUINT16  flags 
)

Opens a memory stream using the specified memory buffer. The 'flags' parameter specifies the access mode for the stream - input or output.

Parameters
pctxtPointer to a context structure variable that has been initialized for stream operations.
pMemBufThe pointer to the buffer.
bufSizeThe size of the buffer.
flagsSpecifies the access mode for the stream:
  • OSRTSTRMF_INPUT = input (reading) stream;
  • OSRTSTRMF_OUTPUT = output (writing) stream.
Returns
Completion status of operation: 0 = success, negative return value is error.

◆ rtxStreamMemoryCreate()

int rtxStreamMemoryCreate ( OSCTXT pctxt,
OSUINT16  flags 
)

Opens a memory stream. A memory buffer will be created by this function. The 'flags' parameter specifies the access mode for the stream - input or output.

Parameters
pctxtPointer to a context structure variable that has been initialized for stream operations.
flagsSpecifies the access mode for the stream:
  • OSRTSTRMF_INPUT = input (reading) stream;
  • OSRTSTRMF_OUTPUT = output (writing) stream.
Returns
Completion status of operation: 0 = success, negative return value is error.

◆ rtxStreamMemoryCreateReader()

int rtxStreamMemoryCreateReader ( OSCTXT pctxt,
OSOCTET *  pMemBuf,
size_t  bufSize 
)

This function creates an input memory stream using the specified buffer.

Parameters
pctxtPointer to a context structure variable that has been initialized for stream operations.
pMemBufThe pointer to the buffer
bufSizeThe size of the buffer
Returns
Completion status of operation: 0 = success, negative return value is error.

◆ rtxStreamMemoryCreateWriter()

int rtxStreamMemoryCreateWriter ( OSCTXT pctxt,
OSOCTET *  pMemBuf,
size_t  bufSize 
)

This function creates an output memory stream using the specified buffer. If pMemBuf or bufSize is NULL then new buffer will be allocated.

Parameters
pctxtPointer to a context structure variable that has been initialized for stream operations.
pMemBufThe pointer to the buffer. Can be NULL - new buffer will be allocated in this case.
bufSizeThe size of the buffer. Can be 0 - new buffer will be allocated in this case.
Returns
Completion status of operation: 0 = success, negative return value is error.

◆ rtxStreamMemoryGetBuffer()

OSOCTET* rtxStreamMemoryGetBuffer ( OSCTXT pctxt,
size_t *  pSize 
)

This function returns the memory buffer and its size for the given memory stream.

Parameters
pctxtPointer to a context structure variable that has been initialized for stream operations.
pSizeThe pointer to size_t to receive the size of buffer.
Returns
The pointer to memory buffer. NULL, if error occurred.

◆ rtxStreamMemoryResetWriter()

int rtxStreamMemoryResetWriter ( OSCTXT pctxt)

This function resets the output memory stream internal buffer to allow it to be overwritten with new data. Memory for the buffer is not freed.

Parameters
pctxtPointer to a context structure variable that has been initialized for stream operations.
Returns
Completion status of operation: 0 = success, negative return value is error.