Review at https://gerrit.osmocom.org/7070
GSM_Types: Switch TLLI from uint32_t to OCT4 The TLLI is not really a number, but an opaque 4-byte value. Change-Id: I0901340a2211eeeb899f312bcc60573fec11f220 --- M gprs_gb/Test.ttcn M library/GSM_Types.ttcn M library/Osmocom_Gb_Types.ttcn M library/RLCMAC_CSN1_Types.ttcn M library/RLCMAC_EncDec.cc 5 files changed, 22 insertions(+), 26 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/70/7070/1 diff --git a/gprs_gb/Test.ttcn b/gprs_gb/Test.ttcn index e9cb40e..7251ef9 100644 --- a/gprs_gb/Test.ttcn +++ b/gprs_gb/Test.ttcn @@ -47,7 +47,7 @@ var BSSGP_CT bssgp_component; var MmContext g_mmctx := { - tlli := 0, + tlli := 'FFFFFFFF'O, n_u := 0 }; @@ -334,7 +334,7 @@ /* compute a random TLLI; FIXME: what about TLLI prefix / local/foreign/...? */ function f_random_tlli() return GprsTlli { - var GprsTlli tlli := float2int(rnd()* 4294967295.0); + var GprsTlli tlli := f_rnd_octstring(4); return tlli; } @@ -402,7 +402,7 @@ [] BSSGP.receive(tr_BD_BSSGP(?)) -> value bd { log("BSSGP Rx: ", bd); //log("GMM Rx: ", dec_PDU_L3_MS_SGSN(pdu.payload)); - g_mmctx.tlli := oct2int(bd.bssgp.pDU_BSSGP_UL_UNITDATA.tLLI); + g_mmctx.tlli := bd.bssgp.pDU_BSSGP_UL_UNITDATA.tLLI; tx_gmm(LLC_CR_DL_CMD, gmm_auth_req); } [] BSSGP.receive(t_BssgpStsInd(?, ?, BVC_S_UNBLOCKED)) { repeat; } diff --git a/library/GSM_Types.ttcn b/library/GSM_Types.ttcn index b86bfd7..c7b7991 100644 --- a/library/GSM_Types.ttcn +++ b/library/GSM_Types.ttcn @@ -16,7 +16,7 @@ type integer GsmRxLev (0..63); type integer GsmTsc (0..7) with { variant "FIELDLENGTH(8)" }; type uint32_t GsmTmsi; - type uint32_t GprsTlli; + type OCT4 GprsTlli; type hexstring GsmMcc length(3); type hexstring GsmMnc length(2 .. 3); type uint16_t GsmLac; diff --git a/library/Osmocom_Gb_Types.ttcn b/library/Osmocom_Gb_Types.ttcn index 2f2a8ba..a3121b5 100644 --- a/library/Osmocom_Gb_Types.ttcn +++ b/library/Osmocom_Gb_Types.ttcn @@ -551,7 +551,7 @@ template PDU_BSSGP ts_BSSGP_DL_UD(GprsTlli tlli, octetstring pdu) := { pDU_BSSGP_DL_UNITDATA := { bssgpPduType := '00'O, - tLLI_current := f_oct_or_wc(tlli, 4), + tLLI_current := tlli, qoS_Profile := t_defaultQos, pDU_Lifetime := t_DefaultLifetime(65535), mS_Radio_Access_Capability := omit, @@ -608,7 +608,7 @@ } } - template PDU_BSSGP ts_BSSGP_UL_UD(OCT4 tlli, BssgpCellId cell_id, octetstring payload) := { + template PDU_BSSGP ts_BSSGP_UL_UD(GprsTlli tlli, BssgpCellId cell_id, octetstring payload) := { pDU_BSSGP_UL_UNITDATA := { bssgpPduType := '01'O, tLLI := tlli, @@ -631,7 +631,7 @@ template octetstring payload := ?) := { pDU_BSSGP_UL_UNITDATA := { bssgpPduType := '01'O, - tLLI := f_oct_or_wc(tlli, 4), + tLLI := tlli, qoS_Profile := ?, cell_Identifier := t_BSSGP_IE_CellId(cell_id), pFI := *, diff --git a/library/RLCMAC_CSN1_Types.ttcn b/library/RLCMAC_CSN1_Types.ttcn index 076b1c1..2335c29 100644 --- a/library/RLCMAC_CSN1_Types.ttcn +++ b/library/RLCMAC_CSN1_Types.ttcn @@ -52,7 +52,9 @@ type record TenTlli { BIT2 presence ('10'B), GprsTlli tlli - } with { variant "" }; + } with { variant "" + variant (tlli) "BYTEORDER(first)" + }; type union GlobalTfiOrTlli { NullGlobalTfi global_tfi, @@ -78,7 +80,9 @@ type record IO_Tlli { BIT2 presence ('10'B), GprsTlli tlli - } with { variant "" }; + } with { variant "" + variant (tlli) "BYTEORDER(first)" + }; type record IIO_Tqi { BIT3 presence ('110'B), PacketRequestReference pkt_req_ref @@ -244,6 +248,7 @@ variant (cont_res_tlli) "PRESENCE(cont_res_tlli_present = '1'B)" variant (pkt_ta) "PRESENCE(pkt_ta_present = '1'B)" variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)" + variant (cont_res_tlli) "BYTEORDER(first)" }; type record PacketUlAckNack { PageMode page_mode, @@ -323,12 +328,16 @@ GprsTlli tlli, CtrlAck ctrl_ack /* TODO: Rel5 additions */ - } with { variant "" }; + } with { variant "" + variant (tlli) "BYTEORDER(first)" + }; /* 1.2.8b Packet Uplink Dummy Control Block */ type record PacketUlDummy { GprsTlli tlli - } with { variant "" }; + } with { variant "" + variant (tlli) "BYTEORDER(first)" + }; /* 11.2.0.2 */ type union RlcmacUlCtrlUnion { diff --git a/library/RLCMAC_EncDec.cc b/library/RLCMAC_EncDec.cc index 4cdeae7..ad52f91 100644 --- a/library/RLCMAC_EncDec.cc +++ b/library/RLCMAC_EncDec.cc @@ -136,14 +136,7 @@ } if (in.mac__hdr().tlli__ind()) { - /* FIXME */ - //in.tlli().encode(GSM__Types::GprsTlli_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW); - INTEGER t = in.tlli(); - unsigned int tmp = t.get_long_long_val(); - ttcn_buffer.put_c(tmp >> 24); - ttcn_buffer.put_c(tmp >> 16); - ttcn_buffer.put_c(tmp >> 8); - ttcn_buffer.put_c(tmp); + ttcn_buffer.put_string(in.tlli()); } if (in.mac__hdr().pfi__ind()) { @@ -215,13 +208,7 @@ /* parse optional TLLI */ if (ret_val.mac__hdr().tlli__ind()) { - /* FIXME: Why is this not working ?!? */ - //ret_val.tlli().decode(GSM__Types::GprsTlli_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW); - const unsigned char *cur = ttcn_buffer.get_read_data(); - unsigned int tmp = cur[0] << 24 | cur[1] << 16 | cur[2] << 8 | cur[3]; - INTEGER t; - t.set_long_long_val(tmp); - ret_val.tlli() = t; + ret_val.tlli() = OCTETSTRING(4, ttcn_buffer.get_read_data()); ttcn_buffer.increase_pos(4); } /* parse optional PFI */ -- To view, visit https://gerrit.osmocom.org/7070 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0901340a2211eeeb899f312bcc60573fec11f220 Gerrit-PatchSet: 1 Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>