Comparison Functions
[C Runtime Common Functions]

Defines

#define rtCmpOID   rtCmpOIDValue
#define rtCmpOID64   rtCmpOID64Value

Functions

OSBOOL rtCmpBoolean (const char *name, OSBOOL value, OSBOOL compValue, char *errBuff, OSSIZE errBuffSize)
OSBOOL rtCmpInt8 (const char *name, OSINT8 value, OSINT8 compValue, char *errBuff, OSSIZE errBuffSize)
OSBOOL rtCmpSInt (const char *name, OSINT16 value, OSINT16 compValue, char *errBuff, OSSIZE errBuffSize)
OSBOOL rtCmpUInt8 (const char *name, OSUINT8 value, OSUINT8 compValue, char *errBuff, OSSIZE errBuffSize)
OSBOOL rtCmpUSInt (const char *name, OSUINT16 value, OSUINT16 compValue, char *errBuff, OSSIZE errBuffSize)
OSBOOL rtCmpInteger (const char *name, OSINT32 value, OSINT32 compValue, char *errBuff, OSSIZE errBuffSize)
OSBOOL rtCmpUnsigned (const char *name, OSUINT32 value, OSUINT32 compValue, char *errBuff, OSSIZE errBuffSize)
OSBOOL rtCmpInt64 (const char *name, OSINT64 value, OSINT64 compValue, char *errBuff, OSSIZE errBuffSize)
OSBOOL rtCmpUInt64 (const char *name, OSUINT64 value, OSUINT64 compValue, char *errBuff, OSSIZE errBuffSize)
OSBOOL rtCmpBitStr (const char *name, OSSIZE numbits, const OSOCTET *data, OSSIZE compNumbits, const OSOCTET *compData, char *errBuff, OSSIZE errBuffSize)
OSBOOL rtCmpOctStr (const char *name, OSSIZE numocts, const OSOCTET *data, OSSIZE compNumocts, const OSOCTET *compData, char *errBuff, OSSIZE errBuffSize)
OSBOOL rtCmpCharStr (const char *name, const char *cstring, const char *compCstring, char *errBuff, OSSIZE errBuffSize)
OSBOOL rtCmp16BitCharStr (const char *name, Asn116BitCharString *bstring, Asn116BitCharString *compBstring, char *errBuff, OSSIZE errBuffSize)
OSBOOL rtCmp32BitCharStr (const char *name, Asn132BitCharString *bstring, Asn132BitCharString *compBstring, char *errBuff, OSSIZE errBuffSize)
OSBOOL rtCmpReal (const char *name, OSREAL value, OSREAL compValue, char *errBuff, OSSIZE errBuffSize)
OSBOOL rtCmpOIDValue (const char *name, ASN1OBJID *pOID, ASN1OBJID *pcompOID, char *errBuff, OSSIZE errBuffSize)
OSBOOL rtCmpOID64Value (const char *name, ASN1OID64 *pOID, ASN1OID64 *pcompOID, char *errBuff, OSSIZE errBuffSize)
OSBOOL rtCmpOpenType (const char *name, OSSIZE numocts, const OSOCTET *data, OSSIZE compNumocts, const OSOCTET *compData, char *errBuff, OSSIZE errBuffSize)
OSBOOL rtCmpOpenTypeExt (const char *name, OSRTDList *pElemList, OSRTDList *pCompElemList, char *errBuff, OSSIZE errBuffSize)
OSBOOL rtCmpTag (const char *name, int tag, int compTag, char *errBuff, OSSIZE errBuffSize)
OSBOOL rtCmpSeqOfElements (const char *name, OSSIZE noOfElems, OSSIZE compNoOfElems, char *errBuff, OSSIZE errBuffSize)
OSBOOL rtCmpOptional (const char *name, unsigned presentBit, unsigned compPresentBit, char *errBuff, OSSIZE errBuffSize)

Detailed Description

The group of functions allows comparing the values of primitive ASN.1 types. These functions are used in the comparison routines that are generated by the ASN1C complier when the -gencompare option is used.

Information on elements that do not match is written to the given error buffer for each function. This makes it possible to compare complex structures and get back specific information as to what elements within those structures are different.


