Vadim Yanitskiy has uploaded this change for review. ( 
https://gerrit.osmocom.org/11061


Change subject: library/GSUP: implement SRI_FOR_SM message support
......................................................................

library/GSUP: implement SRI_FOR_SM message support

According to 3GPP TS 29.002, section 12.1 the SRI_FOR_SM message
(a.k.a MAP-SEND-ROUTING-INFO-FOR-SM) is used to retrieve the
routing information needed for routing a short message to
the servicing node of subscriber.

Please note that only the 'must-have' fields of SRI_FOR_SM
are introduced by this change, in particular:

  - GSUP_MSGT_SRI_FOR_SM_REQUEST (MAP Request)
    - GSUP_MSISDN_IE
    - GSUP_SM_RP_RPI_IE
    - GSUP_SMSC_ADDR_IE

  - GSUP_MSGT_SRI_FOR_SM_RESULT (MAP Response)
    - GSUP_IMSI_IE
    - GSUP_NODE_ADDR_IE

  - GSUP_MSGT_SRI_FOR_SM_ERROR (MAP Response)
    - GSUP_CAUSE_IE (MAP User Error, see 7.6.1)

Since there is no TCAP layer in GSUP, the context is emulated
using the session management IEs, in particular using the
GSUP_SESSION_ID_IE. The session state IE isn't used due to
the 'REQ-RSP' nature of this message.

Change-Id: I7c1a882748d82ed5ef0b22cf1ae5764da5e874a0
---
M library/GSUP_Types.ttcn
1 file changed, 141 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/61/11061/1

diff --git a/library/GSUP_Types.ttcn b/library/GSUP_Types.ttcn
index 7680815..80b8e2e 100644
--- a/library/GSUP_Types.ttcn
+++ b/library/GSUP_Types.ttcn
@@ -31,6 +31,11 @@
        OSMO_GSUP_PDP_QOS_IE            ('13'O),
        OSMO_GSUP_CHARG_CHAR_IE         ('14'O),

+       /* FIXME: should we reserve a separate range (e.g. 0x40) for SM? */
+       OSMO_GSUP_SMSC_ADDR             ('15'O),
+       OSMO_GSUP_NODE_ADDR             ('16'O),
+       OSMO_GSUP_SM_RP_RPI             ('17'O),
+
        OSMO_GSUP_RAND_IE               ('20'O),
        OSMO_GSUP_SRES_IE               ('21'O),
        OSMO_GSUP_KC_IE                 ('22'O),
@@ -75,7 +80,12 @@

        OSMO_GSUP_MSGT_PROC_SS_REQUEST          ('00100000'B),
        OSMO_GSUP_MSGT_PROC_SS_ERROR            ('00100001'B),
-       OSMO_GSUP_MSGT_PROC_SS_RESULT           ('00100010'B)
+       OSMO_GSUP_MSGT_PROC_SS_RESULT           ('00100010'B),
+
+       /* FIXME: 0b001001? any ideas? */
+       OSMO_GSUP_MSGT_SRI_FOR_SM_REQUEST       ('00100100'B),
+       OSMO_GSUP_MSGT_SRI_FOR_SM_ERROR         ('00100101'B),
+       OSMO_GSUP_MSGT_SRI_FOR_SM_RESULT        ('00100110'B)
 } with { variant "FIELDLENGTH(8)" };

 type enumerated GSUP_CancelType {
@@ -128,6 +138,9 @@
                                 session_state, tag = 
OSMO_GSUP_SESSION_STATE_IE;
                                 session_id, tag = OSMO_GSUP_SESSION_ID_IE;
                                 ss_info, tag = OSMO_GSUP_SS_INFO_IE;
+                                smsc_addr, tag = OSMO_GSUP_SMSC_ADDR;
+                                node_addr, tag = OSMO_GSUP_NODE_ADDR;
+                                sm_rp_rpi, tag = OSMO_GSUP_SM_RP_RPI;
                        )"
 };

@@ -161,7 +174,11 @@
        GSUP_SessionState       session_state,
        OCT4                    session_id,
        /* Supplementary Services */
-       octetstring             ss_info
+       octetstring             ss_info,
+       /* Short Message Service */
+       octetstring             smsc_addr, /* FIXME: octetstring? */
+       octetstring             node_addr, /* FIXME: octetstring? */
+       boolean                 sm_rp_rpi /* FIXME: boolean? */
 };

 type record GSUP_PDU {
@@ -593,6 +610,51 @@
        }
 }

+template (value) GSUP_IE ts_GSUP_IE_SMSC_ADDR(octetstring addr) := {
+       tag := OSMO_GSUP_SMSC_ADDR,
+       len := 0, /* overwritten */
+       val := {
+               smsc_addr := addr
+       }
+}
+template GSUP_IE tr_GSUP_IE_SMSC_ADDR(template octetstring addr) := {
+       tag := OSMO_GSUP_SMSC_ADDR,
+       len := ?,
+       val := {
+               smsc_addr := addr
+       }
+}
+
+template (value) GSUP_IE ts_GSUP_IE_NODE_ADDR(octetstring addr) := {
+       tag := OSMO_GSUP_NODE_ADDR,
+       len := 0, /* overwritten */
+       val := {
+               node_addr := addr
+       }
+}
+template GSUP_IE tr_GSUP_IE_NODE_ADDR(template octetstring addr) := {
+       tag := OSMO_GSUP_NODE_ADDR,
+       len := ?,
+       val := {
+               node_addr := addr
+       }
+}
+
+template (value) GSUP_IE ts_GSUP_IE_SM_RP_RPI(boolean val) := {
+       tag := OSMO_GSUP_SM_RP_RPI,
+       len := 0, /* overwritten */
+       val := {
+               sm_rp_rpi := val
+       }
+}
+template GSUP_IE tr_GSUP_IE_SM_RP_RPI(template boolean val) := {
+       tag := OSMO_GSUP_SM_RP_RPI,
+       len := ?,
+       val := {
+               sm_rp_rpi := val
+       }
+}
+
 template (value) GSUP_IE ts_GSUP_IE_SSInfo(octetstring ss) := {
        tag := OSMO_GSUP_SS_INFO_IE,
        len := 0, /* overwritten */
@@ -714,6 +776,83 @@
        }
 );

