BER/PER C Utility Functions
[BER Runtime Library Functions.]
Detailed Description
BER/DER utility functions are provided for memory management, formatting output of ASN.1 messages, and error reporting. In many cases, these functions are closely coupled with the rt (runtime) series of common functions. The common functions provide common functionality shared between the BER/DER, PER, and XER runtime libraries. In many cases, these functions simply provide wrappers to the rt functions to maintain compatibility with existing versions of the ASN1C compiler.
Defines | |
| #define | xu_addTagErrParm berErrAddTagParm |
Functions | |
| OSBOOL | berErrAddTagParm (OSCTXT *pctxt, ASN1TAG tag) |
| int | berErrUnexpTag (OSCTXT *pctxt, ASN1TAG exptag) |
| const char * | berTagToString (ASN1TAG tag, char *buffer, size_t bufsiz) |
| const char * | berTagToDynStr (OSCTXT *pctxt, ASN1TAG tag) |
| int | xu_verify_len (OSOCTET *msg_p) |
| void * | xu_parse_mmbuf (OSOCTET **buf_p2, int *buflen_p, OSOCTET *start_p, int bufsiz) |
| void | xu_alloc_array (OSCTXT *pctxt, ASN1SeqOf *seqOf_p, int recSize, int recCount) |
| void | xu_octscpy_s (OSUINT32 *nocts_p, OSOCTET *data_p, char *cstr, char zterm) |
| void | xu_octscpy_ss (ASN1OctStr *octStr_p, char *cstring, char zterm) |
| void | xu_octscpy_d (OSCTXT *pctxt, OSUINT32 *nocts_p, const OSOCTET **data_p2, char *cstring, char zterm) |
| void | xu_octscpy_ds (OSCTXT *pctxt, ASN1DynOctStr *octStr_p, char *cstring, char zterm) |
| void | xu_octmcpy_s (ASN1OctStr *octStr_p, void *data_p, int datalen) |
| void | xu_octmcpy_d (OSCTXT *pctxt, ASN1DynOctStr *octStr_p, void *data_p, int datalen) |
| char * | xu_fetchstr (int numocts, char *data) |
| int | xu_hexstrcpy (char *data, char *hstring) |
| int | xu_binstrcpy (char *data, char *bstring) |
| int | xu_dump (OSOCTET *msgptr, ASN1DumpCbFunc cb, void *cbArg_p) |
| int | xu_fdump (FILE *file_p, OSOCTET *msgptr) |
| void | xu_hex_dump (OSOCTET *data, int numocts, OSBOOL hdrflg) |
| void | xu_fmt_tag (ASN1TAG *tag_p, char *class_p, char *form_p, char *id_code) |
| char * | xu_fmt_contents (OSCTXT *pctxt, int len, int *count) |
| int | xu_fread (FILE *fp, OSOCTET *bufp, int bufsiz) |
| void | xu_SaveBufferState (OSCTXT *pCtxt, OSRTBufSave *pSavedInfo) |
| void | xu_RestoreBufferState (OSCTXT *pCtxt, OSRTBufSave *pSavedInfo) |
| int | berReadMsgFromSocket (OSCTXT *pctxt, OSRTSOCKET socket, OSOCTET *buffer, int bufsiz, OSOCTET **ppDestBuffer, int *pMessageSize) |
Function Documentation
|
||||||||||||
|
This function adds a tag parameter to the context error structure.
|
|
||||||||||||
|
This function logs a BER unexpected tag error (IDNOTFOU) by adding the expected and parsed tag to the error context and returning the error status.
|
|
||||||||||||||||||||||||||||
|
This routine reads the BER message into the given buffer. The TLV can be of indefinite length. If buffer is NULL, dynamic buffer will be allocated and returned as ppDestBuffer. Length of the message will be returned in pMessageSize.
|
|
||||||||||||
|
This function converts an internal binary ASN.1 tag to a string in standard ASN.1 syntax form. This version creates a dynamic string by allocating memory using the rtxMemAlloc function. This memory will be release when context memory is freed.
|
|
||||||||||||||||
|
This function converts an internal binary ASN.1 tag to a string in standard ASN.1 syntax form.
|
|
||||||||||||||||||||
|
This function will allocate space for a given count of fixed size elements.
|
|
||||||||||||||||
|
This function dumps an encoded ASN.1 message to the standard output device or to another interface in a formatted display. The display includes, for each message component, message tag (class, form, and ID code) and data (in hexadecimal and character text formats). This function is invoked for each line of text formatted from the given message. The formatted line is passed on the text_p argument. The cbArg_p argument allows a user to defined callback argument to be passed to the callback function. This argument is specified in the call to xu_dump. Use of the callback function is optional. If dump to standard output (stdout) is desired, the argument should be specified as NULL (note: the macro XU_DUMP in rtxsrc/rtxCommon.h can be used for this purpose).
|
|
||||||||||||
|
This function dumps an encoded ASN.1 message to a text file. The display includes, for each message component, message tag (class, form, and ID code), length, and data (in hexadecimal and character text formats).
|
|
||||||||||||||||
|
This function dumps binary data in raw hexadecimal and character text formats. It can be used only to examine runtime library encode/decode functions input or output data. This function outputs data only to the standard output device. This function is considered depreciated and is only being maintained to provide backward compatibility with older versions of ASN1C.
|
|
||||||||||||
|
This function is used to restore the current buffer state from previously saved info.
|
|
||||||||||||
|
This function is used to save the current buffer state.
|
