Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This appendix shows how incoming ASN.1 records can be encoded into a sequential external format.

An ASN.1 format definition can be pasted directly into an Ultra asn_block. Nested structures will be are saved as they are in the target_internal type, however the nested fields cannot easily be encoded to a different format without using an APL agent (Analysis or Aggregation). In the example, the incoming ASN.1 record is encoded to a sequential record, mapping all the field values to corresponding fields in the sequential format.

...

  • By creating a constructed external format definition, that is, where the external record definition consists of sub-externals.

  • By extending the target_internal with first level temporary temporary fields which will hold the values of the nested fields to be encoded.

  • By creating a new UDR which is populated with values from the incoming nested UDR.

Constructed Internal

It is possible to encode to a constructed sequential external, that is, an external sequential definition containing other externals to represent the nested fields. The disadvantage with this approach is that it is not possible to mix different level fields in the produced output record.

external

Name the fields in the outgoing external exactly as in the incoming ASN.1 structure. This allows the use of automatic mapping.

Code Block
asn_block {

exchangeRec DEFINITIONS IMPLICIT TAGS ::= 
BEGIN

main_udr   ::= SEQUENCE 
{ 
  duration        [ APPLICATION 1 ]    INTEGER OPTIONAL, 
  calledNumber    [ APPLICATION 2 ]    INTEGER OPTIONAL, 
  callingNumber subUDR1 
}

    subUDR1 ::= [ APPLICATION 3 ] SEQUENCE 
    { 
       category    [ APPLICATION 4 ]    INTEGER OPTIONAL, 
       adressString subUDR2 
    }

        subUDR2 ::= [ APPLICATION 5 ] SEQUENCE 
        { 
           number [ APPLICATION 6 ] INTEGER OPTIONAL, 
           ton [ APPLICATION 7 ] INTEGER OPTIONAL, 
           npi [ APPLICATION 8 ] INTEGER OPTIONAL 
        }

END 
};

//-------------------------------------------------------

external out { 
  ascii duration : static_size(2); 
  ascii calledNumber : static_size(8); 
  subUDR1 callingNumber : static_size(8); 
};

external subUDR1 { 
  ascii category : static_size(2); 
  subUDR2 adressString : static_size(6); 
};

external subUDR2 { 
  ascii number : static_size(2); 
  ascii ton : static_size(2); 
  ascii npi : static_size(2); 
}; 

in-map and out_map

Automatic mapping considers sub-UDRs as well.

Code Block
in_map inM : external( main_udr ),
               target_internal( myTI ) {
  automatic;
}; 

out_map outM : internal( myTI ),
               external( out ) {
                 automatic;
}; 


...

Extending the target_internal

Create an  internal which will hold holds the nested fields to be mapped to the sequential format. Define a target_internal holding both the asn_block and the internal. The values of the nested fields of the target_internal are copied to the fields added with the internal format specification, using APL code.

...

Note
titleNote!

All following fields are declared optional. This is to enable differentiation between an absent value and a zero value (default for int type). Thus, if no value is entered it will be is encoded as empty in output format, as opposed to 0 (zero).

...

A structure of sub-UDRs with the same field names as in the internal mapped from is created (that is, the target_internal which has the same structure as the ASN.1 external). This will only produce produces a line-based comma separated output file.

...

Code Block
decoder exchangeRec: in_map(exchangeRecord_MAP_IN);

encoder exchangeRecSEQ: out_map(exchangeRecord_MAP_OUT);


Scroll pagebreak