Change in libosmocore[master]: GSUP/SMS: introduce READY-FOR-SM message

2018-12-18 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/11751 )

Change subject: GSUP/SMS: introduce READY-FOR-SM message
..


Patch Set 7: Code-Review+2


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic37f3b2114b8095cfce22977e67133b9103942e3
Gerrit-Change-Number: 11751
Gerrit-PatchSet: 7
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Tue, 18 Dec 2018 16:43:28 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in libosmocore[master]: GSUP/SMS: introduce READY-FOR-SM message

2018-12-18 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/11751 )

Change subject: GSUP/SMS: introduce READY-FOR-SM message
..

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
---
M include/osmocom/gsm/gsup.h
M include/osmocom/gsm/gsup_sms.h
M src/gsm/gsup.c
M tests/gsup/gsup_test.c
M tests/gsup/gsup_test.err
M tests/gsup/gsup_test.ok
6 files changed, 46 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved
  Stefan Sperling: Looks good to me, but someone else must approve



diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h
index 192b877..51871e4 100644
--- a/include/osmocom/gsm/gsup.h
+++ b/include/osmocom/gsm/gsup.h
@@ -97,6 +97,7 @@
OSMO_GSUP_SM_RP_UI_IE   = 0x43,
OSMO_GSUP_SM_RP_CAUSE_IE= 0x44,
OSMO_GSUP_SM_RP_MMS_IE  = 0x45,
+   OSMO_GSUP_SM_ALERT_RSN_IE   = 0x46,
 };

 /*! GSUP message type */
@@ -138,6 +139,10 @@
OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST= 0b00101000,
OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR  = 0b00101001,
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) & 0b0011) == 0b00)
@@ -250,6 +255,8 @@
const uint8_t   *sm_rp_cause;
/*! SM-RP-MMS (More Messages to Send), section 7.6.8.7 */
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,
diff --git a/include/osmocom/gsm/gsup_sms.h b/include/osmocom/gsm/gsup_sms.h
index 521412d..480971e 100644
--- a/include/osmocom/gsm/gsup_sms.h
+++ b/include/osmocom/gsm/gsup_sms.h
@@ -22,6 +22,13 @@
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 msgb;

diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c
index e433997..c1c9992 100644
--- a/src/gsm/gsup.c
+++ b/src/gsm/gsup.c
@@ -75,6 +75,10 @@
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_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 }
 };

@@ -471,6 +475,10 @@
gsup_msg->sm_rp_cause = value;
break;

+   case OSMO_GSUP_SM_ALERT_RSN_IE:
+   gsup_msg->sm_alert_rsn = *value;
+   break;
+
default:
LOGP(DLGSUP, LOGL_NOTICE,
 "GSUP IE type %d unknown\n", iei);
@@ -699,6 +707,11 @@
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), );
+   }
+
return 0;
 }

diff --git a/tests/gsup/gsup_test.c b/tests/gsup/gsup_test.c
index 0936893..b3a8c77 100644
--- a/tests/gsup/gsup_test.c
+++ b/tests/gsup/gsup_test.c
@@ -280,6 +280,15 @@
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 {
char *name;
const uint8_t *data;
@@ -327,6 +336,8 @@
send_mo_mt_forward_sm_rsp, 
sizeof(send_mo_mt_forward_sm_rsp)},
  

Change in libosmocore[master]: GSUP/SMS: introduce READY-FOR-SM message

