I have this confusion that I hope somebody can shed some light into it. According to the BER standard (ISO/IEC 8825-1), "if a real variable has the value zero, there shall be no contents octets in the encoding". However, when reading the rules for encoding structures (sequences), I could see that OPTIONAL or DEFAULT VALUE members can skip the contents octets.
Therefore, considering a structure that has a member of real type that can have a default value of 2, if the encoding is like this:
Id field - 0x09 Length field - 0x00
What conclusion do I draw when decoding it: Is it the default value 2 that caused the contents octets to be skipped or it is the value 0 for the real variable that caused the length of the contents octets to be zero?
Any advice will be greatly appreciated,
Dear Mr. Lascu:
It would appear you are confusing the skipping of the value octets (what you call the contents octets) with skipping the entire TLV.
When an element is optional and absent, it does not appear in the encoded BER data at all. There is no tag field (what you call Id field), nor a length field. Similarly, the entire TLV is missing when the element has a default and takes the default value. On the other hand, when the value is 0, the tag and length is encoded, but the value is not.
In summary (T=tag, L=length, V=value),
- a typical element is encoded as TLV - an absent optional element is not encoded (no TLV, nothing) - an element which takes its default is not encoded (no TLV, nothing) - a pure zero REAL is encoded as TL
Thus, your example 09 00 would represent a 0, not a 2. If it were 2, the 09 00 would not be there.
If my explanation is not quite clear, please forgive me and ask again.
===================================================================== 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
