fixeria has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40875?usp=email )

Change subject: s1ap: add {enc,dec}_S1AP_Global_ENB_ID() API
......................................................................

s1ap: add {enc,dec}_S1AP_Global_ENB_ID() API

Change-Id: I83c314f4929a6eb749dfa8dbd1e1371a90481ed6
Related: OS#6490
---
M library/s1ap/S1AP_EncDec.cc
M library/s1ap/S1AP_Types.ttcn
M mme/ConnHdlr.ttcn
3 files changed, 26 insertions(+), 29 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved




diff --git a/library/s1ap/S1AP_EncDec.cc b/library/s1ap/S1AP_EncDec.cc
index 6f82b2b..077ec31 100644
--- a/library/s1ap/S1AP_EncDec.cc
+++ b/library/s1ap/S1AP_EncDec.cc
@@ -30,4 +30,26 @@
        return pdu;
 }

+OCTETSTRING enc__S1AP__Global__ENB__ID(const S1AP__IEs::Global__ENB__ID &ie)
+{
+       TTCN_Buffer buf;
+
+       buf.clear();
+       ie.encode(S1AP__IEs::Global__ENB__ID_descr_, buf,
+                 TTCN_EncDec::CT_PER, PER_ALIGNED);
+       return OCTETSTRING(buf.get_len(), buf.get_data());
+}
+
+S1AP__IEs::Global__ENB__ID dec__S1AP__Global__ENB__ID(const OCTETSTRING 
&stream)
+{
+       S1AP__IEs::Global__ENB__ID ie;
+       TTCN_Buffer buf;
+
+       buf.clear();
+       buf.put_os(stream);
+       ie.decode(S1AP__IEs::Global__ENB__ID_descr_, buf,
+                 TTCN_EncDec::CT_PER, PER_ALIGNED);
+       return ie;
+}
+
 }
diff --git a/library/s1ap/S1AP_Types.ttcn b/library/s1ap/S1AP_Types.ttcn
index 6730ff3..5d0ecbe 100644
--- a/library/s1ap/S1AP_Types.ttcn
+++ b/library/s1ap/S1AP_Types.ttcn
@@ -1,7 +1,11 @@
 module S1AP_Types {

        import from S1AP_PDU_Descriptions language "ASN.1:1997" all;
+       import from S1AP_IEs language "ASN.1:1997" all;

        external function enc_S1AP_PDU(in S1AP_PDU pdu) return octetstring;
        external function dec_S1AP_PDU(in octetstring stream) return S1AP_PDU;
+
+       external function enc_S1AP_Global_ENB_ID(in Global_ENB_ID ie) return 
octetstring;
+       external function dec_S1AP_Global_ENB_ID(in octetstring stream) return 
Global_ENB_ID;
 }
diff --git a/mme/ConnHdlr.ttcn b/mme/ConnHdlr.ttcn
index 86dc1f3..c1e32b8 100644
--- a/mme/ConnHdlr.ttcn
+++ b/mme/ConnHdlr.ttcn
@@ -193,35 +193,6 @@

 type function void_fn() runs on ConnHdlr;

-/* Encode an S1AP Global-ENB-ID into an octetstring */
-private function enc_S1AP_Global_ENB_ID(Global_ENB_ID global_enb_id) return 
octetstring {
-
-       /* Due to the limitations of libfftranscode, we can not define encoders 
(or decoders) for individual
-        * information elements (in S1AP_Types.cc). Unfortuantely Global-ENB-ID 
also appears in BSSGP in its
-        * encoded form. (see also: GTP-C 3GPP TS 48.018, section 11.3.70). To 
encode a given Global-ENB-ID
-        * we craft a full S1AP PDU and encode it. Then we can cut out the 
encoded Global-ENB-ID from the
-        * generated octetstring. */
-
-       var SupportedTAs supported_tas_dummy := {{
-                               tAC := '0000'O,
-                               broadcastPLMNs := { '00f000'O },
-                               iE_Extensions := omit
-                               }};
-       var octetstring encoded;
-       var integer global_enb_id_len;
-
-       if (ispresent(global_enb_id.eNB_ID.macroENB_ID)) {
-               global_enb_id_len := 8;
-       } else {
-               /* All other ENB ID types fit into 8 byte (homeENB_ID, 
short_macroENB_ID, long_macroENB_ID) */
-               global_enb_id_len := 9;
-       }
-
-       encoded := enc_S1AP_PDU(valueof(ts_S1AP_SetupReq(global_enb_id, 
supported_tas_dummy, v32)));
-
-       return substr(encoded, 11, global_enb_id_len);
-}
-
 template (value) S1AP_IEs.TAI ts_enb_S1AP_TAI(EnbParams enb) := {
        pLMNidentity := enb.global_enb_id.pLMNidentity,
        tAC := enb.supported_tas[0].tAC,

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40875?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I83c314f4929a6eb749dfa8dbd1e1371a90481ed6
Gerrit-Change-Number: 40875
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to