Domanda

In ASN.1, Value Assignment syntax requires an identifier, a Type Reference, and a Value. Such as:

age INTEGER ::= 45

or

name UTF8String ::= "bob"

Generally, a user-defined type would be a more complex type, such as a SEQUENCE or a type with constraints. Suppose we have a SEQUENCE type like this:

MySequence ::= SEQUENCE {
  age INTEGER,
  name UTF8String
}

I could then create a Value Assignment like:

seq MySequence ::= { 50, "bob" }

But suppose MySequence was never defined. Is it legal to define types on the fly when creating a Value Assignment? For example, could I say:

seq SEQUENCE {  age INTEGER, name UTF8String } ::= { 50, "bob" }

I realize this syntax is ugly, but I'm simply asking if this ALLOWED by the ASN.1 standard.

Or what about creating a Sub Type on the fly in a Value Assignment? Is it valid ASN.1 syntax to say:

int INTEGER (0..10) ::= 5
È stato utile?

Soluzione

Yes, this is valid ASN.1, but has limited usefulness when passed to an ASN.1 Tool. Feel free to try this in the free online compiler at http://asn1-playground.oss.com.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top