Open Source Telephony
 help / color / mirror / Atom feed
* [PATCH 01/11] Adjust the sequence of comprehension tlv structures
@ 2010-03-31  9:16 Yang Gu
  2010-03-31  9:16 ` [PATCH 02/11] Add parser for items next action indicator objects Yang Gu
  2010-03-31 17:25 ` [PATCH 01/11] Adjust the sequence of comprehension tlv structures Denis Kenzior
  0 siblings, 2 replies; 12+ messages in thread
From: Yang Gu @ 2010-03-31  9:16 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2159 bytes --]

---
 src/stkutil.h |   35 ++++++++++++++++++-----------------
 1 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/src/stkutil.h b/src/stkutil.h
index a9495de..b0b09df 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -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;
 };
 
 /*
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 02/11] Add parser for items next action indicator objects
  2010-03-31  9:16 [PATCH 01/11] Adjust the sequence of comprehension tlv structures Yang Gu
@ 2010-03-31  9:16 ` Yang Gu
  2010-03-31  9:16   ` [PATCH 03/11] Add parser for event list objects Yang Gu
  2010-03-31 17:25 ` [PATCH 01/11] Adjust the sequence of comprehension tlv structures Denis Kenzior
  1 sibling, 1 reply; 12+ messages in thread
From: Yang Gu @ 2010-03-31  9:16 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2140 bytes --]

---
 src/stkutil.c |   20 ++++++++++++++++++++
 src/stkutil.h |    9 +++++++++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index c737395..37db3c3 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -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:
diff --git a/src/stkutil.h b/src/stkutil.h
index b0b09df..fb7a2d0 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -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
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 03/11] Add parser for event list objects
  2010-03-31  9:16 ` [PATCH 02/11] Add parser for items next action indicator objects Yang Gu
@ 2010-03-31  9:16   ` Yang Gu
  2010-03-31  9:16     ` [PATCH 04/11] Add parser for cause objects Yang Gu
  0 siblings, 1 reply; 12+ messages in thread
From: Yang Gu @ 2010-03-31  9:16 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3266 bytes --]

---
 src/stkutil.c |   20 ++++++++++++++++++++
 src/stkutil.h |   33 +++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index 37db3c3..ec64af3 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -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:
diff --git a/src/stkutil.h b/src/stkutil.h
index fb7a2d0..be89c9b 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -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
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 04/11] Add parser for cause objects
  2010-03-31  9:16   ` [PATCH 03/11] Add parser for event list objects Yang Gu
@ 2010-03-31  9:16     ` Yang Gu
  2010-03-31  9:16       ` [PATCH 05/11] Add parser for location status objects Yang Gu
  0 siblings, 1 reply; 12+ messages in thread
From: Yang Gu @ 2010-03-31  9:16 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2020 bytes --]

---
 src/stkutil.c |   25 +++++++++++++++++++++++++
 src/stkutil.h |    9 +++++++++
 2 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index ec64af3..08d013b 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -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:
diff --git a/src/stkutil.h b/src/stkutil.h
index be89c9b..21f6e8a 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -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
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 05/11] Add parser for location status objects
  2010-03-31  9:16     ` [PATCH 04/11] Add parser for cause objects Yang Gu
@ 2010-03-31  9:16       ` Yang Gu
  2010-03-31  9:16         ` [PATCH 06/11] Add parser for transaction identifier objects Yang Gu
  0 siblings, 1 reply; 12+ messages in thread
From: Yang Gu @ 2010-03-31  9:16 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2202 bytes --]

---
 src/stkutil.c |   26 ++++++++++++++++++++++++++
 src/stkutil.h |    6 ++++++
 2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index 08d013b..b04ef4c 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -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:
diff --git a/src/stkutil.h b/src/stkutil.h
index 21f6e8a..a87b4ef 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -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;
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 06/11] Add parser for transaction identifier objects
  2010-03-31  9:16       ` [PATCH 05/11] Add parser for location status objects Yang Gu
@ 2010-03-31  9:16         ` Yang Gu
  2010-03-31  9:16           ` [PATCH 07/11] Add parser for call control requested action objects Yang Gu
  0 siblings, 1 reply; 12+ messages in thread
From: Yang Gu @ 2010-03-31  9:16 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2043 bytes --]

---
 src/stkutil.c |   20 ++++++++++++++++++++
 src/stkutil.h |    9 +++++++++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index b04ef4c..73dae2c 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -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:
diff --git a/src/stkutil.h b/src/stkutil.h
index a87b4ef..419cda7 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -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
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 07/11] Add parser for call control requested action objects
  2010-03-31  9:16         ` [PATCH 06/11] Add parser for transaction identifier objects Yang Gu
@ 2010-03-31  9:16           ` Yang Gu
  2010-03-31  9:17             ` [PATCH 08/11] Add enum for icon qualifier Yang Gu
  0 siblings, 1 reply; 12+ messages in thread
From: Yang Gu @ 2010-03-31  9:16 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2492 bytes --]

---
 src/stkutil.c |   34 ++++++++++++++++++++++++++++++++++
 src/stkutil.h |    6 ++++++
 2 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index 73dae2c..b60aa65 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -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:
diff --git a/src/stkutil.h b/src/stkutil.h
index 419cda7..9ba8138 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -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;
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 08/11] Add enum for icon qualifier
  2010-03-31  9:16           ` [PATCH 07/11] Add parser for call control requested action objects Yang Gu
@ 2010-03-31  9:17             ` Yang Gu
  2010-03-31  9:17               ` [PATCH 09/11] Add parser for item icon identifier list objects Yang Gu
  0 siblings, 1 reply; 12+ messages in thread
From: Yang Gu @ 2010-03-31  9:17 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 579 bytes --]

---
 src/stkutil.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/stkutil.h b/src/stkutil.h
index 9ba8138..5619211 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -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;
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 09/11] Add parser for item icon identifier list objects
  2010-03-31  9:17             ` [PATCH 08/11] Add enum for icon qualifier Yang Gu
@ 2010-03-31  9:17               ` Yang Gu
  2010-03-31  9:17                 ` [PATCH 10/11] Rename stk_icon_identifier to stk_icon_id Yang Gu
  0 siblings, 1 reply; 12+ messages in thread
From: Yang Gu @ 2010-03-31  9:17 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2281 bytes --]

---
 src/stkutil.c |   21 +++++++++++++++++++++
 src/stkutil.h |   12 ++++++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index b60aa65..4c9cb6a 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -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:
diff --git a/src/stkutil.h b/src/stkutil.h
index 5619211..3f2802e 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -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.
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 10/11] Rename stk_icon_identifier to stk_icon_id
  2010-03-31  9:17               ` [PATCH 09/11] Add parser for item icon identifier list objects Yang Gu
@ 2010-03-31  9:17                 ` Yang Gu
  2010-03-31  9:17                   ` [PATCH 11/11] Handle the comprehension tlv with bad format in parse_dataobj() Yang Gu
  0 siblings, 1 reply; 12+ messages in thread
From: Yang Gu @ 2010-03-31  9:17 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1942 bytes --]

---
 src/stkutil.c |    2 +-
 src/stkutil.h |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index 4c9cb6a..b830291 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -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)
diff --git a/src/stkutil.h b/src/stkutil.h
index 3f2802e..4ff8c4b 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -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 */
 };
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 11/11] Handle the comprehension tlv with bad format in parse_dataobj()
  2010-03-31  9:17                 ` [PATCH 10/11] Rename stk_icon_identifier to stk_icon_id Yang Gu
@ 2010-03-31  9:17                   ` Yang Gu
  0 siblings, 0 replies; 12+ messages in thread
