aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gsm_04_80.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-07-26 18:34:27 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-07-26 18:34:27 +0800
commit15ef17e70efc60190ed01609e3f1230d20e062bc (patch)
tree0fc7b30a05cc52f5cd65d3c39e29ec466beb971b /openbsc/src/gsm_04_80.c
parent80dfa75df2541a04cbb74960f4fa07410ad443ef (diff)
gsm_04_80: Create a unstructuredSS-Notify message
Create a unstructuredSS-Notify for a given type.
Diffstat (limited to 'openbsc/src/gsm_04_80.c')
-rw-r--r--openbsc/src/gsm_04_80.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/openbsc/src/gsm_04_80.c b/openbsc/src/gsm_04_80.c
index 2d061e316..1eada9c9c 100644
--- a/openbsc/src/gsm_04_80.c
+++ b/openbsc/src/gsm_04_80.c
@@ -308,6 +308,41 @@ struct msgb *gsm0480_create_notifySS(const char *text)
return msg;
}
+struct msgb *gsm0480_create_unstructuredSS_Notify(const char *text)
+{
+ struct msgb *msg;
+ uint8_t *seq_len_ptr, *ussd_len_ptr, *data;
+ int len;
+
+ msg = gsm48_msgb_alloc();
+ if (!msg)
+ return NULL;
+
+ /* SEQUENCE { */
+ msgb_put_u8(msg, GSM_0480_SEQUENCE_TAG);
+ seq_len_ptr = msgb_put(msg, 1);
+
+ /* DCS { */
+ msgb_put_u8(msg, ASN1_OCTET_STRING_TAG);
+ msgb_put_u8(msg, 1);
+ msgb_put_u8(msg, 0x0F);
+ /* } DCS */
+
+ /* USSD-String { */
+ msgb_put_u8(msg, ASN1_OCTET_STRING_TAG);
+ ussd_len_ptr = msgb_put(msg, 1);
+ data = msgb_put(msg, 0);
+ len = gsm_7bit_encode(data, text);
+ msgb_put(msg, len);
+ ussd_len_ptr[0] = len;
+ /* USSD-String } */
+
+ seq_len_ptr[0] = 3 + 2 + ussd_len_ptr[0];
+ /* } SEQUENCE */
+
+ return msg;
+}
+
/* Send response to a mobile-originated ProcessUnstructuredSS-Request */
int gsm0480_send_ussd_response(struct gsm_subscriber_connection *conn,
const struct msgb *in_msg, const char *response_text,