Streaming BER Runtime Library Functions.
[BER Runtime Library Functions.]

Modules

 C Streaming BER Encode Functions.
 C Streaming BER Decode Functions.

Defines

#define BS_CHKEOB(pctxt)
#define BS_CHKEND(pctxt, ccb_p)

Functions

int berStrmInitContext (OSCTXT *pctxt)
int berStrmInitContextUsingKey (OSCTXT *pctxt, const OSOCTET *key, size_t keylen)
int berStrmFreeContext (OSCTXT *pctxt)
int cerEncCanonicalSort (OSCTXT *pctxt, OSCTXT *pMemCtxt, OSRTSList *pList)
void cerGetBufLocDescr (OSCTXT *pctxt, Asn1BufLocDescr *pDescr)
void cerAddBufLocDescr (OSCTXT *pctxt, OSRTSList *pElemList, Asn1BufLocDescr *pDescr)

Detailed Description

The streaming BER functions handle the BER encode of primitive ASN.1 data types. Calls to these functions are assembled in the C source code generated by the ASN1C compiler (with -stream option) to accomplish the encoding of complex ASN.1 structures. These functions are also directly callable from within a user's application program if the need to accomplish a low level encoding function exists. In contrast to the non-streaming C BER functions, these operate with streams, rather than the memory buffer, the sources or destination. Thus, the data may be encoded directly to the file stream or socket output stream and may be decoded directly from the file or socket input stream.


Define Documentation

#define BS_CHKEND ( pctxt,
ccb_p   ) 
Value:
((ccb_p)->stat = 0, \
(((ccb_p)->len == ASN_K_INDEFLEN) ? berDecStrmTestEOC (pctxt,ccb_p) : \
(((int)(OSRTSTREAM_BYTEINDEX(pctxt) - (ccb_p)->bytes) >= (ccb_p)->len))))
#define BS_CHKEOB ( pctxt   ) 
Value:
(((pctxt)->buffer.byteIndex + 2 > (pctxt)->buffer.size) ? TRUE : \
(((pctxt)->buffer.data[(pctxt)->buffer.byteIndex] == 0 && \
(pctxt)->buffer.data[(pctxt)->buffer.byteIndex + 1] == 0 ) ? \
TRUE : FALSE))

Function Documentation

int berStrmFreeContext ( OSCTXT *  pctxt  ) 

This function closes the stream and frees all dynamic memory associated with a context.

Parameters:
pctxt A pointer to a context structure.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int berStrmInitContext ( OSCTXT *  pctxt  ) 

This function initializes an OSCTXT block for further streaming operations. It makes sure that if the block was not previoiusly initialized, that all key working parameters are set to their correct initial state values (i.e. declared within a function as a normal working variable). It also initialize stream block.

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