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


Change subject: GSUP/SM: (WIP) introduce new SRI_FOR_SM message
......................................................................

GSUP/SM: (WIP) introduce new SRI_FOR_SM message

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 (see GSUP_SESSION_*_IE).

Change-Id: I4303dc817a5f8ee97b78d840672c443a6eddb332
---
M include/osmocom/gsm/gsup.h
M src/gsm/gsup.c
2 files changed, 51 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/68/11068/1

diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h
index 0ef5a75..bed61ae 100644
--- a/include/osmocom/gsm/gsup.h
+++ b/include/osmocom/gsm/gsup.h
@@ -88,6 +88,11 @@

        /*! Supplementary Services payload */
        OSMO_GSUP_SS_INFO_IE                    = 0x35,
+
+       /* SM related IEs (see 3GPP TS 29.002, section 7.6.8) */
+       OSMO_GSUP_SMSC_ADDR_IE                  = 0x40,
+       OSMO_GSUP_NODE_ADDR_IE                  = 0x41,
+       OSMO_GSUP_SM_RP_RPI_IE                  = 0x42,
 };

 /*! GSUP message type */
@@ -121,6 +126,11 @@
        OSMO_GSUP_MSGT_PROC_SS_REQUEST          = 0b00100000,
        OSMO_GSUP_MSGT_PROC_SS_ERROR            = 0b00100001,
        OSMO_GSUP_MSGT_PROC_SS_RESULT           = 0b00100010,
+
+       /* FIXME: 0b001001? any ideas? */
+       OSMO_GSUP_MSGT_SRI_FOR_SM_REQUEST       = 0b00100100,
+       OSMO_GSUP_MSGT_SRI_FOR_SM_ERROR         = 0b00100101,
+       OSMO_GSUP_MSGT_SRI_FOR_SM_RESULT        = 0b00100110,
 };

 #define OSMO_GSUP_IS_MSGT_REQUEST(msgt) (((msgt) & 0b00000011) == 0b00)
@@ -213,6 +223,14 @@
        /*! ASN.1 encoded MAP payload for Supplementary Services */
        uint8_t                         *ss_info;
        size_t                          ss_info_len;
+
+       /*! SMS (Short Message Service) parameters */
+       const uint8_t                   *smsc_addr;
+       size_t                          smsc_addr_len;
+       const uint8_t                   *node_addr;
+       size_t                          node_addr_len;
+       /*! HACK: SM-RP-RPI is (<0 / 0 / >0) => (false / omited / true) */
+       int                             sm_rp_rpi;
 };

 int osmo_gsup_decode(const uint8_t *data, size_t data_len,
diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c
index 9c2f817..22e26f1 100644
--- a/src/gsm/gsup.c
+++ b/src/gsm/gsup.c
@@ -67,6 +67,10 @@
        OSMO_VALUE_STRING(OSMO_GSUP_MSGT_PROC_SS_ERROR),
        OSMO_VALUE_STRING(OSMO_GSUP_MSGT_PROC_SS_RESULT),

+       OSMO_VALUE_STRING(OSMO_GSUP_MSGT_SRI_FOR_SM_REQUEST),
+       OSMO_VALUE_STRING(OSMO_GSUP_MSGT_SRI_FOR_SM_ERROR),
+       OSMO_VALUE_STRING(OSMO_GSUP_MSGT_SRI_FOR_SM_RESULT),
+
        { 0, NULL }
 };

@@ -434,6 +438,20 @@
                        gsup_msg->ss_info_len = value_len;
                        break;

+               case OSMO_GSUP_SMSC_ADDR_IE:
+                       gsup_msg->smsc_addr = value;
+                       gsup_msg->smsc_addr_len = value_len;
+                       break;
+
+               case OSMO_GSUP_NODE_ADDR_IE:
+                       gsup_msg->node_addr = value;
+                       gsup_msg->node_addr_len = value_len;
+                       break;
+
+               case OSMO_GSUP_SM_RP_RPI_IE:
+                       gsup_msg->sm_rp_rpi = (*value) ? 1 : -1;
+                       break;
+
                default:
                        LOGP(DLGSUP, LOGL_NOTICE,
                             "GSUP IE type %d unknown\n", iei);
@@ -626,6 +644,21 @@
                                gsup_msg->ss_info_len, gsup_msg->ss_info);
        }

+       if (gsup_msg->smsc_addr) {
+               msgb_tlv_put(msg, OSMO_GSUP_SMSC_ADDR_IE,
+                               gsup_msg->smsc_addr_len, gsup_msg->smsc_addr);
+       }
+
+       if (gsup_msg->node_addr) {
+               msgb_tlv_put(msg, OSMO_GSUP_NODE_ADDR_IE,
+                               gsup_msg->node_addr_len, gsup_msg->node_addr);
+       }
+
+       if (gsup_msg->sm_rp_rpi != 0) {
+               u8 = gsup_msg->sm_rp_rpi > 0 ? 1 : 0;
+               msgb_tlv_put(msg, OSMO_GSUP_SM_RP_RPI_IE, sizeof(u8), &u8);
+       }
+
        return 0;
 }


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4303dc817a5f8ee97b78d840672c443a6eddb332
Gerrit-Change-Number: 11068
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <[email protected]>

Reply via email to