From 9838c9070fb8147418e65348e71147a52f64320b Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Mon, 1 Apr 2019 22:24:33 +0200 Subject: GSUP: add Message Class IE osmo-msc and osmo-hlr have distinct subsystems handling incoming GSUP messages. So far we decide entirely by message type which code path should handle a GSUP message. Thus no GSUP message type may be re-used across subsystems. If we add a GSUP message to indicate a routing error, it would have to be a distinct message type for subscriber management, another one for SMS, another one for USSD... To allow introducing common message types, introduce a GSUP Message Class IE. In the presence of this IE, GSUP handlers can trivially direct a received message to the right code path. If it is missing, handlers can fall back to the previous switch(message_type) method. Change-Id: Ic397a9f2c4a7224e47cab944c72e75ca5592efef --- src/gsm/gsup.c | 18 ++++++++++++++++++ src/gsm/libosmogsm.map | 1 + 2 files changed, 19 insertions(+) (limited to 'src/gsm') diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c index a0893221..71dbbe18 100644 --- a/src/gsm/gsup.c +++ b/src/gsm/gsup.c @@ -477,6 +477,10 @@ int osmo_gsup_decode(const uint8_t *const_data, size_t data_len, gsup_msg->imei_result = osmo_decode_big_endian(value, value_len) + 1; break; + case OSMO_GSUP_MESSAGE_CLASS_IE: + gsup_msg->message_class = value[0]; + break; + default: LOGP(DLGSUP, LOGL_NOTICE, "GSUP IE type %d unknown\n", iei); @@ -718,7 +722,21 @@ int osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg) msgb_tlv_put(msg, OSMO_GSUP_IMEI_RESULT_IE, sizeof(u8), &u8); } + if (gsup_msg->message_class != OSMO_GSUP_MESSAGE_CLASS_UNSET) { + u8 = gsup_msg->message_class; + msgb_tlv_put(msg, OSMO_GSUP_MESSAGE_CLASS_IE, sizeof(u8), &u8); + } + return 0; } +const struct value_string osmo_gsup_message_class_names[] = { + { OSMO_GSUP_MESSAGE_CLASS_UNSET, "unset" }, + { OSMO_GSUP_MESSAGE_CLASS_SUBSCRIBER_MANAGEMENT, "Subscriber-Management" }, + { OSMO_GSUP_MESSAGE_CLASS_SMS, "SMS" }, + { OSMO_GSUP_MESSAGE_CLASS_USSD, "USSD" }, + { OSMO_GSUP_MESSAGE_CLASS_INTER_MSC, "Inter-MSC" }, + {} +}; + /*! @} */ diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index 56481fdd..47f3b450 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -586,6 +586,7 @@ osmo_gsup_encode; osmo_gsup_decode; osmo_gsup_message_type_names; osmo_gsup_session_state_names; +osmo_gsup_message_class_names; osmo_gsup_get_err_msg_type; osmo_gsup_sms_encode_sm_rp_da; -- cgit v1.2.3