stk: Make parse_dataobj not consume extra data
PATCH 1/8 stk: Make parse_dataobj not consume extra data
--- src/stkutil.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
src/stkutil.c +7 -0
@@ -2023,6 +2023,7 @@ static gboolean parse_dataobj(struct comprehension_tlv_iter *iter,GSList *l;va_list args;gboolean minimum_set = TRUE; +struct comprehension_tlv_iter iter_old;va_start (args, type);
@@ -2056,11 +2057,14 @@ static gboolean parse_dataobj(struct comprehension_tlv_iter *iter,if (handler (iter, entry->data)) entry->parsed = TRUE; +comprehension_tlv_iter_copy (iter, &iter_old); +if (comprehension_tlv_iter_next (iter) == FALSE)break ; } } +comprehension_tlv_iter_copy (&iter_old, iter); out:for (l = entries; l; l = l->next) {struct dataobj_handler_entry *entry = l->data;
@@ -2293,6 +2297,9 @@ static GSList *parse_item_list(struct comprehension_tlv_iter *iter)struct stk_item item;GSList *list =NULL ; +if (comprehension_tlv_iter_next (iter) != TRUE) +return NULL ; +if (comprehension_tlv_iter_get_tag (iter) != tag)return NULL ;
Signature · 1 line
1.7.0.4
PATCH 2/8 stk: Add parser for launch browser commands
--- src/stkutil.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/stkutil.h | 16 +++++++++ 2 files changed, 119 insertions(+), 0 deletions(-)
src/stkutil.c +103 -0
@@ -2865,6 +2865,106 @@ static gboolean parse_language_notification(struct stk_command *command,return TRUE; } +static void destroy_launch_browser (struct stk_command *command) +{ +g_free (command->launch_browser.url); +g_free (command->launch_browser.bearer.array); +g_slist_foreach (command->launch_browser.prov_file_refs, + (GFunc )g_free,NULL ); +g_slist_free (command->launch_browser.prov_file_refs); +g_free (command->launch_browser.text_gateway_proxy_id); +g_free (command->launch_browser.alpha_id); +g_free (command->launch_browser.network_name.array); +g_free (command->launch_browser.text_usr); +g_free (command->launch_browser.text_passwd); +} + +static GSList *parse_provisioining_file_reference_list ( +struct comprehension_tlv_iter *iter) +{ +unsigned short tag =STK_DATA_OBJECT_TYPE_PROVISIONING_FILE_REFERENCE ; +struct comprehension_tlv_iter iter_old; +struct stk_file file; +GSList *list =NULL ; + +if (comprehension_tlv_iter_get_tag (iter) != tag) +return NULL ; + +do { +comprehension_tlv_iter_copy (iter, &iter_old); +memset (&file,0 ,sizeof (file)); + +if (parse_dataobj_provisioning_file_reference (iter, &file) + == TRUE) + list =g_slist_prepend (list, +g_memdup (&file,sizeof (file))); + }while (comprehension_tlv_iter_next (iter) == TRUE && +comprehension_tlv_iter_get_tag (iter) == tag); + +comprehension_tlv_iter_copy (&iter_old, iter); + list =g_slist_reverse (list); + +return list; +} + +static gboolean parse_launch_browser (struct stk_command *command, +struct comprehension_tlv_iter *iter) +{ +struct stk_command_launch_browser *obj = &command->launch_browser; +gboolean ret; + +if (command->src !=STK_DEVICE_IDENTITY_TYPE_UICC ) +return FALSE; + +if (command->dst !=STK_DEVICE_IDENTITY_TYPE_TERMINAL ) +return FALSE; + + ret =parse_dataobj (iter, +STK_DATA_OBJECT_TYPE_BROWSER_ID ,0 , + &obj->browser_id, +STK_DATA_OBJECT_TYPE_URL , +DATAOBJ_FLAG_MANDATORY |DATAOBJ_FLAG_MINIMUM , + &obj->url, +STK_DATA_OBJECT_TYPE_BEARER ,0 , + &obj->bearer, +STK_DATA_OBJECT_TYPE_INVALID ); + +if (ret == FALSE) + goto error; + + obj->prov_file_refs =parse_provisioining_file_reference_list (iter); + + ret =parse_dataobj (iter, +STK_DATA_OBJECT_TYPE_TEXT ,0 , + &obj->text_gateway_proxy_id, +STK_DATA_OBJECT_TYPE_ALPHA_ID ,0 , + &obj->alpha_id, +STK_DATA_OBJECT_TYPE_ICON_ID ,0 , + &obj->icon_id, +STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE ,0 , + &obj->text_attr, +STK_DATA_OBJECT_TYPE_FRAME_ID ,0 , + &obj->frame_id, +STK_DATA_OBJECT_TYPE_NETWORK_ACCESS_NAME ,0 , + &obj->network_name, +STK_DATA_OBJECT_TYPE_TEXT ,0 , + &obj->text_usr, +STK_DATA_OBJECT_TYPE_TEXT ,0 , + &obj->text_passwd, +STK_DATA_OBJECT_TYPE_INVALID ); + +if (ret == FALSE) +return FALSE; + + command->destructor = destroy_launch_browser; + +return TRUE; + +error: +destroy_launch_browser (command); +return FALSE; +} +struct stk_command *stk_command_new_from_pdu (const unsigned char *pdu,unsigned int len) {
@@ -2992,6 +3092,9 @@ struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu,case STK_COMMAND_TYPE_LANGUAGE_NOTIFICATION : ok =parse_language_notification (command, &iter);break ; +case STK_COMMAND_TYPE_LAUNCH_BROWSER : + ok =parse_launch_browser (command, &iter); +break ;default : ok = FALSE;break ;
src/stkutil.h +16 -0
@@ -992,6 +992,21 @@ struct stk_command_language_notification {char language[3 ]; }; +struct stk_command_launch_browser { +unsigned char browser_id; +char *url; +struct stk_common_byte_array bearer; +GSList *prov_file_refs; +char *text_gateway_proxy_id; +char *alpha_id; +struct stk_icon_id icon_id; +struct stk_text_attribute text_attr; +struct stk_frame_id frame_id; +struct stk_common_byte_array network_name; +char *text_usr; +char *text_passwd; +}; +struct stk_command {unsigned char number;unsigned char type;
@@ -1017,6 +1032,7 @@ struct stk_command {struct stk_command_run_at_command run_at_command;struct stk_command_send_dtmf send_dtmf;struct stk_command_language_notification language_notification; +struct stk_command_launch_browser launch_browser; };void (*destructor)(struct stk_command *command);
Signature · 1 line
1.7.0.4
PATCH 3/8 teststk: Add check of len in byte array
In reply to Yang Gu--- unit/test-stkutil.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
unit/test-stkutil.c +1 -0
@@ -82,6 +82,7 @@ static inline void check_common_byte_array( }g_assert (command->len !=0 ); +g_assert (command->len == test->len);g_assert (g_mem_equal (command->array, test->array, test->len)); }
Signature · 1 line
1.7.0.4
PATCH 4/8 teststk: Use check_common_text() to check string
In reply to Yang Gu--- unit/test-stkutil.c | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-)
unit/test-stkutil.c +4 -8
@@ -91,7 +91,7 @@ static inline void check_address(const struct stk_address *command, const struct stk_address *test) {g_assert (command->ton_npi == test->ton_npi); -g_assert (g_str_equal (command->number, test->number)); +check_common_text (command->number, test->number); }/* Defined in TS 102.223 Section 8.2 */
@@ -139,11 +139,7 @@ static void check_item(const struct stk_item *command, const struct stk_item *test) {g_assert (command->id == test->id); - -if (command->text ==NULL ) -g_assert (test->text ==NULL ); -else -g_assert (g_str_equal (command->text, test->text)); +check_common_text (command->text, test->text); }/* Defined in TS 102.223 Section 8.10 */
@@ -181,8 +177,8 @@ static void check_gsm_sms_tpdu(const struct sms *command, {g_assert (command->submit.mr == test->submit.mr);g_assert (command->submit.udl == test->submit.udl); -g_assert (g_str_equal (command->submit.daddr.address, - test->submit.daddr.address)); +check_common_text (command->submit.daddr.address, + test->submit.daddr.address);g_assert (g_mem_equal (command->submit.ud, test->submit.ud, test->submit.udl)); }
Signature · 1 line
1.7.0.4
PATCH 5/8 stk: Fix the parser of send sms
In reply to Yang Gu--- src/stkutil.c | 52 +++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 43 insertions(+), 9 deletions(-)
src/stkutil.c +43 -9
@@ -61,11 +61,15 @@ typedef gboolean (*dataobj_writer)(struct stk_tlv_builder *,/* * Defined in TS 102.223 Section 8.13 -* GSM SMS PDUs are limited to 164 bytes according to 23.040 +* The type of gsm sms can be SMS-COMMAND AND SMS-SUBMIT. According to 23.040, +* the maximum length is 164 bytes. But for SMS-SUBMIT, sms may be packed by +* ME. Thus the maximum length of messsage could be 160 bytes, instead of 140 +* bytes. So the total maximum length could be 184 bytes. Refer TS 31.111, +* section 6.4.10 for details. */ struct gsm_sms_tpdu {unsigned int len; -unsigned char tpdu[164 ]; +unsigned char tpdu[184 ]; };static char *decode_text (unsigned char dcs,int len,const unsigned char *data)
@@ -2453,6 +2457,7 @@ static gboolean parse_send_sms(struct stk_command *command,if (command->dst !=STK_DEVICE_IDENTITY_TYPE_NETWORK )return FALSE; +memset (&gsm_tpdu,0 ,sizeof (gsm_tpdu)); ret = parse_dataobj(iter, STK_DATA_OBJECT_TYPE_ALPHA_ID, 0, &obj->alpha_id, STK_DATA_OBJECT_TYPE_ADDRESS, 0,
@@ -2469,20 +2474,49 @@ static gboolean parse_send_sms(struct stk_command *command, &obj->frame_id, STK_DATA_OBJECT_TYPE_INVALID); + command->destructor = destroy_send_sms; +if (ret == FALSE)return FALSE; - command->destructor = destroy_send_sms; +if (gsm_tpdu.len ==0 && obj->cdma_sms.len ==0 ) +return FALSE; + +if (gsm_tpdu.len >0 && obj->cdma_sms.len >0 ) +return FALSE;if (gsm_tpdu.len >0 ) {if (sms_decode (gsm_tpdu.tpdu, gsm_tpdu.len, TRUE, gsm_tpdu.len, - &obj->gsm_sms) == FALSE) { - command->destructor (command); -return FALSE; + &obj->gsm_sms) == FALSE) { +/* packing by ME must be not required */ +if ((command->qualifier &0x01 ) ==0 ) +return FALSE; + +if (obj->gsm_sms.type !=SMS_TYPE_SUBMIT ) +return FALSE; + +if (obj->gsm_sms.submit.udl ==0 ) +return FALSE; + } + +/* packing is needed */ +if (command->qualifier &0x01 ) { +unsigned char *packed; +long packed_size; +unsigned char *in; +struct sms_submit *s = &obj->gsm_sms.submit; + +if (obj->gsm_sms.type !=SMS_TYPE_SUBMIT ) +return FALSE; + +/* Set dcs to default alphabet */ + s->dcs =0xF0 ; + + in = gsm_tpdu.tpdu + gsm_tpdu.len - s->udl; + packed =pack_7bit (in, s->udl,0 , + FALSE, &packed_size,0 ); +memcpy (s->ud, packed, packed_size); } - }else if (obj->cdma_sms.len ==0 ) { - command->destructor (command); -return FALSE; }return TRUE;
Signature · 1 line
1.7.0.4
PATCH 6/8 teststk: Add cases for send sms parser
In reply to Yang Gu--- src/smsutil.c | 3 + unit/test-stkutil.c | 1767 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 1748 insertions(+), 22 deletions(-)
src/smsutil.c +3 -0
@@ -1276,6 +1276,9 @@ static gboolean decode_submit(const unsigned char *pdu, int len,if ((len - offset) < expected)return FALSE; +if (expected > (int )sizeof (out->submit.ud)) +return FALSE; +memcpy (out->submit.ud, pdu+offset, expected);return TRUE;
unit/test-stkutil.c +1745 -22
1,820 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 7/8 teststk: Add test for launch browser parser
In reply to Yang Gu--- unit/test-stkutil.c | 790 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 790 insertions(+), 0 deletions(-)
unit/test-stkutil.c +790 -0
@@ -397,6 +397,49 @@ static inline void check_language(const char *command, const char *test)check_common_text (command, test); } +/* Defined in TS 102.223 Section 8.47 */ +static inline void check_browser_id (const unsigned char command, +const unsigned char test) +{ +check_common_byte (command, test); +} + +/* Defined in TS 102.223 Section 8.48 */ +static inline void check_url (const char *command,const char *test) +{ +check_common_text (command, test); +} + +/* Defined in TS 102.223 Section 8.49 */ +static inline void check_bearer (const struct stk_common_byte_array *command, +const struct stk_common_byte_array *test) +{ +check_common_byte_array (command, test); +} + +/* Defined in TS 102.223 Section 8.50 */ +static void check_provisioning_file_reference (const struct stk_file *command, +const struct stk_file *test) +{ +g_assert (command->len == test->len); +g_assert (g_mem_equal (command->file, test->file, test->len)); +} + +static void check_provisioning_file_references (GSList *command, +const struct stk_file *test) +{ +struct stk_file *sf; +GSList *l; +unsigned int i =0 ; + +for (l = command; l; l = l->next) { + sf = l->data; +check_provisioning_file_reference (sf, &test[i++]); + } + +g_assert (test[i].len ==0 ); +} +/* Defined in TS 102.223 Section 8.60 */ static inline void check_aid (const struct stk_aid *command,const struct stk_aid *test)
@@ -13835,6 +13878,676 @@ static void test_language_notification(gconstpointer data)stk_command_free (command); } +struct launch_browser_test { +const unsigned char *pdu; +unsigned int pdu_len; +unsigned char qualifier; +unsigned char browser_id; +char *url; +struct stk_common_byte_array bearer; +struct stk_file prov_file_refs[MAX_ITEM ]; +char *text_gateway_proxy_id; +char *alpha_id; +struct stk_icon_id icon_id; +struct stk_text_attribute text_attr; +struct stk_frame_id frame_id; +struct stk_common_byte_array network_name; +char *text_usr; +char *text_passwd; +}; + +static unsigned char launch_browser_111[] = {0xD0 ,0x18 ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0B , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C }; + +static unsigned char launch_browser_121[] = {0xD0 ,0x1F ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x12 ,0x68 ,0x74 , +0x74 ,0x70 ,0x3A ,0x2F ,0x2F , +0x78 ,0x78 ,0x78 ,0x2E ,0x79 , +0x79 ,0x79 ,0x2E ,0x7A ,0x7A , +0x7A ,0x05 ,0x00 }; + +static unsigned char launch_browser_131[] = {0xD0 ,0x0E ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x30 ,0x01 ,0x00 ,0x31 , +0x00 }; + +static unsigned char launch_browser_141[] = {0xD0 ,0x20 ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x32 ,0x01 , +0x03 ,0x0D ,0x10 ,0x04 ,0x61 , +0x62 ,0x63 ,0x2E ,0x64 ,0x65 , +0x66 ,0x2E ,0x67 ,0x68 ,0x69 , +0x2E ,0x6A ,0x6B ,0x6C }; + +static unsigned char launch_browser_211[] = {0xD0 ,0x18 ,0x81 ,0x03 ,0x01 , +0x15 ,0x02 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0B , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C }; + +static unsigned char launch_browser_221[] = {0xD0 ,0x18 ,0x81 ,0x03 ,0x01 , +0x15 ,0x03 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0B , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C }; + +static unsigned char launch_browser_231[] = {0xD0 ,0x0B ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 }; + +static unsigned char launch_browser_311[] = {0xD0 ,0x26 ,0x81 ,0x03 ,0x01 , +0x15 ,0x02 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x19 , +0x80 ,0x04 ,0x17 ,0x04 ,0x14 , +0x04 ,0x20 ,0x04 ,0x10 ,0x04 , +0x12 ,0x04 ,0x21 ,0x04 ,0x22 , +0x04 ,0x12 ,0x04 ,0x23 ,0x04 , +0x19 ,0x04 ,0x22 ,0x04 ,0x15 }; + +static unsigned char launch_browser_411[] = {0xD0 ,0x21 ,0x81 ,0x03 ,0x01 , +0x15 ,0x02 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x10 , +0x4E ,0x6F ,0x74 ,0x20 ,0x73 , +0x65 ,0x6C ,0x66 ,0x20 ,0x65 , +0x78 ,0x70 ,0x6C ,0x61 ,0x6E , +0x2E ,0x1E ,0x02 ,0x01 ,0x01 }; + +static unsigned char launch_browser_421[] = {0xD0 ,0x1D ,0x81 ,0x03 ,0x01 , +0x15 ,0x02 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0C , +0x53 ,0x65 ,0x6C ,0x66 ,0x20 , +0x65 ,0x78 ,0x70 ,0x6C ,0x61 , +0x6E ,0x2E ,0x1E ,0x02 ,0x00 , +0x01 }; + +static unsigned char launch_browser_511[] = {0xD0 ,0x20 ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x31 ,0xD0 ,0x04 , +0x00 ,0x0D ,0x00 ,0xB4 }; + +static unsigned char launch_browser_512[] = {0xD0 ,0x1A ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x32 }; + +static unsigned char launch_browser_521[] = {0xD0 ,0x20 ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x31 ,0xD0 ,0x04 , +0x00 ,0x0D ,0x01 ,0xB4 }; + +static unsigned char launch_browser_522[] = {0xD0 ,0x1A ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x32 }; + +static unsigned char launch_browser_531[] = {0xD0 ,0x20 ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x31 ,0xD0 ,0x04 , +0x00 ,0x0D ,0x02 ,0xB4 }; + +static unsigned char launch_browser_532[] = {0xD0 ,0x1A ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x32 }; + +static unsigned char launch_browser_541[] = {0xD0 ,0x20 ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x31 ,0xD0 ,0x04 , +0x00 ,0x0D ,0x04 ,0xB4 }; + +static unsigned char launch_browser_542[] = {0xD0 ,0x20 ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x32 ,0xD0 ,0x04 , +0x00 ,0x0D ,0x00 ,0xB4 }; + +static unsigned char launch_browser_543[] = {0xD0 ,0x1A ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x33 }; + +static unsigned char launch_browser_551[] = {0xD0 ,0x20 ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x31 ,0xD0 ,0x04 , +0x00 ,0x0D ,0x08 ,0xB4 }; + +static unsigned char launch_browser_552[] = {0xD0 ,0x20 ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x32 ,0xD0 ,0x04 , +0x00 ,0x0D ,0x00 ,0xB4 }; + +static unsigned char launch_browser_553[] = {0xD0 ,0x1A ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x33 }; + +static unsigned char launch_browser_561[] = {0xD0 ,0x20 ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x31 ,0xD0 ,0x04 , +0x00 ,0x0D ,0x10 ,0xB4 }; + +static unsigned char launch_browser_562[] = {0xD0 ,0x20 ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x32 ,0xD0 ,0x04 , +0x00 ,0x0D ,0x00 ,0xB4 }; + +static unsigned char launch_browser_563[] = {0xD0 ,0x1A ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x33 }; + +static unsigned char launch_browser_571[] = {0xD0 ,0x20 ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x31 ,0xD0 ,0x04 , +0x00 ,0x0D ,0x20 ,0xB4 }; + +static unsigned char launch_browser_572[] = {0xD0 ,0x20 ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x32 ,0xD0 ,0x04 , +0x00 ,0x0D ,0x00 ,0xB4 }; + +static unsigned char launch_browser_573[] = {0xD0 ,0x1A ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x33 }; + +static unsigned char launch_browser_581[] = {0xD0 ,0x20 ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x31 ,0xD0 ,0x04 , +0x00 ,0x0D ,0x40 ,0xB4 }; + +static unsigned char launch_browser_582[] = {0xD0 ,0x20 ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x32 ,0xD0 ,0x04 , +0x00 ,0x0D ,0x00 ,0xB4 }; + +static unsigned char launch_browser_583[] = {0xD0 ,0x1A ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x33 }; + +static unsigned char launch_browser_591[] = {0xD0 ,0x20 ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x31 ,0xD0 ,0x04 , +0x00 ,0x0D ,0x80 ,0xB4 }; + +static unsigned char launch_browser_592[] = {0xD0 ,0x20 ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x32 ,0xD0 ,0x04 , +0x00 ,0x0D ,0x00 ,0xB4 }; + +static unsigned char launch_browser_593[] = {0xD0 ,0x1A ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x33 }; + +static unsigned char launch_browser_5101[] = {0xD0 ,0x20 ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x31 ,0xD0 ,0x04 , +0x00 ,0x0D ,0x00 ,0xB4 }; + +static unsigned char launch_browser_5102[] = {0xD0 ,0x1A ,0x81 ,0x03 ,0x01 , +0x15 ,0x00 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x0D , +0x44 ,0x65 ,0x66 ,0x61 ,0x75 , +0x6C ,0x74 ,0x20 ,0x55 ,0x52 , +0x4C ,0x20 ,0x32 }; + +static unsigned char launch_browser_611[] = {0xD0 ,0x12 ,0x81 ,0x03 ,0x01 , +0x15 ,0x02 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x05 , +0x80 ,0x4F ,0x60 ,0x59 ,0x7D }; + +static unsigned char launch_browser_711[] = {0xD0 ,0x10 ,0x81 ,0x03 ,0x01 , +0x15 ,0x02 ,0x82 ,0x02 ,0x81 , +0x82 ,0x31 ,0x00 ,0x05 ,0x03 , +0x80 ,0x30 ,0xEB }; + +static struct launch_browser_test launch_browser_data_111 = { + .pdu = launch_browser_111, + .pdu_len =sizeof (launch_browser_111), + .qualifier =0x00 , + .alpha_id ="Default URL" +}; + +static struct launch_browser_test launch_browser_data_121 = { + .pdu = launch_browser_121, + .pdu_len =sizeof (launch_browser_121), + .qualifier =0x00 , + .url ="http://xxx.yyy.zzz" +}; + +static struct launch_browser_test launch_browser_data_131 = { + .pdu = launch_browser_131, + .pdu_len =sizeof (launch_browser_131), + .qualifier =0x00 +}; + +static struct launch_browser_test launch_browser_data_141 = { + .pdu = launch_browser_141, + .pdu_len =sizeof (launch_browser_141), + .qualifier =0x00 , + .bearer = { + .len =1 , + .array = (unsigned char *)"\x03" + }, + .text_gateway_proxy_id ="abc.def.ghi.jkl" +}; + +static struct launch_browser_test launch_browser_data_211 = { + .pdu = launch_browser_211, + .pdu_len =sizeof (launch_browser_211), + .qualifier =0x02 , + .alpha_id ="Default URL" +}; + +static struct launch_browser_test launch_browser_data_221 = { + .pdu = launch_browser_221, + .pdu_len =sizeof (launch_browser_221), + .qualifier =0x03 , + .alpha_id ="Default URL" +}; + +static struct launch_browser_test launch_browser_data_231 = { + .pdu = launch_browser_231, + .pdu_len =sizeof (launch_browser_231), + .qualifier =0x00 +}; + +static struct launch_browser_test launch_browser_data_311 = { + .pdu = launch_browser_311, + .pdu_len =sizeof (launch_browser_311), + .qualifier =0x02 , + .alpha_id ="ЗДРАВСТВУЙТЕ" +}; + +static struct launch_browser_test launch_browser_data_411 = { + .pdu = launch_browser_411, + .pdu_len =sizeof (launch_browser_411), + .qualifier =0x02 , + .alpha_id ="Not self explan." , + .icon_id = { + .qualifier =STK_ICON_QUALIFIER_TYPE_NON_SELF_EXPLANATORY , + .id =0x01 + } +}; + +static struct launch_browser_test launch_browser_data_421 = { + .pdu = launch_browser_421, + .pdu_len =sizeof (launch_browser_421), + .qualifier =0x02 , + .alpha_id ="Self explan." , + .icon_id = { + .qualifier =STK_ICON_QUALIFIER_TYPE_SELF_EXPLANATORY , + .id =0x01 + } +}; + +static struct launch_browser_test launch_browser_data_511 = { + .pdu = launch_browser_511, + .pdu_len =sizeof (launch_browser_511), + .qualifier =0x00 , + .alpha_id ="Default URL 1" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0D ,0x00 ,0xB4 } + } +}; + +static struct launch_browser_test launch_browser_data_512 = { + .pdu = launch_browser_512, + .pdu_len =sizeof (launch_browser_512), + .qualifier =0x00 , + .alpha_id ="Default URL 2" +}; + +static struct launch_browser_test launch_browser_data_521 = { + .pdu = launch_browser_521, + .pdu_len =sizeof (launch_browser_521), + .qualifier =0x00 , + .alpha_id ="Default URL 1" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0D ,0x01 ,0xB4 } + } +}; + +static struct launch_browser_test launch_browser_data_522 = { + .pdu = launch_browser_522, + .pdu_len =sizeof (launch_browser_522), + .qualifier =0x00 , + .alpha_id ="Default URL 2" +}; + +static struct launch_browser_test launch_browser_data_531 = { + .pdu = launch_browser_531, + .pdu_len =sizeof (launch_browser_531), + .qualifier =0x00 , + .alpha_id ="Default URL 1" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0D ,0x02 ,0xB4 } + } +}; + +static struct launch_browser_test launch_browser_data_532 = { + .pdu = launch_browser_532, + .pdu_len =sizeof (launch_browser_532), + .qualifier =0x00 , + .alpha_id ="Default URL 2" +}; + +static struct launch_browser_test launch_browser_data_541 = { + .pdu = launch_browser_541, + .pdu_len =sizeof (launch_browser_541), + .qualifier =0x00 , + .alpha_id ="Default URL 1" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0D ,0x04 ,0xB4 } + } +}; + +static struct launch_browser_test launch_browser_data_542 = { + .pdu = launch_browser_542, + .pdu_len =sizeof (launch_browser_542), + .qualifier =0x00 , + .alpha_id ="Default URL 2" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0D ,0x00 ,0xB4 } + } +}; + +static struct launch_browser_test launch_browser_data_543 = { + .pdu = launch_browser_543, + .pdu_len =sizeof (launch_browser_543), + .qualifier =0x00 , + .alpha_id ="Default URL 3" +}; + +static struct launch_browser_test launch_browser_data_551 = { + .pdu = launch_browser_551, + .pdu_len =sizeof (launch_browser_551), + .qualifier =0x00 , + .alpha_id ="Default URL 1" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0D ,0x08 ,0xB4 } + } +}; + +static struct launch_browser_test launch_browser_data_552 = { + .pdu = launch_browser_552, + .pdu_len =sizeof (launch_browser_552), + .qualifier =0x00 , + .alpha_id ="Default URL 2" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0D ,0x00 ,0xB4 } + } +}; + +static struct launch_browser_test launch_browser_data_553 = { + .pdu = launch_browser_553, + .pdu_len =sizeof (launch_browser_553), + .qualifier =0x00 , + .alpha_id ="Default URL 3" +}; + +static struct launch_browser_test launch_browser_data_561 = { + .pdu = launch_browser_561, + .pdu_len =sizeof (launch_browser_561), + .qualifier =0x00 , + .alpha_id ="Default URL 1" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0D ,0x10 ,0xB4 } + } +}; + +static struct launch_browser_test launch_browser_data_562 = { + .pdu = launch_browser_562, + .pdu_len =sizeof (launch_browser_562), + .qualifier =0x00 , + .alpha_id ="Default URL 2" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0D ,0x00 ,0xB4 } + } +}; + +static struct launch_browser_test launch_browser_data_563 = { + .pdu = launch_browser_563, + .pdu_len =sizeof (launch_browser_563), + .qualifier =0x00 , + .alpha_id ="Default URL 3" +}; + +static struct launch_browser_test launch_browser_data_571 = { + .pdu = launch_browser_571, + .pdu_len =sizeof (launch_browser_571), + .qualifier =0x00 , + .alpha_id ="Default URL 1" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0D ,0x20 ,0xB4 } + } +}; + +static struct launch_browser_test launch_browser_data_572 = { + .pdu = launch_browser_572, + .pdu_len =sizeof (launch_browser_572), + .qualifier =0x00 , + .alpha_id ="Default URL 2" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0D ,0x00 ,0xB4 } + } +}; + +static struct launch_browser_test launch_browser_data_573 = { + .pdu = launch_browser_573, + .pdu_len =sizeof (launch_browser_573), + .qualifier =0x00 , + .alpha_id ="Default URL 3" +}; + +static struct launch_browser_test launch_browser_data_581 = { + .pdu = launch_browser_581, + .pdu_len =sizeof (launch_browser_581), + .qualifier =0x00 , + .alpha_id ="Default URL 1" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0D ,0x40 ,0xB4 } + } +}; + +static struct launch_browser_test launch_browser_data_582 = { + .pdu = launch_browser_582, + .pdu_len =sizeof (launch_browser_582), + .qualifier =0x00 , + .alpha_id ="Default URL 2" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0D ,0x00 ,0xB4 } + } +}; + +static struct launch_browser_test launch_browser_data_583 = { + .pdu = launch_browser_583, + .pdu_len =sizeof (launch_browser_583), + .qualifier =0x00 , + .alpha_id ="Default URL 3" +}; + +static struct launch_browser_test launch_browser_data_591 = { + .pdu = launch_browser_591, + .pdu_len =sizeof (launch_browser_591), + .qualifier =0x00 , + .alpha_id ="Default URL 1" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0D ,0x80 ,0xB4 } + } +}; + +static struct launch_browser_test launch_browser_data_592 = { + .pdu = launch_browser_592, + .pdu_len =sizeof (launch_browser_592), + .qualifier =0x00 , + .alpha_id ="Default URL 2" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0D ,0x00 ,0xB4 } + } +}; + +static struct launch_browser_test launch_browser_data_593 = { + .pdu = launch_browser_593, + .pdu_len =sizeof (launch_browser_593), + .qualifier =0x00 , + .alpha_id ="Default URL 3" +}; + +static struct launch_browser_test launch_browser_data_5101 = { + .pdu = launch_browser_5101, + .pdu_len =sizeof (launch_browser_5101), + .qualifier =0x00 , + .alpha_id ="Default URL 1" , + .text_attr = { + .len =4 , + .attributes = {0x00 ,0x0D ,0x00 ,0xB4 } + } +}; + +static struct launch_browser_test launch_browser_data_5102 = { + .pdu = launch_browser_5102, + .pdu_len =sizeof (launch_browser_5102), + .qualifier =0x00 , + .alpha_id ="Default URL 2" +}; + +static struct launch_browser_test launch_browser_data_611 = { + .pdu = launch_browser_611, + .pdu_len =sizeof (launch_browser_611), + .qualifier =0x02 , + .alpha_id ="你好" +}; + +static struct launch_browser_test launch_browser_data_711 = { + .pdu = launch_browser_711, + .pdu_len =sizeof (launch_browser_711), + .qualifier =0x02 , + .alpha_id ="ル" +}; + +static void test_launch_browser (gconstpointer data) +{ +const struct launch_browser_test *test = data; +struct stk_command *command; + + command =stk_command_new_from_pdu (test->pdu, test->pdu_len); + +g_assert (command); + +g_assert (command->number ==1 ); +g_assert (command->type ==STK_COMMAND_TYPE_LAUNCH_BROWSER ); +g_assert (command->qualifier == test->qualifier); + +g_assert (command->src ==STK_DEVICE_IDENTITY_TYPE_UICC ); +g_assert (command->dst ==STK_DEVICE_IDENTITY_TYPE_TERMINAL ); + +check_browser_id (command->launch_browser.browser_id, test->browser_id); +check_url (command->launch_browser.url, test->url); +check_bearer (&command->launch_browser.bearer, &test->bearer); +check_provisioning_file_references ( + command->launch_browser.prov_file_refs, test->prov_file_refs); +check_text (command->launch_browser.text_gateway_proxy_id, + test->text_gateway_proxy_id); +check_alpha_id (command->launch_browser.alpha_id, test->alpha_id); +check_icon_id (&command->launch_browser.icon_id, &test->icon_id); +check_text_attr (&command->launch_browser.text_attr, &test->text_attr); +check_frame_id (&command->launch_browser.frame_id, &test->frame_id); +check_text (command->launch_browser.text_usr, test->text_usr); +check_text (command->launch_browser.text_passwd, test->text_passwd); + +stk_command_free (command); +} +struct terminal_response_test {const unsigned char *pdu;unsigned int pdu_len;
@@ -17246,5 +17959,82 @@ int main(int argc, char **argv)g_test_add_data_func ("/teststk/Language Notification 1.2.1" , &language_notification_data_121, test_language_notification); +g_test_add_data_func ("/teststk/Launch Browser 1.1.1" , + &launch_browser_data_111, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 1.2.1" , + &launch_browser_data_121, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 1.3.1" , + &launch_browser_data_131, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 1.4.1" , + &launch_browser_data_141, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 2.1.1" , + &launch_browser_data_211, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 2.2.1" , + &launch_browser_data_221, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 2.3.1" , + &launch_browser_data_231, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 3.1.1" , + &launch_browser_data_311, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 4.1.1" , + &launch_browser_data_411, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 4.2.1" , + &launch_browser_data_421, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.1.1" , + &launch_browser_data_511, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.1.2" , + &launch_browser_data_512, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.2.1" , + &launch_browser_data_521, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.2.2" , + &launch_browser_data_522, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.3.1" , + &launch_browser_data_531, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.3.2" , + &launch_browser_data_532, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.4.1" , + &launch_browser_data_541, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.4.2" , + &launch_browser_data_542, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.4.3" , + &launch_browser_data_543, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.5.1" , + &launch_browser_data_551, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.5.2" , + &launch_browser_data_552, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.5.3" , + &launch_browser_data_553, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.6.1" , + &launch_browser_data_561, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.6.2" , + &launch_browser_data_562, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.6.3" , + &launch_browser_data_563, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.7.1" , + &launch_browser_data_571, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.7.2" , + &launch_browser_data_572, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.7.3" , + &launch_browser_data_573, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.8.1" , + &launch_browser_data_581, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.8.2" , + &launch_browser_data_582, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.8.3" , + &launch_browser_data_583, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.9.1" , + &launch_browser_data_591, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.9.2" , + &launch_browser_data_592, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.9.3" , + &launch_browser_data_593, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.10.1" , + &launch_browser_data_5101, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 5.10.2" , + &launch_browser_data_5102, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 6.1.1" , + &launch_browser_data_611, test_launch_browser); +g_test_add_data_func ("/teststk/Launch Browser 7.1.1" , + &launch_browser_data_711, test_launch_browser); +return g_test_run (); }
Signature · 1 line
1.7.0.4
PATCH 8/8 Move destructor prior to return
In reply to Yang Gu--- src/stkutil.c | 60 +++++++++++++++++++++++++------------------------------- 1 files changed, 27 insertions(+), 33 deletions(-)
src/stkutil.c +27 -33
@@ -2116,11 +2116,11 @@ static gboolean parse_display_text(struct stk_command *command, &obj->frame_id, STK_DATA_OBJECT_TYPE_INVALID); + command->destructor = destroy_display_text; +if (ret == FALSE)return FALSE; - command->destructor = destroy_display_text; -return TRUE; }
@@ -2154,11 +2154,11 @@ static gboolean parse_get_inkey(struct stk_command *command, &obj->frame_id, STK_DATA_OBJECT_TYPE_INVALID); + command->destructor = destroy_get_inkey; +if (ret == FALSE)return FALSE; - command->destructor = destroy_get_inkey; -return TRUE; }
@@ -2196,11 +2196,11 @@ static gboolean parse_get_input(struct stk_command *command, &obj->frame_id, STK_DATA_OBJECT_TYPE_INVALID); + command->destructor = destroy_get_input; +if (ret == FALSE)return FALSE; - command->destructor = destroy_get_input; -return TRUE; }
@@ -2247,11 +2247,11 @@ static gboolean parse_play_tone(struct stk_command *command, &obj->frame_id, STK_DATA_OBJECT_TYPE_INVALID); + command->destructor = destroy_play_tone; +if (ret == FALSE)return FALSE; - command->destructor = destroy_play_tone; -return TRUE; }
@@ -2275,8 +2275,6 @@ static gboolean parse_poll_interval(struct stk_command *command,if (ret == FALSE)return FALSE; - command->destructor =NULL ; -return TRUE; }
@@ -2330,10 +2328,12 @@ static gboolean parse_setup_menu(struct stk_command *command,gboolean ret;if (command->src !=STK_DEVICE_IDENTITY_TYPE_UICC ) - goto error; +return FALSE;if (command->dst !=STK_DEVICE_IDENTITY_TYPE_TERMINAL ) - goto error; +return FALSE; + + command->destructor = destroy_setup_menu; ret = parse_dataobj(iter, STK_DATA_OBJECT_TYPE_ALPHA_ID,
@@ -2342,12 +2342,12 @@ static gboolean parse_setup_menu(struct stk_command *command, STK_DATA_OBJECT_TYPE_INVALID);if (ret == FALSE) - goto error; +return FALSE; obj->items =parse_item_list (iter);if (obj->items ==NULL ) - goto error; +return FALSE; ret = parse_dataobj(iter, STK_DATA_OBJECT_TYPE_ITEMS_NEXT_ACTION_INDICATOR, 0,
@@ -2363,15 +2363,9 @@ static gboolean parse_setup_menu(struct stk_command *command, STK_DATA_OBJECT_TYPE_INVALID);if (ret == FALSE) - goto error; - - command->destructor = destroy_setup_menu; +return FALSE;return TRUE; - -error: -destroy_setup_menu (command); -return FALSE; }static void destroy_select_item (struct stk_command *command)
@@ -2566,11 +2560,11 @@ static gboolean parse_setup_call(struct stk_command *command, &obj->frame_id, STK_DATA_OBJECT_TYPE_INVALID); + command->destructor = destroy_setup_call; +if (ret == FALSE)return FALSE; - command->destructor = destroy_setup_call; -return TRUE; }
@@ -2607,11 +2601,11 @@ static gboolean parse_refresh(struct stk_command *command, &obj->frame_id, STK_DATA_OBJECT_TYPE_INVALID); + command->destructor = destroy_refresh; +if (ret == FALSE)return FALSE; - command->destructor = destroy_refresh; -return TRUE; }
@@ -2790,11 +2784,11 @@ static gboolean parse_setup_idle_mode_text(struct stk_command *command, &obj->frame_id, STK_DATA_OBJECT_TYPE_INVALID); + command->destructor = destroy_setup_idle_mode_text; +if (ret == FALSE)return FALSE; - command->destructor = destroy_setup_idle_mode_text; -return TRUE; }
@@ -2829,11 +2823,11 @@ static gboolean parse_run_at_command(struct stk_command *command, &obj->frame_id, STK_DATA_OBJECT_TYPE_INVALID); + command->destructor = destroy_run_at_command; +if (ret == FALSE)return FALSE; - command->destructor = destroy_run_at_command; -return TRUE; }
@@ -2868,11 +2862,11 @@ static gboolean parse_send_dtmf(struct stk_command *command, &obj->frame_id, STK_DATA_OBJECT_TYPE_INVALID); + command->destructor = destroy_send_dtmf; +if (ret == FALSE)return FALSE; - command->destructor = destroy_send_dtmf; -return TRUE; }
@@ -2987,11 +2981,11 @@ static gboolean parse_launch_browser(struct stk_command *command, &obj->text_passwd, STK_DATA_OBJECT_TYPE_INVALID); + command->destructor = destroy_launch_browser; +if (ret == FALSE)return FALSE; - command->destructor = destroy_launch_browser; -return TRUE; error:
Signature · 1 line
1.7.0.4
Hi Yang,
Quoted 3 lines
--- src/stkutil.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
I applied patches 2..8 in this series (with some refactoring). For this patch I decided to fix it differently. Let me know if I screwed something up.
Thanks,
-Denis