Define Documentation

#define rtCmpOID   rtCmpOIDValue

For backwards compatibility, we define rtCmpOID to be the same as rtCmpOIDValue.

#define rtCmpOID64   rtCmpOID64Value

For backwards compatibility, we define rtCmpOID64 to be the same as rtCmpOID64Value.


Function Documentation

OSBOOL rtCmp16BitCharStr ( const char *  name,
Asn116BitCharString bstring,
Asn116BitCharString compBstring,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmp16BitCharStr function compares two ASN.1 16-bit character string values (including BMPString).

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
bstring The pointer to the first 16-bit character string structure to compare.
compBstring The pointer to the second 16-bit character string structure to compare.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.
OSBOOL rtCmp32BitCharStr ( const char *  name,
Asn132BitCharString bstring,
Asn132BitCharString compBstring,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmp32BitCharStr function compares two 32-bit character string values (including UniversalString).

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
bstring The pointer to the first 32-bit character string structure to compare.
compBstring The pointer to the second 32-bit character string structure to compare.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.
OSBOOL rtCmpBitStr ( const char *  name,
OSSIZE  numbits,
const OSOCTET *  data,
OSSIZE  compNumbits,
const OSOCTET *  compData,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmpBitStr function compares two ASN.1 BIT STRING values.

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
numbits The number of bits in the first value to compare.
data The pointer to the data of the first value to compare.
compNumbits The number of bits in the second value to compare.
compData The pointer to the data of the second value to compare.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.
OSBOOL rtCmpBoolean ( const char *  name,
OSBOOL  value,
OSBOOL  compValue,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmpBoolean function compares two ASN.1 Boolean values. The return value is TRUE (matched) or FALSE (unmatched).

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
value First value to compare.
compValue Second value to compare.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.
OSBOOL rtCmpCharStr ( const char *  name,
const char *  cstring,
const char *  compCstring,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmpCharStr function compares two ASN.1 8-bit character sting values (including IA5String, VisibleString, PrintableString, NumericString, etc.)

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
cstring The first standard null-terminated string to compare.
compCstring The second standard null-terminated string to compare.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.
OSBOOL rtCmpInt64 ( const char *  name,
OSINT64  value,
OSINT64  compValue,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCompInt64 function compares two 64-bit ASN.1 INTEGER values.

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
value First value to compare.
compValue Second value to compare.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.
OSBOOL rtCmpInt8 ( const char *  name,
OSINT8  value,
OSINT8  compValue,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmpInt8 function compares two ASN.1 8-bit integers. The return value is TRUE (matched) or FALSE (unmatched).

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
value First value to compare.
compValue Second value to compare.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.
OSBOOL rtCmpInteger ( const char *  name,
OSINT32  value,
OSINT32  compValue,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmpInteger function compars two ASN.1 INTEGER values.

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
value First value to compare.
compValue Second value to compare.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.
OSBOOL rtCmpOctStr ( const char *  name,
OSSIZE  numocts,
const OSOCTET *  data,
OSSIZE  compNumocts,
const OSOCTET *  compData,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmpOctStr function compares two ASN.1 OCTET STRING values.

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
numocts The number of the octets in the first value to compare.
data The pointer to the data of the first value to compare.
compNumocts The number of the octets in the second value to compare.
compData The pointer to the data of the second value to compare.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.
OSBOOL rtCmpOID64Value ( const char *  name,
ASN1OID64 pOID,
ASN1OID64 pcompOID,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmpOID64Value function compares two 64-bit ASN.1 OBJECT IDENTIFIER or RELATIVE-OID values.

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
pOID The pointer to the first value to compare.
pcompOID The pointer to the second value to compare.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.
OSBOOL rtCmpOIDValue ( const char *  name,
ASN1OBJID pOID,
ASN1OBJID pcompOID,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmpOIDValue function compares two ASN.1 OBJECT IDENTIFIER or REALTIVE-OID values.

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
pOID The pointer to the first value to compare.
pcompOID The pointer to the second value to compare.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.
OSBOOL rtCmpOpenType ( const char *  name,
OSSIZE  numocts,
const OSOCTET *  data,
OSSIZE  compNumocts,
const OSOCTET *  compData,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmpOpenType function compares two ASN.1 values of the old (pre- 1994) ASN.1 ANY type or other elements defined in the later standards to be Open Types (for example, a variable type declaration in a CLASS construct defined in X.681).

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
numocts The number of octets in the first value to compare.
data The pointer to the data of the first value to compare.
compNumocts The number of octets in the second value to compare.
compData The pointer to the data of the second value to compare.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.
OSBOOL rtCmpOpenTypeExt ( const char *  name,
OSRTDList pElemList,
OSRTDList pCompElemList,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmpOpenTypeExt function compares two ASN.1 open type extension values.

An open type extension is defined as an extensibility marker on a constructed type without any extension elements defined (for example, SEQUENCE {a INTEGER, ...}). The difference is that this is an implicit field that can span one or more elements whereas the standard Open Type is assumed to be a single tagged field.

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
pElemList The first pointer to a linked list structure. The list should consist of ASN1OpenType elements.
pCompElemList The second pointer to a linked list structure. The list should consist of ASN1OpenType elements.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.
OSBOOL rtCmpOptional ( const char *  name,
unsigned  presentBit,
unsigned  compPresentBit,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmpOptional function compares two ASN.1 OPTIONAL bits. The return value is TRUE (matched) or FALSE (unmatched).

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
presentBit First bit to compare.
compPresentBit Second bit to compare.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.
OSBOOL rtCmpReal ( const char *  name,
OSREAL  value,
OSREAL  compValue,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmpReal function compares two ASN.1 REAL values.

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
value First value to compare.
compValue Second value to compare.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.
OSBOOL rtCmpSeqOfElements ( const char *  name,
OSSIZE  noOfElems,
OSSIZE  compNoOfElems,
char *  errBuff,
OSSIZE  errBuffSize 
)

This function compares two ASN.1 SEQUENCE OF sizes. The return value is TRUE (matched) or FALSE (unmatched).

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
noOfElems First size value to compare.
compNoOfElems Second size value to compare.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.
OSBOOL rtCmpSInt ( const char *  name,
OSINT16  value,
OSINT16  compValue,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmpSInt function compares two ASN.1 16-bit integers. The return value is TRUE (matched) or FALSE (unmatched).

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
value First value to compare.
compValue Second value to compare.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.
OSBOOL rtCmpTag ( const char *  name,
int  tag,
int  compTag,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmpTag function compares two ASN.1 tag values. The return value is TRUE (matched) or FALSE (unmatched).

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
tag First tag value to compare.
compTag Second tag value to compare.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.
OSBOOL rtCmpUInt64 ( const char *  name,
OSUINT64  value,
OSUINT64  compValue,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmpUInt64 function compares two 64-bit ASN.1 unsigned INTEGER values.

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
value First value to compare.
compValue Second value to compare.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.
OSBOOL rtCmpUInt8 ( const char *  name,
OSUINT8  value,
OSUINT8  compValue,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmpUInt8 function compares unsigned ASN.1 8-bit integers. The return value is TRUE (matched) or FALSE (unmatched).

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
value First value to compare.
compValue Second value to compare.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.
OSBOOL rtCmpUnsigned ( const char *  name,
OSUINT32  value,
OSUINT32  compValue,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmpUnsigned function compares two ASN.1 unsigned INTEGER values.

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
value First value to compare.
compValue Second value to compare.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.
OSBOOL rtCmpUSInt ( const char *  name,
OSUINT16  value,
OSUINT16  compValue,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmpUSInt function compares ASN.1 unsigned 16-bit integers. The return value is TRUE (matched) or FALSE (unmatched).

Parameters:
name The name of value. Used for constructing errBuff if values are not matching.
value First value to compare.
compValue Second value to compare.
errBuff The pointer to the buffer to receive the null-terminated string if the comparison fails. If the comparison failed, this buffer will contain the null-terminated string that explains the reason of comparison failure.
errBuffSize The size of the errBuff buffer.
Returns:
The comparison result. TRUE, if values matched, otherwise FALSE.