Hi Guillame,

Guillaume Martin wrote:
Hi,
I'd like to express constrained values such the following, where "c" has the same value as "a".
The problem is the value of "a" is unkown until the runtime.

A ::= INTEGER( 1 | 2 )

MySequence ::= SEQUENCE {
   a    A,
   b    INTEGER,
   c    A(a)
}

Is it possible and is it the right way to do ?

It's possible, but only by enumerating the cases, like so:

    MySequence ::= SEQUENCE {
       a    A,
       b    INTEGER,
       c    A
    } (WITH COMPONENTS { ..., a(1), c(1) } |
       WITH COMPONENTS { ..., a(2), c(2) })

That's okay as long as A is restricted to a small set of values.
If A is unconstrained then there isn't a way to express the constraint
in a machine processable fashion.

If "c" is always the same as "a" then why you need to have "c" at all ?

Regards,
Steven

Thanks.

Guillaume Martin

_______________________________________________
ASN1 mailing list
[email protected]
http://lists.asn1.org/mailman/listinfo/asn1

_______________________________________________
ASN1 mailing list
[email protected]
http://lists.asn1.org/mailman/listinfo/asn1

Reply via email to