[PATCH 10/15] Add parser for network access name objects

Yang Gu yang.gu at intel.com
Tue Apr 20 21:55:54 PDT 2010


---
 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 1856c93..6b3500e 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1436,6 +1436,24 @@ static gboolean parse_dataobj_esn(
 	return TRUE;
 }
 
+/* Defined in TS 102.223 Section 8.70 */
+static gboolean parse_dataobj_network_access_name(
+		struct comprehension_tlv_iter *iter, void *user)
+{
+	struct stk_network_access_name *nan = user;
+	const unsigned char *data;
+	unsigned int len = comprehension_tlv_iter_get_length(iter);
+
+	if (len == 0)
+		return TRUE;
+
+	data = comprehension_tlv_iter_get_data(iter);
+	nan->len = len;
+	memcpy(nan->name, data, len);
+
+	return TRUE;
+}
+
 /* Defined in TS 102.223 Section 8.72 */
 static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
 					void *user)
@@ -1604,6 +1622,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
 		return parse_dataobj_remote_entity_address;
 	case STK_DATA_OBJECT_TYPE_ESN:
 		return parse_dataobj_esn;
+	case STK_DATA_OBJECT_TYPE_NETWORK_ACCESS_NAME:
+		return parse_dataobj_network_access_name;
 	case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE:
 		return parse_dataobj_text_attr;
 	case STK_DATA_OBJECT_TYPE_FRAME_ID:
diff --git a/src/stkutil.h b/src/stkutil.h
index 39d159b..9e3cbf5 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -656,6 +656,15 @@ struct stk_remote_entity_address {
 };
 
 /*
+ * According to 102.223 Section 8.70 the length of CTLV is 1 byte. This means
+ * that the maximum size is 127 according to the rules of CTLVs.
+ */
+struct stk_network_access_name {
+	unsigned char name[127];
+	unsigned char 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.7.0.4



More information about the ofono mailing list