+template (value) GSUP_PDU ts_GSUP_SRI_FOR_SM_REQ(
+       OCT4 sid, /* TCAP TransactionID */
+       /* TODO: having IMSI instead of MSISDN is also legal */
+       hexstring msisdn, /* MSISDN of subscriber */
+       boolean sm_rp_rpi, /* See 3GPP TS 29.002, 7.6.8.5 */
+       octetstring smsc_addr /* Address of SMSC */
+) := ts_GSUP(
+       OSMO_GSUP_MSGT_SRI_FOR_SM_REQUEST,
+       {
+               valueof(ts_GSUP_IE_SessionId(sid)),
+               valueof(ts_GSUP_IE_MSISDN(msisdn)),
+               valueof(ts_GSUP_IE_SM_RP_RPI(sm_rp_rpi)),
+               valueof(ts_GSUP_IE_SMSC_ADDR(smsc_addr))
+       }
+);
+template GSUP_PDU tr_GSUP_SRI_FOR_SM_REQ(
+       template OCT4 sid := ?, /* TCAP TransactionID */
+       /* TODO: having IMSI instead of MSISDN is also legal */
+       template hexstring msisdn, /* MSISDN of subscriber */
+       template boolean sm_rp_rpi, /* See 3GPP TS 29.002, 7.6.8.5 */
+       template octetstring smsc_addr /* Address of SMSC */
+) := tr_GSUP(
+       OSMO_GSUP_MSGT_SRI_FOR_SM_REQUEST,
+       {
+               tr_GSUP_IE_SessionId(sid),
+               tr_GSUP_IE_MSISDN(msisdn),
+               tr_GSUP_IE_SM_RP_RPI(sm_rp_rpi),
+               tr_GSUP_IE_SMSC_ADDR(smsc_addr)
+       }
+);
+
+template (value) GSUP_PDU ts_GSUP_SRI_FOR_SM_RES(
+       OCT4 sid, /* TCAP TransactionID */
+       hexstring imsi, /* IMSI of subscriber */
+       octetstring node_addr /* Address of serving node (e.g. HLR) */
+) := ts_GSUP(
+       OSMO_GSUP_MSGT_SRI_FOR_SM_RESULT,
+       {
+               valueof(ts_GSUP_IE_SessionId(sid)),
+               valueof(ts_GSUP_IE_IMSI(imsi)),
+               valueof(ts_GSUP_IE_NODE_ADDR(node_addr))
+       }
+);
+template GSUP_PDU tr_GSUP_SRI_FOR_SM_RES(
+       template OCT4 sid := ?, /* TCAP TransactionID */
+       template hexstring imsi, /* IMSI of subscriber */
+       template octetstring node_addr /* Address of serving node (e.g. HLR) */
+) := tr_GSUP(
+       OSMO_GSUP_MSGT_SRI_FOR_SM_RESULT,
+       {
+               tr_GSUP_IE_SessionId(sid),
+               tr_GSUP_IE_IMSI(imsi),
+               tr_GSUP_IE_NODE_ADDR(node_addr)
+       }
+);
+
+template (value) GSUP_PDU ts_GSUP_SRI_FOR_SM_ERR(
+       OCT4 sid, /* TCAP TransactionID */
+       integer cause /* User error, see 12.1.3 */
+) := ts_GSUP(
+       OSMO_GSUP_MSGT_SRI_FOR_SM_ERROR,
+       {
+               valueof(ts_GSUP_IE_SessionId(sid)),
+               valueof(ts_GSUP_IE_Cause(cause))
+       }
+);
+template GSUP_PDU tr_GSUP_SRI_FOR_SM_ERR(
+       template OCT4 sid := ?, /* TCAP TransactionID */
+       template integer cause := ? /* User error, see 12.1.3 */
+) := tr_GSUP(
+       OSMO_GSUP_MSGT_SRI_FOR_SM_ERROR,
+       {
+               tr_GSUP_IE_SessionId(sid),
+               tr_GSUP_IE_Cause(cause)
+       }
+);
+
 function f_gsup_find_ie(GSUP_PDU msg, GSUP_IEI iei, out GSUP_IeValue ret) 
return boolean {
        for (var integer i := 0; i < sizeof(msg.ies); i := i+1) {
                if (msg.ies[i].tag == iei) {

--
To view, visit https://gerrit.osmocom.org/11061
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c1a882748d82ed5ef0b22cf1ae5764da5e874a0
Gerrit-Change-Number: 11061
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>

Reply via email to