laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/27517 )
Change subject: bsc: use select() statement in f_cipher_mode_bssmap_to_rsl() ......................................................................
bsc: use select() statement in f_cipher_mode_bssmap_to_rsl()
Change-Id: I6e1c6762d2dd1efac2bd7ead3caf25e25dd3e7ad Related: SYS#5838 --- M bsc/MSC_ConnectionHandler.ttcn 1 file changed, 11 insertions(+), 32 deletions(-)
Approvals: laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn index 95cdb7c..a37a3b8 100644 --- a/bsc/MSC_ConnectionHandler.ttcn +++ b/bsc/MSC_ConnectionHandler.ttcn @@ -780,41 +780,20 @@ /* Convert the cipher representation on BSSMAP to the representation used on RSL */ function f_cipher_mode_bssmap_to_rsl(OCT1 alg_bssmap) return RSL_AlgId { - /* A5 0 */ - if (alg_bssmap == '01'O) { - return RSL_ALG_ID_A5_0; - } - /* A5 1 */ - else if (alg_bssmap == '02'O) { - return RSL_ALG_ID_A5_1; - } - /* A5 2 */ - else if (alg_bssmap == '04'O) { - return RSL_ALG_ID_A5_2; - } - /* A5 3 */ - else if (alg_bssmap == '08'O) { - return RSL_ALG_ID_A5_3; - } - /* A5 4 */ - else if (alg_bssmap == '10'O) { - return RSL_ALG_ID_A5_4; - } - /* A5 5 */ - else if (alg_bssmap == '20'O) { - return RSL_ALG_ID_A5_5; - } - /* A5 6 */ - else if (alg_bssmap == '40'O) { - return RSL_ALG_ID_A5_6; - } - /* A5 7 */ - else if (alg_bssmap == '80'O) { - return RSL_ALG_ID_A5_7; - } else { + select (alg_bssmap) { + case ('01'O) { return RSL_ALG_ID_A5_0; } + case ('02'O) { return RSL_ALG_ID_A5_1; } + case ('04'O) { return RSL_ALG_ID_A5_2; } + case ('08'O) { return RSL_ALG_ID_A5_3; } + case ('10'O) { return RSL_ALG_ID_A5_4; } + case ('20'O) { return RSL_ALG_ID_A5_5; } + case ('40'O) { return RSL_ALG_ID_A5_6; } + case ('80'O) { return RSL_ALG_ID_A5_7; } + case else { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected Encryption Algorithm: " & oct2str(alg_bssmap)); return RSL_ALG_ID_A5_0; + } } }