2018-12-18 Thread Stefan Sperling
Stefan Sperling has posted comments on this change. ( 
https://gerrit.osmocom.org/11751 )

Change subject: GSUP/SMS: introduce READY-FOR-SM message
..


Patch Set 6:

(1 comment)

https://gerrit.osmocom.org/#/c/11751/6/src/gsm/gsup.c
File src/gsm/gsup.c:

https://gerrit.osmocom.org/#/c/11751/6/src/gsm/gsup.c@710
PS6, Line 710:  if ((u8 = gsup_msg->sm_alert_rsn)) {
> Well, this approach is quite common, look at: […]
The only benefit is that it would help code readers like me :)
I think it is more obvious to check against != NONE if there's a NONE value 
specifically defined for this set of values.



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic37f3b2114b8095cfce22977e67133b9103942e3
Gerrit-Change-Number: 11751
Gerrit-PatchSet: 6
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Tue, 18 Dec 2018 11:15:40 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in libosmocore[master]: GSUP/SMS: introduce READY-FOR-SM message

2018-12-14 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/11751 )

Change subject: GSUP/SMS: introduce READY-FOR-SM message
..


Patch Set 6:

(2 comments)

https://gerrit.osmocom.org/#/c/11751/6/src/gsm/gsup.c
File src/gsm/gsup.c:

