Vadim Yanitskiy has uploaded this change for review. (
https://gerrit.osmocom.org/11069
Change subject: GSUP/SM: (WIP) introduce MO/MT FORWARD_SM messages
..
GSUP/SM: (WIP) introduce MO/MT FORWARD_SM messages
According to 3GPP TS 29.002, sections 12.2 and 12.9 the FORWARD_SM
messages (a.k.a MAP-*-FORWARD-SHORT-MESSAGE) are used to forward
MO/MT SMS messages.
Please note that only the 'must-have' fields of of both message
types are introduced by this change, in particular:
- OSMO_GSUP_MSGT_{MO|MT}_FORWARD_SM_REQUEST (MAP Request)
- OSMO_GSUP_SM_RP_DA_IE
- OSMO_GSUP_SM_RP_OA_IE
- OSMO_GSUP_SM_RP_UI_IE
- OSMO_GSUP_MSGT_{MO|MT}_FORWARD_SM_RESULT (MAP ACK)
- OSMO_GSUP_SM_RP_UI_IE
- OSMO_GSUP_MSGT_{MO|MT}_FORWARD_SM_ERROR (MAP Response)
- GSUP_CAUSE_IE (MAP User Error, see 7.6.1)
Since there is no TCAP layer in GSUP, the context is emulated
using the session management IEs (see GSUP_SESSION_*_IE).
Change-Id: Ibe325c64ae2d6c626b232533bb4cbc65fc2b5d71
---
M include/osmocom/gsm/gsup.h
M src/gsm/gsup.c
M tests/gsup/gsup_test.err
3 files changed, 96 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/69/11069/1
diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h
index bed61ae..3f9a3f9 100644
--- a/include/osmocom/gsm/gsup.h
+++ b/include/osmocom/gsm/gsup.h
@@ -93,6 +93,9 @@
OSMO_GSUP_SMSC_ADDR_IE = 0x40,
OSMO_GSUP_NODE_ADDR_IE = 0x41,
OSMO_GSUP_SM_RP_RPI_IE = 0x42,
+ OSMO_GSUP_SM_RP_DA_IE = 0x43,
+ OSMO_GSUP_SM_RP_OA_IE = 0x44,
+ OSMO_GSUP_SM_RP_UI_IE = 0x45,
};
/*! GSUP message type */
@@ -131,6 +134,14 @@
OSMO_GSUP_MSGT_SRI_FOR_SM_REQUEST = 0b00100100,
OSMO_GSUP_MSGT_SRI_FOR_SM_ERROR = 0b00100101,
OSMO_GSUP_MSGT_SRI_FOR_SM_RESULT= 0b00100110,
+
+ OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST= 0b00101000,
+ OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR = 0b00101001,
+ OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT = 0b00101010,
+
+ OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST= 0b0011,
+ OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR = 0b00110001,
+ OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT = 0b00110010,
};
#define OSMO_GSUP_IS_MSGT_REQUEST(msgt) (((msgt) & 0b0011) == 0b00)
@@ -231,6 +242,25 @@
size_t node_addr_len;
/*! HACK: SM-RP-RPI is (<0 / 0 / >0) => (false / omited / true) */
int sm_rp_rpi;
+
+ /*! SM Destination Address, see 7.6.8.1. It can be of the following:
+** IMSI, LMSI, MSISDN, roaming number, or service centre address.
+** The values from 'osmo_gsup_iei' enum are used for 'sm_rp_da_type'.
+** NOTE: LMSI, roaming number are not implemented */
+ const uint8_t *sm_rp_da;
+ uint8_t sm_rp_da_type;
+ size_t sm_rp_da_len;
+
+ /*! SM Originating Address, see 7.6.8.2. It can be of the following:
+** MSISDN or service centre address. ** The values from 'osmo_gsup_iei'
+** enum are used for 'sm_rp_da_type'. */
+ const uint8_t *sm_rp_oa;
+ uint8_t sm_rp_oa_type;
+ size_t sm_rp_oa_len;
+
+ /*! SM TPDU (Transport Protocol Data Unit), see 7.6.8.4 */
+ const uint8_t *sm_rp_ui;
+ size_t sm_rp_ui_len;
};
int osmo_gsup_decode(const uint8_t *data, size_t data_len,
diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c
index 22e26f1..752cfca 100644
--- a/src/gsm/gsup.c
+++ b/src/gsm/gsup.c
@@ -71,6 +71,14 @@
OSMO_VALUE_STRING(OSMO_GSUP_MSGT_SRI_FOR_SM_ERROR),
OSMO_VALUE_STRING(OSMO_GSUP_MSGT_SRI_FOR_SM_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 }
};
@@ -452,6 +460,37 @@
gsup_msg->sm_rp_rpi = (*value) ? 1 : -1;
break;
+ case OSMO_GSUP_SM_RP_DA_IE:
+ /* First octet contains type of address */
+ if (value_len < 1) {
+ LOGP(DLGSUP, LOGL_ERROR, "Short read of "
+ "SM_RP_DA_IE (missing address type)\n");
+ return -GMM_CAUSE_COND_IE_ERR;
+ }
+
+ gsup_msg->sm_rp_da = value + 1; /*