Home > Support > Documentation

Context Management Functions


Detailed Description

Context initialization functions handle the allocation, initialization, and destruction of context variables (variables of type OSCTXT). These variables hold all of the working data used during the process of encoding or decoding a message. The context provides thread safe operation by isolating what would otherwise be global variables within this structure. The context variable is passed from function to function as a message is encoded or decoded and maintains state information on the encoding or decoding process.


Classes

struct  OSRTErrLocn
struct  OSRTErrInfo
struct  OSRTErrInfoList
struct  OSRTBuffer
struct  OSRTBufSave
struct  OSCTXT
struct  OSRTErrLocn
struct  OSRTErrInfo
struct  OSRTBuffer
struct  OSRTBufSave
struct  OSCTXT

Defines

#define OSRTERRSTKSIZ   8
#define OSRTMAXERRPRM   5
#define OSDIAG   0x80000000
#define OSTRACE   0x40000000
#define OSDISSTRM   0x20000000
#define OSSAVEBUF   0x10000000
#define OSRT_GET_FIRST_ERROR_INFO(pctxt)
#define OSRT_GET_LAST_ERROR_INFO(pctxt)
#define rtxCtxtTestFlag(pctxt, mask)   ((pctxt->flags & mask) != 0)

Typedefs

typedef OSUINT32 OSRTFLAGS
typedef int(*) OSFreeCtxtAppInfoPtr (OSCTXT *pctxt)
typedef int(*) OSResetCtxtAppInfoPtr (OSCTXT *pctxt)

Functions

EXTERNRTX int rtxInitContext (OSCTXT *pctxt)
EXTERNRTX int rtxInitContextBuffer (OSCTXT *pctxt, OSOCTET *bufaddr, size_t bufsiz)
EXTERNRTX void rtxFreeContext (OSCTXT *pctxt)
EXTERNRTX void rtxCopyContext (OSCTXT *pdest, OSCTXT *psrc)
EXTERNRTX void rtxCtxtSetFlag (OSCTXT *pctxt, OSUINT32 mask)
EXTERNRTX void rtxCtxtClearFlag (OSCTXT *pctxt, OSUINT32 mask)
EXTERNRTX int rtxPreInitContext (OSCTXT *pctxt)
EXTERNRTX void rtxMemFreeOpenSeqExt (OSCTXT *pctxt, struct OSRTDList *pElemList)
EXTERNRTX void rtxMemHeapSetFlags (OSCTXT *pctxt, OSUINT32 flags)
EXTERNRTX void rtxMemHeapClearFlags (OSCTXT *pctxt, OSUINT32 flags)
EXTERNRTX void rtxMemHeapSetDefBlkSize (OSCTXT *pctxt, OSUINT32 blkSize)
EXTERNRTX OSUINT32 rtxMemHeapGetDefBlkSize (OSCTXT *pctxt)

Variables

OSINT32 OSRTErrLocn::lineno
OSINT16 OSRTErrInfo::status
OSUINT8 OSRTErrInfo::stkx
OSUINT8 OSRTErrInfo::parmcnt
OSUTF8CHAR * OSRTErrInfo::parms [OSRTMAXERRPRM]
OSUTF8CHAR * OSRTErrInfo::elemName
OSRTErrInfo OSRTErrInfoList::reserved
OSRTDListNode OSRTErrInfoList::reservedNode
size_t OSRTBuffer::byteIndex
size_t OSRTBuffer::size
OSINT16 OSRTBuffer::bitOffset
OSBOOL OSRTBuffer::dynamic
OSBOOL OSRTBuffer::aligned
OSINT16 OSRTBufSave::bitOffset
OSRTFLAGS OSRTBufSave::flags
OSRTBuffer OSCTXT::buffer
OSRTBufSave OSCTXT::savedInfo
OSRTErrInfoList OSCTXT::errInfo
OSUINT32 OSCTXT::initCode
OSRTFLAGS OSCTXT::flags
OSOCTET OSCTXT::level
OSOCTET OSCTXT::state
OSOCTET OSCTXT::spare [2]
OSRTSTREAMOSCTXT::pStream
OSRTPrintStreamOSCTXT::pPrintStrm
OSRTDList OSCTXT::elemNameStack
const OSOCTET * OSCTXT::key
size_t OSCTXT::keylen
OSVoidPtr OSCTXT::pXMLInfo
OSVoidPtr OSCTXT::pASN1Info
OSVoidPtr OSCTXT::pUserData

Define Documentation

#define OSRT_GET_FIRST_ERROR_INFO ( pctxt   ) 

Value:

(((pctxt)->errInfo.list.head == 0) ? (OSRTErrInfo*)0 : \
(OSRTErrInfo*)((pctxt)->errInfo.list.head->data))

#define OSRT_GET_LAST_ERROR_INFO ( pctxt   ) 

Value:

(((pctxt)->errInfo.list.tail == 0) ? (OSRTErrInfo*)0 : \
(OSRTErrInfo*)((pctxt)->errInfo.list.tail->data))

#define rtxCtxtTestFlag ( pctxt,
mask   )     ((pctxt->flags & mask) != 0)

This macro tests if the given bit flag is set in the context.

Parameters:
pctxt - A pointer to a context structure.
mask - Bit flag to be tested


Function Documentation

EXTERNRTX void rtxCtxtClearFlag ( OSCTXT pctxt,
OSUINT32  mask 
)

This function is used to clear a processing flag within the context structure.

Parameters:
pctxt - A pointer to a context structure.
mask - Mask containing bit(s) to be cleared.

EXTERNRTX void rtxCtxtSetFlag ( OSCTXT pctxt,
OSUINT32  mask 
)

This function is used to set a processing flag within the context structure.

Parameters:
pctxt - A pointer to a context structure.
mask - Mask containing bit(s) to be set.

EXTERNRTX void rtxFreeContext ( OSCTXT pctxt  ) 

This function frees all dynamic memory associated with a context. This includes all memory allocated using the rtxMem functions using the given context parameter.

Parameters:
pctxt - A pointer to a context structure.

EXTERNRTX int rtxInitContext ( OSCTXT pctxt  ) 

This function initializes an OSCTXT block. It sets all key working parameters to their correct initial state values. It is required that this function be invoked before using a context variable.

Parameters:
pctxt Pointer to the context structure variable to be initialized.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.

EXTERNRTX int rtxInitContextBuffer ( OSCTXT pctxt,
OSOCTET *  bufaddr,
size_t  bufsiz 
)

This function assigns a message buffer to a context block. The block should have been previously initialized by rtxInitContext.

Parameters:
pctxt The pointer to the context structure variable to be initialized.
bufaddr For encoding, the address of a memory buffer to receive the encoded message. If this address is NULL (0), encoding to a dynamic buffer will be done. For decoding, the address of a buffer that contains the message data to be decoded.
bufsiz The size of the memory buffer. For encoding, this argument may be set to zero to indicate a dynamic memory buffer should be used.
Returns:
Completion status of operation:
  • 0 = success,
  • negative return value is error.