The OBJECT IDENTIFIER cannot have arbitrary values for the first 2 arcs. The first arc can be ONLY 0, 1 and 2. The second arc cannot exceed 4 if the first arc is 0 and cannot exceed 3 if the first arc is 1. The minimum number of arcs in OBJECT IDENTIFIER values is 2.
A number of protocols were created violating the above standard rules. So to compile erroneously written ASN.1, we introduced the ASN.1 compiler command line option -allowbadvalues which allows bad value notation like:
{0 9 2342 19200300 100 1 2}
Keep in mind that in contrast to the encoder, the decoder is not concerned if you pass a valid arc or not. Very often the problem is that one of the arcs exceeds the maximum value for a given ASN.1 compiler generated OBJECT IDENTIFIER representation, like a linked list for example:
typedef struct ObjectID { struct ObjectID *next; unsigned short value; } *ObjectID;
In such a case, the arc 19200300 would not fit into a short integer representation and you would need to use the following directive along with the -allowbadvalues command line option to force generation of unsigned long instead:
--<OSS.OBJECTID LONG>-- D DEFINITIONS ::= BEGIN P ::= OBJECT IDENTIFIER p P ::= {0 9 2342 19200300 100 1 25} END
The samples included with some of the Knowledge Center answers are meant for your general understanding of the OSS products. Different versions of the products might produce slightly different outputs. Consult the products documentation and samples for the most up-to-date products information and code examples.
Test drive the OSS Nokalva ASN.1, LTE, and XML Tools now! Your trial includes complete software, documentation, sample programs, free 24x7 technical support and more.
Our expert personnel can help you learn ASN.1!
We offer 4-day ASN.1 courses at our headquarters or your premises.