You are right, it is a '}' and not a ')'. Just a typo.
However, everything else is exactly the same as the DATEX-ASN.1 standard is
describing the Time type. I thought that the "DEFAULT{0}" at the end means
in fact
time-SecondFractions CHOICE {
deci-seconds INTEGER (0..9) DEFAULT{0},
centi-seconds INTEGER (0..99) DEFAULT{0},
milliseconds INTEGER (0..999) DEFAULT{0} }
And this is the case that confuses me - if on the encoding side I have the
chosen sub-field being the millisecond with a value of 0, I will not encode
anything. On the decoding side I can figure out that the CHOICE was skipped
because the chosen field had the default value (I also know the value -
zero - but I don't know which one was the chosen field).
Things are even worse in this case:
time-SecondFractions CHOICE {
deci-seconds INTEGER (0..9) DEFAULT{1},
centi-seconds INTEGER (0..99) DEFAULT{2},
milliseconds INTEGER (0..999) DEFAULT{3} }
There is something that I am missing.
Regards,
Eddie
-----Original Message-----
From: Conrad Sigona [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 12, 2005 2:36 PM
To: Eduard Lascu
Cc: [email protected]
Subject: Re: [ASN1] BER encoding of a CHOICE type that has data members
with DEFAULT value
> I have a CHOICE type that is defined like this:
>
> time-SecondFractions CHOICE {
> deci-seconds INTEGER (0..9),
> centi-seconds INTEGER (0..99),
> milliseconds INTEGER (0..999) ) DEFAULT(0)
>
> I have a problem interpreting what the BER standard says about encoding
such
> a field. On one hand, members having the Default value are not to be
> encoded. In a SEQUENCE, the class of the members is context specific and
the
> tag numbers are used too determine which member is present and which is
> absent.
>
> On the other hand, BER says that the encoding of a choice value shall be
the
> same as the encoding of the value of the chosen type. If the inner members
> are not OPTIONAL and cannot have a DEFAULT VALUE everything is fine. But
if
> they are OPTIONAL or if they can have a DEFAULT VALUE (such as my case,
> above described) I am confused.
>
> If my chosen type has exactly the default value, how do I encode the
Choice?
>
> Any help would be highly appreciated.
Are you sure about that right parenthesis before the DEFAULT? I suspect
you meant to write "}", but even so,
time-SecondFractions CHOICE {
deci-seconds INTEGER (0..9),
centi-seconds INTEGER (0..99),
milliseconds INTEGER (0..999) } DEFAULT(0)
would not be correct. The default value needs to be a choice and the
value taken, , something like this
time-SecondFractions CHOICE {
deci-seconds INTEGER (0..9),
centi-seconds INTEGER (0..99),
milliseconds INTEGER (0..999) } DEFAULT deci-seconds: 0
When encoding the default value for time-SecondFractions in BER, you have
a choice of either encoding it or not. If you decide not to encode it, you
would treat it just like an optional value that isn't present.
One more point (already mentioned by Mr. Walkin): you can't have multiple
elements in a CHOICE where the tags are the same. You would either have to
have an automatic tagging environment or to insert tags. I presume that
you you have AUTOMATIC TAGS on your module definition line.
=====================================================================
Conrad Sigona Voice Mail : 1-732-302-9669 x400
OSS Nokalva Fax : 1-614-388-4156
[EMAIL PROTECTED] My direct line : 1-315-845-1773
_______________________________________________
ASN1 mailing list
[email protected]
http://lists.asn1.org/mailman/listinfo/asn1