From 72696040dfac41512c672f71f2b3712656641a7f Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Sat, 7 Apr 2018 02:34:55 +0700 Subject: GSUP: implement TCAP-like session management Unlike TCAP/MAP, GSUP is just a transport layer without the dialogue/context. This prevents us from having session based communication, required e.g. for USSD. But we can emulate TCAP dialogue by adding additional IEs, which would allow to relate each message to a particular session. This change introduces the following IEs: - OSMO_GSUP_SESSION_ID_IE, - OSMO_GSUP_SESSION_STATE_IE, which optionally can be used to indicate that the message is related to a session with given ID, and to manage session state, i.e. initiate, continue, and finish. Change-Id: I1cee271fed0284a134ffed103c0d4bebbcfde2a8 Related: OS#1597 --- src/gsm/gsup.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c index b6ac56d9..8663f449 100644 --- a/src/gsm/gsup.c +++ b/src/gsm/gsup.c @@ -385,6 +385,14 @@ int osmo_gsup_decode(const uint8_t *const_data, size_t data_len, gsup_msg->pdp_charg_enc_len = value_len; break; + case OSMO_GSUP_SESSION_ID_IE: + gsup_msg->session_id = osmo_decode_big_endian(value, value_len); + break; + + case OSMO_GSUP_SESSION_STATE_IE: + gsup_msg->session_state = *value; + break; + default: LOGP(DLGSUP, LOGL_NOTICE, "GSUP IE type %d unknown\n", iei); @@ -564,6 +572,14 @@ int osmo_gsup_encode(struct msgb *msg, const struct osmo_gsup_message *gsup_msg) gsup_msg->pdp_charg_enc_len, gsup_msg->pdp_charg_enc); } + if ((u8 = gsup_msg->session_state)) { + size_t len = sizeof(gsup_msg->session_id); + uint8_t *sid = osmo_encode_big_endian(gsup_msg->session_id, len); + + msgb_tlv_put(msg, OSMO_GSUP_SESSION_ID_IE, len, sid); + msgb_tlv_put(msg, OSMO_GSUP_SESSION_STATE_IE, sizeof(u8), &u8); + } + return 0; } -- cgit v1.2.3