ASN.1 default value handling is partially supported
ASN.1 supports the definition of default values within the ASN.1 structure definition document. If an ASN.1 field with a default value does not occur in the encoded data, then the ASN1Parse operator uses the provided default value.
ASN1Parse supports only directly provided single default values in double quotes as shown in the following table.
Hint: The ASCII (American Standard Code for Information Interchange) is a character encoding scheme.
ASN.1 Type |
Supported DEFAULT Format Examples |
---|---|
BIT STRING |
any combination of 0 and 1 characters
|
BMPString |
any UTF-8 string
|
BOOLEAN |
any of the typical boolean values (0, 1, true, false, TRUE, FALSE)
|
ENUMERATED |
either the name or the value of the enumeration id
|
GeneralizedTime |
any format specified in ITU X.680 and ISO 8601, i.e. local time, UTC time or time with timezone, e.g.
|
GeneralString |
any hex dump is allowed
|
GraphicString |
any hex dump is allowed
|
IA5String |
any 7-bit ASCII character string
|
INTEGER |
any integer
|
ISO646String |
any 7-bit ASCII character (between 0x20 and 0x7E) string
|
NULL |
default makes no sense, but is still supported
|
NumericString |
any numeric string (digits only)
|
ObjectDesrciptor |
any UTF-8 string
|
OBJECT IDENTIFIER |
any dot-separated list of unsigned integers
|
OCTET STRING |
any hex dump is allowed
|
PrintableString |
any ASCII string with Latin letters, digits and some few other characters, as specified in ITU X.680.
|
REAL |
any real value with/without exponent or special meaning
|
RELATIVE-OID |
any dot-separated list of unsigned integers
|
T61String |
any hex dump is allowed
|
TeletexString |
any hex dump is allowed
|
UniversalString |
any UTF-8 string
|
UTCTime |
any format specified in ITU X.680, i.e. local time, UTC time or time with timezone, e.g.
|
UTF8String |
any UTF-8 string
|
VideotexString |
any hex dump is allowed
|
VisibleString |
any 7-bit ASCII character (between 0x20 and 0x7E) string
|
ASN1Parse does not support the following features:
- Indirect default values
- Lists of default values
- Default values for containers
The following table shows an example of unsupported default values:
myDefault INTEGER ::= 4
TEST ::= SEQUENCE
{
aaa [0] INTEGER DEFAULT myDefault, -- indirect default
bbb [1] SEQUENCE OF INTEGER DEFAULT { 3 }, -- list of defaults
ccc [2] SUB DEFAULT { 2, TRUE } -- container default
}
SUB ::= SEQUENCE
{
a [0] INTEGER,
b [1] BOOLEAN,
...
}
If your ASN.1 grammar has unsupported default values, the sc compiler prints warning messages, like the ones in the following sample output:
CDISP9163W WARNING: repeatable ASN.1 field 'xxx' has DEFAULT list '{ 1, 3 }', which is ignored because it is not yet supported
CDISP9163W WARNING: ASN.1 field 'yyy' has a default value of '{ 2, TRUE }' specified in the grammar, which could not be automatically converted to a Streams literal of type 'int64'. Be aware that a non-existing ASN.1 value results in an empty result list.
Resolving the problem
If you have ignored default values, you can implement the default handling in a downstream operator. For example, if a list is empty but default values should be applied, insert the default element.