From ad97689b868f9678a06b24edc893f18a9b458878 Mon Sep 17 00:00:00 2001 From: Andrzej Zaborowski Date: Thu, 27 May 2010 06:59:45 +0200 Subject: [PATCH] test-stkutil: Add Provide Local Info response tests --- unit/test-stkutil.c | 555 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 555 insertions(+) diff --git a/unit/test-stkutil.c b/unit/test-stkutil.c index 35301f36..45f47d13 100644 --- a/unit/test-stkutil.c +++ b/unit/test-stkutil.c @@ -16204,6 +16204,509 @@ static const struct terminal_response_test polling_off_response_data_112 = { }, }; +static const unsigned char provide_local_info_response_111a[] = { + 0x81, 0x03, 0x01, 0x26, 0x00, 0x82, 0x02, 0x82, + 0x81, 0x83, 0x01, 0x00, 0x93, 0x07, 0x00, 0xf1, + 0x10, 0x00, 0x01, 0x00, 0x01, +}; + +static const struct terminal_response_test + provide_local_info_response_data_111a = { + .pdu = provide_local_info_response_111a, + .pdu_len = sizeof(provide_local_info_response_111a), + .response = { + .number = 1, + .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO, + .qualifier = 0x00, /* Location information (MCC MNC LAC CI) */ + .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL, + .dst = STK_DEVICE_IDENTITY_TYPE_UICC, + .result = { + .type = STK_RESULT_TYPE_SUCCESS, + }, + { .provide_local_info = { + { .location = { + .mcc = "001", + .mnc = "01", + .lac_tac = 0x0001, + .has_ci = TRUE, + .ci = 0x0001, + }}, + }}, + }, +}; + +static const unsigned char provide_local_info_response_111b[] = { + 0x81, 0x03, 0x01, 0x26, 0x00, 0x82, 0x02, 0x82, + 0x81, 0x83, 0x01, 0x00, 0x93, 0x07, 0x00, 0x11, + 0x10, 0x00, 0x01, 0x00, 0x01, +}; + +static const struct terminal_response_test + provide_local_info_response_data_111b = { + .pdu = provide_local_info_response_111b, + .pdu_len = sizeof(provide_local_info_response_111b), + .response = { + .number = 1, + .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO, + .qualifier = 0x00, /* Location information (MCC MNC LAC CI) */ + .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL, + .dst = STK_DEVICE_IDENTITY_TYPE_UICC, + .result = { + .type = STK_RESULT_TYPE_SUCCESS, + }, + { .provide_local_info = { + { .location = { + .mcc = "001", + .mnc = "011", + .lac_tac = 0x0001, + .has_ci = TRUE, + .ci = 0x0001, + }}, + }}, + }, +}; + +static const unsigned char provide_local_info_response_121[] = { + 0x81, 0x03, 0x01, 0x26, 0x01, 0x82, 0x02, 0x82, + 0x81, 0x83, 0x01, 0x00, 0x94, 0x08, 0x1a, 0x32, + 0x54, 0x76, 0x98, 0x10, 0x32, 0x54, /* Typo in TS 102 384? */ +}; + +static const struct terminal_response_test + provide_local_info_response_data_121 = { + .pdu = provide_local_info_response_121, + .pdu_len = sizeof(provide_local_info_response_121), + .response = { + .number = 1, + .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO, + .qualifier = 0x01, /* IMEI of the Terminal */ + .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL, + .dst = STK_DEVICE_IDENTITY_TYPE_UICC, + .result = { + .type = STK_RESULT_TYPE_SUCCESS, + }, + { .provide_local_info = { + { .imei = "123456789012345", } + }}, + }, +}; + +static const unsigned char provide_local_info_response_131[] = { + 0x81, 0x03, 0x01, 0x26, 0x02, 0x82, 0x02, 0x82, + 0x81, 0x83, 0x01, 0x00, 0x96, 0x10, 0x34, 0x34, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9d, 0x0d, + 0x8c, 0x63, 0x58, 0xe2, 0x39, 0x8f, 0x63, 0xf9, + 0x06, 0x45, 0x91, 0xa4, 0x90, +}; + +static const short bcch_channels_131[] = { +}; + +static const struct terminal_response_test + provide_local_info_response_data_131 = { + .pdu = provide_local_info_response_131, + .pdu_len = sizeof(provide_local_info_response_131), + .response = { + .number = 1, + .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO, + .qualifier = 0x02, /* Network Measurement Results */ + .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL, + .dst = STK_DEVICE_IDENTITY_TYPE_UICC, + .result = { + .type = STK_RESULT_TYPE_SUCCESS, + }, + { .provide_local_info = { + { .nmr = { + .nmr = { + /* RXLEV-FULL-SERVING-CELL=52, no BA, + * no DTX */ + .array = (unsigned char[16]) { + 0x34, 0x34, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + }, + .len = 16, + }, + .bcch_ch_list = { + .channels = (short[]) { + 561, 565, 568, 569, 573, + 575, 577, 581, 582, 585, + }, + .length = 10, + }, + }}, + }}, + }, +}; + +static const unsigned char provide_local_info_response_141[] = { + 0x81, 0x03, 0x01, 0x26, 0x03, 0x82, 0x02, 0x82, + 0x81, 0x83, 0x01, 0x00, 0xa6, 0x07, 0x20, 0x50, + 0x70, 0x41, 0x80, 0x71, 0xff, +}; + +static const struct terminal_response_test + provide_local_info_response_data_141 = { + .pdu = provide_local_info_response_141, + .pdu_len = sizeof(provide_local_info_response_141), + .response = { + .number = 1, + .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO, + .qualifier = 0x03, /* Date Time and Time Zone */ + .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL, + .dst = STK_DEVICE_IDENTITY_TYPE_UICC, + .result = { + .type = STK_RESULT_TYPE_SUCCESS, + }, + { .provide_local_info = { + { .datetime = { + .year = 2, /* 2002 - 1900 - 100 */ + .month = 5, + .day = 7, + .hour = 14, + .minute = 8, + .second = 17, + .timezone = 0xff, /* No information */ + }}, + }}, + }, +}; + +static const unsigned char provide_local_info_response_151[] = { + 0x81, 0x03, 0x01, 0x26, 0x04, 0x82, 0x02, 0x82, + 0x81, 0x83, 0x01, 0x00, 0xad, 0x02, 0x65, 0x6e, +}; + +static const struct terminal_response_test + provide_local_info_response_data_151 = { + .pdu = provide_local_info_response_151, + .pdu_len = sizeof(provide_local_info_response_151), + .response = { + .number = 1, + .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO, + .qualifier = 0x04, /* Language setting */ + .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL, + .dst = STK_DEVICE_IDENTITY_TYPE_UICC, + .result = { + .type = STK_RESULT_TYPE_SUCCESS, + }, + { .provide_local_info = { + { .language = "en", } + }}, + }, +}; + +static const unsigned char provide_local_info_response_161[] = { + 0x81, 0x03, 0x01, 0x26, 0x05, 0x82, 0x02, 0x82, + 0x81, 0x83, 0x01, 0x00, 0xae, 0x02, 0x00, 0x00, +}; + +static const struct terminal_response_test + provide_local_info_response_data_161 = { + .pdu = provide_local_info_response_161, + .pdu_len = sizeof(provide_local_info_response_161), + .response = { + .number = 1, + .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO, + .qualifier = 0x05, /* Timing Advance */ + .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL, + .dst = STK_DEVICE_IDENTITY_TYPE_UICC, + .result = { + .type = STK_RESULT_TYPE_SUCCESS, + }, + { .provide_local_info = { + { .tadv = { + .status = STK_TIMING_ADVANCE_ME_IDLE, + .advance = 0, + }}, + }}, + }, +}; + +static const unsigned char provide_local_info_response_171[] = { + 0x81, 0x03, 0x01, 0x26, 0x06, 0x82, 0x02, 0x82, + 0x81, 0x83, 0x01, 0x00, 0x3f, 0x01, 0x03, +}; + +static const struct terminal_response_test + provide_local_info_response_data_171 = { + .pdu = provide_local_info_response_171, + .pdu_len = sizeof(provide_local_info_response_171), + .response = { + .number = 1, + .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO, + .qualifier = 0x06, /* Access technology */ + .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL, + .dst = STK_DEVICE_IDENTITY_TYPE_UICC, + .result = { + .type = STK_RESULT_TYPE_SUCCESS, + }, + { .provide_local_info = { + { .access_technology = STK_ACCESS_TECHNOLOGY_UTRAN, } + }}, + }, +}; + +static const unsigned char provide_local_info_response_181[] = { + 0x81, 0x03, 0x01, 0x26, 0x07, 0x82, 0x02, 0x82, + 0x81, 0x83, 0x01, 0x00, 0xc6, 0x04, 0x01, 0x02, + 0x03, 0x04, +}; + +static const struct terminal_response_test + provide_local_info_response_data_181 = { + .pdu = provide_local_info_response_181, + .pdu_len = sizeof(provide_local_info_response_181), + .response = { + .number = 1, + .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO, + .qualifier = 0x07, /* ESN of the terminal */ + .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL, + .dst = STK_DEVICE_IDENTITY_TYPE_UICC, + .result = { + .type = STK_RESULT_TYPE_SUCCESS, + }, + { .provide_local_info = { + { .esn = 0x01020304, } + }}, + }, +}; + +static const unsigned char provide_local_info_response_191[] = { + 0x81, 0x03, 0x01, 0x26, 0x08, 0x82, 0x02, 0x82, + 0x81, 0x83, 0x01, 0x00, 0xe2, 0x09, 0x13, 0x32, + 0x54, 0x76, 0x98, 0x10, 0x32, 0x54, 0xf6, +}; + +static const struct terminal_response_test + provide_local_info_response_data_191 = { + .pdu = provide_local_info_response_191, + .pdu_len = sizeof(provide_local_info_response_191), + .response = { + .number = 1, + .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO, + .qualifier = 0x08, /* IMEISV of the terminal */ + .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL, + .dst = STK_DEVICE_IDENTITY_TYPE_UICC, + .result = { + .type = STK_RESULT_TYPE_SUCCESS, + }, + { .provide_local_info = { + { .imeisv = "1234567890123456", } + }}, + }, +}; + +static const unsigned char provide_local_info_response_1111[] = { + 0x81, 0x03, 0x01, 0x26, 0x0a, 0x82, 0x02, 0x82, + 0x81, 0x83, 0x01, 0x00, 0xe3, 0x01, 0x04, +}; + +static const struct terminal_response_test + provide_local_info_response_data_1111 = { + .pdu = provide_local_info_response_1111, + .pdu_len = sizeof(provide_local_info_response_1111), + .response = { + .number = 1, + .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO, + .qualifier = 0x0a, /* Charge state of the battery */ + .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL, + .dst = STK_DEVICE_IDENTITY_TYPE_UICC, + .result = { + .type = STK_RESULT_TYPE_SUCCESS, + }, + { .provide_local_info = { + { .battery_charge = STK_BATTERY_FULL, } + }}, + }, +}; + +static const unsigned char provide_local_info_response_1121[] = { + 0x81, 0x03, 0x01, 0x26, 0x02, 0x82, 0x02, 0x82, + 0x81, 0x83, 0x01, 0x00, 0x96, 0x02, 0x80, 0x00, + /* Intra-frequency UTRAN Measurement report in ASN.1 goes here */ + /* "The remaining bytes shall not be verified" */ +}; + +static const struct terminal_response_test + provide_local_info_response_data_1121 = { + .pdu = provide_local_info_response_1121, + .pdu_len = sizeof(provide_local_info_response_1121), + .response = { + .number = 1, + .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO, + .qualifier = 0x02, /* Network Measurement Results */ + .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL, + .dst = STK_DEVICE_IDENTITY_TYPE_UICC, + .result = { + .type = STK_RESULT_TYPE_SUCCESS, + }, + { .provide_local_info = { + { .nmr = { + .nmr = { + .array = (unsigned char[2]) + { 0x80, 0x00 }, + .len = 2, + }, + }}, + }}, + }, +}; + +static const unsigned char provide_local_info_response_1131[] = { + 0x81, 0x03, 0x01, 0x26, 0x02, 0x82, 0x02, 0x82, + 0x81, 0x83, 0x01, 0x00, 0x96, 0x02, 0x80, 0x11, + /* Inter-frequency UTRAN Measurement report in ASN.1 goes here */ + /* "The remaining bytes shall not be verified" */ +}; + +static const struct terminal_response_test + provide_local_info_response_data_1131 = { + .pdu = provide_local_info_response_1131, + .pdu_len = sizeof(provide_local_info_response_1131), + .response = { + .number = 1, + .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO, + .qualifier = 0x02, /* Network Measurement Results */ + .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL, + .dst = STK_DEVICE_IDENTITY_TYPE_UICC, + .result = { + .type = STK_RESULT_TYPE_SUCCESS, + }, + { .provide_local_info = { + { .nmr = { + .nmr = { + .array = (unsigned char[2]) + { 0x80, 0x11}, + .len = 2, + }, + }}, + }}, + }, +}; + +static const unsigned char provide_local_info_response_1141[] = { + 0x81, 0x03, 0x01, 0x26, 0x06, 0x82, 0x02, 0x82, + 0x81, 0x83, 0x01, 0x00, 0x3f, 0x01, 0x08, +}; + +static const struct terminal_response_test + provide_local_info_response_data_1141 = { + .pdu = provide_local_info_response_1141, + .pdu_len = sizeof(provide_local_info_response_1141), + .response = { + .number = 1, + .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO, + .qualifier = 0x06, /* Access technology */ + .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL, + .dst = STK_DEVICE_IDENTITY_TYPE_UICC, + .result = { + .type = STK_RESULT_TYPE_SUCCESS, + }, + { .provide_local_info = { + { .access_technology = STK_ACCESS_TECHNOLOGY_EUTRAN, } + }}, + }, +}; + +static const unsigned char provide_local_info_response_1151[] = { + 0x81, 0x03, 0x01, 0x26, 0x02, 0x82, 0x02, 0x82, + 0x81, 0x83, 0x01, 0x00, 0x96, 0x02, 0x80, 0x00, + /* Intra-frequency E-UTRAN Measurement report in ASN.1 goes here */ + /* "The remaining bytes shall not be verified" */ +}; + +static const struct terminal_response_test + provide_local_info_response_data_1151 = { + .pdu = provide_local_info_response_1151, + .pdu_len = sizeof(provide_local_info_response_1151), + .response = { + .number = 1, + .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO, + .qualifier = 0x02, /* Network Measurement Results */ + .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL, + .dst = STK_DEVICE_IDENTITY_TYPE_UICC, + .result = { + .type = STK_RESULT_TYPE_SUCCESS, + }, + { .provide_local_info = { + { .nmr = { + .nmr = { + .array = (unsigned char[2]) + { 0x80, 0x00}, + .len = 2, + }, + }}, + }}, + }, +}; + +static const unsigned char provide_local_info_response_1161[] = { + 0x81, 0x03, 0x01, 0x26, 0x02, 0x82, 0x02, 0x82, + 0x81, 0x83, 0x01, 0x00, 0x96, 0x02, 0x80, 0x11, + /* Inter-frequency E-UTRAN Measurement report in ASN.1 goes here */ + /* "The remaining bytes shall not be verified" */ +}; + +static const struct terminal_response_test + provide_local_info_response_data_1161 = { + .pdu = provide_local_info_response_1161, + .pdu_len = sizeof(provide_local_info_response_1161), + .response = { + .number = 1, + .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO, + .qualifier = 0x02, /* Network Measurement Results */ + .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL, + .dst = STK_DEVICE_IDENTITY_TYPE_UICC, + .result = { + .type = STK_RESULT_TYPE_SUCCESS, + }, + { .provide_local_info = { + { .nmr = { + .nmr = { + .array = (unsigned char[2]) + { 0x80, 0x11}, + .len = 2, + }, + }}, + }}, + }, +}; + +static const unsigned char provide_local_info_response_1171[] = { + 0x81, 0x03, 0x01, 0x26, 0x00, 0x82, 0x02, 0x82, + 0x81, 0x83, 0x01, 0x00, 0x93, 0x09, 0x00, 0xf1, + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1f, + /* Typo in TS 102 223? Byte 18 changed to 01 here */ +}; + +static const struct terminal_response_test + provide_local_info_response_data_1171 = { + .pdu = provide_local_info_response_1171, + .pdu_len = sizeof(provide_local_info_response_1171), + .response = { + .number = 1, + .type = STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO, + .qualifier = 0x00, /* Location information (MCC MNC LAC CI) */ + .src = STK_DEVICE_IDENTITY_TYPE_TERMINAL, + .dst = STK_DEVICE_IDENTITY_TYPE_UICC, + .result = { + .type = STK_RESULT_TYPE_SUCCESS, + }, + { .provide_local_info = { + { .location = { + .mcc = "001", + .mnc = "01", + .lac_tac = 0x0001, + .has_eutran_ci = TRUE, + .eutran_ci = 0x0000001, + }}, + }}, + }, +}; + int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); @@ -17244,6 +17747,58 @@ int main(int argc, char **argv) g_test_add_data_func("/teststk/Provide Local Info 1.11.1", &provide_local_info_data_1111, test_provide_local_info); + g_test_add_data_func("/teststk/Provide Local Info response 1.1.1A", + &provide_local_info_response_data_111a, + test_terminal_response_encoding); + g_test_add_data_func("/teststk/Provide Local Info response 1.1.1B", + &provide_local_info_response_data_111b, + test_terminal_response_encoding); + g_test_add_data_func("/teststk/Provide Local Info response 1.2.1", + &provide_local_info_response_data_121, + test_terminal_response_encoding); + g_test_add_data_func("/teststk/Provide Local Info response 1.3.1", + &provide_local_info_response_data_131, + test_terminal_response_encoding); + g_test_add_data_func("/teststk/Provide Local Info response 1.4.1", + &provide_local_info_response_data_141, + test_terminal_response_encoding); + g_test_add_data_func("/teststk/Provide Local Info response 1.5.1", + &provide_local_info_response_data_151, + test_terminal_response_encoding); + g_test_add_data_func("/teststk/Provide Local Info response 1.6.1", + &provide_local_info_response_data_161, + test_terminal_response_encoding); + g_test_add_data_func("/teststk/Provide Local Info response 1.7.1", + &provide_local_info_response_data_171, + test_terminal_response_encoding); + g_test_add_data_func("/teststk/Provide Local Info response 1.8.1", + &provide_local_info_response_data_181, + test_terminal_response_encoding); + g_test_add_data_func("/teststk/Provide Local Info response 1.9.1", + &provide_local_info_response_data_191, + test_terminal_response_encoding); + g_test_add_data_func("/teststk/Provide Local Info response 1.11.1", + &provide_local_info_response_data_1111, + test_terminal_response_encoding); + g_test_add_data_func("/teststk/Provide Local Info response 1.12.1", + &provide_local_info_response_data_1121, + test_terminal_response_encoding); + g_test_add_data_func("/teststk/Provide Local Info response 1.13.1", + &provide_local_info_response_data_1131, + test_terminal_response_encoding); + g_test_add_data_func("/teststk/Provide Local Info response 1.14.1", + &provide_local_info_response_data_1141, + test_terminal_response_encoding); + g_test_add_data_func("/teststk/Provide Local Info response 1.15.1", + &provide_local_info_response_data_1151, + test_terminal_response_encoding); + g_test_add_data_func("/teststk/Provide Local Info response 1.16.1", + &provide_local_info_response_data_1161, + test_terminal_response_encoding); + g_test_add_data_func("/teststk/Provide Local Info response 1.17.1", + &provide_local_info_response_data_1171, + test_terminal_response_encoding); + g_test_add_data_func("/teststk/Setup Event List 1.1.1", &setup_event_list_data_111, test_setup_event_list); g_test_add_data_func("/teststk/Setup Event List 1.2.1",