diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-07-26 18:34:27 +0800 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-07-29 04:23:25 +0800 |
commit | 980891cdf435c558abebc962aaf36b4317cd8661 (patch) | |
tree | f7ea5bcebbff9f593892d188ae0398b4f8686242 | |
parent | c43a0ab8568a0b1bdb0d85e921750b66c761fba8 (diff) |
gsm_04_80: Create a unstructuredSS-Notify message
Create a unstructuredSS-Notify for a given type.
-rw-r--r-- | openbsc/include/openbsc/gsm_04_80.h | 1 | ||||
-rw-r--r-- | openbsc/src/gsm_04_80.c | 35 |
2 files changed, 36 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/gsm_04_80.h b/openbsc/include/openbsc/gsm_04_80.h index 2a272c670..4ec43123b 100644 --- a/openbsc/include/openbsc/gsm_04_80.h +++ b/openbsc/include/openbsc/gsm_04_80.h @@ -20,6 +20,7 @@ int gsm0480_send_ussd_reject(const struct msgb *msg, const struct ussd_request *request); struct msgb *gsm0480_create_notifySS(const char *text); +struct msgb *gsm0480_create_unstructuredSS_Notify(const char *text); int gsm0480_wrap_invoke(struct msgb *msg, int op, int link_id); #endif diff --git a/openbsc/src/gsm_04_80.c b/openbsc/src/gsm_04_80.c index a314d40ec..a6b67028f 100644 --- a/openbsc/src/gsm_04_80.c +++ b/openbsc/src/gsm_04_80.c @@ -307,6 +307,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(const struct msgb *in_msg, const char *response_text, const struct ussd_request *req) |