BER/DER C Decode Functions.
[BER Runtime Library Functions.]
Defines | |
#define | xd_utf8str(pctxt, object_p, tagging, length) xd_charstr (pctxt, (const char**)object_p, tagging, ASN_ID_UTF8String, length) |
#define | xd_indeflen(m) xd_indeflen_ex(m, INT_MAX) |
Functions | |
int | xd_tag (OSCTXT *pctxt, ASN1TAG *tag_p) |
int | xd_tag_len (OSCTXT *pctxt, ASN1TAG *tag_p, int *len_p, OSOCTET flags) |
int | xd_tag_len_64 (OSCTXT *pctxt, ASN1TAG *tag_p, OSSIZE *len_p, OSBOOL *pIndefLen, OSOCTET flags) |
int | xd_match (OSCTXT *pctxt, ASN1TAG tag, int *len_p, OSOCTET flags) |
int | xd_match64 (OSCTXT *pctxt, ASN1TAG tag, OSSIZE *len_p, OSBOOL *pindef, OSOCTET flags) |
int | xd_boolean (OSCTXT *pctxt, OSBOOL *object_p, ASN1TagType tagging, int length) |
int | xd_integer (OSCTXT *pctxt, OSINT32 *object_p, ASN1TagType tagging, int length) |
int | xd_int8 (OSCTXT *pctxt, OSINT8 *object_p, ASN1TagType tagging, int length) |
int | xd_int16 (OSCTXT *pctxt, OSINT16 *object_p, ASN1TagType tagging, int length) |
int | xd_unsigned (OSCTXT *pctxt, OSUINT32 *object_p, ASN1TagType tagging, int length) |
int | xd_uint8 (OSCTXT *pctxt, OSUINT8 *object_p, ASN1TagType tagging, int length) |
int | xd_uint16 (OSCTXT *pctxt, OSUINT16 *object_p, ASN1TagType tagging, int length) |
int | xd_int64 (OSCTXT *pctxt, OSINT64 *object_p, ASN1TagType tagging, int length) |
int | xd_uint64 (OSCTXT *pctxt, OSUINT64 *object_p, ASN1TagType tagging, int length) |
int | xd_bigint (OSCTXT *pctxt, const char **object_p, ASN1TagType tagging, int length) |
int | xd_bitstr_s (OSCTXT *pctxt, OSOCTET *object_p, OSUINT32 *numbits_p, ASN1TagType tagging, int length) |
int | xd_bitstr64_s (OSCTXT *pctxt, OSOCTET *object_p, OSSIZE *numbits_p, ASN1TagType tagging, OSSIZE length, OSBOOL indefLen) |
int | xd_bitstr (OSCTXT *pctxt, const OSOCTET **object_p2, OSUINT32 *numbits_p, ASN1TagType tagging, int length) |
int | xd_bitstr64 (OSCTXT *pctxt, const OSOCTET **object_p2, OSSIZE *numbits_p, ASN1TagType tagging, OSSIZE length, OSBOOL indefLen) |
int | xd_octstr_s (OSCTXT *pctxt, OSOCTET *object_p, OSUINT32 *pnumocts, ASN1TagType tagging, int length) |
int | xd_octstr64_s (OSCTXT *pctxt, OSOCTET *object_p, OSSIZE *pnumocts, ASN1TagType tagging, OSSIZE length, OSBOOL indefLen) |
int | xd_octstr (OSCTXT *pctxt, const OSOCTET **object_p2, OSUINT32 *pnumocts, ASN1TagType tagging, int length) |
int | xd_octstr64 (OSCTXT *pctxt, OSOCTET **object_p2, OSSIZE *pnumocts, ASN1TagType tagging, OSSIZE length, OSBOOL indefLen) |
int | xd_charstr (OSCTXT *pctxt, const char **object_p, ASN1TagType tagging, ASN1TAG tag, int length) |
int | xd_charstr64 (OSCTXT *pctxt, char **object_p, ASN1TagType tagging, ASN1TAG tag, OSSIZE length, OSBOOL indefLen) |
int | xd_datestr (OSCTXT *pctxt, const char **object_p, ASN1TagType tagging, ASN1TAG tag, int length) |
int | xd_timestr (OSCTXT *pctxt, const char **object_p, ASN1TagType tagging, ASN1TAG tag, int length) |
int | xd_datetimestr (OSCTXT *pctxt, const char **object_p, ASN1TagType tagging, ASN1TAG tag, int length) |
int | xd_timeofdaystr (OSCTXT *pctxt, const char **object_p, ASN1TagType tagging, ASN1TAG tag, int length) |
int | xd_durationstr (OSCTXT *pctxt, const char **object_p, ASN1TagType tagging, ASN1TAG tag, int length) |
int | berDecCharArray (OSCTXT *pctxt, char *charArray, OSSIZE arraySize, ASN1TagType tagging, ASN1TAG tag, int length) |
int | xd_16BitCharStr (OSCTXT *pctxt, Asn116BitCharString *object_p, ASN1TagType tagging, ASN1TAG tag, int length) |
int | xd_16BitCharStr64 (OSCTXT *pctxt, Asn116BitCharString *object_p, ASN1TagType tagging, ASN1TAG tag, OSSIZE length, OSBOOL indefLen) |
int | xd_32BitCharStr (OSCTXT *pctxt, Asn132BitCharString *object_p, ASN1TagType tagging, ASN1TAG tag, int length) |
int | xd_32BitCharStr64 (OSCTXT *pctxt, Asn132BitCharString *object_p, ASN1TagType tagging, ASN1TAG tag, OSSIZE length, OSBOOL indefLen) |
int | xd_null (OSCTXT *pctxt, ASN1TagType tagging) |
int | xd_objid (OSCTXT *pctxt, ASN1OBJID *object_p, ASN1TagType tagging, int length) |
int | xd_oid64 (OSCTXT *pctxt, ASN1OID64 *object_p, ASN1TagType tagging, int length) |
int | xd_reloid (OSCTXT *pctxt, ASN1OBJID *object_p, ASN1TagType tagging, int length) |
int | xd_real (OSCTXT *pctxt, OSREAL *object_p, ASN1TagType tagging, int length) |
int | xd_enum (OSCTXT *pctxt, OSINT32 *object_p, ASN1TagType tagging, int length) |
int | xd_enumUnsigned (OSCTXT *pctxt, OSUINT32 *object_p, ASN1TagType tagging, int length) |
int | xd_OpenType (OSCTXT *pctxt, const OSOCTET **object_p2, OSSIZE *pnumocts) |
int | xd_OpenTypeExt (OSCTXT *pctxt, ASN1CCB *ccb_p, ASN1TAG *tags, int tagCount, OSRTDList *pElemList) |
int | xd_OpenTypeExt64 (OSCTXT *pctxt, const OSOCTET *consptr, OSSIZE conslen, OSBOOL indefLen, ASN1TAG *tags, OSSIZE tagCount, OSRTDList *pElemList) |
int | xd_OpenTypeAppend (OSCTXT *pctxt, OSRTDList *pElemList) |
int | xd_real10 (OSCTXT *pctxt, const char **object_p, ASN1TagType tagging, int length) |
int | xd_setp (OSCTXT *pctxt, const OSOCTET *msg_p, int msglen, ASN1TAG *tag_p, int *len_p) |
int | xd_setp64 (OSCTXT *pctxt, const OSOCTET *msg_p, OSSIZE msglen, ASN1TAG *tag_p, OSSIZE *len_p, OSBOOL *pIndefLen) |
int | xd_indeflen_ex (const OSOCTET *msg_p, int bufSize) |
int | xd_indeflen64 (const OSOCTET *msg_p, OSSIZE bufSize, OSSIZE *plength) |
int | xd_len (OSCTXT *pctxt, int *len_p) |
int | xd_len64 (OSCTXT *pctxt, OSSIZE *len_p, OSBOOL *pindef) |
OSBOOL | xd_chkend (OSCTXT *pctxt, const ASN1CCB *ccb_p) |
OSBOOL | xd_chkend64 (OSCTXT *pctxt, const OSOCTET *consptr, OSSIZE conslen, OSBOOL indef) |
int | xd_count (OSCTXT *pctxt, int length, int *count_p) |
int | xd_count64 (OSCTXT *pctxt, OSSIZE length, OSBOOL indefLen, OSSIZE *count_p) |
int | xd_NextElement (OSCTXT *pctxt) |
int | xd_Tag1AndLen (OSCTXT *pctxt, OSINT32 *len_p) |
int | xd_memcpy (OSCTXT *pctxt, OSOCTET *object_p, int length) |
int | xd_match1 (OSCTXT *pctxt, OSOCTET tag, int *len_p) |
int | xd_match1_64 (OSCTXT *pctxt, OSOCTET tag, OSSIZE *len_p, OSBOOL *pindef) |
Detailed Description
BER/DER C decode functions handle the decoding of the primitive ASN.1 data types and ASN.1 length and tag fields within a message. Calls to these functions are assembled in the C source code generated by the ASN1C compiler to decode complex ASN.1 structures. These functions are also directly callable from within a user's application program if the need to decode a primitive data item exists.
The procedure to decode a primitive data item is as follows:
- Call the xd_setp low-level decode function to specify the address of the buffer containing the encoded ASN.1 data to be decoded.
- Call the specific decode function to decode the value. The tag value obtained in the first step can be used to determine which decode function to call for decoding the variable.
Define Documentation
#define xd_utf8str | ( | pctxt, | |||
object_p, | |||||
tagging, | |||||
length | ) | xd_charstr (pctxt, (const char**)object_p, tagging, ASN_ID_UTF8String, length) |
This function is used to decode a variable of the ASN.1 UTF-8 string type. This function allocates memory for the decoded string and returns a pointer to the data.
- Parameters:
-
pctxt Pointer to ASN.1 context block structure object_p Pointer to a pointer to receive the address of the allocated memory into which the decoded character string data will be stored. The string is assumed to be a normal C string containing non-null characters. A null terminator is automatically added to the end of the string by this function. tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
Function Documentation
int berDecCharArray | ( | OSCTXT * | pctxt, | |
char * | charArray, | |||
OSSIZE | arraySize, | |||
ASN1TagType | tagging, | |||
ASN1TAG | tag, | |||
int | length | |||
) |
This function is the base function for decoding any of the 8-bit character string useful types such as IA5String, VisibleString, etc. This function decodes the character string into a static array variable.
- Parameters:
-
pctxt Pointer to ASN.1 context block structure charArray Static character array variable (char[]) large enough to hold decoded data plus a null-termination byte. If the array is not large enoungh, an RTERR_TOOBIG error status will be returned. arraySize Size (in bytes) of the charArray variable. tagging Specifies whether element is implicitly or explicitly tagged. tag Tag variable to match length Length of data to retrieve. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_16BitCharStr | ( | OSCTXT * | pctxt, | |
Asn116BitCharString * | object_p, | |||
ASN1TagType | tagging, | |||
ASN1TAG | tag, | |||
int | length | |||
) |
This function is the base function for decoding a 16-bit character string useful type. In the current version of ASN.1, the only string type based on 16-bit Unicode characters is the UniCharString type. This function allocates memory for the decoded string and returns a pointer to the data.
- Parameters:
-
pctxt Pointer to ASN.1 context block structure object_p Pointer to a pointer to receive the address of the allocated memory into which the decoded character string data will be stored. The string is assumed to contain all non-null 16-bit unicode characters. A null terminator is automatically added to the end of the string by this function. tagging Specifies whether element is implicitly or explicitly tagged. tag Tag variable to match length Length of data to retrieve. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_16BitCharStr64 | ( | OSCTXT * | pctxt, | |
Asn116BitCharString * | object_p, | |||
ASN1TagType | tagging, | |||
ASN1TAG | tag, | |||
OSSIZE | length, | |||
OSBOOL | indefLen | |||
) |
This function is the base function for decoding a 16-bit character string useful type. In the current version of ASN.1, the only string type based on 16-bit Unicode characters is the UniCharString type. This function allocates memory for the decoded string and returns a pointer to the data.
This version of the function supports full 64-bit lengths.
- Parameters:
-
pctxt Pointer to ASN.1 context block structure object_p Pointer to a pointer to receive the address of the allocated memory into which the decoded character string data will be stored. The string is assumed to contain all non-null 16-bit unicode characters. A null terminator is automatically added to the end of the string by this function. tagging Specifies whether element is implicitly or explicitly tagged. tag Tag variable to match length Length of data to retrieve. Valid for implicit case only. indefLen Flag indicating length of string is indefinite.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_32BitCharStr | ( | OSCTXT * | pctxt, | |
Asn132BitCharString * | object_p, | |||
ASN1TagType | tagging, | |||
ASN1TAG | tag, | |||
int | length | |||
) |
This function is the base function for decoding a 32-bit character string useful type. In the current version of ASN.1, the only string type based on 32-bit characters is the 32BitCharString type. This function allocates memory for the decoded string and returns a pointer to the data.
- Parameters:
-
pctxt Pointer to ASN.1 context block structure object_p Pointer to a pointer to receive the address of the allocated memory into which the decoded character string data will be stored. The string is assumed to contain all non-null 32-bit unicode characters. A null terminator is automatically added to the end of the string by this function. tagging Specifies whether element is implicitly or explicitly tagged. tag Tag variable to match. length Length of data to retrieve. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_32BitCharStr64 | ( | OSCTXT * | pctxt, | |
Asn132BitCharString * | object_p, | |||
ASN1TagType | tagging, | |||
ASN1TAG | tag, | |||
OSSIZE | length, | |||
OSBOOL | indefLen | |||
) |
64-bit version of xd_32BitCharStr.
- Parameters:
-
pctxt Pointer to ASN.1 context block structure object_p Pointer to a pointer to receive the address of the allocated memory into which the decoded character string data will be stored. The string is assumed to contain all non-null 32-bit unicode characters. A null terminator is automatically added to the end of the string by this function. tagging Specifies whether element is implicitly or explicitly tagged. tag Tag variable to match. length Length of data to retrieve. Valid for implicit case only. indefLen Indefinite length indicator.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error. xd_32BitCharStr
int xd_bigint | ( | OSCTXT * | pctxt, | |
const char ** | object_p, | |||
ASN1TagType | tagging, | |||
int | length | |||
) |
This function parses an ASN.1 INTEGER tag/length/value at the current message pointer location and advances the pointer to the next field.
This function will decode a variable of the ASN.1 INTEGER type. In this case, the integer is assumed to be of a larger size than can fit in a C or C++ long type (normally 32 or 64 bits). For example, parameters used to calculate security values are typically larger than these sizes. These variables are stored in character string constant variables. They are represented as hexadecimal strings with prefix '0x'. A leading zero is also added to positive values where the leading digit would otherwise be greater than 8 (i.e. representing a negative value in two's complement). If it is necessary to convert a hexadecimal string to another radix, then use rtxBigIntSetStr / rtxBigIntToString functions.
- Parameters:
-
pctxt Pointer to context block structure. tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only. object_p Pointer to a character pointer variable to receive the decoded hexadecimal value. Dynamic memory is allocated for the variable using the rtxMemAlloc function. The decoded variable is represented as a hexadecimal string with prefix '0x'.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_bitstr | ( | OSCTXT * | pctxt, | |
const OSOCTET ** | object_p2, | |||
OSUINT32 * | numbits_p, | |||
ASN1TagType | tagging, | |||
int | length | |||
) |
This function decodes a variable of the ASN.1 BIT STRING. This function will allocate dynamic memory to store the decoded result.
- Parameters:
-
pctxt Pointer to context block structure. tagging Specifies whether element is implicitly or explicitly tagged. length The length, in OCTETs, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field. numbits_p Pointer to an integer value to receive the decoded number of bits. object_p2 Pointer to a pointer variable to receive the decoded bit string. Dynamic memory is allocated to hold the string.Pointer to a variable to receive the decoded bit string.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_bitstr64 | ( | OSCTXT * | pctxt, | |
const OSOCTET ** | object_p2, | |||
OSSIZE * | numbits_p, | |||
ASN1TagType | tagging, | |||
OSSIZE | length, | |||
OSBOOL | indefLen | |||
) |
This function decodes a variable of the ASN.1 BIT STRING. This function will allocate dynamic memory to store the decoded result. It support 64-bit lengths.
- Parameters:
-
pctxt Pointer to context block structure. tagging Specifies whether element is implicitly or explicitly tagged. length The length, in OCTETs, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field. numbits_p Pointer to an integer value to receive the decoded number of bits. object_p2 Pointer to a pointer variable to receive the decoded bit string. Dynamic memory is allocated to hold the string.Pointer to a variable to receive the decoded bit string. indefLen Boolean flag indicating length is indefinite.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_bitstr64_s | ( | OSCTXT * | pctxt, | |
OSOCTET * | object_p, | |||
OSSIZE * | numbits_p, | |||
ASN1TagType | tagging, | |||
OSSIZE | length, | |||
OSBOOL | indefLen | |||
) |
This function decodes a variable of the ASN.1 BIT STRING type into a static memory structure. This function call is generated by ASN1C to decode a sized bit string production. This version supports 64-bit lengths.
- Parameters:
-
pctxt Pointer to context block structure. object_p Pointer to a variable to receive the decoded bit string. This is assumed to be a static array large enough to hold the number of bits specified in the *numbits_p input parameter. numbits_p Pointer to an integer variable containing the size (in bits) of the sized ASN.1 bit string. An error will occur if the number of bits in the decoded string is larger than this value. Note that this is also used as an output variable - the actual number of decoded bits will be returned in this variable. tagging Specifies whether element is implicitly or explicitly tagged. length The length, in OCTETs, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field. indefLen Boolean flag indicating length is indefinite.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_bitstr_s | ( | OSCTXT * | pctxt, | |
OSOCTET * | object_p, | |||
OSUINT32 * | numbits_p, | |||
ASN1TagType | tagging, | |||
int | length | |||
) |
This function decodes a variable of the ASN.1 BIT STRING type into a static memory structure. This function call is generated by ASN1C to decode a sized bit string production.
- Parameters:
-
pctxt Pointer to context block structure. tagging Specifies whether element is implicitly or explicitly tagged. length The length, in OCTETs, of the contents field to be decoded. This parameter only has meaning if the tagging parameter specifies implicit decoding. If explicit, the length is obtained from the decoded length field. numbits_p Pointer to an integer variable containing the size (in bits) of the sized ASN.1 bit string. An error will occur if the number of bits in the decoded string is larger than this value. Note that this is also used as an output variable - the actual number of decoded bits will be returned in this variable. object_p Pointer to a variable to receive the decoded bit string. This is assumed to be a static array large enough to hold the number of bits specified in the *numbits_p input parameter.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_boolean | ( | OSCTXT * | pctxt, | |
OSBOOL * | object_p, | |||
ASN1TagType | tagging, | |||
int | length | |||
) |
This function parses an ASN.1 BOOLEAN tag/length/value at the current message pointer location and advances the pointer to the next field.
The function first checks to see if explicit tagging is specified. If yes, the universal tag for this message type is checked to make sure it is of the expected value. If the match is not successful, a negative value is returned to indicate the parse was not successful. Otherwise, the pointer is advanced to the length field and the length parsed.
The length value is then check to see if it is equal to one which is the only valid length for boolean. If it is equal, the boolean data value is parsed; otherwise, and error is returned.
- Parameters:
-
pctxt Pointer to context block structure. tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only. object_p Decoded boolean data value.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- RTERR_INVLEN invalid length (!= 1)
- RTERR_IDNOTFOU unexpected tag value (not UNIV 1)
int xd_charstr | ( | OSCTXT * | pctxt, | |
const char ** | object_p, | |||
ASN1TagType | tagging, | |||
ASN1TAG | tag, | |||
int | length | |||
) |
This function is the base function for decoding any of the 8-bit character string useful types such as IA5String, VisibleString, etc. This function allocates memory for the decoded string and returns a pointer to the data.
- Parameters:
-
pctxt Pointer to ASN.1 context block structure object_p Pointer to a pointer to receive the address of the allocated memory into which the decoded character string data will be stored. The string is assumed to be a normal C string containing non-null characters. A null terminator is automatically added to the end of the string by this function. tagging Specifies whether element is implicitly or explicitly tagged. tag Tag variable to match length Length of data to retrieve. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_charstr64 | ( | OSCTXT * | pctxt, | |
char ** | object_p, | |||
ASN1TagType | tagging, | |||
ASN1TAG | tag, | |||
OSSIZE | length, | |||
OSBOOL | indefLen | |||
) |
This function is the base function for decoding any of the 8-bit character string useful types such as IA5String, VisibleString, etc. This function allocates memory for the decoded string and returns a pointer to the data. It supporta character string lengths up to 64-bits on 64-bit systems.
- Parameters:
-
pctxt Pointer to ASN.1 context block structure object_p Pointer to a pointer to receive the address of the allocated memory into which the decoded character string data will be stored. The string is assumed to be a normal C string containing non-null characters. A null terminator is automatically added to the end of the string by this function. tagging Specifies whether element is implicitly or explicitly tagged. tag Tag variable to match length Length of data to retrieve. Valid for implicit case only. indefLen Indicates length of data passed in is indefinite. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
OSBOOL xd_chkend | ( | OSCTXT * | pctxt, | |
const ASN1CCB * | ccb_p | |||
) |
This function checks for the end of a constructed element. It is typically used by the ASN1C compiler to set up a loop for decoding a constructed type such as a SEQUENCE or SET.
- Parameters:
-
pctxt Pointer to context block structure. ccb_p Pointer to a context control block (ccb). This is a structure added to compiler generated code to keep track of the current position within nested structures.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
OSBOOL xd_chkend64 | ( | OSCTXT * | pctxt, | |
const OSOCTET * | consptr, | |||
OSSIZE | conslen, | |||
OSBOOL | indef | |||
) |
64-bit version of xd_chkend.
- Parameters:
-
pctxt Pointer to context block structure. consptr Pointer to start of encoded constructed element. conslen Length of encoded constructed element. indef True if constructor is indefinite length.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- xd_chkend
int xd_count | ( | OSCTXT * | pctxt, | |
int | length, | |||
int * | count_p | |||
) |
This function determines the count of elements within a constructed type.
- Parameters:
-
pctxt Pointer to context block structure. length Length of the constructed type. count_p Pointer to an integer variable to receive the element count.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_count64 | ( | OSCTXT * | pctxt, | |
OSSIZE | length, | |||
OSBOOL | indefLen, | |||
OSSIZE * | count_p | |||
) |
64-bit version of xd_count function
- Parameters:
-
pctxt Pointer to context block structure. length Length of the constructed type. indefLen Flag indicating length is indefinite. count_p Pointer to a size-typed variable to receive the element count.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- xd_count
int xd_datestr | ( | OSCTXT * | pctxt, | |
const char ** | object_p, | |||
ASN1TagType | tagging, | |||
ASN1TAG | tag, | |||
int | length | |||
) |
This function is the base function for decoding ISO 8601 Date character string types. This function allocates memory for the decoded string and returns a pointer to the data.
- Parameters:
-
pctxt Pointer to ASN.1 context block structure object_p Pointer to a pointer to receive the address of the allocated memory into which the decoded character string data will be stored. The string is assumed to be a normal C string containing non-null characters. A null terminator is automatically added to the end of the string by this function. tagging Specifies whether element is implicitly or explicitly tagged. tag Tag variable to match length Length of data to retrieve. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_datetimestr | ( | OSCTXT * | pctxt, | |
const char ** | object_p, | |||
ASN1TagType | tagging, | |||
ASN1TAG | tag, | |||
int | length | |||
) |
This function is the base function for decoding ISO 8601 Date/Time character string types. This function allocates memory for the decoded string and returns a pointer to the data.
- Parameters:
-
pctxt Pointer to ASN.1 context block structure object_p Pointer to a pointer to receive the address of the allocated memory into which the decoded character string data will be stored. The string is assumed to be a normal C string containing non-null characters. A null terminator is automatically added to the end of the string by this function. tagging Specifies whether element is implicitly or explicitly tagged. tag Tag variable to match length Length of data to retrieve. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_durationstr | ( | OSCTXT * | pctxt, | |
const char ** | object_p, | |||
ASN1TagType | tagging, | |||
ASN1TAG | tag, | |||
int | length | |||
) |
This function is the base function for decoding ISO 8601 Duration character string types. This function allocates memory for the decoded string and returns a pointer to the data.
- Parameters:
-
pctxt Pointer to ASN.1 context block structure object_p Pointer to a pointer to receive the address of the allocated memory into which the decoded character string data will be stored. The string is assumed to be a normal C string containing non-null characters. A null terminator is automatically added to the end of the string by this function. tagging Specifies whether element is implicitly or explicitly tagged. tag Tag variable to match length Length of data to retrieve. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_enum | ( | OSCTXT * | pctxt, | |
OSINT32 * | object_p, | |||
ASN1TagType | tagging, | |||
int | length | |||
) |
This function decodes a value of the ASN.1 ENUMERATED type. This function is identical to the integer decode function (xd_integer) except that the enumerated universal tag value is validated.
- Parameters:
-
pctxt Pointer to context block structure. object_p Pointer to value to receive decoded result. tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_enumUnsigned | ( | OSCTXT * | pctxt, | |
OSUINT32 * | object_p, | |||
ASN1TagType | tagging, | |||
int | length | |||
) |
This function decodes a value of the ASN.1 ENUMERATED type. This function is identical to the integer decode function (xd_integer) except that the enumerated universal tag value is validated.
- Parameters:
-
pctxt Pointer to context block structure. object_p Pointer to value to receive decoded result. tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_indeflen64 | ( | const OSOCTET * | msg_p, | |
OSSIZE | bufSize, | |||
OSSIZE * | plength | |||
) |
This function calculates the actual length of an indefinite length message component. This version can support lengths up to 64 bits in size.
- Parameters:
-
msg_p Pointer to an indefinite length message component. bufSize Size of the message buffer plength Pointer to a size-typed variable to receive decoded length;
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
Referenced by ASN1BERMessageBuffer::calcIndefLen().
int xd_indeflen_ex | ( | const OSOCTET * | msg_p, | |
int | bufSize | |||
) |
This function calculates the actual length of an indefinite length message component.
- Parameters:
-
msg_p Pointer to an indefinite length message component. bufSize Size of the message buffer
- Returns:
- Zero or positive = decoded length, negative = error status
Referenced by ASN1BERMessageBuffer::calcIndefLen().
int xd_int16 | ( | OSCTXT * | pctxt, | |
OSINT16 * | object_p, | |||
ASN1TagType | tagging, | |||
int | length | |||
) |
This function parses an ASN.1 INTEGER tag/length/value at the current message pointer location and advances the pointer to the next field.
This function is similar to xd_integer but it is used to parse 16-bit integer values.
- Parameters:
-
pctxt Pointer to context block structure. tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only. object_p Pointer to decoded 16-bit integer value.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_int64 | ( | OSCTXT * | pctxt, | |
OSINT64 * | object_p, | |||
ASN1TagType | tagging, | |||
int | length | |||
) |
This function parses an ASN.1 INTEGER tag/length/value at the current message pointer location and advances the pointer to the next field.
The function is similar to xd_integer but it can be used to parse integer values with sizes up to 64 bits (if platform supports such integer's size).
If the match is successful or implicit tagging is specified, the integer data value is parsed.
- Parameters:
-
pctxt Pointer to context block structure. tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only. object_p Pointer to decoded 64-bit integer value.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_int8 | ( | OSCTXT * | pctxt, | |
OSINT8 * | object_p, | |||
ASN1TagType | tagging, | |||
int | length | |||
) |
This function parses an ASN.1 INTEGER tag/length/value at the current message pointer location and advances the pointer to the next field.
This function is similar to xd_integer but it is used to parse 8-bit integer values.
- Parameters:
-
pctxt Pointer to context block structure. tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only. object_p Pointer to decoded 8-bit integer value.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_integer | ( | OSCTXT * | pctxt, | |
OSINT32 * | object_p, | |||
ASN1TagType | tagging, | |||
int | length | |||
) |
This function parses an ASN.1 INTEGER tag/length/value at the current message pointer location and advances the pointer to the next field.
The function first checks to see if explicit tagging is specified. If yes, the universal tag value is parsed and checked to make sure it matches the expected tag for this message type. If not, a negative value is returned to indicate the parse was not successful. Otherwise, the length value is parsed.
If the match is successful or implicit tagging is specified, the integer data value is parsed.
- Parameters:
-
pctxt Pointer to context block structure. tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only. object_p Pointer to decoded integer value.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_len | ( | OSCTXT * | pctxt, | |
int * | len_p | |||
) |
This function decodes an ASN.1 length value.
- Parameters:
-
pctxt Pointer to context block structure. len_p Pointer to integer variable to receive the the decoded length value. If the length is indefinite, the constant ASN_K_INDEFLEN is returned.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_len64 | ( | OSCTXT * | pctxt, | |
OSSIZE * | len_p, | |||
OSBOOL * | pindef | |||
) |
This function decodes an ASN.1 length value. It supports lengths up to 64-bits in size on 64-bit platforms.
- Parameters:
-
pctxt Pointer to context block structure. len_p Pointer to integer variable to receive the the decoded length value. If the length is indefinite, the constant ASN_K_INDEFLEN is returned. pindef Pointer to boolean indicating if length is indefinite.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_match | ( | OSCTXT * | pctxt, | |
ASN1TAG | tag, | |||
int * | len_p, | |||
OSOCTET | flags | |||
) |
This function compares the tag at the current message pointer position with the given tag for a match. If a match occurs, the length field is decoded and the length is returned to the caller. If the input parameter 'advance' is set to TRUE, the message pointer is advanced to the beginning of the contents field.
If a match does not occur, the routine will skip to subsequent fields in search of a match. If a match is eventually found, the processing described above is done; otherwise, a not found status is returned to the caller.
- Parameters:
-
pctxt Pointer to context block structure. tag Tag variable to match. len_p Length of message component. Returned as follows: >= 0 component is fixed length ASN_K_INDEFLEN component is indefinite length flags Bit flags used to set the following options: - XM_ADVANCE: Advance decode pointer on match.
- XM_SEEK : Seek until match found or EOM.
- XM_SKIP : Skip to next tag before search
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_match1 | ( | OSCTXT * | pctxt, | |
OSOCTET | tag, | |||
int * | len_p | |||
) |
The xd_match1 function does a comparison between the given tag and the tag at the current decode pointer position to determine if they match. It then returns the result of the match operation. In contrast to xd_match function xd_match1 is an optimized version and can be used only to compare primitive tags (with number less than 31). It is always advance the decode pointer to the contents field if matching is successful. Note, that the tag should be specified as an octet, like it is used in BER encoding.
- Parameters:
-
pctxt Pointer to context block structure. tag Tag variable to match in octet format. len_p Length of message component. Returned as follows: >= 0 component is fixed length ASN_K_INDEFLEN component is indefinite length
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_match64 | ( | OSCTXT * | pctxt, | |
ASN1TAG | tag, | |||
OSSIZE * | len_p, | |||
OSBOOL * | pindef, | |||
OSOCTET | flags | |||
) |
This function compares the tag at the current message pointer position with the given tag for a match. If a match occurs, the length field is decoded and the length is returned to the caller. If the input parameter 'advance' is set to TRUE, the message pointer is advanced to the beginning of the contents field.
If a match does not occur, the routine will skip to subsequent fields in search of a match. If a match is eventually found, the processing described above is done; otherwise, a not found status is returned to the caller.
This version of the function works with lengths up to 64-bits in size.
- Parameters:
-
pctxt Pointer to context block structure. tag Tag variable to match. len_p Pointer to variable to receive length of message component. pindef Pointer to boolean variable to indicate if parsed length value is indefinite. flags Bit flags used to set the following options: - XM_ADVANCE: Advance decode pointer on match.
- XM_SEEK : Seek until match found or EOM.
- XM_SKIP : Skip to next tag before search
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_memcpy | ( | OSCTXT * | pctxt, | |
OSOCTET * | object_p, | |||
int | length | |||
) |
This function copies data from the contents field of a message component into the target object.
- Parameters:
-
pctxt Pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls. *object_p A pointer to a memory structure to receive the copied data. length The number of bytes to copy from the contents field.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_NextElement | ( | OSCTXT * | pctxt | ) |
This function skips to the next element in the decode buffer.
- Parameters:
-
pctxt Pointer to context block structure.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_null | ( | OSCTXT * | pctxt, | |
ASN1TagType | tagging | |||
) |
This function decoded the ASN.1 NULL placeholder type. The null data type contains no data; however, if explicit tagging is specified, it will contain a universal tag value (5) and zero length. This function will parse those values.
- Parameters:
-
pctxt Pointer to ASN.1 context block structure tagging Specifies whether element is implicitly or explicitly tagged. The function will do nothing if implicit tagging is specified.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_objid | ( | OSCTXT * | pctxt, | |
ASN1OBJID * | object_p, | |||
ASN1TagType | tagging, | |||
int | length | |||
) |
This function decodes a value of the ASN.1 object identifier type.
- Parameters:
-
pctxt Pointer to context block structure. object_p Pointer to value to receive decoded result. The ASN1OBJID structure contains an integer to hold the number of subidentifiers and an array to hold the subidentifier values. tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_octstr | ( | OSCTXT * | pctxt, | |
const OSOCTET ** | object_p2, | |||
OSUINT32 * | pnumocts, | |||
ASN1TagType | tagging, | |||
int | length | |||
) |
This function decodes the octet string at the current message pointer location and returns its value. This version of the function allocates memory for the decoded string and returns a pointer to the data.
- Parameters:
-
pctxt Pointer to ASN.1 context block structure object_p2 Pointer to a pointer to receive the address of the allocated memory into which the decoded data will be stored. pnumocts Pointer to an integer variable to receive length of the decoded octet string. tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_octstr64 | ( | OSCTXT * | pctxt, | |
OSOCTET ** | object_p2, | |||
OSSIZE * | pnumocts, | |||
ASN1TagType | tagging, | |||
OSSIZE | length, | |||
OSBOOL | indefLen | |||
) |
This function decodes the octet string at the current message pointer location and returns its value. This version of the function allocates memory for the decoded string and returns a pointer to the data. It supporta OCTET STRING lengths up to 64-bits on 64-bit systems.
- Parameters:
-
pctxt Pointer to ASN.1 context block structure object_p2 Pointer to a pointer to receive the address of the allocated memory into which the decoded data will be stored. pnumocts Pointer to an integer variable to receive length of the decoded octet string. tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only. indefLen Indicates length of data passed in is indefinite. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_octstr64_s | ( | OSCTXT * | pctxt, | |
OSOCTET * | object_p, | |||
OSSIZE * | pnumocts, | |||
ASN1TagType | tagging, | |||
OSSIZE | length, | |||
OSBOOL | indefLen | |||
) |
This function decodes the octet string at the current message pointer location and returns its value. The value is returned in the buffer pointed to by the given character buffer pointer. This is a static buffer that must be large enough to hold the decoded data. It supporta OCTET STRING lengths up to 64-bits on 64-bit systems.
- Parameters:
-
pctxt Pointer to ASN.1 context block structure object_p Pointer to static octet array to receive decoded data pnumocts Pointer to an integer variable to receive the length of the decoded octet string. On input, this parameter is used to specify the size of the octet array. tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_octstr_s | ( | OSCTXT * | pctxt, | |
OSOCTET * | object_p, | |||
OSUINT32 * | pnumocts, | |||
ASN1TagType | tagging, | |||
int | length | |||
) |
This function decodes the octet string at the current message pointer location and returns its value. The value is returned in the buffer pointed to by the given character buffer pointer. This is a static buffer that must be large enough to hold the decoded data.
- Parameters:
-
pctxt Pointer to ASN.1 context block structure object_p Pointer to static octet array to receive decoded data pnumocts Pointer to an integer variable to receive the length of the decoded octet string. On input, this parameter is used to specify the size of the octet array. tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_oid64 | ( | OSCTXT * | pctxt, | |
ASN1OID64 * | object_p, | |||
ASN1TagType | tagging, | |||
int | length | |||
) |
This function decodes a value of the ASN.1 object identifier type using 64-bit subidentifiers.
- Parameters:
-
pctxt Pointer to context block structure. object_p Pointer to value to receive decoded result. The ASN1OID64 structure contains an integer to hold the number of subidentifiers and an array of 64-bit unsigned integers to hold the subidentifier values. tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_OpenType | ( | OSCTXT * | pctxt, | |
const OSOCTET ** | object_p2, | |||
OSSIZE * | pnumocts | |||
) |
This function decodes a value of an ASN.1 open type. An open type is used to model the old ASN.1 ANY and ANY DEFINED BY types. It is also used to model variable type references within information objects (for example, TYPE-IDENTIFER.&Type). Dynamic memory is allocated to hold the decoded result.
- Parameters:
-
pctxt Pointer to context block structure. object_p2 Pointer to value to receive decoded result. pnumocts Pointer to an integer variable to receive length of the decoded octet string.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_OpenTypeAppend | ( | OSCTXT * | pctxt, | |
OSRTDList * | pElemList | |||
) |
This function appends a decoded open type element onto a list of elements. It is used by the ASN1C compiler to decode messages with multiple extension fields following an extension marker (...).
- Parameters:
-
pctxt Pointer to context block structure. pElemList Pointer to element list onto which the decoded element should be appended.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_OpenTypeExt | ( | OSCTXT * | pctxt, | |
ASN1CCB * | ccb_p, | |||
ASN1TAG * | tags, | |||
int | tagCount, | |||
OSRTDList * | pElemList | |||
) |
This function decodes an ASN.1 open type extension. This is the optional data that follows the ... in multi-version messages. Dynamic memory is allocated to hold the decoded result.
- Parameters:
-
pctxt Pointer to context block structure. ccb_p Pointer to a 'context control block' structure. This is basically a loop control mechanism to keep the variable associated with parsing a nested constructed element straight. tags Array of next expected tag values (null if last field). The routine will loop through elements until a matching tag is found or some other error occurs. tagCount The number of tags in the tags array. pElemList The pointer to linked list structure. The list will contain elements of ASN1OpenType type.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_OpenTypeExt64 | ( | OSCTXT * | pctxt, | |
const OSOCTET * | consptr, | |||
OSSIZE | conslen, | |||
OSBOOL | indefLen, | |||
ASN1TAG * | tags, | |||
OSSIZE | tagCount, | |||
OSRTDList * | pElemList | |||
) |
64-bit version of xd_OpenTypeExt.
- Parameters:
-
pctxt Pointer to context block structure. consptr Pointer to start of encoded constructed element. conslen Length of encoded constructed element. indefLen True if constructor is indefinite length. tags Array of next expected tag values (null if last field). The routine will loop through elements until a matching tag is found or some other error occurs. tagCount The number of tags in the tags array. pElemList The pointer to linked list structure. The list will contain elements of ASN1OpenType type.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
- See also:
- xd_OpenTypeExt
int xd_real | ( | OSCTXT * | pctxt, | |
OSREAL * | object_p, | |||
ASN1TagType | tagging, | |||
int | length | |||
) |
This function decodes a value of the binary encoded ASN.1 REAL type.
- Parameters:
-
pctxt Pointer to context block structure. object_p Pointer to value to receive decoded result. The OSREAL data type is a double-precision floating point number type (C double type). tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_real10 | ( | OSCTXT * | pctxt, | |
const char ** | object_p, | |||
ASN1TagType | tagging, | |||
int | length | |||
) |
This function decodes a value of the decimal encoded ASN.1 REAL type.
- Parameters:
-
pctxt Pointer to context block structure. object_p Pointer to a character pointer variable to receive the decoded result. Dynamic memory is allocated for the variable using the rtxMemAlloc function. tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_reloid | ( | OSCTXT * | pctxt, | |
ASN1OBJID * | object_p, | |||
ASN1TagType | tagging, | |||
int | length | |||
) |
This function decodes a value of the ASN.1 RELATIVE-OID type.
- Parameters:
-
pctxt Pointer to context block structure. object_p Pointer to value to receive decoded result. The ASN1OBJID structure contains an integer to hold the number of subidentifiers and an array to hold the subidentifier values. tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_setp | ( | OSCTXT * | pctxt, | |
const OSOCTET * | msg_p, | |||
int | msglen, | |||
ASN1TAG * | tag_p, | |||
int * | len_p | |||
) |
This function sets the decode pointer (cursor) to point at the beginning of the encoded ASN.1 message that is to be decoded. This function must be called prior to calling any of the other decode functions.
- Parameters:
-
pctxt Pointer to context block structure. msg_p Pointer to message buffer containing data to be decoded. msglen Size of the message data buffer. This is an optional parameter. It is used to verify that the length of the data encoded in the message is less than or equal to the given size of the message buffer. If the message size is unknown at the time of decoding, this argument can be set to zero and the size check will be bypassed. tag_p Pointer to an ASN.1 tag variable to recieve the value of the initial tag parsed from a message. This is an optional parameter. It can be set to NULL is the user does not require the initial tag value. len_p Pointer to an integer variable to receive the decoded message length. Note that this is the total length of the message from the start of message, NOT the actual length decoded after the initial tag. In other words the length of the initial tag and length are added on to the parsed length. This is an optional parameter. It can be set to NULL if the user does not require the message length value.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
Referenced by ASN1BERDecodeBuffer::parseTagLen().
int xd_setp64 | ( | OSCTXT * | pctxt, | |
const OSOCTET * | msg_p, | |||
OSSIZE | msglen, | |||
ASN1TAG * | tag_p, | |||
OSSIZE * | len_p, | |||
OSBOOL * | pIndefLen | |||
) |
This function sets the decode pointer (cursor) to point at the beginning of the encoded ASN.1 message that is to be decoded. This function must be called prior to calling any of the other decode functions. This version of the function supports 64-bit lengths.
- Parameters:
-
pctxt Pointer to context block structure. msg_p Pointer to message buffer containing data to be decoded. msglen Size of the message data buffer. This is an optional parameter. It is used to verify that the length of the data encoded in the message is less than or equal to the given size of the message buffer. If the message size is unknown at the time of decoding, this argument can be set to zero and the size check will be bypassed. tag_p Pointer to an ASN.1 tag variable to recieve the value of the initial tag parsed from a message. This is an optional parameter. It can be set to NULL is the user does not require the initial tag value. len_p Pointer to an integer variable to receive the decoded message length. Note that this is the total length of the message from the start of message, NOT the actual length decoded after the initial tag. In other words the length of the initial tag and length are added on to the parsed length. This is an optional parameter. It can be set to NULL if the user does not require the message length value. pIndefLen Boolean flag indicating parsed length is indefinite.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
Referenced by ASN1BERDecodeBuffer::parseTagLen().
int xd_tag | ( | OSCTXT * | pctxt, | |
ASN1TAG * | tag_p | |||
) |
This function decodes an ASN.1 tag into a standard 32-bit unsigned integer type. The bits used to represent the components of a tag are as follows:
Bit Fields:
- 31-30 Class (00 = UNIV, 01 = APPL, 10 = CTXT, 11 = PRIV)
- 29 Form (0 = primitive, 1 = constructed)
- 28-0 ID code value
- Parameters:
-
pctxt Pointer to context block structure. tag_p Pointer to variable to receive decoded tag info.
- Returns:
- Completion status of operation: 0 (0) = success, negative return value is error.
int xd_Tag1AndLen | ( | OSCTXT * | pctxt, | |
OSINT32 * | len_p | |||
) |
This function is an optimized version of the xd_tag_len function. If the ASN1C compiler determines the tag at a given location to be parsed is only one byte long (a typical case) then it will use this function. It reads a single tag byte and then immediately parses the length field.
- Parameters:
-
pctxt Pointer to context block structure. len_p Length of message component. Returned as follows: >= 0 component is fixed length ASN_K_INDEFLEN component is indefinite length
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_tag_len | ( | OSCTXT * | pctxt, | |
ASN1TAG * | tag_p, | |||
int * | len_p, | |||
OSOCTET | flags | |||
) |
This function parses the ASN.1 tag and length fields located at the current message pointer position.
xd_tag_len monitors indefinite length messages as follows: Each time a length is parsed, it is checked to see if it is an indefinite length value. If it is, an indefinite length section counter is incremented. Each time an end-of-contents (EOC) identifier is parsed, this counter is decremented. When the counter goes to zero, end of message is signaled.
- Parameters:
-
pctxt Pointer to context block structure. tag_p Pointer to variable to receive decoded tag info. len_p Length of message component. Returned as follows: >= 0 component is fixed length ASN_K_INDEFLEN component is indefinite length flags Bit flags used to set the following options: XM_ADVANCE: Advance decode pointer on match.
- Returns:
- Completion status of operation: 0 (0) = success, negative return value is error.
int xd_tag_len_64 | ( | OSCTXT * | pctxt, | |
ASN1TAG * | tag_p, | |||
OSSIZE * | len_p, | |||
OSBOOL * | pIndefLen, | |||
OSOCTET | flags | |||
) |
This version of the xd_tag_len function supports lengths up to 64 bits in size on 64-bit systems.
- Parameters:
-
pctxt Pointer to context block structure. tag_p Pointer to variable to receive decoded tag info. len_p Length of message component. Returned as follows: >= 0 component is fixed length ASN_K_INDEFLEN component is indefinite length pIndefLen Boolean flag indicating parsed length is indefinite. flags Bit flags used to set the following options: XM_ADVANCE: Advance decode pointer on match.
- Returns:
- Completion status of operation: 0 (0) = success, negative return value is error.
int xd_timeofdaystr | ( | OSCTXT * | pctxt, | |
const char ** | object_p, | |||
ASN1TagType | tagging, | |||
ASN1TAG | tag, | |||
int | length | |||
) |
This function is the base function for decoding ISO 8601 Time-of-day character string types. This function allocates memory for the decoded string and returns a pointer to the data.
- Parameters:
-
pctxt Pointer to ASN.1 context block structure object_p Pointer to a pointer to receive the address of the allocated memory into which the decoded character string data will be stored. The string is assumed to be a normal C string containing non-null characters. A null terminator is automatically added to the end of the string by this function. tagging Specifies whether element is implicitly or explicitly tagged. tag Tag variable to match length Length of data to retrieve. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_timestr | ( | OSCTXT * | pctxt, | |
const char ** | object_p, | |||
ASN1TagType | tagging, | |||
ASN1TAG | tag, | |||
int | length | |||
) |
This function is the base function for decoding ISO 8601 Time character string types. This function allocates memory for the decoded string and returns a pointer to the data.
- Parameters:
-
pctxt Pointer to ASN.1 context block structure object_p Pointer to a pointer to receive the address of the allocated memory into which the decoded character string data will be stored. The string is assumed to be a normal C string containing non-null characters. A null terminator is automatically added to the end of the string by this function. tagging Specifies whether element is implicitly or explicitly tagged. tag Tag variable to match length Length of data to retrieve. Valid for implicit case only.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_uint16 | ( | OSCTXT * | pctxt, | |
OSUINT16 * | object_p, | |||
ASN1TagType | tagging, | |||
int | length | |||
) |
This function parses an unsigned variant of ASN.1 INTEGER tag/length/value at the current message pointer location and advances the pointer to the next field.
This function is similar to xd_unsigned but it is used to parse 16-bit unsigned integer values.
- Parameters:
-
pctxt Pointer to context block structure. tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only. object_p Pointer to decoded 16-bit unsigned integer value.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_uint64 | ( | OSCTXT * | pctxt, | |
OSUINT64 * | object_p, | |||
ASN1TagType | tagging, | |||
int | length | |||
) |
This function parses an unsigned variant of ASN.1 INTEGER tag/length/value at the current message pointer location and advances the pointer to the next field.
The function is similar to xd_unsigned but it can be used to parse integer values with sizes up to 64 bits (if platform supports such integer's size).
If the match is successful or implicit tagging is specified, the integer data value is parsed.
- Parameters:
-
pctxt Pointer to context block structure. tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only. object_p Pointer to decoded 64-bit unsigned integer value.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_uint8 | ( | OSCTXT * | pctxt, | |
OSUINT8 * | object_p, | |||
ASN1TagType | tagging, | |||
int | length | |||
) |
This function parses an unsigned variant of ASN.1 INTEGER tag/length/value at the current message pointer location and advances the pointer to the next field.
This function is similar to xd_unsigned but it is used to parse 8-bit unsigned integer values.
- Parameters:
-
pctxt Pointer to context block structure. tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only. object_p Pointer to decoded 8-bit unsigned integer value.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.
int xd_unsigned | ( | OSCTXT * | pctxt, | |
OSUINT32 * | object_p, | |||
ASN1TagType | tagging, | |||
int | length | |||
) |
This function parses an unsigned variant of ASN.1 INTEGER tag/length/value at the current message pointer location and advances the pointer to the next field.
The function first checks to see if explicit tagging is specified. If yes, the universal tag value is parsed and checked to make sure it matches the expected tag for this message type. If not, a negative value is returned to indicate the parse was not successful. Otherwise, the length value is parsed.
If the match is successful or implicit tagging is specified, the integer data value is parsed.
- Parameters:
-
pctxt Pointer to context block structure. tagging Specifies whether element is implicitly or explicitly tagged. length Length of data to retrieve. Valid for implicit case only. object_p Pointer to decoded unsigned integer value.
- Returns:
- Completion status of operation:
- 0 (0) = success,
- negative return value is error.