https://gerrit.osmocom.org/#/c/11751/6/src/gsm/gsup.c@710
PS6, Line 710:  if ((u8 = gsup_msg->sm_alert_rsn)) {
> A follow-up suggestion: […]
Well, this approach is quite common, look at:

  - gsup_msg->cause,
  - gsup_msg->cancel_type,

where this check is also done implicitly.

Any benefits of checking this explicitly?


https://gerrit.osmocom.org/#/c/11751/6/src/gsm/gsup.c@710
PS6, Line 710:  if ((u8 = gsup_msg->sm_alert_rsn)) {
> This check for non-zero means OSMO_GSUP_SMS_SM_ALERT_RSN_NONE won't ever be 
> sent. […]
Yes, correct. The current GSUP API in libosmocore is ugly, because
we have a single structure for all kinds of messages. This is why
we have to introduce such special values.



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic37f3b2114b8095cfce22977e67133b9103942e3
Gerrit-Change-Number: 11751
Gerrit-PatchSet: 6
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Fri, 14 Dec 2018 12:51:07 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in libosmocore[master]: GSUP/SMS: introduce READY-FOR-SM message

2018-12-14 Thread Stefan Sperling
Stefan Sperling has posted comments on this change. ( 
https://gerrit.osmocom.org/11751 )

Change subject: GSUP/SMS: introduce READY-FOR-SM message
..


Patch Set 6:

(1 comment)

https://gerrit.osmocom.org/#/c/11751/6/src/gsm/gsup.c
File src/gsm/gsup.c:

https://gerrit.osmocom.org/#/c/11751/6/src/gsm/gsup.c@710
PS6, Line 710:  if ((u8 = gsup_msg->sm_alert_rsn)) {
> This check for non-zero means OSMO_GSUP_SMS_SM_ALERT_RSN_NONE won't ever be 
> sent. […]
A follow-up suggestion:

If, as I expect, this is intended, then we could explicitly write this check 
like this:

 if ((u8 = gsup_msg->sm_alert_rsn) != OSMO_GSUP_SMS_SM_ALERT_RSN_NONE) {



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic37f3b2114b8095cfce22977e67133b9103942e3
Gerrit-Change-Number: 11751
Gerrit-PatchSet: 6
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Fri, 14 Dec 2018 12:36:44 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in libosmocore[master]: GSUP/SMS: introduce READY-FOR-SM message

2018-12-14 Thread Stefan Sperling
Stefan Sperling has posted comments on this change. ( 
https://gerrit.osmocom.org/11751 )

Change subject: GSUP/SMS: introduce READY-FOR-SM message
..


Patch Set 6: Code-Review+1

(1 comment)

https://gerrit.osmocom.org/#/c/11751/6/src/gsm/gsup.c
File src/gsm/gsup.c:

https://gerrit.osmocom.org/#/c/11751/6/src/gsm/gsup.c@710
PS6, Line 710:  if ((u8 = gsup_msg->sm_alert_rsn)) {
This check for non-zero means OSMO_GSUP_SMS_SM_ALERT_RSN_NONE won't ever be 
sent.
I assume this is intended, and ALERT_RSN_NONE is never part of a valid 
wire-protocol message?



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic37f3b2114b8095cfce22977e67133b9103942e3
Gerrit-Change-Number: 11751
Gerrit-PatchSet: 6
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Fri, 14 Dec 2018 12:32:51 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes


Change in libosmocore[master]: GSUP/SMS: introduce READY-FOR-SM message

2018-12-13 Thread Vadim Yanitskiy
Hello Stefan Sperling, Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/11751

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

Change subject: GSUP/SMS: introduce READY-FOR-SM message
..

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
---
M include/osmocom/gsm/gsup.h
M include/osmocom/gsm/gsup_sms.h
M src/gsm/gsup.c
M tests/gsup/gsup_test.c
M tests/gsup/gsup_test.err
M tests/gsup/gsup_test.ok
6 files changed, 46 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/51/11751/6
--
To view, visit https://gerrit.osmocom.org/11751
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ic37f3b2114b8095cfce22977e67133b9103942e3
Gerrit-Change-Number: 11751
Gerrit-PatchSet: 6
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Reviewer: Vadim Yanitskiy 


Change in libosmocore[master]: GSUP/SMS: introduce READY-FOR-SM message

2018-12-11 Thread Stefan Sperling
Stefan Sperling has posted comments on this change. ( 
https://gerrit.osmocom.org/11751 )

Change subject: GSUP/SMS: introduce READY-FOR-SM message
..


Patch Set 5: Code-Review+1


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic37f3b2114b8095cfce22977e67133b9103942e3
Gerrit-Change-Number: 11751
Gerrit-PatchSet: 5
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Tue, 11 Dec 2018 10:07:25 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in libosmocore[master]: GSUP/SMS: introduce READY-FOR-SM message

2018-12-10 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/11751 )

Change subject: GSUP/SMS: introduce READY-FOR-SM message
..


Patch Set 5: Code-Review+2


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic37f3b2114b8095cfce22977e67133b9103942e3
Gerrit-Change-Number: 11751
Gerrit-PatchSet: 5
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Mon, 10 Dec 2018 20:09:03 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in libosmocore[master]: GSUP/SMS: introduce READY-FOR-SM message

2018-12-02 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/11751 )

Change subject: GSUP/SMS: introduce READY-FOR-SM message
..


Set Ready For Review


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic37f3b2114b8095cfce22977e67133b9103942e3
Gerrit-Change-Number: 11751
Gerrit-PatchSet: 5
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Sun, 02 Dec 2018 22:21:29 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in libosmocore[master]: GSUP/SMS: introduce READY-FOR-SM message

2018-11-27 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/11751 )

Change subject: GSUP/SMS: introduce READY-FOR-SM message
..


Set Ready For Review


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic37f3b2114b8095cfce22977e67133b9103942e3
Gerrit-Change-Number: 11751
Gerrit-PatchSet: 3
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Comment-Date: Tue, 27 Nov 2018 09:25:10 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in libosmocore[master]: GSUP/SMS: introduce READY-FOR-SM message and IEs

2018-11-12 Thread Vadim Yanitskiy
Vadim Yanitskiy has uploaded this change for review. ( 
https://gerrit.osmocom.org/11751


Change subject: GSUP/SMS: introduce READY-FOR-SM message and IEs
..

GSUP/SMS: introduce READY-FOR-SM message and IEs

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' which is replicated as OSMO_GSUP_SM_AL_REAS_IE.

Change-Id: Ic37f3b2114b8095cfce22977e67133b9103942e3
---
M include/osmocom/gsm/gsup.h
M include/osmocom/gsm/gsup_sms.h
M src/gsm/gsup.c
M tests/gsup/gsup_test.c
M tests/gsup/gsup_test.err
M tests/gsup/gsup_test.ok
6 files changed, 46 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/51/11751/1

diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h
index c4d215a..d67ba07 100644
--- a/include/osmocom/gsm/gsup.h
+++ b/include/osmocom/gsm/gsup.h
@@ -95,6 +95,7 @@
OSMO_GSUP_SM_RP_DA_IE   = 0x41,
OSMO_GSUP_SM_RP_OA_IE   = 0x42,
OSMO_GSUP_SM_RP_UI_IE   = 0x43,
+   OSMO_GSUP_SM_AL_REAS_IE = 0x44,
 };

 /*! GSUP message type */
@@ -136,6 +137,10 @@
OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST= 0b00101000,
OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR  = 0b00101001,
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) & 0b0011) == 0b00)
@@ -244,6 +249,8 @@
/*! SM-RP-UI (see 3GPP TS 29.002, 7.6.8.4), SMS TPDU */
const uint8_t   *sm_rp_ui;
size_t  sm_rp_ui_len;
+   /*! Alert reason (see 3GPP TS 29.002, 7.6.8.8) */
+   enum osmo_gsup_sms_sm_al_reas_t sm_al_reas;
 };

 int osmo_gsup_decode(const uint8_t *data, size_t data_len,
diff --git a/include/osmocom/gsm/gsup_sms.h b/include/osmocom/gsm/gsup_sms.h
index 25f1e91..7c579ae 100644
--- a/include/osmocom/gsm/gsup_sms.h
+++ b/include/osmocom/gsm/gsup_sms.h
@@ -48,4 +48,11 @@
const uint8_t   *smsc_addr_enc;
 };

+/*! Alert reason values, see 7.6.8.8 */
+enum osmo_gsup_sms_sm_al_reas_t {
+   OSMO_GSUP_SMS_SM_AL_REAS_NONE   = 0x00,
+   OSMO_GSUP_SMS_SM_AL_REAS_MS_PRESENT = 0x01,
+   OSMO_GSUP_SMS_SM_AL_REAS_MEM_AVAIL  = 0x02,
+};
+
 /*! @} */
diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c
index 78b5e7b..64c2e4b 100644
--- a/src/gsm/gsup.c
+++ b/src/gsm/gsup.c
@@ -86,6 +86,10 @@
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_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 }
 };

