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.

Public Member Functions
ASN1CType(OSRTMessageBufferIF &)
ASN1CType(const ASN1CType &)
~ASN1CType()
EXTRTMETHOD intDecode()
intDecodeFrom(OSRTMessageBufferIF &)
EXTRTMETHOD intEncode()
intEncodeTo(OSRTMessageBufferIF &)
voidappend(OSRTDList &, void *)
OSRTCtxtPtr getContext()
OSCTXT *getCtxtPtr()
intgetStatus()
void *memAlloc(size_t)
voidmemFreeAll()
voidmemFreePtr(void *)
void *memRealloc(void *, size_t)
voidmemReset()
voidprintErrorInfo()
voidresetError()
OSBOOL setDiag(OSBOOL)
Protected Member Functions
ASN1CType()
ASN1CType(OSRTContext &)
EXTRTMETHOD intsetMsgBuf(OSRTMessageBufferIF &, OSBOOL)
EXTRTMETHOD intsetRunTimeKey(const OSOCTET *, size_t)
Protected Attributes
OSRTCtxtPtr mpContext
OSRTMessageBufferIF *mpMsgBuf

Constructor & Destructor Documentation

ASN1CType()

EXTRTMETHODASN1CType()[protected]

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

ASN1CType(OSRTContext &)

EXTRTMETHODASN1CType(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 &)

EXTRTMETHODASN1CType(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 &)

EXTRTMETHODASN1CType(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 intDecode()[virtual]

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

DecodeFrom(OSRTMessageBufferIF &)

intDecodeFrom(OSRTMessageBufferIF &)[inline, virtual]

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

Parameters

OSRTMessageBufferIF &

Encode()

EXTRTMETHOD intEncode()[virtual]

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

EncodeTo(OSRTMessageBufferIF &)

intEncodeTo(OSRTMessageBufferIF &)[inline, virtual]

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

Parameters

OSRTMessageBufferIF &

append(OSRTDList &, void *)

voidappend(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 & llistLinked list structure.
void * pdataData 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()

intgetStatus()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_tnumocts)[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 numoctsNumber of bytes of memory to allocate

memFreeAll()

voidmemFreeAll()[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 *)

voidmemFreePtr(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_tnumocts
)[inline]

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

Parameters

void * ptrOriginal pointer containing dynamic memory to be resized.
size_t numoctsNumber of bytes of memory to allocate

memReset()

voidmemReset()[inline]

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

printErrorInfo()

voidprintErrorInfo()[inline]

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

resetError()

voidresetError()[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(OSBOOLvalue)[inline]

This method turns diagnostic tracing on or off.

Parameters

OSBOOL valueBoolean value; TRUE = turn tracing on.

setMsgBuf(OSRTMessageBufferIF &, OSBOOL)

EXTRTMETHOD intsetMsgBuf(OSRTMessageBufferIF &msgBuf,
OSBOOLinitBuf = FALSE
)[protected]

Parameters

OSRTMessageBufferIF & msgBuf
OSBOOL initBuf = FALSE

setRunTimeKey(const OSOCTET *, size_t)

EXTRTMETHOD intsetRunTimeKey(const OSOCTET *key,
size_tkeylen
)[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.