...
Code Block |
---|
<field_type> <field_name> : <field options> ; |
Primitive Field Types
The following primitive types are supported:
Primitive Field Type | Description | |||||
---|---|---|---|---|---|---|
| ASCII encoded string. This type may also be used for other types of string encodings with the | |||||
| Special type used to encode a BER encoded size specification. It decodes to the BER length specification as well as the length of the length specification itself. The type makes it possible to decode some special cases of BER encoded data without using ASN.1 format specifications. The special option | |||||
| Array of digits encoded in BCD. Nibble order can be specified as | |||||
| Byte array. | |||||
| A special case of | |||||
float types ( | Binary encoded float value. This type supports IEEE754 standard 32-bit and 64-bit data encodings. The only difference between float and double is that the field is automatically mapped to their corresponding internal type. | |||||
integer types ( byte , short , int , long , bigint ) | Binary coded integer value. The first byte is the most significant (that is, big endian order). The field can be used with the field options The only difference between the types, when using an automatic
| |||||
msp_length | Special type used to decode the length field in a Siemens MSP billing event. The length field specifies the event length excluding the length field itself.
| |||||
list | Type that can be used to decode a list of elements.
The list can have any of the following field size options |
Primitive Field Options
Primitive Field Option | Description | |||||
---|---|---|---|---|---|---|
| Specifies that the field is encoded with the encoding named | |||||
| Specifies that the encoded value of the field always is | |||||
| Informs the decoder that the value is actually a | |||||
| Informs the decoder that the value is actually an integer of decimal or hexadecimal base and that the automatic mapping of the field is of the internal type | |||||
| The least significant bit of the field is | |||||
| The most significant bit of the field is | |||||
| Specifies the number of BCD digits for a bcd declared field. This size does not cover field size calculation and | |||||
byte_alignment(<int_constant>) | Specifies that a field begins at the next even multiple of an alignment byte size. The value must be an even power of 2 (for example 1, 2, 4, or 8). This field option can also be used in a
|
Field Size Specifications
Field Size Specification | Description |
---|---|
| Used to specify a static size of a field (in bytes) |
| Used to specify a dynamic size of a field (in bytes) |
element_count(<expr>) | Used to specify the size of a list field (in number of elements) |
| Used to specify a dynamic field terminated by a specific constant |
| Used to specify a size of a field (in bits). This size specification can only be used inside a |
| Used to specify padding character |
| Specifies that the field is left aligned, default |
| Specifies that the field is right aligned |
When decoding a field, the size calculation is done in two steps. First the occupying size is calculated. This is the required field size in the record. After that the core size and offset is calculated, which is the part of the field actually decoded into the internal field.
...
For a BCD field, with
native_size
specified, this along with the alignment specification is used.
If
terminated_by
is used to find the occupying size, this terminator char (or nibble for BCD) is removed.
Any padding is removed (while considering the alignment specification). The padding is either specified with
padded_with
or withterminated_by
providing the occupying size is not calculated using the terminator (this case is present due to historical reasons and in current versionspadded_with
should be used instead). If the field is an ASCII field, space is used as default padding.
Field Options for Optional Fields
The following field options are used to specify when a field is present.
Field Option | Description |
---|---|
| The field is present if the |
| The field is present unless the end of the UDR data has been reached. This is a convenient option equivalent to |
Other Field Options
Field Option | Description |
---|---|
external_only | The field will not be automatically created in the |
udr_size and remaining_size
Fields may need to use the size of the containing record in expressions. This is done by using the udr_size
keyword.
...
Info | ||
---|---|---|
| ||
|
Bit Blocks
Bit blocks are used when the data record contains fields that are not byte aligned. When declaring fields in bit blocks there are two ways to specify which bits to use for the field content. When using a bit_block
of a single byte, it is possible to specify the most and least significant bit of the field using msb
and lsb
, as previously described. The alternative is to use the bit_size
option to specify the number of bits spanned by the field.
...
Except for simple fields, a bit_block
can contain repeat_block
constructs in the contents part. For a description of repeat_block
see the section below, Repeat Blocks.
Repeat Blocks
A repeat_block
can be used to specify that a group of fields is to be repeated a specified number of times. Currently this construct can only be used inside bit_block
structures or another repeat_block
structure. However this is restricted to a maximum of two levels of repeat_block. See the example below.
...
Info | ||
---|---|---|
| ||
In the UDR Internal Format Browser, the structure of the UDR Type for this example appears as shown below: |
Note | ||
---|---|---|
| ||
It is not possible to encode to a structure containing a |
Constructed Types
A sequential field can be a type that is an instance of another external format.
Info | ||
---|---|---|
| ||
|
Here MyEnclosedFormat
can be any external format.
set Construct
The set
construct is used for decoding formats containing optional blocks of additional data. The syntax of the set Construct is declared as follows:
...
If a size is not specified on the set level, Ultra cannot validate that all the data in the UDR has been decoded. The user is therefore recommended to specify the size, unless the set size in advance is unknown (for instance if the record is terminated by a terminator package or the set size calculation is needed for the record size calculation). The dynamic_size(remaining_size)
specification used in the previous example is often correct.
switched_set Construct
The switched_set
construct can often be used instead of the set
construct. It has advantages (in performance and in ease of usage) especially when the separate sub-packages are simple. The syntax is however more complex compared to the basic set
construct. The syntax of the switched_set construct is declared as follows:
...
Info | ||
---|---|---|
| ||
|
Encoding Specifications and Expressions
To support encoding to binary formats, it is often necessary to explicitly specify which value to be encoded in the external fields. Normally the value is taken from the corresponding internal field, however there are cases when this is not desirable. For instance, if there is no mapped internal field (because the external_only
option has been used), or the value must be calculated from information about the encoding (for instance, udr_size
). This is done through the encode_value
option and there are several special constructs that may be used in the value expression (see the section above, Primitive Field Types).
...