ASN1C C/C++ Common Runtime
ASN1C v7.8.x
|
Classes | |
struct | ASN1OBJID |
struct | ASN1DynOBJID |
struct | ASN1OID64 |
Macros | |
#define | ASN_K_MAXSUBIDS 128 /* maximum sub-id's in an object ID */ |
Functions | |
int | rtOIDAsn2Xml (char *oidstr, OSSIZE oidlen, OSSIZE buflen, OSBOOL bRelative, OSSIZE *resultlen) |
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) |
int | rtDecOIDSubIds (OSCTXT *pctxt, OSUINT32 subidArray[], OSSIZE subidArraySize, int enclen) |
Object identifier helper functions provide assistance in working with the object identifier ASN.1 type.
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.
ptarget | A pointer to a target object identifier variable to receive object identifier data. Typically, this is a variable within a compiler-generated C structure. |
psource | A 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. |
int rtDecOIDSubIds | ( | OSCTXT * | pctxt, |
OSUINT32 | subidArray[], | ||
OSSIZE | subidArraySize, | ||
int | enclen | ||
) |
This function decodes OID subidentifiers into the given array. It will work for all binary encoding rules (BER/DER/CER, PER/UPER, and OER).
pvalue | Pointer to OID value to validate. |
int rtOIDAsn2Xml | ( | char * | oidstr, |
OSSIZE | oidlen, | ||
OSSIZE | buflen, | ||
OSBOOL | bRelative, | ||
OSSIZE * | resultlen | ||
) |
This function converts between ASN.1 notation and XML notation for OBJECT IDENTIFIER and RELATIVE-OID.
This can convert the ObjIdComponentsList of an ObjectIdentifierValue to an XMLObjectIdentifierValue, or the RelativeOIDComponentsList of a RelativeOIDValue to an XMLRelativeOIDValue, in place.
The XML value will use number form only, making it a dotted number string (e.g. "0.5.1234").
If bRelative is TRUE, the components must be NameAndNumberForm or NumberForm, and must use a number, not a defined value, for the number part. If bRelative is FALSE, NameForm is also allowed, but only if used as permitted by X.680 & X.660 (i.e. those cases where the name is predefined and can be translated to a number).
The input format is the usual ASN.1 value notation, minus the curly braces. Leading and trailing whitespace is ignored.
The maximum length of the result string, which is not null terminated, is as follows: if the input string is an OID using NameForm, then 1 + the length of the input string; otherwise, the length of the input string. The reason for this is that there are some predefined arc names whose numeric representation is one character longer than the name (e.g. {0 0 z} == {0 0 26}). In order to guarantee a successful (in place) conversion, ensure that buflen is at least the maximum length of the result string, as described above.
oidstr | OID string containing data to be converted, in place. |
oidlen | Length of the string (if > 0), or zero may be used if the string is null terminated. |
buflen | Size of memory buffer holding str. See also above comments regarding the maximum length of the result string. |
bRelative | TRUE if conversion is for RELATIVE-OID and FALSE if for OBJECT IDENTIIFER. |
resultlen | Receives the length of the result string, which is not null terminated. |
OSBOOL rtOIDIsValid | ( | const ASN1OBJID * | pvalue | ) |
This function determines 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.
pvalue | Pointer to OID value to validate. |
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.
str | OID string containing data to be parsed. It does not have to be null-terminated. |
strlen | Length of the string. |
pvalue | Pointer to OID value to receive parsed OID. |
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.
oidstr | OID string containing data to be parsed. |
oidstrlen | Length of the string. |
pvalue | Pointer to OID value to receive parsed OID. |
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.
oidstr | OID string containing data to be parsed. It does not have to be null-terminated. |
oidstrlen | Length of the string. |
pvalue | Pointer to OID value to receive parsed OID. |
This function compares two OID values for equality.
pOID1 | Pointer to first OID value to compare. |
pOID2 | Pointer to second OID value to compare. |
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.
str | String containing data to be parsed. It does not have to be null-terminated. |
strlen | Length of the string. |
pvalue | Pointer to OID value to receive parsed OID. |
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.
oidstr | OID string containing data to be parsed. It does not have to be null-terminated. |
oidstrlen | Length of the string. |
pvalue | Pointer to OID value to receive parsed OID. |
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.
ptarget | A pointer to a target object identifier variable to receive object * identifier data. Typically, this is a variable within a compiler-generated C structure. |
psource | A 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. |