Adjust the sequence of comprehension tlv structures
PATCH 1/11 Adjust the sequence of comprehension tlv structures
--- src/stkutil.h | 35 ++++++++++++++++++----------------- 1 files changed, 18 insertions(+), 17 deletions(-)
src/stkutil.h +18 -17
@@ -308,15 +308,6 @@ struct stk_ccp { };/* -* Icon ID denotes a file on the SIM filesystem. Since EF cannot have record -* ids of 0, we use icon_id with 0 to denote empty icon_identifier objects -*/ -struct stk_icon_identifier { -unsigned char qualifier; -unsigned char id; -}; - -/* * According to 102.223 Section 8.8 interval values of 0x00 are reserved. * We use this to denote empty duration objects. */
@@ -347,6 +338,17 @@ struct stk_result {unsigned char *additional; }; +/* Define the struct of single file in TS102.223 Section 8.18. +* According to TS 11.11 Section 6.2, each file id has two bytes, and the +* maximum Dedicated File level is 2. So the maximum size of file is 8, which +* contains two bytes of Master File, 2 bytes of 1st level Dedicated File, +* 2 bytes of 2nd level Dedicated File and 2 bytes of Elementary File. +*/ +struct stk_file { +unsigned char file[8 ]; +unsigned int len; +}; +/* Defined in TS 102.223 Section 8.19 */ struct stk_location_info {char mnc[OFONO_MAX_MNC_LENGTH +1 ];
@@ -358,15 +360,14 @@ struct stk_location_info {unsigned short ext_ci; }; -/* Define the struct of single file in TS102.223 Section 8.18. -* According to TS 11.11 Section 6.2, each file id has two bytes, and the -* maximum Dedicated File level is 2. So the maximum size of file is 8, which -* contains two bytes of Master File, 2 bytes of 1st level Dedicated File, -* 2 bytes of 2nd level Dedicated File and 2 bytes of Elementary File. +/* +* Defined in TS 102.223 Section 8.31 +* Icon ID denotes a file on the SIM filesystem. Since EF cannot have record +* ids of 0, we use icon_id with 0 to denote empty icon_identifier objects */ -struct stk_file { -unsigned char file[8 ]; -unsigned int len; +struct stk_icon_identifier { +unsigned char qualifier; +unsigned char id; };/*
Signature · 1 line
1.6.3.3
PATCH 2/11 Add parser for items next action indicator objects
--- src/stkutil.c | 20 ++++++++++++++++++++ src/stkutil.h | 9 +++++++++ 2 files changed, 29 insertions(+), 0 deletions(-)
src/stkutil.c +20 -0
@@ -592,6 +592,24 @@ static gboolean parse_dataobj_default_text(struct comprehension_tlv_iter *iter,return TRUE; } +/* Defined in TS 102.223 Section 8.24 */ +static gboolean parse_dataobj_items_next_action_indicator ( +struct comprehension_tlv_iter *iter,void *user) +{ +struct stk_items_next_action_indicator *inai = user; +const unsigned char *data; +unsigned int len =comprehension_tlv_iter_get_length (iter); + +if ((len <1 ) || (len >sizeof (inai->list))) +return FALSE; + + data =comprehension_tlv_iter_get_data (iter); + inai->len = len; +memcpy (inai->list, data, len); + +return TRUE; +} +/* Defined in TS 102.223 Section 8.31 */ static gboolean parse_dataobj_icon_id (struct comprehension_tlv_iter *iter,void *user)
@@ -698,6 +716,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)return parse_dataobj_network_measurement_results;case STK_DATA_OBJECT_TYPE_DEFAULT_TEXT :return parse_dataobj_default_text; +case STK_DATA_OBJECT_TYPE_ITEMS_NEXT_ACTION_INDICATOR : +return parse_dataobj_items_next_action_indicator;case STK_DATA_OBJECT_TYPE_ICON_ID :return parse_dataobj_icon_id;case STK_DATA_OBJECT_TYPE_IMMEDIATE_RESPONSE :
src/stkutil.h +9 -0
@@ -361,6 +361,15 @@ struct stk_location_info { };/* +* According to 102.223 Section 8.24 the length of CTLV is 1 byte. This means +* that the maximum size is 127 according to the rules of CTLVs. +*/ +struct stk_items_next_action_indicator { +unsigned char list[127 ]; +unsigned int len; +}; + +/* * Defined in TS 102.223 Section 8.31 * Icon ID denotes a file on the SIM filesystem. Since EF cannot have record * ids of 0, we use icon_id with 0 to denote empty icon_identifier objects
Signature · 1 line
1.6.3.3
PATCH 3/11 Add parser for event list objects
--- src/stkutil.c | 20 ++++++++++++++++++++ src/stkutil.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 0 deletions(-)
src/stkutil.c +20 -0
@@ -610,6 +610,24 @@ static gboolean parse_dataobj_items_next_action_indicator(return TRUE; } +/* Defined in TS 102.223 Section 8.25 */ +static gboolean parse_dataobj_event_list ( +struct comprehension_tlv_iter *iter,void *user) +{ +struct stk_event_list *el = user; +const unsigned char *data; +unsigned int len =comprehension_tlv_iter_get_length (iter); + +if ((len <1 ) || (len >sizeof (el->list))) +return FALSE; + + data =comprehension_tlv_iter_get_data (iter); + el->len = len; +memcpy (el->list, data, len); + +return TRUE; +} +/* Defined in TS 102.223 Section 8.31 */ static gboolean parse_dataobj_icon_id (struct comprehension_tlv_iter *iter,void *user)
@@ -718,6 +736,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)return parse_dataobj_default_text;case STK_DATA_OBJECT_TYPE_ITEMS_NEXT_ACTION_INDICATOR :return parse_dataobj_items_next_action_indicator; +case STK_DATA_OBJECT_TYPE_EVENT_LIST : +return parse_dataobj_event_list;case STK_DATA_OBJECT_TYPE_ICON_ID :return parse_dataobj_icon_id;case STK_DATA_OBJECT_TYPE_IMMEDIATE_RESPONSE :
src/stkutil.h +33 -0
@@ -266,6 +266,30 @@ enum stk_tone_type {STK_TONE_TYPE_MELODY_8 =0x47 }; +enum stk_event_type { +STK_EVENT_TYPE_MT_CALL =0x00 , +STK_EVENT_TYPE_CALL_CONNECTED =0x01 , +STK_EVENT_TYPE_CALL_DISCONNECTED =0x02 , +STK_EVENT_TYPE_LOCATION_STATUS =0x03 , +STK_EVENT_TYPE_USER_ACTIVITY =0x04 , +STK_EVENT_TYPE_IDLE_SCREEN_AVAILABLE =0x05 , +STK_EVENT_TYPE_CARD_READER_STATUS =0x06 , +STK_EVENT_TYPE_LANGUAGE_SELECTION =0x07 , +STK_EVENT_TYPE_BROWSER_TERMINATION =0x08 , +STK_EVENT_TYPE_DATA_AVAILABLE =0x09 , +STK_EVENT_TYPE_CHANNEL_STATUS =0x0A , +STK_EVENT_TYPE_SINGLE_ACCESS_TECHNOLOGY_CHANGE =0x0B , +STK_EVENT_TYPE_DISPLAY_PARAMETERS_CHANGED =0x0C , +STK_EVENT_TYPE_LOCAL_CONNECTION =0x0D , +STK_EVENT_TYPE_NETWORK_SEARCH_MODE_CHANGE =0x0E , +STK_EVENT_TYPE_BROWSING_STATUS =0x0F , +STK_EVENT_TYPE_FRAMES_INFORMATION_CHANGE =0x10 , +STK_EVENT_TYPE_I_WLAN_ACCESS_STATUS =0x11 , +STK_EVENT_TYPE_NETWORK_REJECTION =0x12 , +STK_EVENT_TYPE_HCI_CONNECTIVITY_EVENT =0x13 , +STK_EVENT_TYPE_MULTIPLE_ACCESS_TECHNOLOGIES_CHANGE =0x14 +}; +/* Defined in TS 102.223 Section 8.1 */ struct stk_address {unsigned char ton_npi;
@@ -370,6 +394,15 @@ struct stk_items_next_action_indicator { };/* +* According to 102.223 Section 8.25, there are 21 kinds of event type and no +* one should appear more than once. +*/ +struct stk_event_list { +unsigned char list[21 ]; +unsigned int len; +}; + +/* * Defined in TS 102.223 Section 8.31 * Icon ID denotes a file on the SIM filesystem. Since EF cannot have record * ids of 0, we use icon_id with 0 to denote empty icon_identifier objects
Signature · 1 line
1.6.3.3
PATCH 4/11 Add parser for cause objects
--- src/stkutil.c | 25 +++++++++++++++++++++++++ src/stkutil.h | 9 +++++++++ 2 files changed, 34 insertions(+), 0 deletions(-)
src/stkutil.c +25 -0
@@ -628,6 +628,29 @@ static gboolean parse_dataobj_event_list(return TRUE; } +/* Defined in TS 102.223 Section 8.26 */ +static gboolean parse_dataobj_cause ( +struct comprehension_tlv_iter *iter,void *user) +{ +struct stk_cause *cause = user; +const unsigned char *data; +unsigned int len =comprehension_tlv_iter_get_length (iter); + +if ((len ==1 ) || (len >sizeof (cause->cause))) +return FALSE; + + cause->has_cause = TRUE; + +if (len ==0 ) +return TRUE; + + data =comprehension_tlv_iter_get_data (iter); + cause->len = len; +memcpy (cause->cause, data, len); + +return TRUE; +} +/* Defined in TS 102.223 Section 8.31 */ static gboolean parse_dataobj_icon_id (struct comprehension_tlv_iter *iter,void *user)
@@ -738,6 +761,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)return parse_dataobj_items_next_action_indicator;case STK_DATA_OBJECT_TYPE_EVENT_LIST :return parse_dataobj_event_list; +case STK_DATA_OBJECT_TYPE_CAUSE : +return parse_dataobj_cause;case STK_DATA_OBJECT_TYPE_ICON_ID :return parse_dataobj_icon_id;case STK_DATA_OBJECT_TYPE_IMMEDIATE_RESPONSE :
src/stkutil.h +9 -0
@@ -403,6 +403,15 @@ struct stk_event_list { };/* +* According to 102.223 Section 8.26, the maximum length of cause is 30. +*/ +struct stk_cause { +unsigned char cause[30 ]; +unsigned int len; +ofono_bool_t has_cause; +}; + +/* * Defined in TS 102.223 Section 8.31 * Icon ID denotes a file on the SIM filesystem. Since EF cannot have record * ids of 0, we use icon_id with 0 to denote empty icon_identifier objects
Signature · 1 line
1.6.3.3
PATCH 5/11 Add parser for location status objects
--- src/stkutil.c | 26 ++++++++++++++++++++++++++ src/stkutil.h | 6 ++++++ 2 files changed, 32 insertions(+), 0 deletions(-)
src/stkutil.c +26 -0
@@ -97,6 +97,21 @@ static gboolean parse_dataobj_common_bool(struct comprehension_tlv_iter *iter,return TRUE; } +/* For data object that only has one byte */ +static gboolean parse_dataobj_common_byte ( +struct comprehension_tlv_iter *iter,unsigned char *out) +{ +const unsigned char *data; + +if (comprehension_tlv_iter_get_length (iter) !=1 ) +return FALSE; + + data =comprehension_tlv_iter_get_data (iter); + *out = data[0 ]; + +return TRUE; +} +/* Defined in TS 102.223 Section 8.1 */ static gboolean parse_dataobj_address (struct comprehension_tlv_iter *iter,void *user)
@@ -651,6 +666,15 @@ static gboolean parse_dataobj_cause(return TRUE; } +/* Defined in TS 102.223 Section 8.27 */ +static gboolean parse_dataobj_location_status ( +struct comprehension_tlv_iter *iter,void *user) +{ +unsigned char *byte = user; + +return parse_dataobj_common_byte (iter, byte); +} +/* Defined in TS 102.223 Section 8.31 */ static gboolean parse_dataobj_icon_id (struct comprehension_tlv_iter *iter,void *user)
@@ -763,6 +787,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)return parse_dataobj_event_list;case STK_DATA_OBJECT_TYPE_CAUSE :return parse_dataobj_cause; +case STK_DATA_OBJECT_TYPE_LOCATION_STATUS : +return parse_dataobj_location_status;case STK_DATA_OBJECT_TYPE_ICON_ID :return parse_dataobj_icon_id;case STK_DATA_OBJECT_TYPE_IMMEDIATE_RESPONSE :
src/stkutil.h +6 -0
@@ -290,6 +290,12 @@ enum stk_event_type {STK_EVENT_TYPE_MULTIPLE_ACCESS_TECHNOLOGIES_CHANGE =0x14 }; +enum stk_service_state { +STK_NORMAL_SERVICE =0x00 , +STK_LIMITED_SERVICE =0x01 , +STK_NO_SERVICE =0x02 +}; +/* Defined in TS 102.223 Section 8.1 */ struct stk_address {unsigned char ton_npi;
Signature · 1 line
1.6.3.3
PATCH 6/11 Add parser for transaction identifier objects
--- src/stkutil.c | 20 ++++++++++++++++++++ src/stkutil.h | 9 +++++++++ 2 files changed, 29 insertions(+), 0 deletions(-)
src/stkutil.c +20 -0
@@ -675,6 +675,24 @@ static gboolean parse_dataobj_location_status(return parse_dataobj_common_byte (iter, byte); } +/* Defined in TS 102.223 Section 8.28 */ +static gboolean parse_dataobj_transaction_id ( +struct comprehension_tlv_iter *iter,void *user) +{ +struct stk_transaction_id *ti = user; +const unsigned char *data; +unsigned int len =comprehension_tlv_iter_get_length (iter); + +if ((len <1 ) || (len >sizeof (ti->list))) +return FALSE; + + data =comprehension_tlv_iter_get_data (iter); + ti->len = len; +memcpy (ti->list, data, len); + +return TRUE; +} +/* Defined in TS 102.223 Section 8.31 */ static gboolean parse_dataobj_icon_id (struct comprehension_tlv_iter *iter,void *user)
@@ -789,6 +807,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)return parse_dataobj_cause;case STK_DATA_OBJECT_TYPE_LOCATION_STATUS :return parse_dataobj_location_status; +case STK_DATA_OBJECT_TYPE_TRANSACTION_ID : +return parse_dataobj_transaction_id;case STK_DATA_OBJECT_TYPE_ICON_ID :return parse_dataobj_icon_id;case STK_DATA_OBJECT_TYPE_IMMEDIATE_RESPONSE :
src/stkutil.h +9 -0
@@ -418,6 +418,15 @@ struct stk_cause { };/* +* According to 102.223 Section 8.28 the length of CTLV is 1 byte. This means +* that the maximum size is 127 according to the rules of CTLVs. +*/ +struct stk_transaction_id { +unsigned char list[127 ]; +unsigned int len; +}; + +/* * Defined in TS 102.223 Section 8.31 * Icon ID denotes a file on the SIM filesystem. Since EF cannot have record * ids of 0, we use icon_id with 0 to denote empty icon_identifier objects
Signature · 1 line
1.6.3.3
PATCH 7/11 Add parser for call control requested action objects
--- src/stkutil.c | 34 ++++++++++++++++++++++++++++++++++ src/stkutil.h | 6 ++++++ 2 files changed, 40 insertions(+), 0 deletions(-)
src/stkutil.c +34 -0
@@ -112,6 +112,29 @@ static gboolean parse_dataobj_common_byte(return TRUE; } +/* For data object that only has a byte array with undetermined length */ +static gboolean parse_dataobj_common_byte_array ( +struct comprehension_tlv_iter *iter, +struct stk_common_byte_array *array) +{ +const unsigned char *data; +unsigned int len =comprehension_tlv_iter_get_length (iter); + +if (len <1 ) +return FALSE; + + data =comprehension_tlv_iter_get_data (iter); + array->len = len; + + array->array =g_try_malloc (len); +if (array->array ==NULL ) +return FALSE; + +memcpy (array->array, data, len); + +return TRUE; +} +/* Defined in TS 102.223 Section 8.1 */ static gboolean parse_dataobj_address (struct comprehension_tlv_iter *iter,void *user)
@@ -693,6 +716,15 @@ static gboolean parse_dataobj_transaction_id(return TRUE; } +/* Defined in TS 102.223 Section 8.30 */ +static gboolean parse_dataobj_call_control_requested_action ( +struct comprehension_tlv_iter *iter,void *user) +{ +struct stk_common_byte_array *array = user; + +return parse_dataobj_common_byte_array (iter, array); +} +/* Defined in TS 102.223 Section 8.31 */ static gboolean parse_dataobj_icon_id (struct comprehension_tlv_iter *iter,void *user)
@@ -809,6 +841,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)return parse_dataobj_location_status;case STK_DATA_OBJECT_TYPE_TRANSACTION_ID :return parse_dataobj_transaction_id; +case STK_DATA_OBJECT_TYPE_CALL_CONTROL_REQUESTED_ACTION : +return parse_dataobj_call_control_requested_action;case STK_DATA_OBJECT_TYPE_ICON_ID :return parse_dataobj_icon_id;case STK_DATA_OBJECT_TYPE_IMMEDIATE_RESPONSE :
src/stkutil.h +6 -0
@@ -296,6 +296,12 @@ enum stk_service_state {STK_NO_SERVICE =0x02 }; +/* For data object that only has a byte array with undetermined length */ +struct stk_common_byte_array { +unsigned char *array; +unsigned int len; +}; +/* Defined in TS 102.223 Section 8.1 */ struct stk_address {unsigned char ton_npi;
Signature · 1 line
1.6.3.3
PATCH 8/11 Add enum for icon qualifier
--- src/stkutil.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
src/stkutil.h +5 -0
@@ -296,6 +296,11 @@ enum stk_service_state {STK_NO_SERVICE =0x02 }; +enum stk_icon_qualifier { +STK_ICON_QUALIFIER_TYPE_SELF_EXPLANATORY =0x00 , +STK_ICON_QUALIFIER_TYPE_NON_SELF_EXPLANATORY =0x01 +}; +/* For data object that only has a byte array with undetermined length */ struct stk_common_byte_array {unsigned char *array;
Signature · 1 line
1.6.3.3
PATCH 9/11 Add parser for item icon identifier list objects
--- src/stkutil.c | 21 +++++++++++++++++++++ src/stkutil.h | 12 ++++++++++++ 2 files changed, 33 insertions(+), 0 deletions(-)
src/stkutil.c +21 -0
@@ -743,6 +743,25 @@ static gboolean parse_dataobj_icon_id(struct comprehension_tlv_iter *iter,return TRUE; } +/* Defined in TS 102.223 Section 8.32 */ +static gboolean parse_dataobj_item_icon_id_list ( +struct comprehension_tlv_iter *iter,void *user) +{ +struct stk_item_icon_id_list *iiil = user; +const unsigned char *data; +unsigned int len =comprehension_tlv_iter_get_length (iter); + +if ((len <2 ) || (len >127 )) +return FALSE; + + data =comprehension_tlv_iter_get_data (iter); + iiil->qualifier = data[0 ]; + iiil->len = len -1 ; +memcpy (iiil->list, data +1 , iiil->len); + +return TRUE; +} +/* Defined in 102.223 Section 8.43 */ static gboolean parse_dataobj_imm_resp (struct comprehension_tlv_iter *iter,void *user)
@@ -845,6 +864,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)return parse_dataobj_call_control_requested_action;case STK_DATA_OBJECT_TYPE_ICON_ID :return parse_dataobj_icon_id; +case STK_DATA_OBJECT_TYPE_ITEM_ICON_ID_LIST : +return parse_dataobj_item_icon_id_list;case STK_DATA_OBJECT_TYPE_IMMEDIATE_RESPONSE :return parse_dataobj_imm_resp;case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE :
src/stkutil.h +12 -0
@@ -448,6 +448,18 @@ struct stk_icon_identifier { };/* +* According to 102.223 Section 8.32 the length of CTLV is 1 byte. This means +* that the maximum size is 127 according to the rules of CTLVs. This size also +* includes icon list qualifier for 1 byte, so the maxmimum size of icon +* identifier list is 126. +*/ +struct stk_item_icon_id_list { +unsigned char qualifier; +unsigned char list[126 ]; +unsigned int len; +}; + +/* * According to 102.223 Section 8.72 the length of text attribute CTLV is 1 * byte. This means that the maximum size is 127 according to the rules * of CTLVs. Empty attribute options will have len of 0.
Signature · 1 line
1.6.3.3
PATCH 10/11 Rename stk_icon_identifier to stk_icon_id
--- src/stkutil.c | 2 +- src/stkutil.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
src/stkutil.c +1 -1
@@ -729,7 +729,7 @@ static gboolean parse_dataobj_call_control_requested_action(static gboolean parse_dataobj_icon_id (struct comprehension_tlv_iter *iter,void *user) { -struct stk_icon_identifier *id = user; +struct stk_icon_id *id = user;const unsigned char *data;if (comprehension_tlv_iter_get_length (iter) !=2 )
src/stkutil.h +4 -4
@@ -442,7 +442,7 @@ struct stk_transaction_id {* Icon ID denotes a file on the SIM filesystem. Since EF cannot have record * ids of 0, we use icon_id with 0 to denote empty icon_identifier objects */ -struct stk_icon_identifier { +struct stk_icon_id {unsigned char qualifier;unsigned char id; };
@@ -471,7 +471,7 @@ struct stk_text_attribute {struct stk_command_display_text {char *text; -struct stk_icon_identifier icon_id; +struct stk_icon_id icon_id;ofono_bool_t immediate_response;struct stk_duration duration;struct stk_text_attribute text_attribute;
@@ -482,7 +482,7 @@ struct stk_command_get_input {char *text;struct stk_response_length response_length;char *default_text; -struct stk_icon_identifier icon_id; +struct stk_icon_id icon_id;struct stk_text_attribute text_attribute;unsigned char frame_id;/* Values 0x10 to 0xFF reserved */ };
@@ -491,7 +491,7 @@ struct stk_command_send_sms {char *alpha_id;struct stk_address address;struct sms gsm_sms; -struct stk_icon_identifier icon_id; +struct stk_icon_id icon_id;struct stk_text_attribute text_attribute;unsigned char frame_id;/* Values 0x10 to 0xFF reserved */ };
Signature · 1 line
1.6.3.3
PATCH 11/11 Handle the comprehension tlv with bad format in parse_dataobj()
--- src/stkutil.c | 16 ++++++---------- 1 files changed, 6 insertions(+), 10 deletions(-)
src/stkutil.c +6 -10
@@ -910,7 +910,6 @@ static gboolean parse_dataobj(struct comprehension_tlv_iter *iter, entries =g_slist_reverse (entries);for (l = entries; l; l = l->next) { -gboolean ret;dataobj_handler handler;struct dataobj_handler_entry *entry = l->data;
@@ -918,15 +917,12 @@ static gboolean parse_dataobj(struct comprehension_tlv_iter *iter,if (handler ==NULL )continue ; -if (comprehension_tlv_iter_get_tag (iter) == entry->type) - ret =handler (iter, entry->data); -else - ret = FALSE; - - entry->parsed = ret; - -if (ret &&comprehension_tlv_iter_next (iter) == FALSE) -break ; +if (comprehension_tlv_iter_get_tag (iter) == entry->type) { +if (handler (iter, entry->data)) + entry->parsed = TRUE; +if (comprehension_tlv_iter_next (iter) == FALSE) +break ; + } }for (l = entries; l; l = l->next) {
Signature · 1 line
1.6.3.3
Hi Yang,
Quoted 3 lines
--- src/stkutil.h | 35 ++++++++++++++++++----------------- 1 files changed, 18 insertions(+), 17 deletions(-)
All 11 patches have now been applied.
Thanks,
-Denis