summaryrefslogtreecommitdiffstats
path: root/src/gsm/gsup.c
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2018-09-25 23:03:13 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2018-12-18 21:52:01 +0700
commitc2628317cc3482262c80b93cbfb2cbe960772558 (patch)
treee2a36265577bdefa4412e9c938562882359b3e20 /src/gsm/gsup.c
parent520743278064c81e7fbe06ba42de6eefa807235a (diff)
GSUP/SMS: introduce MO-/MT-FORWARD-SM messages
According to 3GPP TS 29.002, there are two services: - MAP-MO-FORWARD-SHORT-MESSAGE (see 12.2), - MAP-MT-FORWARD-SHORT-MESSAGE (see 12.9), which are used to forward MO/MT short messages. This change replicates both services as GSUP messages: - OSMO_GSUP_MSGT_MO_FORWARD_SM_*, - OSMO_GSUP_MSGT_MT_FORWARD_SM_*. Please note, that only the 'must-have' IEs are introduced by this change, in particular the following: - OSMO_GSUP_SM_RP_MR_IE (see note below), - OSMO_GSUP_SM_RP_DA_IE (see 7.6.8.1), - OSMO_GSUP_SM_RP_OA_IE (see 7.6.8.2), - OSMO_GSUP_SM_RP_UI_IE (see 7.6.8.4), - OSMO_GSUP_SM_RP_MMS_IE (see 7.6.8.7), - OSMO_GSUP_SM_RP_CAUSE_IE (see GSM TS 04.11, 8.2.5.4), where both SM_RP_DA and SM_RP_OA IEs basically contain a single nested TV of the following format: - T: identity type (see 'osmo_gsup_sms_sm_rp_oda_t'), - V: encoded identity itself (optional). According to GSM TS 04.11, every single message on the SM-RL has an unique message reference (see 8.2.3), that is used to link an RP-ACK or RP-ERROR message to the associated (preceding) RP-DATA or RP-SMMA message transfer attempt. In case of TCAP/MAP, this message reference is being mapped to the Invoke ID. But since GSUP has no 'Invoke ID' IE, and it is not required for other applications (other than SMS), this change introduces a special 'SM_RP_MR' IE that doesn't exist in MAP. Change-Id: Ibe325c64ae2d6c626b232533bb4cbc65fc2b5d71 Related Change-Id: (docs) Ie0150756c33c1352bc4eb49421824542c711175c Related Change-Id: (TTCN) Ibf49474a81235096c032ea21f217170f523bd94e Related: OS#3587
Diffstat (limited to 'src/gsm/gsup.c')
-rw-r--r--src/gsm/gsup.c75
1 files changed, 74 insertions, 1 deletions
diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c
index 18b35806..e4339971 100644
--- a/src/gsm/gsup.c
+++ b/src/gsm/gsup.c
@@ -67,6 +67,14 @@ const struct value_string osmo_gsup_message_type_names[] = {
OSMO_VALUE_STRING(OSMO_GSUP_MSGT_PROC_SS_ERROR),
OSMO_VALUE_STRING(OSMO_GSUP_MSGT_PROC_SS_RESULT),
+ OSMO_VALUE_STRING(OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST),
+ OSMO_VALUE_STRING(OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR),
+ OSMO_VALUE_STRING(OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT),
+
+ OSMO_VALUE_STRING(OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST),
+ OSMO_VALUE_STRING(OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR),
+ OSMO_VALUE_STRING(OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT),
+
{ 0, NULL }
};
@@ -434,6 +442,35 @@ int osmo_gsup_decode(const uint8_t *const_data, size_t data_len,
gsup_msg->ss_info_len = value_len;
break;
+ case OSMO_GSUP_SM_RP_MR_IE:
+ gsup_msg->sm_rp_mr = value;
+ break;
+
+ case OSMO_GSUP_SM_RP_DA_IE:
+ rc = osmo_gsup_sms_decode_sm_rp_da(gsup_msg, value, value_len);
+ if (rc)
+ return rc;
+ break;
+
+ case OSMO_GSUP_SM_RP_OA_IE:
+ rc = osmo_gsup_sms_decode_sm_rp_oa(gsup_msg, value, value_len);
+ if (rc)
+ return rc;
+ break;
+
+ case OSMO_GSUP_SM_RP_UI_IE:
+ gsup_msg->sm_rp_ui = value;
+ gsup_msg->sm_rp_ui_len = value_len;
+ break;
+
+ case OSMO_GSUP_SM_RP_MMS_IE:
+ gsup_msg->sm_rp_mms = value;
+ break;
+
+ case OSMO_GSUP_SM_RP_CAUSE_IE:
+ gsup_msg->sm_rp_cause = value;
+ break;
+
default:
LOGP(DLGSUP, LOGL_NOTICE,
"GSUP IE type %d unknown\n", iei);
@@ -529,7 +566,7 @@ static void encode_auth_info(struct msgb *msg, enum osmo_gsup_iei iei,
int osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg)
{
uint8_t u8;
- int idx;
+ int idx, rc;
uint8_t bcd_buf[GSM48_MI_SIZE] = {0};
size_t bcd_len;
@@ -626,6 +663,42 @@ int osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg)
gsup_msg->ss_info_len, gsup_msg->ss_info);
}
+ if (gsup_msg->sm_rp_mr) {
+ msgb_tlv_put(msg, OSMO_GSUP_SM_RP_MR_IE,
+ sizeof(*gsup_msg->sm_rp_mr), gsup_msg->sm_rp_mr);
+ }
+
+ if (gsup_msg->sm_rp_da_type) {
+ rc = osmo_gsup_sms_encode_sm_rp_da(msg, gsup_msg);
+ if (rc) {
+ LOGP(DLGSUP, LOGL_ERROR, "Failed to encode SM-RP-DA IE\n");
+ return -EINVAL;
+ }
+ }
+
+ if (gsup_msg->sm_rp_oa_type) {
+ rc = osmo_gsup_sms_encode_sm_rp_oa(msg, gsup_msg);
+ if (rc) {
+ LOGP(DLGSUP, LOGL_ERROR, "Failed to encode SM-RP-OA IE\n");
+ return -EINVAL;
+ }
+ }
+
+ if (gsup_msg->sm_rp_ui) {
+ msgb_tlv_put(msg, OSMO_GSUP_SM_RP_UI_IE,
+ gsup_msg->sm_rp_ui_len, gsup_msg->sm_rp_ui);
+ }
+
+ if (gsup_msg->sm_rp_mms) {
+ msgb_tlv_put(msg, OSMO_GSUP_SM_RP_MMS_IE,
+ sizeof(*gsup_msg->sm_rp_mms), gsup_msg->sm_rp_mms);
+ }
+
+ if (gsup_msg->sm_rp_cause) {
+ msgb_tlv_put(msg, OSMO_GSUP_SM_RP_CAUSE_IE,
+ sizeof(*gsup_msg->sm_rp_cause), gsup_msg->sm_rp_cause);
+ }
+
return 0;
}