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
This commit is contained in:
parent
fdc9966a90
commit
3c14803b8d
|
@ -280,7 +280,7 @@ static int gsm340_gen_sms_deliver_tpdu(struct msgb *msg, struct gsm_sms *sms)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sms_route_mt_sms(struct gsm_subscriber_connection *conn,
|
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;
|
int rc;
|
||||||
|
|
||||||
|
@ -338,23 +338,6 @@ try_local:
|
||||||
rc = GSM411_RP_CAUSE_MO_NUM_UNASSIGNED;
|
rc = GSM411_RP_CAUSE_MO_NUM_UNASSIGNED;
|
||||||
rate_ctr_inc(&conn->network->msc_ctrs->ctr[MSC_CTR_SMS_NO_RECEIVER]);
|
rate_ctr_inc(&conn->network->msc_ctrs->ctr[MSC_CTR_SMS_NO_RECEIVER]);
|
||||||
#endif
|
#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;
|
return rc;
|
||||||
|
@ -485,7 +468,27 @@ static int gsm340_rx_tpdu(struct gsm_trans *trans, struct msgb *msg,
|
||||||
/* FIXME: This looks very wrong */
|
/* FIXME: This looks very wrong */
|
||||||
send_signal(0, NULL, gsms, 0);
|
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:
|
out:
|
||||||
sms_free(gsms);
|
sms_free(gsms);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue