Call external functions implicitly for PER encoding/decoding
Submitted by Gyorgy Rethy
Link to original bug (#508200)
Description
Current situation: when encvalue/decvalue/decmatch/@decoded is called for an ASN.1 instance, Titan will call the auto-generated BER encoder or decoder function with the type of coding specified in an external function declaration for the type. The return value of the encoding and the inout parameter of the decoding function shall be octetstring; e.g.: ASN.1 definition: CAM ::= SEQUENCE { header ItsPduHeader, cam CoopAwareness } External function declarations: external function fx_enc_CAM (in CAM pdu) return octetstring with {extension "prototype(convert) encode(BER:BER_ENCODE_DER)"} external function fx_dec_CAM (inout octetstring stream, out CAM pdu) return integer with {extension "prototype(sliding) decode(BER:BER_ACCEPT_ALL)"}
New features requested:
-
In the external function declarations also allow bitstring as return value and inout parameter; this will change the runtime behaviour only, i.e. add implicit octetstring/bitstring conversion, if the function is called directly as in case of encvalue/decvalue it is done already.
-
If the encode and decode attribute value of the external function is "PER" for an ASN.1 type, there shall be a manually implemented C++ function for each such external function declaration. One ASN.1 type shall have at most one external function declaration with an encode and one with a decode attribute. No other attribute values than "BER:..." or "PER" shall be allowed. Example: external function fx_enc_CAM (in CAM pdu) return bitstring with {extension "prototype(convert) encode(PER)"}
external function fx_dec_CAM (inout bitstring stream, out CAM pdu) return integer with {extension "prototype(sliding) decode(PER)"}
When an instance of an ASN.1 type is used in encvalue/decvalue/decmatch/@decoded, and the type has an external function declaration with the encode/decode attribute PER, the manually implemented external function shall be called implicitly, the same way, it is done for TTCN-3 types with user defined TTCN-3 encode attribute strings.