laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40981?usp=email )
Change subject: es12_Types_JSON: add ES12 JSON encoder/decoder ......................................................................
es12_Types_JSON: add ES12 JSON encoder/decoder
This patch adds ES12 encoder/decoder functions.
Related: SYS#7339 Change-Id: I875cbb3a6dab6ac1eac5df1199f6fb71738a744e --- A library/euicc/es12_Types_JSON.ttcn 1 file changed, 126 insertions(+), 0 deletions(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve
diff --git a/library/euicc/es12_Types_JSON.ttcn b/library/euicc/es12_Types_JSON.ttcn new file mode 100644 index 0000000..a2ead3a --- /dev/null +++ b/library/euicc/es12_Types_JSON.ttcn @@ -0,0 +1,126 @@ +/* JSON message definitions for ES12 + * + * Author: Philipp Maier pmaier@sysmocom.de / sysmocom - s.f.m.c. GmbH + * + * Released under the terms of GNU General Public License, Version 2 or + * (at your option) any later version. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +module es12_Types_JSON { + +import from esx_header_Types_JSON all; + +/* GSMA SGP.22, section 6.5.2.13 */ +type record JSON_ES12_RegisterEventRequest { + JSON_ESx_RequestHeader header, + charstring eid, + charstring rspServerAddress, + charstring eventId, + boolean forwardingIndicator +}; + +/* GSMA SGP.22, section 6.5.2.14 */ +type record JSON_ES12_DeleteEventRequest { + JSON_ESx_RequestHeader header, + charstring eid, + charstring eventId +}; + +/* Common response */ +type record JSON_ES12_DeleteOrRegisterEventResponse { + JSON_ESx_ResponseHeader header +}; + + +/* Definition for JSON ES12 requests */ +type union JSON_ES12_Request { + JSON_ES12_RegisterEventRequest registerEventRequest, + JSON_ES12_DeleteEventRequest deleteEventRequest +} with { + variant "JSON : as value" +} + +external function enc_JSON_ES12_Request(in JSON_ES12_Request msg) + return octetstring +with { + extension "prototype (convert) encode(JSON)"; + extension "printing(pretty)"; + extension "errorbehavior(ALL:ERROR)" +} +external function dec_JSON_ES12_Request(in octetstring stream) + return JSON_ES12_Request +with { + extension "prototype (convert) decode(JSON)" + extension "errorbehavior(ALL:ERROR)" +} + + +/* Definition for JSON ES12 responses */ +external function enc_JSON_ES12_DeleteOrRegisterEventResponse(in JSON_ES12_DeleteOrRegisterEventResponse msg) + return octetstring +with { + extension "prototype (convert) encode(JSON)"; + extension "printing(pretty)"; + extension "errorbehavior(ALL:ERROR)" +} +external function dec_JSON_ES12_DeleteOrRegisterEventResponse(in octetstring stream) + return JSON_ES12_DeleteOrRegisterEventResponse +with { + extension "prototype (convert) decode(JSON)" + extension "errorbehavior(ALL:ERROR)" +} + + +template (value) JSON_ES12_Request +ts_registerEventRequest := { + registerEventRequest := { + header := ts_requestHeader, + eid := "000102030405060708090A0B0C0D0E0F", + rspServerAddress := "smdp.example.com", + eventId := "abcdefgh", + forwardingIndicator := false + } +} +template (present) JSON_ES12_Request +tr_registerEventRequest := { + registerEventRequest := { + header := tr_requestHeader, + eid := ?, + rspServerAddress := ?, + eventId := ?, + forwardingIndicator := ? + } +} + +template (value) JSON_ES12_Request +ts_deleteEventRequest := { + deleteEventRequest := { + header := ts_requestHeader, + eid := "000102030405060708090A0B0C0D0E0F", + eventId := "abcdefgh" + } +} +template (present) JSON_ES12_Request +tr_deleteEventRequest := { + deleteEventRequest := { + header := tr_requestHeader, + eid := ?, + eventId := ? + } +} + +template (value) JSON_ES12_DeleteOrRegisterEventResponse +ts_deleteOrRegisterEventResponse := { + header := ts_responseHeader +} +template (present) JSON_ES12_DeleteOrRegisterEventResponse +tr_deleteOrRegisterEventResponse := { + header := tr_responseHeader +} + + +} with { + encode "JSON"; +}