* [PATCH] Add air interface flash validation in CDMA voice call
@ 2011-08-16 7:39 Caiwen Zhang
2011-08-18 19:01 ` Denis Kenzior
0 siblings, 1 reply; 3+ messages in thread
From: Caiwen Zhang @ 2011-08-16 7:39 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1938 bytes --]
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;
+
+ len = strlen(str);
+ 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);
+
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);
--
1.7.5
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] Add air interface flash validation in CDMA voice call
2011-08-16 7:39 [PATCH] Add air interface flash validation in CDMA voice call Caiwen Zhang
@ 2011-08-18 19:01 ` Denis Kenzior
2011-08-19 5:46 ` Zhang, Caiwen
0 siblings, 1 reply; 3+ messages in thread
From: Denis Kenzior @ 2011-08-18 19:01 UTC (permalink / raw)
To: ofono
[-- 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
^ permalink raw reply [flat|nested] 3+ messages in thread* RE: [PATCH] Add air interface flash validation in CDMA voice call
2011-08-18 19:01 ` Denis Kenzior
@ 2011-08-19 5:46 ` Zhang, Caiwen
0 siblings, 0 replies; 3+ messages in thread
From: Zhang, Caiwen @ 2011-08-19 5:46 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1126 bytes --]
Hi Denis,
> > + /* 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.
>
I will remove it.
> > 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?
>
During dialing state, the flash should be ignored.
There is no alerting state used in CDMA voice call. It doesn't distinguish
alerting state and connected state.
There are two situations for incoming stage:
(1) only one ringing call, the flash should be ignored
(2) there is a waiting call. send flash will switch the calls.
To make it clearer, I will specified the valid states.
Please have a look the previous two patches relative call waiting and call
status notify. It is required to check call waiting status here. It depends on
those patches.
Thanks!
Caiwen
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-08-19 5:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-16 7:39 [PATCH] Add air interface flash validation in CDMA voice call Caiwen Zhang
2011-08-18 19:01 ` Denis Kenzior
2011-08-19 5:46 ` Zhang, Caiwen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.