GSUP/SMS: introduce READY-FOR-SM message

According to 3GPP TS 29.002, section 12.4, MAP-READY-FOR-SM is
used between the MSC and VLR as well as between the VLR and the
HLR to indicate that a subscriber has memory available for SMS.

This change replicates this service in GSUP as READY_FOR_SM_*.
The only mandatory IE for this service (excluding Invoke ID) is
'Alert Reason' that is replicated by OSMO_GSUP_SM_ALERT_RSN_IE.

Change-Id: Ic37f3b2114b8095cfce22977e67133b9103942e3
Related Change-Id: (docs) I549b6c8840a1e86caac09e77fb8bc5042d939e62
Related Change-Id: (TTCN) If2256607527ecfcb10285583332fb8b0515d7c78
Related: OS#3587
This commit is contained in:
Vadim Yanitskiy 2018-11-13 02:06:15 +07:00
parent c2628317cc
commit f9ee8da0cd
6 changed files with 46 additions and 1 deletions

View File

@ -97,6 +97,7 @@ enum osmo_gsup_iei {
OSMO_GSUP_SM_RP_UI_IE = 0x43, OSMO_GSUP_SM_RP_UI_IE = 0x43,
OSMO_GSUP_SM_RP_CAUSE_IE = 0x44, OSMO_GSUP_SM_RP_CAUSE_IE = 0x44,
OSMO_GSUP_SM_RP_MMS_IE = 0x45, OSMO_GSUP_SM_RP_MMS_IE = 0x45,
OSMO_GSUP_SM_ALERT_RSN_IE = 0x46,
}; };
/*! GSUP message type */ /*! GSUP message type */
@ -138,6 +139,10 @@ enum osmo_gsup_message_type {
OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST = 0b00101000, OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST = 0b00101000,
OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR = 0b00101001, OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR = 0b00101001,
OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT = 0b00101010, OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT = 0b00101010,
OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST = 0b00101100,
OSMO_GSUP_MSGT_READY_FOR_SM_ERROR = 0b00101101,
OSMO_GSUP_MSGT_READY_FOR_SM_RESULT = 0b00101110,
}; };
#define OSMO_GSUP_IS_MSGT_REQUEST(msgt) (((msgt) & 0b00000011) == 0b00) #define OSMO_GSUP_IS_MSGT_REQUEST(msgt) (((msgt) & 0b00000011) == 0b00)
@ -250,6 +255,8 @@ struct osmo_gsup_message {
const uint8_t *sm_rp_cause; const uint8_t *sm_rp_cause;
/*! SM-RP-MMS (More Messages to Send), section 7.6.8.7 */ /*! SM-RP-MMS (More Messages to Send), section 7.6.8.7 */
const uint8_t *sm_rp_mms; const uint8_t *sm_rp_mms;
/*! Alert reason (see 3GPP TS 29.002, 7.6.8.8) */
enum osmo_gsup_sms_sm_alert_rsn_t sm_alert_rsn;
}; };
int osmo_gsup_decode(const uint8_t *data, size_t data_len, int osmo_gsup_decode(const uint8_t *data, size_t data_len,

View File

@ -22,6 +22,13 @@ enum osmo_gsup_sms_sm_rp_oda_t {
OSMO_GSUP_SMS_SM_RP_ODA_NULL = 0xff, OSMO_GSUP_SMS_SM_RP_ODA_NULL = 0xff,
}; };
/*! Alert reason values, see 7.6.8.8 */
enum osmo_gsup_sms_sm_alert_rsn_t {
OSMO_GSUP_SMS_SM_ALERT_RSN_NONE = 0x00,
OSMO_GSUP_SMS_SM_ALERT_RSN_MS_PRESENT = 0x01,
OSMO_GSUP_SMS_SM_ALERT_RSN_MEM_AVAIL = 0x02,
};
struct osmo_gsup_message; struct osmo_gsup_message;
struct msgb; struct msgb;

View File

@ -75,6 +75,10 @@ const struct value_string osmo_gsup_message_type_names[] = {
OSMO_VALUE_STRING(OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR), OSMO_VALUE_STRING(OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR),
OSMO_VALUE_STRING(OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT), OSMO_VALUE_STRING(OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT),
OSMO_VALUE_STRING(OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST),
OSMO_VALUE_STRING(OSMO_GSUP_MSGT_READY_FOR_SM_ERROR),
OSMO_VALUE_STRING(OSMO_GSUP_MSGT_READY_FOR_SM_RESULT),
{ 0, NULL } { 0, NULL }
}; };
@ -471,6 +475,10 @@ int osmo_gsup_decode(const uint8_t *const_data, size_t data_len,
gsup_msg->sm_rp_cause = value; gsup_msg->sm_rp_cause = value;
break; break;
case OSMO_GSUP_SM_ALERT_RSN_IE:
gsup_msg->sm_alert_rsn = *value;
break;
default: default:
LOGP(DLGSUP, LOGL_NOTICE, LOGP(DLGSUP, LOGL_NOTICE,
"GSUP IE type %d unknown\n", iei); "GSUP IE type %d unknown\n", iei);
@ -699,6 +707,11 @@ int osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg)
sizeof(*gsup_msg->sm_rp_cause), gsup_msg->sm_rp_cause); sizeof(*gsup_msg->sm_rp_cause), gsup_msg->sm_rp_cause);
} }
if ((u8 = gsup_msg->sm_alert_rsn)) {
msgb_tlv_put(msg, OSMO_GSUP_SM_ALERT_RSN_IE,
sizeof(u8), &u8);
}
return 0; return 0;
} }

View File

@ -280,6 +280,15 @@ static void test_gsup_messages_dec_enc(void)
0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef,
}; };
static const uint8_t send_ready_for_sm_ind[] = {
0x2c, /* OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST */
TEST_IMSI_IE,
/* SM related IEs */
0x46, 0x01, /* Alert reason */
0x02, /* Memory Available (SMMA) */
};
static const struct test { static const struct test {
char *name; char *name;
const uint8_t *data; const uint8_t *data;
@ -327,6 +336,8 @@ static void test_gsup_messages_dec_enc(void)
send_mo_mt_forward_sm_rsp, sizeof(send_mo_mt_forward_sm_rsp)}, send_mo_mt_forward_sm_rsp, sizeof(send_mo_mt_forward_sm_rsp)},
{"MO-/MT-ForwardSM Error", {"MO-/MT-ForwardSM Error",
send_mo_mt_forward_sm_err, sizeof(send_mo_mt_forward_sm_err)}, send_mo_mt_forward_sm_err, sizeof(send_mo_mt_forward_sm_err)},
{"ReadyForSM (MSC -> SMSC) Indication",
send_ready_for_sm_ind, sizeof(send_ready_for_sm_ind)},
}; };
printf("Test GSUP message decoding/encoding\n"); printf("Test GSUP message decoding/encoding\n");
@ -394,7 +405,7 @@ static void test_gsup_messages_dec_enc(void)
* FIXME: share the maximal IE value somehow * FIXME: share the maximal IE value somehow
* in order to avoid manual updating of this * in order to avoid manual updating of this
*/ */
OSMO_ASSERT(t->data[j+0] <= OSMO_GSUP_SM_RP_MMS_IE); OSMO_ASSERT(t->data[j+0] <= OSMO_GSUP_SM_ALERT_RSN_IE);
OSMO_ASSERT(t->data[j+1] <= ie_end - j - 2); OSMO_ASSERT(t->data[j+1] <= ie_end - j - 2);
ie_end = j; ie_end = j;

View File

@ -61,6 +61,9 @@
generated message: 25 01 08 21 43 65 87 09 21 43 f5 30 04 de ad be ef 31 01 03 40 01 fa 44 01 af generated message: 25 01 08 21 43 65 87 09 21 43 f5 30 04 de ad be ef 31 01 03 40 01 fa 44 01 af
original message: 25 01 08 21 43 65 87 09 21 43 f5 30 04 de ad be ef 31 01 03 40 01 fa 44 01 af original message: 25 01 08 21 43 65 87 09 21 43 f5 30 04 de ad be ef 31 01 03 40 01 fa 44 01 af
IMSI: 123456789012345 IMSI: 123456789012345
generated message: 2c 01 08 21 43 65 87 09 21 43 f5 46 01 02
original message: 2c 01 08 21 43 65 87 09 21 43 f5 46 01 02
IMSI: 123456789012345
message 0: tested 11 truncations, 11 parse failures message 0: tested 11 truncations, 11 parse failures
message 1: tested 14 truncations, 13 parse failures message 1: tested 14 truncations, 13 parse failures
message 2: tested 83 truncations, 81 parse failures message 2: tested 83 truncations, 81 parse failures
@ -82,6 +85,7 @@
message 18: tested 44 truncations, 39 parse failures message 18: tested 44 truncations, 39 parse failures
message 19: tested 20 truncations, 18 parse failures message 19: tested 20 truncations, 18 parse failures
message 20: tested 26 truncations, 22 parse failures message 20: tested 26 truncations, 22 parse failures
message 21: tested 14 truncations, 13 parse failures
DLGSUP Stopping DLGSUP logging DLGSUP Stopping DLGSUP logging
message 0: tested 2816 modifications, 510 parse failures message 0: tested 2816 modifications, 510 parse failures
message 1: tested 3584 modifications, 770 parse failures message 1: tested 3584 modifications, 770 parse failures
@ -104,3 +108,4 @@ DLGSUP Stopping DLGSUP logging
message 18: tested 11264 modifications, 2307 parse failures message 18: tested 11264 modifications, 2307 parse failures
message 19: tested 5120 modifications, 1031 parse failures message 19: tested 5120 modifications, 1031 parse failures
message 20: tested 6656 modifications, 1546 parse failures message 20: tested 6656 modifications, 1546 parse failures
message 21: tested 3584 modifications, 771 parse failures

View File

@ -41,4 +41,6 @@ Test GSUP message decoding/encoding
MO-/MT-ForwardSM Response OK MO-/MT-ForwardSM Response OK
Testing MO-/MT-ForwardSM Error Testing MO-/MT-ForwardSM Error
MO-/MT-ForwardSM Error OK MO-/MT-ForwardSM Error OK
Testing ReadyForSM (MSC -> SMSC) Indication
ReadyForSM (MSC -> SMSC) Indication OK
Done. Done.