Open Source Telephony
 help / color / mirror / Atom feed
From: Yang Gu <yang.gu@intel.com>
To: ofono@ofono.org
Subject: [PATCH 2/6] stkutil: Move advance of ctlv to decicated proactive commands parser
Date: Mon, 26 Apr 2010 18:29:22 +0800	[thread overview]
Message-ID: <1272277766-25432-2-git-send-email-yang.gu@intel.com> (raw)
In-Reply-To: <1272277766-25432-1-git-send-email-yang.gu@intel.com>

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

Not all the proactive commands have comprehension tlv other than command
details and device identities. So the appropriate code should be moved to
decicated parser if needed.
---
 src/stkutil.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index b4279c1..9f9b1a6 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -2079,6 +2079,9 @@ static gboolean parse_display_text(struct stk_command *command,
 	if (command->dst != STK_DEVICE_IDENTITY_TYPE_DISPLAY)
 		return FALSE;
 
+	if (comprehension_tlv_iter_next(iter) != TRUE)
+		return FALSE;
+
 	obj->frame_id = 0xFF;
 
 	ret = parse_dataobj(iter, STK_DATA_OBJECT_TYPE_TEXT,
@@ -2121,6 +2124,9 @@ static gboolean parse_get_inkey(struct stk_command *command,
 	if (command->dst != STK_DEVICE_IDENTITY_TYPE_TERMINAL)
 		return FALSE;
 
+	if (comprehension_tlv_iter_next(iter) != TRUE)
+		return FALSE;
+
 	obj->frame_id = 0xFF;
 
 	ret = parse_dataobj(iter, STK_DATA_OBJECT_TYPE_TEXT,
@@ -2165,6 +2171,9 @@ static gboolean parse_get_input(struct stk_command *command,
 	if (command->dst != STK_DEVICE_IDENTITY_TYPE_TERMINAL)
 		return FALSE;
 
+	if (comprehension_tlv_iter_next(iter) != TRUE)
+		return FALSE;
+
 	ret = parse_dataobj(iter, STK_DATA_OBJECT_TYPE_TEXT,
 				DATAOBJ_FLAG_MANDATORY | DATAOBJ_FLAG_MINIMUM,
 				&obj->text,
@@ -2210,6 +2219,9 @@ static gboolean parse_send_sms(struct stk_command *command,
 	if (command->dst != STK_DEVICE_IDENTITY_TYPE_NETWORK)
 		return FALSE;
 
+	if (comprehension_tlv_iter_next(iter) != TRUE)
+		return FALSE;
+
 	ret = parse_dataobj(iter, STK_DATA_OBJECT_TYPE_ALPHA_ID, 0,
 				&obj->alpha_id,
 				STK_DATA_OBJECT_TYPE_ADDRESS, 0,
@@ -2295,9 +2307,6 @@ struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu,
 	command->src = data[0];
 	command->dst = data[1];
 
-	if (comprehension_tlv_iter_next(&iter) != TRUE)
-		return FALSE;
-
 	switch (command->type) {
 	case STK_COMMAND_TYPE_DISPLAY_TEXT:
 		ok = parse_display_text(command, &iter);
-- 
1.7.0.4


  reply	other threads:[~2010-04-26 10:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-26 10:29 [PATCH 1/6] stkutil: Fix the assignment to minimum set Yang Gu
2010-04-26 10:29 ` Yang Gu [this message]
2010-04-26 14:53   ` [PATCH 2/6] stkutil: Move advance of ctlv to decicated proactive commands parser Andrzej Zaborowski
2010-04-26 15:39     ` Denis Kenzior
2010-04-27  9:42       ` Gu, Yang
2010-04-26 10:29 ` [PATCH 3/6] stkutil: Use struct to represent frame id Yang Gu
2010-04-26 16:41   ` Denis Kenzior
2010-04-26 10:29 ` [PATCH 4/6] test-stkutil: Refactor the implementation to test display text Yang Gu
2010-04-26 10:29 ` [PATCH 5/6] stkutil: Add parser for more time proactive commands Yang Gu
2010-04-26 10:29 ` [PATCH 6/6] test-stkutil: Add unit test for more time parser Yang Gu
2010-04-26 16:32 ` [PATCH 1/6] stkutil: Fix the assignment to minimum set Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1272277766-25432-2-git-send-email-yang.gu@intel.com \
    --to=yang.gu@intel.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox