This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14455 ) Change subject: library/GSUP_Types.ttcn: refactor PROC_SS IEs generation ...................................................................... library/GSUP_Types.ttcn: refactor PROC_SS IEs generation Both ts_GSUP_PROC_SS_ERR() and tr_GSUP_PROC_SS_ERR() templates used to compose the set of GSUP IEs manually, while similar ones were using both f_gen_ts_ss_ies() and f_gen_tr_ss_ies(). This led to the following problems: - tr_GSUP_PROC_SS_ERR was not tolerant to omitted message class IE, which was recently introduced; - code duplication. Let's modify the both functions in order to accept an optional Cause IE value, which is omitted by default, and use them in the both templates. Change-Id: I5cd6d2bc754bcedd1e721b3bd95ada9cdd44bcf0 --- M library/GSUP_Types.ttcn 1 file changed, 39 insertions(+), 29 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/library/GSUP_Types.ttcn b/library/GSUP_Types.ttcn index 8081347..e627538 100644 --- a/library/GSUP_Types.ttcn +++ b/library/GSUP_Types.ttcn @@ -1089,18 +1089,26 @@ hexstring imsi, OCT4 sid, GSUP_SessionState state, - template (omit) octetstring ss + template (omit) octetstring ss := omit, + template (omit) integer cause := omit ) return GSUP_IEs { /* Mandatory IEs */ var GSUP_IEs ies := { - valueof(ts_GSUP_IE_IMSI(imsi)), - valueof(ts_GSUP_IE_SessionId(sid)), - valueof(ts_GSUP_IE_SessionState(state)) + valueof(ts_GSUP_IE_IMSI(imsi)) }; + /* Cause IE is needed for PROC_SS_ERR */ + if (isvalue(cause)) { + ies := ies & { valueof(ts_GSUP_IE_Cause(valueof(cause))) }; + } + + /* Mandatory session IEs */ + ies := ies & { valueof(ts_GSUP_IE_SessionId(sid)) }; + ies := ies & { valueof(ts_GSUP_IE_SessionState(state)) }; + /* Optional SS payload */ if (isvalue(ss)) { - ies[3] := valueof(ts_GSUP_IE_SSInfo(valueof(ss))); + ies := ies & { valueof(ts_GSUP_IE_SSInfo(valueof(ss))) }; } return ies; @@ -1109,29 +1117,42 @@ template hexstring imsi, template OCT4 sid := ?, template GSUP_SessionState state := ?, - template octetstring ss := ? + template octetstring ss := omit, + template integer cause := omit ) return template GSUP_IEs { /* Mandatory IEs */ var template GSUP_IEs ies := { - tr_GSUP_IE_IMSI(imsi), - tr_GSUP_IE_SessionId(sid), - tr_GSUP_IE_SessionState(state) + tr_GSUP_IE_IMSI(imsi) }; - var integer last_idx := 3; + var integer idx := 1; + + /* Cause IE is needed for PROC_SS_ERR */ + if (istemplatekind(cause, "*")) { + ies[idx] := *; + idx := idx + 1; + } else if (not istemplatekind(cause, "omit")) { + ies[idx] := tr_GSUP_IE_Cause(cause); + idx := idx + 1; + } + + /* Mandatory session IEs */ + ies[idx] := tr_GSUP_IE_SessionId(sid); + ies[idx + 1] := tr_GSUP_IE_SessionState(state); + idx := idx + 2; /* Optional SS payload */ if (istemplatekind(ss, "*")) { - ies[3] := *; - last_idx := last_idx + 1; + ies[idx] := *; + idx := idx + 1; } else if (not istemplatekind(ss, "omit")) { - ies[3] := tr_GSUP_IE_SSInfo(ss); - last_idx := last_idx + 1; + ies[idx] := tr_GSUP_IE_SSInfo(ss); + idx := idx + 1; } /* the GSUP Message Class IE is optional, as old implementations don't have it yet */ var template GSUP_IEs ies2 := ies; - ies2[last_idx] := tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_USSD); - last_idx := last_idx + 1; + ies2[idx] := tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_USSD); + idx := idx + 1; return (ies, ies2); } @@ -1181,12 +1202,7 @@ integer cause ) := ts_GSUP( OSMO_GSUP_MSGT_PROC_SS_ERROR, - { - valueof(ts_GSUP_IE_IMSI(imsi)), - valueof(ts_GSUP_IE_Cause(cause)), - valueof(ts_GSUP_IE_SessionId(sid)), - valueof(ts_GSUP_IE_SessionState(state)) - } + f_gen_ts_ss_ies(imsi, sid, state, cause := cause) ); template GSUP_PDU tr_GSUP_PROC_SS_ERR( template hexstring imsi, @@ -1195,13 +1211,7 @@ template integer cause := ? ) := tr_GSUP( OSMO_GSUP_MSGT_PROC_SS_ERROR, - { - tr_GSUP_IE_IMSI(imsi), - tr_GSUP_IE_Cause(cause), - tr_GSUP_IE_SessionId(sid), - tr_GSUP_IE_SessionState(state), - tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_USSD) - } + f_gen_tr_ss_ies(imsi, sid, state, cause := cause) ); template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_REQ( -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14455 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I5cd6d2bc754bcedd1e721b3bd95ada9cdd44bcf0 Gerrit-Change-Number: 14455 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <axilirator at gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at gnumonks.org> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190614/6f2aa91b/attachment.htm>