Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/3427

to look at the new patch set (#2).

libmsc: move gsm340_rx_sms_submit() to sms_route_mt_sms()

Move the sms message-type-identifier (mti) handling away from the
routing logic. This patch allows us to reuse the sms_route_mt_sms()
function in a follow up patch for sms reports send through SMPP
DELIVER_SM with esm_class = Delivery Receipt whose Change-Id is
Ic1a9023074bfa938099377980b6aff9b262fab2a.

Change-Id: I3f3d30e0762b91e2099243b0be1a4b67cbb5e9c0
---
M openbsc/src/libmsc/gsm_04_11.c
1 file changed, 22 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/27/3427/2

diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c
index d60de08..7294153 100644
--- a/openbsc/src/libmsc/gsm_04_11.c
+++ b/openbsc/src/libmsc/gsm_04_11.c
@@ -278,7 +278,7 @@
 }
 
 static int sms_route_mt_sms(struct gsm_subscriber_connection *conn,
-                           struct gsm_sms *gsms, uint8_t sms_mti)
+                           struct gsm_sms *gsms)
 {
        int rc;
 
@@ -336,23 +336,6 @@
                rc = GSM411_RP_CAUSE_MO_NUM_UNASSIGNED;
                
rate_ctr_inc(&conn->network->msc_ctrs->ctr[MSC_CTR_SMS_NO_RECEIVER]);
 #endif
-               return rc;
-       }
-
-       switch (sms_mti) {
-       case GSM340_SMS_SUBMIT_MS2SC:
-               /* MS is submitting a SMS */
-               rc = gsm340_rx_sms_submit(gsms);
-               break;
-       case GSM340_SMS_COMMAND_MS2SC:
-       case GSM340_SMS_DELIVER_REP_MS2SC:
-               LOGP(DLSMS, LOGL_NOTICE, "Unimplemented MTI 0x%02x\n", sms_mti);
-               rc = GSM411_RP_CAUSE_IE_NOTEXIST;
-               break;
-       default:
-               LOGP(DLSMS, LOGL_NOTICE, "Undefined MTI 0x%02x\n", sms_mti);
-               rc = GSM411_RP_CAUSE_IE_NOTEXIST;
-               break;
        }
 
        return rc;
@@ -484,7 +467,27 @@
        /* FIXME: This looks very wrong */
        send_signal(0, NULL, gsms, 0);
 
-       rc = sms_route_mt_sms(conn, gsms, sms_mti);
+       rc = sms_route_mt_sms(conn, gsms);
+
+       /* This SMS got routed through SMPP or no receiver exists. */
+       if (!gsms->receiver)
+               return rc;
+
+       switch (sms_mti) {
+       case GSM340_SMS_SUBMIT_MS2SC:
+               /* MS is submitting a SMS */
+               rc = gsm340_rx_sms_submit(gsms);
+               break;
+       case GSM340_SMS_COMMAND_MS2SC:
+       case GSM340_SMS_DELIVER_REP_MS2SC:
+               LOGP(DLSMS, LOGL_NOTICE, "Unimplemented MTI 0x%02x\n", sms_mti);
+               rc = GSM411_RP_CAUSE_IE_NOTEXIST;
+               break;
+       default:
+               LOGP(DLSMS, LOGL_NOTICE, "Undefined MTI 0x%02x\n", sms_mti);
+               rc = GSM411_RP_CAUSE_IE_NOTEXIST;
+               break;
+       }
 out:
        sms_free(gsms);
 

-- 
To view, visit https://gerrit.osmocom.org/3427
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I3f3d30e0762b91e2099243b0be1a4b67cbb5e9c0
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Pablo Neira Ayuso <pa...@gnumonks.org>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Holger Freyther <hol...@freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Keith Whyte <ke...@rhizomatica.org>
Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de>

Reply via email to