From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH] Add air interface flash validation in CDMA voice call
Date: Thu, 18 Aug 2011 14:01:07 -0500 [thread overview]
Message-ID: <4E4D6173.7030302@gmail.com> (raw)
In-Reply-To: <1313480375-30628-1-git-send-email-caiwen.zhang@windriver.com>
[-- Attachment #1: Type: text/plain, Size: 2413 bytes --]
Hi Caiwen,
On 08/16/2011 02:39 AM, Caiwen Zhang wrote:
> Check whether air interface flash is valid:
>
> 1. Air interface flash should be sent during a call
>
> 2. flash string may include feature code, digits (0-9) and end marks(*, #),
> along with any additional PIN information, called party number, etc.
> Generally, should be characters can be input in dialer.
>
> 3. flash without a string is allowed, it is used to switch call status.
>
> ---
> src/cdma-voicecall.c | 30 ++++++++++++++++++++++++++++++
> 1 files changed, 30 insertions(+), 0 deletions(-)
>
> diff --git a/src/cdma-voicecall.c b/src/cdma-voicecall.c
> index bbf805f..8de94c7 100644
> --- a/src/cdma-voicecall.c
> +++ b/src/cdma-voicecall.c
> @@ -307,6 +307,30 @@ static DBusMessage *voicecall_manager_answer(DBusConnection *conn,
> return NULL;
> }
>
> +static ofono_bool_t is_valid_flash_string(const char *str)
> +{
> + int len;
> + int i;
> +
> + /* flash string is empty, it is allowed */
> + if (str == NULL)
> + return TRUE;
NULL strings are not valid here, they can't be sent over D-Bus. Please
omit this check.
> +
> + len = strlen(str);
> + if (len == 0)
> + return TRUE;
> +
Please write this as:
int len = strlen(str);
int i;
if (len == 0)
return TRUE
...
> + for (i = 0; i < len; i++) {
> + if (g_ascii_isdigit(str[i]) || str[i] == '*' ||
> + str[i] == '#' || str[i] == '+')
> + continue;
> + else
> + return FALSE;
> + }
> +
> + return TRUE;
> +}
> +
> static DBusMessage *voicecall_manager_flash(DBusConnection *conn,
> DBusMessage *msg, void *data)
> {
> @@ -319,10 +343,16 @@ static DBusMessage *voicecall_manager_flash(DBusConnection *conn,
> if (vc->driver->send_flash == NULL)
> return __ofono_error_not_implemented(msg);
>
> + if (vc->status == CDMA_CALL_STATUS_DISCONNECTED)
> + return __ofono_error_failed(msg);
> +
Just to double check, can a flash be sent during
dialing/alerting/incoming stage?
> if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &string,
> DBUS_TYPE_INVALID) == FALSE)
> return __ofono_error_invalid_args(msg);
>
> + if (is_valid_flash_string(string) == FALSE)
> + return __ofono_error_invalid_args(msg);
> +
> vc->pending = dbus_message_ref(msg);
>
> vc->driver->send_flash(vc, string, generic_callback, vc);
Regards,
-Denis
next prev parent reply other threads:[~2011-08-18 19:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-16 7:39 [PATCH] Add air interface flash validation in CDMA voice call Caiwen Zhang
2011-08-18 19:01 ` Denis Kenzior [this message]
2011-08-19 5:46 ` Zhang, Caiwen
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=4E4D6173.7030302@gmail.com \
--to=denkenz@gmail.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