ASN1CType Class Reference

class ASN1CType

ASN1C control class base class. This is the main base class for all generated ASN1C_<name> control classes. It holds a variable of a generated data type as well as the associated message buffer or stream class to which a message will be encoded or from which a message will be decoded.

Constructor & Destructor Documentation

ASN1CType()

EXTRTMETHOD ASN1CType ( ) [protected]

The default constructor sets the message pointer member variable to NULL and creates a new context object.

ASN1CType(OSRTContext &)

EXTRTMETHOD ASN1CType ( OSRTContext & ctxt ) [protected]

This constructor sets the message pointer member variable to NULL and initializes the context object to point at the given context value.

Parameters

OSRTContext & ctxt - Reference to a context object.

ASN1CType(OSRTMessageBufferIF &)

EXTRTMETHOD ASN1CType ( OSRTMessageBufferIF & msgBuf )

This constructor sets the internal message buffer pointer to point at the given message buffer or stream object. The context is set to point at the context contained within the message buffer object. Thus, the message buffer and control class object share the context. It will not be released until both objects are destroyed.

Parameters

OSRTMessageBufferIF & msgBuf - Reference to a message buffer or stream object.

ASN1CType(const ASN1CType &)

EXTRTMETHOD ASN1CType ( const ASN1CType & orig )

The copy constructor sets the internal message buffer pointer and context to point at the message buffer and context from the original ASN1CType object.

Parameters

const ASN1CType & orig - Reference to a message buffer or stream object.

~ASN1CType()

~ASN1CType ( ) [inline, virtual]

The virtual destructor does nothing. It is overridden by derived versions of this class.

Member Functions Documentation

Decode()

EXTRTMETHOD int Decode ( ) [virtual]

The Decode method decodes the ASN.1 message described by the encapsulated message buffer object.

DecodeFrom(OSRTMessageBufferIF &)

int DecodeFrom ( OSRTMessageBufferIF & ) [inline, virtual]

The DecodeFrom method decodes an ASN.1 message from the given message buffer or stream argument.

Encode()

EXTRTMETHOD int Encode ( ) [virtual]

The Encode method encodes an ASN.1 message using the encoding rules specified by the derived message buffer object.

EncodeTo(OSRTMessageBufferIF &)

int EncodeTo ( OSRTMessageBufferIF & ) [inline, virtual]

The EncodeTo method encodes an ASN.1 message into the given message buffer or stream argument.

append(OSRTDList &, void *)

void append ( OSRTDList & llist,
void * pdata
) [inline]

The append method can be used to append an element to any linked list structure contained within the generated type.

Parameters

OSRTDList & llist Linked list structure.
void * pdata Data record to be appended. Note that the pointer value is appended. The data is not copied.

getContext()

OSRTCtxtPtr getContext ( ) [inline]

The getContext method returns the underlying context smart-pointer object.

getCtxtPtr()

OSCTXT * getCtxtPtr ( ) [inline]

The getCtxtPtr method returns the underlying C runtime context. This context can be used in calls to C runtime functions.

getStatus()

int getStatus ( ) const [inline]

This method returns the completion status of previous operation. It can be used to check completion status of constructors or methods, which do not return completion status. If error occurs, use printErrorInfo method to print out the error's description and stack trace. Method resetError can be used to reset error to continue operations after recovering from the error.

memAlloc(size_t)

void * memAlloc ( size_t numocts ) [inline]

The memAlloc method allocates memory using the C runtime memory management functions. The memory is tracked in the underlying context structure. When both this ASN1CType derived control class object and the message buffer object are destroyed, this memory will be freed.

Parameters

size_t numocts Number of bytes of memory to allocate

memFreeAll()

void memFreeAll ( ) [inline]

The memFreeAll method will free all memory currently tracked within the context. This includes all memory allocated with the memAlloc method as well as any memory allocated using the C rtxMemAlloc function with the context returned by the getCtxtPtr method.

memFreePtr(void *)

void memFreePtr ( void * ptr ) [inline]

The memFreePtr method frees the memory at a specific location. This memory must have been allocated using the memAlloc method described earlier.

Parameters

void * ptr - Pointer to a block of memory allocated with memAlloc

memRealloc(void *, size_t)

void * memRealloc ( void * ptr,
size_t numocts
) [inline]

The memRealloc method reallocates memory using the C runtime memory management functions.

Parameters

void * ptr Original pointer containing dynamic memory to be resized.
size_t numocts Number of bytes of memory to allocate

memReset()

void memReset ( ) [inline]

The memReset method resets dynamic memory using the C runtime memory management functions.

printErrorInfo()

void printErrorInfo ( ) [inline]

The PrintErrorInfo method prints information on errors contained within the context.

resetError()

void resetError ( ) [inline]

This method resets error status and stack trace. This method should be used to continue operations after recovering from the error.

setDiag(OSBOOL)

OSBOOL setDiag ( OSBOOL value ) [inline]

This method turns diagnostic tracing on or off.

Parameters

OSBOOL value Boolean value; TRUE = turn tracing on.

setMsgBuf(OSRTMessageBufferIF &, OSBOOL)

EXTRTMETHOD int setMsgBuf ( OSRTMessageBufferIF & msgBuf,
OSBOOL initBuf = FALSE
) [protected]

Parameters

OSRTMessageBufferIF & msgBuf
OSBOOL initBuf = FALSE

setRunTimeKey(const OSOCTET *, size_t)

EXTRTMETHOD int setRunTimeKey ( const OSOCTET * key,
size_t keylen
) [protected]

This method sets run-time key to the context. This method does nothing for unlimited redistribution libraries.

Parameters

const OSOCTET * key - array of octets with the key
size_t keylen - number of octets in key array.

Member Data Documentation

OSRTCtxtPtr mpContext

OSRTCtxtPtr mpContext [protected]

The mpContext member variable holds a reference-counted C runtime variable. This context is used in calls to all C run-time functions. The context pointed at by this smart-pointer object is shared with the message buffer object contained within this class.

OSRTMessageBufferIF * mpMsgBuf

OSRTMessageBufferIF * mpMsgBuf [protected]

The mpMsgBuf member variable is a pointer to a derived message buffer or stream class that will manage the ASN.1 message being encoded or decoded.