ASN1C C/C++ Common Runtime  ASN1C v7.6.x
Macros | Functions
Comparison Functions

Macros

#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 rtCmpBitStrExt (const char *name, OSSIZE numbits, const OSOCTET *data, OSSIZE dataSize, const OSOCTET *extdata, OSSIZE compNumbits, const OSOCTET *compData, const OSOCTET *compExtdata, 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.

Macro Definition Documentation

◆ rtCmpOID

#define rtCmpOID   rtCmpOIDValue

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

◆ rtCmpOID64

#define rtCmpOID64   rtCmpOID64Value

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

Function Documentation

◆ rtCmp16BitCharStr()

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
nameThe name of value. Used for constructing errBuff if values are not matching.
bstringThe pointer to the first 16-bit character string structure to compare.
compBstringThe pointer to the second 16-bit character string structure to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmp32BitCharStr()

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
nameThe name of value. Used for constructing errBuff if values are not matching.
bstringThe pointer to the first 32-bit character string structure to compare.
compBstringThe pointer to the second 32-bit character string structure to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmpBitStr()

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
nameThe name of value. Used for constructing errBuff if values are not matching.
numbitsThe number of bits in the first value to compare.
dataThe pointer to the data of the first value to compare.
compNumbitsThe number of bits in the second value to compare.
compDataThe pointer to the data of the second value to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmpBitStrExt()

OSBOOL rtCmpBitStrExt ( const char *  name,
OSSIZE  numbits,
const OSOCTET *  data,
OSSIZE  dataSize,
const OSOCTET *  extdata,
OSSIZE  compNumbits,
const OSOCTET *  compData,
const OSOCTET *  compExtdata,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmpBitStrExt function compares two ASN.1 BIT STRING values containing extdata fields.

Parameters
nameThe name of value. Used for constructing errBuff if values are not matching.
numbitsThe number of bits in the first value to compare.
dataThe pointer to the data of the first value to compare.
dataSizeSize of the array pointed to by data and compData.
extdataThe pointer to the extdata of the first value to compare.
compNumbitsThe number of bits in the second value to compare.
compDataThe pointer to the data of the second value to compare.
compExtdataThe pointer to the extdata of the second value to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmpBoolean()

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
nameThe name of value. Used for constructing errBuff if values are not matching.
valueFirst value to compare.
compValueSecond value to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmpCharStr()

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
nameThe name of value. Used for constructing errBuff if values are not matching.
cstringThe first standard null-terminated string to compare.
compCstringThe second standard null-terminated string to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmpInt64()

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
nameThe name of value. Used for constructing errBuff if values are not matching.
valueFirst value to compare.
compValueSecond value to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmpInt8()

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
nameThe name of value. Used for constructing errBuff if values are not matching.
valueFirst value to compare.
compValueSecond value to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmpInteger()

OSBOOL rtCmpInteger ( const char *  name,
OSINT32  value,
OSINT32  compValue,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmpInteger function compars two ASN.1 INTEGER values.

Parameters
nameThe name of value. Used for constructing errBuff if values are not matching.
valueFirst value to compare.
compValueSecond value to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmpOctStr()

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
nameThe name of value. Used for constructing errBuff if values are not matching.
numoctsThe number of the octets in the first value to compare.
dataThe pointer to the data of the first value to compare.
compNumoctsThe number of the octets in the second value to compare.
compDataThe pointer to the data of the second value to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmpOID64Value()

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
nameThe name of value. Used for constructing errBuff if values are not matching.
pOIDThe pointer to the first value to compare.
pcompOIDThe pointer to the second value to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmpOIDValue()

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
nameThe name of value. Used for constructing errBuff if values are not matching.
pOIDThe pointer to the first value to compare.
pcompOIDThe pointer to the second value to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmpOpenType()

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
nameThe name of value. Used for constructing errBuff if values are not matching.
numoctsThe number of octets in the first value to compare.
dataThe pointer to the data of the first value to compare.
compNumoctsThe number of octets in the second value to compare.
compDataThe pointer to the data of the second value to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmpOpenTypeExt()

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
nameThe name of value. Used for constructing errBuff if values are not matching.
pElemListThe first pointer to a linked list structure. The list should consist of ASN1OpenType elements.
pCompElemListThe second pointer to a linked list structure. The list should consist of ASN1OpenType elements.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmpOptional()

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
nameThe name of value. Used for constructing errBuff if values are not matching.
presentBitFirst bit to compare.
compPresentBitSecond bit to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmpReal()

OSBOOL rtCmpReal ( const char *  name,
OSREAL  value,
OSREAL  compValue,
char *  errBuff,
OSSIZE  errBuffSize 
)

The rtCmpReal function compares two ASN.1 REAL values.

Parameters
nameThe name of value. Used for constructing errBuff if values are not matching.
valueFirst value to compare.
compValueSecond value to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmpSeqOfElements()

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
nameThe name of value. Used for constructing errBuff if values are not matching.
noOfElemsFirst size value to compare.
compNoOfElemsSecond size value to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmpSInt()

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
nameThe name of value. Used for constructing errBuff if values are not matching.
valueFirst value to compare.
compValueSecond value to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmpTag()

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
nameThe name of value. Used for constructing errBuff if values are not matching.
tagFirst tag value to compare.
compTagSecond tag value to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmpUInt64()

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
nameThe name of value. Used for constructing errBuff if values are not matching.
valueFirst value to compare.
compValueSecond value to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmpUInt8()

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
nameThe name of value. Used for constructing errBuff if values are not matching.
valueFirst value to compare.
compValueSecond value to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmpUnsigned()

OSBOOL rtCmpUnsigned ( const char *  name,
OSUINT32  value,
OSUINT32  compValue,
char *  errBuff,
OSSIZE  errBuffSize 
)

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

Parameters
nameThe name of value. Used for constructing errBuff if values are not matching.
valueFirst value to compare.
compValueSecond value to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.

◆ rtCmpUSInt()

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
nameThe name of value. Used for constructing errBuff if values are not matching.
valueFirst value to compare.
compValueSecond value to compare.
errBuffThe 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.
errBuffSizeThe size of the errBuff buffer.
Returns
The comparison result. TRUE, if values matched, otherwise FALSE.