[PATCH 07/11] Add parser for call control requested action objects

Yang Gu yang.gu at intel.com
Wed Mar 31 02:16:59 PDT 2010


---
 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



More information about the ofono mailing list