From: Yang Gu @ 2010-03-31  9:17 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1111 bytes --]

---
 src/stkutil.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index b830291..937ef1a 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -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) {
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 01/11] Adjust the sequence of comprehension tlv structures
  2010-03-31  9:16 [PATCH 01/11] Adjust the sequence of comprehension tlv structures Yang Gu
  2010-03-31  9:16 ` [PATCH 02/11] Add parser for items next action indicator objects Yang Gu
@ 2010-03-31 17:25 ` Denis Kenzior
  1 sibling, 0 replies; 12+ messages in thread
From: Denis Kenzior @ 2010-03-31 17:25 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 195 bytes --]

Hi Yang,

> ---
>  src/stkutil.h |   35 ++++++++++++++++++-----------------
>  1 files changed, 18 insertions(+), 17 deletions(-)

All 11 patches have now been applied.

Thanks,
-Denis

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-03-31 17:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-31  9:16 [PATCH 01/11] Adjust the sequence of comprehension tlv structures Yang Gu
2010-03-31  9:16 ` [PATCH 02/11] Add parser for items next action indicator objects Yang Gu
2010-03-31  9:16   ` [PATCH 03/11] Add parser for event list objects Yang Gu
2010-03-31  9:16     ` [PATCH 04/11] Add parser for cause objects Yang Gu
2010-03-31  9:16       ` [PATCH 05/11] Add parser for location status objects Yang Gu
2010-03-31  9:16         ` [PATCH 06/11] Add parser for transaction identifier objects Yang Gu
2010-03-31  9:16           ` [PATCH 07/11] Add parser for call control requested action objects Yang Gu
2010-03-31  9:17             ` [PATCH 08/11] Add enum for icon qualifier Yang Gu
2010-03-31  9:17               ` [PATCH 09/11] Add parser for item icon identifier list objects Yang Gu
2010-03-31  9:17                 ` [PATCH 10/11] Rename stk_icon_identifier to stk_icon_id Yang Gu
2010-03-31  9:17                   ` [PATCH 11/11] Handle the comprehension tlv with bad format in parse_dataobj() Yang Gu
2010-03-31 17:25 ` [PATCH 01/11] Adjust the sequence of comprehension tlv structures Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox