aboutsummaryrefslogtreecommitdiffstats
path: root/tests/ussd/ussd_test.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-07-12 17:45:34 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-07-12 17:45:34 +0200
commit4a62dbbfa9260cd0c079f043b57f9adaedfad38e (patch)
tree77b2c7b1f90f329a96104a56b696b75b3dbd2759 /tests/ussd/ussd_test.c
parent9394dbd8e0ea010e8ee7af7729a27d6a68ff8256 (diff)
ussd: Decode interrogateSS that doesn't have test
Keith of Rhizomatica has an issue of a unrejected interrogateSS. Start with just decoding the message and printing the empty test and the code. What is kind of missing is the classification between invoke, returnResult and returnResultLast that we need to add in the long run. Change-Id: Iadfa156707a96f2a34f3948c7cc9a74435f17114
Diffstat (limited to 'tests/ussd/ussd_test.c')
-rw-r--r--tests/ussd/ussd_test.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ussd/ussd_test.c b/tests/ussd/ussd_test.c
index f798e37c..40b4317a 100644
--- a/tests/ussd/ussd_test.c
+++ b/tests/ussd/ussd_test.c
@@ -34,6 +34,12 @@ static const uint8_t ussd_request[] = {
0x01, 0x7f, 0x01, 0x00
};
+static const uint8_t interrogate_ss[] = {
+ 0x0b, 0x7b, 0x1c, 0x0d, 0xa1, 0x0b, 0x02, 0x01,
+ 0x03, 0x02, 0x01, 0x0e, 0x30, 0x03, 0x04, 0x01,
+ 0x21, 0x7f, 0x01, 0x00
+};
+
static int parse_ussd(const uint8_t *_data, int len)
{
uint8_t *data;
@@ -120,9 +126,15 @@ int main(int argc, char **argv)
osmo_init_logging(&info);
+ memset(&req, 0, sizeof(req));
gsm0480_decode_ss_request((struct gsm48_hdr *) ussd_request, size, &req);
printf("Tested if it still works. Text was: %s\n", req.ussd_text);
+ memset(&req, 0, sizeof(req));
+ gsm0480_decode_ss_request((struct gsm48_hdr *) interrogate_ss, size, &req);
+ OSMO_ASSERT(strlen((char *) req.ussd_text) == 0);
+ OSMO_ASSERT(req.ss_code == 33);
+ printf("interrogateSS CFU text..'%s' code %d\n", req.ussd_text, req.ss_code);
printf("Testing parsing a USSD request and truncated versions\n");