TOC PREV NEXT INDEX


OBJECT IDENTIFIER



The ASN.1 OBJECT IDENTIFIER type is converted into a C or C++ structured type to hold the subidentifier values that make up the object identifier.

	ASN.1 production:   <name> ::= OBJECT IDENTIFIER
 

 
	Generated C code:    typedef ASN1OBJID <name>;
 

 
	Generated C++ code:  typedef ASN1TObjId ASN1T_<name>;
 

In this case, different base types are used for C and C++. The difference between the two is the C++ version includes constructors and assignment operators that make setting the value a bit easier.

The ASN1OBJID type (i.e., the type used in the C mapping) is defined in asn1type.h to be the following:

typedef struct {
 
   ASN1UINT numids;		  	/* number of subidentifiers */
 
   ASN1UINT subid[ASN_K_MAXSUBIDS];	/* subidentifier values */
 
} ASN1OBJID;
 

The constant "ASN_K_MAXSUBIDS" specifies the maximum number of sub-identifiers that can be assigned to a value of the type. This constant is set to 128 as per the ASN.1 standard. The value of this constant can be changed to a lower number for applications with restricted memory requirements.

The ASN1TObjId type used in the C++ mapping is defined in Asn1CppTypes.h as follows:

struct EXTERNRT ASN1TObjId : public ASN1OBJID {
 
   ASN1TObjId () { numids = 0; }
 
   ASN1TObjId (ASN1OCTET _numids, const ASN1UINT* _subids);
 
   ASN1TObjId (const ASN1OBJID& oid);
 
   ASN1TObjId (const ASN1TObjId& oid);
 
   void operator= (const ASN1OBJID& rhs);
 
   void operator= (const ASN1TObjId& rhs);
 
} ;
 

The definition is the same as the C type with the addition of the constructors and assignment operators. Note that a constructor and assignment operator are overloaded to use the C ASN1OBJID type. That is because value assignments are generated using the ASN1OBJID type so these methods allow direct assignment of these generated values to an object of this type.



Objective Systems, Inc.

102 Pickering Way, Suite #506
Exton, Pennsylvania 19341
http://www.obj-sys.com
Phone: (484) 875-9841
Toll-free: (877) 307-6855 (US only)
Fax: (484) 875-9830
info@obj-sys.com
TOC PREV NEXT INDEX