ASN1C C/C++ Common Runtime  ASN1C v7.6.x
Classes | Macros | Functions
Object Identifier Helper Functions

Classes

struct  ASN1OBJID
 
struct  ASN1OID64
 

Macros

#define ASN_K_MAXSUBIDS   128 /* maximum sub-id's in an object ID */
 

Functions

void rtSetOID (ASN1OBJID *ptarget, ASN1OBJID *psource)
 
void rtAddOID (ASN1OBJID *ptarget, ASN1OBJID *psource)
 
OSBOOL rtOIDsEqual (const ASN1OBJID *pOID1, const ASN1OBJID *pOID2)
 
int rtOIDParseCompList (const char *str, OSSIZE strlen, ASN1OBJID *pvalue)
 
int rtOIDParseString (const char *oidstr, OSSIZE oidstrlen, ASN1OBJID *pvalue)
 
int rtRelOIDParseCompList (const char *str, OSSIZE strlen, ASN1OBJID *pvalue)
 
int rtRelOIDParseString (const char *oidstr, OSSIZE oidstrlen, ASN1OBJID *pvalue)
 
int rtOIDParseDottedNumberString (const char *oidstr, OSSIZE oidstrlen, ASN1OBJID *pvalue)
 
OSBOOL rtOIDIsValid (const ASN1OBJID *pvalue)
 

Detailed Description

Object identifier helper functions provide assistance in working with the object identifier ASN.1 type.

Function Documentation

◆ rtAddOID()

void rtAddOID ( ASN1OBJID ptarget,
ASN1OBJID psource 
)

This function appends one object identifier to another one. It copies the data from a source variable to the end of a target variable. Typically, the source variable is a compiler-generated object identifier constant that resulted from an object identifier value specification within an ASN.1 specification.

Parameters
ptargetA pointer to a target object identifier variable to receive object identifier data. Typically, this is a variable within a compiler-generated C structure.
psourceA pointer to a source object identifier variable to copy to a target. Typically, this is a compiler-generated variable corresponding to an ASN.1 value specification in the ASN.1 source file.

◆ rtOIDIsValid()

OSBOOL rtOIDIsValid ( const ASN1OBJID pvalue)

This function determine if an OID value is valid according to ASN.1 rules. In particular it checks a) if number of subidentifiers is greater than or equal to 2, b) if the first subidentifier value is less than or equal to 2, and c) if the first subidentifier is 2 that the second subidentifier is less than 40.

Parameters
pvaluePointer to OID value to validate.
Returns
True if OID value is valid.

◆ rtOIDParseCompList()

int rtOIDParseCompList ( const char *  str,
OSSIZE  strlen,
ASN1OBJID pvalue 
)

This function parses the ObjIdComponentsList of an ObjectIdentifierValue. Components that use only a name can be converted if that form was used as permitted by X.680 & X.660. Leading and trailing whitespace is ignored.

Parameters
strOID string containing data to be parsed. It does not have to be null-terminated.
strlenLength of the string.
pvaluePointer to OID value to receive parsed OID.
Returns
Status of operation: 0 = success, negative value is failure.

◆ rtOIDParseDottedNumberString()

int rtOIDParseDottedNumberString ( const char *  oidstr,
OSSIZE  oidstrlen,
ASN1OBJID pvalue 
)

This function parses an OID dotted number string (n.n.n) which is the from of OID XML content. Data must be in the form of numbers and dots only (i.e. OID components in other forms such as names or named number will cause a parse failure). Embedded whitespace will be ignored.

Parameters
oidstrOID string containing data to be parsed.
oidstrlenLength of the string.
pvaluePointer to OID value to receive parsed OID.
Returns
Status of operation: 0 = success, negative value is failure.

◆ rtOIDParseString()

int rtOIDParseString ( const char *  oidstr,
OSSIZE  oidstrlen,
ASN1OBJID pvalue 
)

This function parses an OID that is an XMLObjectIdentifierValue. Components that use only a name can be converted if that form was used as permitted by X.680 & X.660. Leading and trailing whitespace is ignored.

Parameters
oidstrOID string containing data to be parsed. It does not have to be null-terminated.
oidstrlenLength of the string.
pvaluePointer to OID value to receive parsed OID.
Returns
Status of operation: 0 = success, negative value is failure.

◆ rtOIDsEqual()

OSBOOL rtOIDsEqual ( const ASN1OBJID pOID1,
const ASN1OBJID pOID2 
)

This function compares two OID values for equality.

Parameters
pOID1Pointer to first OID value to compare.
pOID2Pointer to second OID value to compare.
Returns
True if OID's are equal.

◆ rtRelOIDParseCompList()

int rtRelOIDParseCompList ( const char *  str,
OSSIZE  strlen,
ASN1OBJID pvalue 
)

This function parses the RelativeOIDComponentsList of a RelativeOIDValue. Name-only components are not supported. Leading and trailing whitespace is ignored.

Parameters
strString containing data to be parsed. It does not have to be null-terminated.
strlenLength of the string.
pvaluePointer to OID value to receive parsed OID.
Returns
Status of operation: 0 = success, negative value is failure.

◆ rtRelOIDParseString()

int rtRelOIDParseString ( const char *  oidstr,
OSSIZE  oidstrlen,
ASN1OBJID pvalue 
)

This function parses an OID that is an XMLRelativeOIDValue. Name-only components are not supported. Leading and trailing whitespace is ignored.

Parameters
oidstrOID string containing data to be parsed. It does not have to be null-terminated.
oidstrlenLength of the string.
pvaluePointer to OID value to receive parsed OID.
Returns
Status of operation: 0 = success, negative value is failure.

◆ rtSetOID()

void rtSetOID ( ASN1OBJID ptarget,
ASN1OBJID psource 
)

This function populates an object identifier variable with data. It copies data from a source variable to a target variable. Typically, the source variable is a compiler-generated object identifier constant that resulted from a object identifier value specification within an ASN.1 specification.

Parameters
ptargetA pointer to a target object identifier variable to receive object * identifier data. Typically, this is a variable within a compiler-generated C structure.
psourceA pointer to a source object identifier variable to copy to a target. Typically, this is a compiler-generated variable corresponding to an ASN.1 value specification in the ASN.1 source file.