ASN1CType Class Reference
[Control (ASN1C_) Base Classes]

#include <asn1CppTypes.h>

Inheritance diagram for ASN1CType:
ASN1CBitStr ASN1CSeqOfList ASN1CTime ASN1CGeneralizedTime ASN1CUTCTime

List of all members.

Public Member Functions

EXTRTMETHOD ASN1CType (OSRTMessageBufferIF &msgBuf)
EXTRTMETHOD ASN1CType (const ASN1CType &orig)
virtual ~ASN1CType ()
void append (OSRTDList &llist, void *pdata)
OSRTCtxtPtr getContext ()
OSCTXTgetCtxtPtr ()
char * getErrorText (char *textbuf=(char *) 0, OSSIZE bufsize=0)
int getStatus () const
void * memAlloc (OSSIZE numocts)
void memFreeAll ()
void * memRealloc (void *ptr, OSSIZE numocts)
void memReset ()
void memFreePtr (void *ptr)
void printErrorInfo ()
void resetError ()
OSBOOL setDiag (OSBOOL value)
virtual EXTRTMETHOD int Encode ()
virtual EXTRTMETHOD int Decode ()
virtual int EncodeTo (OSRTMessageBufferIF &)
virtual int DecodeFrom (OSRTMessageBufferIF &)

Protected Member Functions

EXTRTMETHOD ASN1CType ()
EXTRTMETHOD ASN1CType (OSRTContext &ctxt)
EXTRTMETHOD int setMsgBuf (OSRTMessageBufferIF &msgBuf, OSBOOL initBuf=FALSE)
EXTRTMETHOD int setRunTimeKey (const OSOCTET *key, OSSIZE keylen)

Protected Attributes

OSRTCtxtPtr mpContext
OSRTMessageBufferIF * mpMsgBuf

Detailed Description

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

EXTRTMETHOD ASN1CType::ASN1CType (  )  [protected]

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

EXTRTMETHOD ASN1CType::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:
ctxt - Reference to a context object.
EXTRTMETHOD ASN1CType::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:
msgBuf - Reference to a message buffer or stream object.
EXTRTMETHOD ASN1CType::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:
orig - Reference to a message buffer or stream object.
virtual ASN1CType::~ASN1CType (  )  [inline, virtual]

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


Member Function Documentation

void ASN1CType::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:
llist Linked list structure.
pdata Data record to be appended. Note that the pointer value is appended. The data is not copied.

References LOG_RTERR, RTERR_NOMEM, and rtxDListAppend().

virtual EXTRTMETHOD int ASN1CType::Decode (  )  [virtual]

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

Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
virtual int ASN1CType::DecodeFrom ( OSRTMessageBufferIF &   )  [inline, virtual]

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

Parameters:
msgBuf Message buffer or stream containing message to decode.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

References ASN_E_NOTPDU.

virtual EXTRTMETHOD int ASN1CType::Encode (  )  [virtual]

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

Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
virtual int ASN1CType::EncodeTo ( OSRTMessageBufferIF &   )  [inline, virtual]

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

Parameters:
msgBuf Message buffer or stream to which the message is to be encoded.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

References ASN_E_NOTPDU.

OSRTCtxtPtr ASN1CType::getContext (  )  [inline]

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

Returns:
Context smart pointer object.
OSCTXT* ASN1CType::getCtxtPtr (  )  [inline]

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

char* ASN1CType::getErrorText ( char *  textbuf = (char *) 0,
OSSIZE  bufsize = 0 
)

This method returns the error text associated with the last run-time error. If buffer pointer and buffer size are specified in parameters (not NULL) then error text will be copied in the passed buffer. Otherwise, this function allocates memory using the 'new' operator. It is the user's responsibility to free this memory using 'delete'.

Parameters:
textbuf A pointer to a destination buffer to hold the error text. If NULL, a dynamic buffer will be allocated.
bufsize The size of the output buffer size.
Returns:
A pointer to a buffer with error text. If pBuf is not NULL, the return pointer will be equal to it. Otherwise, returns newly allocated buffer with error text. NULL, if error occurred.
int ASN1CType::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.

Returns:
Runtime status code:
  • 0 (0) = success,
  • negative return value is error.
void* ASN1CType::memAlloc ( OSSIZE  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:
numocts Number of bytes of memory to allocate
Returns:
Void pointer to allocated memory or NULL if insufficient memory was available to fulfill the request.
void ASN1CType::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.

void ASN1CType::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:
ptr - Pointer to a block of memory allocated with memAlloc
void* ASN1CType::memRealloc ( void *  ptr,
OSSIZE  numocts 
) [inline]

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

Parameters:
ptr Original pointer containing dynamic memory to be resized.
numocts Number of bytes of memory to allocate
Returns:
Reallocated memory pointer
void ASN1CType::memReset (  )  [inline]

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

void ASN1CType::printErrorInfo (  )  [inline]

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

void ASN1CType::resetError (  )  [inline]

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

OSBOOL ASN1CType::setDiag ( OSBOOL  value  )  [inline]

This method turns diagnostic tracing on or off.

Parameters:
value Boolean value; TRUE = turn tracing on.
Returns:
Previous state.
EXTRTMETHOD int ASN1CType::setRunTimeKey ( const OSOCTET *  key,
OSSIZE  keylen 
) [protected]

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

Parameters:
key - array of octets with the key
keylen - number of octets in key array.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

Member Data Documentation

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* ASN1CType::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.


The documentation for this class was generated from the following file: