fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/26458?usp=email )
Change subject: library/IPA_Types: add codec for IPA UnitID ......................................................................
library/IPA_Types: add codec for IPA UnitID
Change-Id: I68eb0d9e28bbf5d2d8ffe916aae5a66a0fdb9bd0 --- M library/IPA_Types.ttcn 1 file changed, 41 insertions(+), 0 deletions(-)
Approvals: fixeria: Looks good to me, approved Jenkins Builder: Verified
diff --git a/library/IPA_Types.ttcn b/library/IPA_Types.ttcn index 95623ef..fc729fb 100644 --- a/library/IPA_Types.ttcn +++ b/library/IPA_Types.ttcn @@ -132,6 +132,38 @@ extension "decode(RAW)" }
+/* Example: 1234/0/0 (site_id=1234, bts_id=0, trx_id=0) */ +type record IpaUnitId { + integer site_id, + integer bts_id, + integer trx_id +} with { + encode "TEXT" + variant "SEPARATOR('/')" + /* workaround for https://gitlab.eclipse.org/eclipse/titan/titan.core/-/issues/725 */ + variant (trx_id) "TEXT_CODING(,,'\d+')" +}; + +external function enc_IpaUnitId(in IpaUnitId unit_id) return charstring + with { extension "prototype(convert) encode(TEXT)" } +external function dec_IpaUnitId(in charstring stream) return IpaUnitId + with { extension "prototype(convert) decode(TEXT)" } + +template (value) IpaUnitId ts_IpaUnitId(integer site_id := 1234, + integer bts_id := 0, + integer trx_id := 0) := { + site_id := site_id, + bts_id := bts_id, + trx_id := trx_id +}; +template (present) IpaUnitId tr_IpaUnitId(template (present) integer site_id := ?, + template (present) integer bts_id := ?, + template (present) integer trx_id := ?) := { + site_id := site_id, + bts_id := bts_id, + trx_id := trx_id +}; + /* Finds an IE with the given tag in IPA IDENTITY RESPONSE. * Returns index of an IE if found, -1 otherwise. */ function f_ipa_id_resp_find_ie(in IpaCcmIdResp resp, IpaCcmIdTag tag)