@@ -474,6 +478,10 @@
gsup_msg->sm_rp_ui_len = value_len;
break;

+   case OSMO_GSUP_SM_AL_REAS_IE:
+   gsup_msg->sm_al_reas = *value;
+   break;
+
default:
LOGP(DLGSUP, LOGL_NOTICE,
 "GSUP IE type %d unknown\n", iei);
@@ -692,6 +700,11 @@
gsup_msg->sm_rp_ui_len, gsup_msg->sm_rp_ui);
}

+   if ((u8 = gsup_msg->sm_al_reas)) {
+   msgb_tlv_put(msg, OSMO_GSUP_SM_AL_REAS_IE,
+   sizeof(u8), );
+   }
+
return 0;
 }

diff --git a/tests/gsup/gsup_test.c b/tests/gsup/gsup_test.c
index 75ddfcb..2091f87 100644
--- a/tests/gsup/gsup_test.c
+++ b/tests/gsup/gsup_test.c
@@ -279,6 +279,15 @@
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 */
+   0x44, 0x01, /* Alert reason */
+   0x02, /* Memory Available (SMMA) */
+   };
+
static const struct test {
char *name;
const uint8_t *data;
@@ -324,6 +333,8 @@
send_mt_forward_sm_req, sizeof(send_mt_forward_sm_req)},
{"MO-/MT-ForwardSM (SMSC -> MSC) Response",
send_mo_mt_forward_sm_rsp, 
sizeof(send_mo_mt_forward_sm_rsp)},
+   {"ReadyForSM (MSC -> SMSC) Indication",
+   send_ready_for_sm_ind, sizeof(send_ready_for_sm_ind)},
};