* [PATCH 01/13] Fix the logic when parsing c-apdu objects
@ 2010-04-06 10:06 Yang Gu
2010-04-06 10:06 ` [PATCH 02/13] Add parser for url objects Yang Gu
2010-04-14 18:13 ` [PATCH 01/13] Fix the logic when parsing c-apdu objects Denis Kenzior
0 siblings, 2 replies; 14+ messages in thread
From: Yang Gu @ 2010-04-06 10:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 416 bytes --]
---
src/stkutil.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 13c2978..3fac701 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -852,7 +852,6 @@ static gboolean parse_dataobj_c_apdu(struct comprehension_tlv_iter *iter,
}
if (len - pos > 0) {
- ca->lc = 0;
ca->le = data[len - 1];
ca->has_le = TRUE;
}
--
1.6.3.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 02/13] Add parser for url objects
2010-04-06 10:06 [PATCH 01/13] Fix the logic when parsing c-apdu objects Yang Gu
@ 2010-04-06 10:06 ` Yang Gu
2010-04-06 10:06 ` [PATCH 03/13] Add parser for bearer objects Yang Gu
2010-04-14 18:13 ` [PATCH 01/13] Fix the logic when parsing c-apdu objects Denis Kenzior
1 sibling, 1 reply; 14+ messages in thread
From: Yang Gu @ 2010-04-06 10:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1133 bytes --]
---
src/stkutil.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 3fac701..2fc5287 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1014,6 +1014,14 @@ static gboolean parse_dataobj_browser_id(struct comprehension_tlv_iter *iter,
return parse_dataobj_common_byte(iter, byte);
}
+/* Defined in TS 102.223 Section 8.48 */
+static gboolean parse_dataobj_url(struct comprehension_tlv_iter *iter,
+ void *user)
+{
+ char **url = user;
+ return parse_dataobj_common_text(iter, url);
+}
+
/* Defined in TS 102.223 Section 8.72 */
static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
void *user)
@@ -1138,6 +1146,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
return parse_dataobj_language;
case STK_DATA_OBJECT_TYPE_BROWSER_ID:
return parse_dataobj_browser_id;
+ case STK_DATA_OBJECT_TYPE_URL:
+ return parse_dataobj_url;
case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE:
return parse_dataobj_text_attr;
case STK_DATA_OBJECT_TYPE_FRAME_ID:
--
1.6.3.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 03/13] Add parser for bearer objects
2010-04-06 10:06 ` [PATCH 02/13] Add parser for url objects Yang Gu
@ 2010-04-06 10:06 ` Yang Gu
2010-04-06 10:06 ` [PATCH 04/13] Break out stk_file iterator to parse file list objects Yang Gu
0 siblings, 1 reply; 14+ messages in thread
From: Yang Gu @ 2010-04-06 10:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1660 bytes --]
---
src/stkutil.c | 10 ++++++++++
src/stkutil.h | 7 +++++++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 2fc5287..c249a3a 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1022,6 +1022,14 @@ static gboolean parse_dataobj_url(struct comprehension_tlv_iter *iter,
return parse_dataobj_common_text(iter, url);
}
+/* Defined in TS 102.223 Section 8.49 */
+static gboolean parse_dataobj_bearer(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.72 */
static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
void *user)
@@ -1148,6 +1156,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
return parse_dataobj_browser_id;
case STK_DATA_OBJECT_TYPE_URL:
return parse_dataobj_url;
+ case STK_DATA_OBJECT_TYPE_BEARER:
+ return parse_dataobj_bearer;
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 3f96159..3dcb2c3 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -309,6 +309,13 @@ enum stk_browser_id {
STK_BROWSER_ID_CHTML = 0x04
};
+enum stk_bearer {
+ STK_BEARER_SMS = 0x00,
+ STK_BEARER_CS_DATA = 0x01,
+ STK_BEARER_GSM_3G = 0x02,
+ STK_BEARER_PS = 0x03
+};
+
/* 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] 14+ messages in thread
* [PATCH 04/13] Break out stk_file iterator to parse file list objects
2010-04-06 10:06 ` [PATCH 03/13] Add parser for bearer objects Yang Gu
@ 2010-04-06 10:06 ` Yang Gu
2010-04-06 10:06 ` [PATCH 05/13] Add parser for provisioning file reference objects Yang Gu
0 siblings, 1 reply; 14+ messages in thread
From: Yang Gu @ 2010-04-06 10:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 5205 bytes --]
---
src/stkutil.c | 166 +++++++++++++++++++++++++++++++++------------------------
1 files changed, 97 insertions(+), 69 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index c249a3a..8b53e6d 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -39,6 +39,14 @@ enum stk_data_object_flag {
DATAOBJ_FLAG_MINIMUM = 2
};
+struct stk_file_iter {
+ const unsigned char *start;
+ unsigned int pos;
+ unsigned int max;
+ unsigned char len;
+ const unsigned char *file;
+};
+
typedef gboolean (*dataobj_handler)(struct comprehension_tlv_iter *, void *);
/*
@@ -157,6 +165,86 @@ static gboolean parse_dataobj_common_byte_array(
return TRUE;
}
+static void stk_file_iter_init(struct stk_file_iter *iter,
+ const unsigned char *start, unsigned int len)
+{
+ iter->start = start;
+ iter->max = len;
+ iter->pos = 0;
+}
+
+static gboolean stk_file_iter_next(struct stk_file_iter *iter)
+{
+ unsigned int pos = iter->pos;
+ const unsigned int max = iter->max;
+ const unsigned char *start = iter->start;
+ unsigned int i;
+ unsigned char last_type;
+
+ /* SIM EFs always start with ROOT MF, 0x3f */
+ if (start[iter->pos] != 0x3f)
+ return FALSE;
+
+ if (pos + 2 >= max)
+ return FALSE;
+
+ last_type = 0x3f;
+
+ for (i = pos + 2; i < max; i += 2) {
+ /*
+ * Check the validity of file type.
+ * According to TS 11.11, each file id contains of two bytes,
+ * in which the first byte is the type of file. For GSM is:
+ * 0x3f: master file
+ * 0x7f: 1st level dedicated file
+ * 0x5f: 2nd level dedicated file
+ * 0x2f: elementary file under the master file
+ * 0x6f: elementary file under 1st level dedicated file
+ * 0x4f: elementary file under 2nd level dedicated file
+ */
+ switch (start[i]) {
+ case 0x2f:
+ if (last_type != 0x3f)
+ return FALSE;
+ break;
+ case 0x6f:
+ if (last_type != 0x7f)
+ return FALSE;
+ break;
+ case 0x4f:
+ if (last_type != 0x5f)
+ return FALSE;
+ break;
+ case 0x7f:
+ if (last_type != 0x3f)
+ return FALSE;
+ break;
+ case 0x5f:
+ if (last_type != 0x7f)
+ return FALSE;
+ break;
+ default:
+ return FALSE;
+ }
+
+ if ((start[i] == 0x2f) || (start[i] == 0x6f) ||
+ (start[i] == 0x4f)) {
+ if (i + 1 >= max)
+ return FALSE;
+
+ iter->file = start + pos;
+ iter->len = i - pos + 2;
+ iter->pos = i + 2;
+
+ return TRUE;
+ }
+
+ last_type = start[i];
+ }
+
+ return FALSE;
+}
+
/* Defined in TS 102.223 Section 8.1 */
static gboolean parse_dataobj_address(struct comprehension_tlv_iter *iter,
void *user)
@@ -443,10 +531,8 @@ static gboolean parse_dataobj_file_list(struct comprehension_tlv_iter *iter,
GSList **fl = user;
const unsigned char *data;
unsigned int len;
- unsigned int i;
- unsigned int start;
struct stk_file *sf;
- unsigned char last_type;
+ struct stk_file_iter sf_iter;
len = comprehension_tlv_iter_get_length(iter);
if (len < 5)
@@ -454,77 +540,19 @@ static gboolean parse_dataobj_file_list(struct comprehension_tlv_iter *iter,
data = comprehension_tlv_iter_get_data(iter);
- /* SIM EFs always start with ROOT MF, 0x3f */
- if (data[1] != 0x3f)
- return FALSE;
-
- start = 1;
- last_type = 0x3f;
-
- for (i = 3; i < len; i += 2) {
- /*
- * Check the validity of file type.
- * According to TS 11.11, each file id contains of two bytes,
- * in which the first byte is the type of file. For GSM is:
- * 0x3f: master file
- * 0x7f: 1st level dedicated file
- * 0x5f: 2nd level dedicated file
- * 0x2f: elementary file under the master file
- * 0x6f: elementary file under 1st level dedicated file
- * 0x4f: elementary file under 2nd level dedicated file
- */
- switch (data[i]) {
- case 0x3f:
- if ((last_type != 0x2f) && (last_type != 0x6f) &&
- (last_type != 0x4f))
- goto error;
-
- start = i;
+ stk_file_iter_init(&sf_iter, data + 1, len - 1);
- break;
- case 0x2f:
- if (last_type != 0x3f)
- goto error;
- break;
- case 0x6f:
- if (last_type != 0x7f)
- goto error;
- break;
- case 0x4f:
- if (last_type != 0x5f)
- goto error;
- break;
- case 0x7f:
- if (last_type != 0x3f)
- goto error;
- break;
- case 0x5f:
- if (last_type != 0x7f)
- goto error;
- break;
- default:
+ while (stk_file_iter_next(&sf_iter)) {
+ sf = g_try_new0(struct stk_file, 1);
+ if (sf == NULL)
goto error;
- }
-
- if ((data[i] == 0x2f) || (data[i] == 0x6f) ||
- (data[i] == 0x4f)) {
- if (i + 1 >= len)
- goto error;
-
- sf = g_try_new0(struct stk_file, 1);
- if (sf == NULL)
- goto error;
-
- sf->len = i - start + 2;
- memcpy(sf->file, data + start, i - start + 2);
- *fl = g_slist_prepend(*fl, sf);
- }
- last_type = data[i];
+ sf->len = sf_iter.len;
+ memcpy(sf->file, sf_iter.file, sf_iter.len);
+ *fl = g_slist_prepend(*fl, sf);
}
- if ((data[len - 2] != 0x2f) && (data[len - 2] != 0x6f) &&
- (data[len - 2] != 0x4f))
+ if (sf_iter.pos != sf_iter.max)
goto error;
*fl = g_slist_reverse(*fl);
--
1.6.3.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 05/13] Add parser for provisioning file reference objects
2010-04-06 10:06 ` [PATCH 04/13] Break out stk_file iterator to parse file list objects Yang Gu
@ 2010-04-06 10:06 ` Yang Gu
2010-04-06 10:06 ` [PATCH 06/13] Add parser for browser termination cause objects Yang Gu
0 siblings, 1 reply; 14+ messages in thread
From: Yang Gu @ 2010-04-06 10:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1607 bytes --]
---
src/stkutil.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 8b53e6d..2b551e2 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1058,6 +1058,32 @@ static gboolean parse_dataobj_bearer(struct comprehension_tlv_iter *iter,
return parse_dataobj_common_byte_array(iter, array);
}
+/* Defined in TS 102.223 Section 8.50 */
+static gboolean parse_dataobj_provisioning_file_reference(
+ struct comprehension_tlv_iter *iter, void *user)
+{
+ struct stk_file *f = user;
+ const unsigned char *data;
+ struct stk_file_iter sf_iter;
+ unsigned int len = comprehension_tlv_iter_get_length(iter);
+
+ if ((len < 1) || (len > 8))
+ return FALSE;
+
+ data = comprehension_tlv_iter_get_data(iter);
+
+ stk_file_iter_init(&sf_iter, data, len);
+ stk_file_iter_next(&sf_iter);
+
+ if (sf_iter.pos != sf_iter.max)
+ return FALSE;
+
+ f->len = len;
+ memcpy(f->file, 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)
@@ -1186,6 +1212,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
return parse_dataobj_url;
case STK_DATA_OBJECT_TYPE_BEARER:
return parse_dataobj_bearer;
+ case STK_DATA_OBJECT_TYPE_PROVISIONING_FILE_REFERENCE:
+ return parse_dataobj_provisioning_file_reference;
case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE:
return parse_dataobj_text_attr;
case STK_DATA_OBJECT_TYPE_FRAME_ID:
--
1.6.3.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 06/13] Add parser for browser termination cause objects
2010-04-06 10:06 ` [PATCH 05/13] Add parser for provisioning file reference objects Yang Gu
@ 2010-04-06 10:06 ` Yang Gu
2010-04-06 10:06 ` [PATCH 07/13] Add parser for bearer description objects Yang Gu
0 siblings, 1 reply; 14+ messages in thread
From: Yang Gu @ 2010-04-06 10:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1667 bytes --]
---
src/stkutil.c | 10 ++++++++++
src/stkutil.h | 5 +++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 2b551e2..4998440 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1084,6 +1084,14 @@ static gboolean parse_dataobj_provisioning_file_reference(
return TRUE;
}
+/* Defined in 102.223 Section 8.51 */
+static gboolean parse_dataobj_browser_termination_cause(
+ 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.72 */
static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
void *user)
@@ -1214,6 +1222,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
return parse_dataobj_bearer;
case STK_DATA_OBJECT_TYPE_PROVISIONING_FILE_REFERENCE:
return parse_dataobj_provisioning_file_reference;
+ case STK_DATA_OBJECT_TYPE_BROWSER_TERMINATION_CAUSE:
+ return parse_dataobj_browser_termination_cause;
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 3dcb2c3..746c5ff 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -316,6 +316,11 @@ enum stk_bearer {
STK_BEARER_PS = 0x03
};
+enum stk_browser_termination_cause {
+ STK_BROWSER_USER_TERMINATION = 0x00,
+ STK_BROWSER_ERROR_TERMINATION = 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] 14+ messages in thread
* [PATCH 07/13] Add parser for bearer description objects
2010-04-06 10:06 ` [PATCH 06/13] Add parser for browser termination cause objects Yang Gu
@ 2010-04-06 10:06 ` Yang Gu
2010-04-06 10:06 ` [PATCH 08/13] Add parser for channel data objects Yang Gu
0 siblings, 1 reply; 14+ messages in thread
From: Yang Gu @ 2010-04-06 10:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2870 bytes --]
---
src/stkutil.c | 21 +++++++++++++++++++++
src/stkutil.h | 23 +++++++++++++++++++++++
2 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 4998440..f27ff69 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1092,6 +1092,25 @@ static gboolean parse_dataobj_browser_termination_cause(
return parse_dataobj_common_byte(iter, byte);
}
+/* Defined in TS 102.223 Section 8.52 */
+static gboolean parse_dataobj_bearer_description(
+ struct comprehension_tlv_iter *iter, void *user)
+{
+ struct stk_bearer_description *bd = user;
+ 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);
+ bd->type = data[0];
+ bd->len = len - 1;
+ memcpy(bd->pars, data + 1, bd->len);
+
+ return TRUE;
+}
+
/* Defined in TS 102.223 Section 8.72 */
static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
void *user)
@@ -1224,6 +1243,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
return parse_dataobj_provisioning_file_reference;
case STK_DATA_OBJECT_TYPE_BROWSER_TERMINATION_CAUSE:
return parse_dataobj_browser_termination_cause;
+ case STK_DATA_OBJECT_TYPE_BEARER_DESCRIPTION:
+ return parse_dataobj_bearer_description;
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 746c5ff..c1b9af0 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -321,6 +321,17 @@ enum stk_browser_termination_cause {
STK_BROWSER_ERROR_TERMINATION = 0x01
};
+enum stk_bearer_type {
+ STK_BEARER_TYPE_DEFAULT = 0x03,
+ STK_BEARER_TYPE_INDEPENDENT = 0x04,
+ STK_BEARER_TYPE_BLUETOOTH = 0x05,
+ STK_BEARER_TYPE_IRDA = 0x06,
+ STK_BEARER_TYPE_RS232 = 0x07,
+ STK_BEARER_TYPE_PACKET_DATA_SERVICE = 0x08,
+ STK_BEARER_TYPE_I_WLAN = 0x0a,
+ STK_BEARER_TYPE_USB = 0x10
+};
+
/* For data object that only has a byte array with undetermined length */
struct stk_common_byte_array {
unsigned char *array;
@@ -521,6 +532,18 @@ struct stk_timer_value {
};
/*
+ * According to 102.223 Section 8.52 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 bearer type for 1 byte, so the maxmimum size of bearer parameters
+ * is 126.
+ */
+struct stk_bearer_description {
+ unsigned char type;
+ unsigned char pars[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] 14+ messages in thread
* [PATCH 08/13] Add parser for channel data objects
2010-04-06 10:06 ` [PATCH 07/13] Add parser for bearer description objects Yang Gu
@ 2010-04-06 10:06 ` Yang Gu
2010-04-06 10:06 ` [PATCH 09/13] Add parser for channel data length objects Yang Gu
0 siblings, 1 reply; 14+ messages in thread
From: Yang Gu @ 2010-04-06 10:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1166 bytes --]
---
src/stkutil.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index f27ff69..0c9108f 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1111,6 +1111,14 @@ static gboolean parse_dataobj_bearer_description(
return TRUE;
}
+/* Defined in TS 102.223 Section 8.53 */
+static gboolean parse_dataobj_channel_data(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.72 */
static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
void *user)
@@ -1245,6 +1253,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
return parse_dataobj_browser_termination_cause;
case STK_DATA_OBJECT_TYPE_BEARER_DESCRIPTION:
return parse_dataobj_bearer_description;
+ case STK_DATA_OBJECT_TYPE_CHANNEL_DATA:
+ return parse_dataobj_channel_data;
case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE:
return parse_dataobj_text_attr;
case STK_DATA_OBJECT_TYPE_FRAME_ID:
--
1.6.3.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 09/13] Add parser for channel data length objects
2010-04-06 10:06 ` [PATCH 08/13] Add parser for channel data objects Yang Gu
@ 2010-04-06 10:06 ` Yang Gu
2010-04-06 10:06 ` [PATCH 10/13] Add parser for buffer size objects Yang Gu
0 siblings, 1 reply; 14+ messages in thread
From: Yang Gu @ 2010-04-06 10:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1212 bytes --]
---
src/stkutil.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 0c9108f..b841fa6 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1119,6 +1119,14 @@ static gboolean parse_dataobj_channel_data(struct comprehension_tlv_iter *iter,
return parse_dataobj_common_byte_array(iter, array);
}
+/* Defined in TS 102.223 Section 8.54 */
+static gboolean parse_dataobj_channel_data_length(
+ 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.72 */
static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
void *user)
@@ -1255,6 +1263,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
return parse_dataobj_bearer_description;
case STK_DATA_OBJECT_TYPE_CHANNEL_DATA:
return parse_dataobj_channel_data;
+ case STK_DATA_OBJECT_TYPE_CHANNEL_DATA_LENGTH:
+ return parse_dataobj_channel_data_length;
case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE:
return parse_dataobj_text_attr;
case STK_DATA_OBJECT_TYPE_FRAME_ID:
--
1.6.3.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 10/13] Add parser for buffer size objects
2010-04-06 10:06 ` [PATCH 09/13] Add parser for channel data length objects Yang Gu
@ 2010-04-06 10:06 ` Yang Gu
2010-04-06 10:06 ` [PATCH 11/13] Add parser for channel status objects Yang Gu
0 siblings, 1 reply; 14+ messages in thread
From: Yang Gu @ 2010-04-06 10:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1335 bytes --]
---
src/stkutil.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index b841fa6..30c476d 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1127,6 +1127,22 @@ static gboolean parse_dataobj_channel_data_length(
return parse_dataobj_common_byte(iter, byte);
}
+/* Defined in TS 102.223 Section 8.55 */
+static gboolean parse_dataobj_buffer_size(struct comprehension_tlv_iter *iter,
+ void *user)
+{
+ unsigned short *size = user;
+ const unsigned char *data;
+
+ if (comprehension_tlv_iter_get_length(iter) != 2)
+ return FALSE;
+
+ data = comprehension_tlv_iter_get_data(iter);
+ *size = (data[0] << 8) + data[1];
+
+ return TRUE;
+}
+
/* Defined in TS 102.223 Section 8.72 */
static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
void *user)
@@ -1265,6 +1281,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
return parse_dataobj_channel_data;
case STK_DATA_OBJECT_TYPE_CHANNEL_DATA_LENGTH:
return parse_dataobj_channel_data_length;
+ case STK_DATA_OBJECT_TYPE_BUFFER_SIZE:
+ return parse_dataobj_buffer_size;
case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE:
return parse_dataobj_text_attr;
case STK_DATA_OBJECT_TYPE_FRAME_ID:
--
1.6.3.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 11/13] Add parser for channel status objects
2010-04-06 10:06 ` [PATCH 10/13] Add parser for buffer size objects Yang Gu
@ 2010-04-06 10:06 ` Yang Gu
2010-04-06 10:06 ` [PATCH 12/13] Add parser for card reader identifier objects Yang Gu
0 siblings, 1 reply; 14+ messages in thread
From: Yang Gu @ 2010-04-06 10:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1372 bytes --]
---
src/stkutil.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 30c476d..01124a5 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1143,6 +1143,24 @@ static gboolean parse_dataobj_buffer_size(struct comprehension_tlv_iter *iter,
return TRUE;
}
+/* Defined in TS 102.223 Section 8.56 */
+static gboolean parse_dataobj_channel_status(
+ struct comprehension_tlv_iter *iter, void *user)
+{
+ unsigned char *status = user;
+ const unsigned char *data;
+
+ if (comprehension_tlv_iter_get_length(iter) != 2)
+ return FALSE;
+
+ data = comprehension_tlv_iter_get_data(iter);
+
+ /* Assume channel status is 2 bytes long */
+ memcpy(status, data, 2);
+
+ return TRUE;
+}
+
/* Defined in TS 102.223 Section 8.72 */
static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
void *user)
@@ -1283,6 +1301,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
return parse_dataobj_channel_data_length;
case STK_DATA_OBJECT_TYPE_BUFFER_SIZE:
return parse_dataobj_buffer_size;
+ case STK_DATA_OBJECT_TYPE_CHANNEL_STATUS:
+ return parse_dataobj_channel_status;
case STK_DATA_OBJECT_TYPE_TEXT_ATTRIBUTE:
return parse_dataobj_text_attr;
case STK_DATA_OBJECT_TYPE_FRAME_ID:
--
1.6.3.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 12/13] Add parser for card reader identifier objects
2010-04-06 10:06 ` [PATCH 11/13] Add parser for channel status objects Yang Gu
@ 2010-04-06 10:06 ` Yang Gu
2010-04-06 10:06 ` [PATCH 13/13] Add parser for other address objects Yang Gu
0 siblings, 1 reply; 14+ messages in thread
From: Yang Gu @ 2010-04-06 10:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2024 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 01124a5..28a09d9 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1161,6 +1161,24 @@ static gboolean parse_dataobj_channel_status(
return TRUE;
}
+/* Defined in TS 102.223 Section 8.57 */
+static gboolean parse_dataobj_card_reader_id(
+ struct comprehension_tlv_iter *iter, void *user)
+{
+ struct stk_card_reader_id *cr_id = user;
+ 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);
+ cr_id->len = len;
+ memcpy(cr_id->id, 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)
@@ -1303,6 +1321,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
return parse_dataobj_buffer_size;
case STK_DATA_OBJECT_TYPE_CHANNEL_STATUS:
return parse_dataobj_channel_status;
+ case STK_DATA_OBJECT_TYPE_CARD_READER_ID:
+ return parse_dataobj_card_reader_id;
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 c1b9af0..511b912 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -544,6 +544,15 @@ struct stk_bearer_description {
};
/*
+ * According to 102.223 Section 8.57 the length of CTLV is 1 byte. This means
+ * that the maximum size is 127 according to the rules of CTLVs.
+ */
+struct stk_card_reader_id {
+ unsigned char id[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.6.3.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 13/13] Add parser for other address objects
2010-04-06 10:06 ` [PATCH 12/13] Add parser for card reader identifier objects Yang Gu
@ 2010-04-06 10:06 ` Yang Gu
0 siblings, 0 replies; 14+ messages in thread
From: Yang Gu @ 2010-04-06 10:06 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2375 bytes --]
---
src/stkutil.c | 23 +++++++++++++++++++++++
src/stkutil.h | 14 ++++++++++++++
2 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 28a09d9..7d9e2e0 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1179,6 +1179,27 @@ static gboolean parse_dataobj_card_reader_id(
return TRUE;
}
+/* Defined in TS 102.223 Section 8.58 */
+static gboolean parse_dataobj_other_address(
+ struct comprehension_tlv_iter *iter, void *user)
+{
+ struct stk_other_address *oa = user;
+ const unsigned char *data;
+ unsigned char len = comprehension_tlv_iter_get_length(iter);
+
+ if (len == 0)
+ return TRUE;
+
+ if ((len != 5) && (len != 17))
+ return FALSE;
+
+ data = comprehension_tlv_iter_get_data(iter);
+ oa->type = data[0];
+ memcpy(oa->addr, data + 1, len - 1);
+
+ return TRUE;
+}
+
/* Defined in TS 102.223 Section 8.72 */
static gboolean parse_dataobj_text_attr(struct comprehension_tlv_iter *iter,
void *user)
@@ -1323,6 +1344,8 @@ static dataobj_handler handler_for_type(enum stk_data_object_type type)
return parse_dataobj_channel_status;
case STK_DATA_OBJECT_TYPE_CARD_READER_ID:
return parse_dataobj_card_reader_id;
+ case STK_DATA_OBJECT_TYPE_OTHER_ADDRESS:
+ return parse_dataobj_other_address;
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 511b912..0811048 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -332,6 +332,11 @@ enum stk_bearer_type {
STK_BEARER_TYPE_USB = 0x10
};
+enum stk_address_type {
+ STK_ADDRESS_IPV4 = 0x21,
+ STK_ADDRESS_IPV6 = 0x57
+};
+
/* For data object that only has a byte array with undetermined length */
struct stk_common_byte_array {
unsigned char *array;
@@ -553,6 +558,15 @@ struct stk_card_reader_id {
};
/*
+ * According to 102.223 Section 8.58 the address can be either ipv4 or ipv6.
+ * So the maximum size is 16 (for ipv6).
+ */
+struct stk_other_address {
+ unsigned char addr[16];
+ unsigned char type;
+};
+
+/*
* 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] 14+ messages in thread
* Re: [PATCH 01/13] Fix the logic when parsing c-apdu objects
2010-04-06 10:06 [PATCH 01/13] Fix the logic when parsing c-apdu objects Yang Gu
2010-04-06 10:06 ` [PATCH 02/13] Add parser for url objects Yang Gu
@ 2010-04-14 18:13 ` Denis Kenzior
1 sibling, 0 replies; 14+ messages in thread
From: Denis Kenzior @ 2010-04-14 18:13 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 201 bytes --]
Hi Yang,
> ---
> src/stkutil.c | 1 -
> 1 files changed, 0 insertions(+), 1 deletions(-)
>
All 13 patches have now been applied upstream with minor fixed in-between.
Regards,
-Denis
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2010-04-14 18:13 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-06 10:06 [PATCH 01/13] Fix the logic when parsing c-apdu objects Yang Gu
2010-04-06 10:06 ` [PATCH 02/13] Add parser for url objects Yang Gu
2010-04-06 10:06 ` [PATCH 03/13] Add parser for bearer objects Yang Gu
2010-04-06 10:06 ` [PATCH 04/13] Break out stk_file iterator to parse file list objects Yang Gu
2010-04-06 10:06 ` [PATCH 05/13] Add parser for provisioning file reference objects Yang Gu
2010-04-06 10:06 ` [PATCH 06/13] Add parser for browser termination cause objects Yang Gu
2010-04-06 10:06 ` [PATCH 07/13] Add parser for bearer description objects Yang Gu
2010-04-06 10:06 ` [PATCH 08/13] Add parser for channel data objects Yang Gu
2010-04-06 10:06 ` [PATCH 09/13] Add parser for channel data length objects Yang Gu
2010-04-06 10:06 ` [PATCH 10/13] Add parser for buffer size objects Yang Gu
2010-04-06 10:06 ` [PATCH 11/13] Add parser for channel status objects Yang Gu
2010-04-06 10:06 ` [PATCH 12/13] Add parser for card reader identifier objects Yang Gu
2010-04-06 10:06 ` [PATCH 13/13] Add parser for other address objects Yang Gu
2010-04-14 18:13 ` [PATCH 01/13] Fix the logic when parsing c-apdu objects Denis Kenzior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox