Send connman mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."
Today's Topics:
1. Re: [PATCH 1/2] client: Added session create append dict
(Mounesh Sutar)
2. Re: [PATCH 2/2] client: Add session contextIdentifier config
support (Mounesh Sutar)
----------------------------------------------------------------------
Message: 1
Date: Fri, 24 Nov 2017 13:36:08 +0530
From: Mounesh Sutar <[email protected]>
To: [email protected]
Cc: "Sutar, Mounesh" <[email protected]>, Mounesh Sutar
<[email protected]>
Subject: Re: [PATCH 1/2] client: Added session create append dict
Message-ID:
<CAHRsm5Mg7VM=1nc8pw+f7yok3ooofwh-kaywkx3wbrxjcjd...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hi,
This change is a follow up of previous discussion:
https://lists.01.org/pipermail/connman/2017-October/022198.html
Regards,
Mounesh
On Thu, Nov 23, 2017 at 3:43 PM, <[email protected]> wrote:
> From: Mounesh Sutar <[email protected]>
>
>
> diff --git a/client/commands.c b/client/commands.c
> index 7488850..4864ad1 100644
> --- a/client/commands.c
> +++ b/client/commands.c
> @@ -901,6 +901,13 @@ struct config_append {
> int values;
> };
>
> +struct session_options {
> + char **args;
> + int num;
> + char *notify_path;
> + struct connman_option *options;
> +};
> +
> static void config_append_ipv4(DBusMessageIter *iter,
> void *user_data)
> {
> @@ -1820,28 +1827,132 @@ static int session_create_cb(DBusMessageIter
> *iter, const char *error,
> return -EINPROGRESS;
> }
>
> +static void session_config_append_array(DBusMessageIter *iter,
> + void *user_data)
> +{
> + struct config_append *append = user_data;
> + char **opts = append->opts;
> + int i = 1;
> +
> + if (!opts)
> + return;
> +
> + while (opts[i] && strncmp(opts[i], "--", 2) != 0) {
> + dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING,
> + &opts[i]);
> + i++;
> + }
> +
> + append->values = i;
> +}
> +
> +static void session_create_append_dict(DBusMessageIter *iter, void
> *user_data)
> +{
> + struct session_options *args_struct = user_data;
> + int index = 0, res = 0;
> + struct config_append append;
> + char c;
> + char *ifname;
> + dbus_bool_t source_ip_rule;
> +
> + while (index < args_struct->num && args_struct->args[index]) {
> + append.opts = &args_struct->args[index];
> + append.values = 0;
> +
> + c = parse_args(args_struct->args[index],
> args_struct->options);
> +
> + switch (c) {
> + case 'b':
> + __connmanctl_dbus_append_dict_string_array(iter,
> "AllowedBearers",
> +
> session_config_append_array,
> +
> &append);
> + break;
> + case 't':
> + if (! args_struct->args[index + 1]) {
> + res = -EINVAL;
> + break;
> + }
> + __connmanctl_dbus_append_dict_entry(iter,
> "ConnectionType",
> +
> DBUS_TYPE_STRING,
> +
> &args_struct->args[index + 1]);
> + append.values = 2;
> + break;
> + case 'i':
> + if (index + 1 < args_struct->num)
> + ifname = args_struct->args[index + 1];
> + else
> + ifname = "";
> + __connmanctl_dbus_append_dict_entry(iter,
> "AllowedInterface",
> +
> DBUS_TYPE_STRING,
> + &ifname);
> + append.values = 2;
> + break;
> + case 's':
> + if (! args_struct->args[index + 1]) {
> + res = -EINVAL;
> + break;
> + }
> + switch (parse_boolean( args_struct->args[index +
> 1])) {
> + case 1:
> + source_ip_rule = TRUE;
> + break;
> + case 0:
> + source_ip_rule = FALSE;
> + break;
> + default:
> + res = -EINVAL;
> + break;
> + }
> + __connmanctl_dbus_append_dict_entry(iter,
> "SourceIPRule",
> +
> DBUS_TYPE_BOOLEAN,
> +
> &source_ip_rule);
> + append.values = 2;
> + break;
> + default:
> + res = -EINVAL;
> + }
> +
> + if (res < 0 && res != -EINPROGRESS) {
> + printf("Error '%s': %s\n",
> args_struct->args[index],
> + strerror(-res));
> + return;
> + }
> +
> + index += append.values;
> + }
> +
> + return;
> +}
> +
> static void session_create_append(DBusMessageIter *iter, void *user_data)
> {
> - const char *notify_path = user_data;
> + struct session_options *args_struct = user_data;
>
> - __connmanctl_dbus_append_dict(iter, NULL, NULL);
> + __connmanctl_dbus_append_dict(iter, session_create_append_dict,
> + args_struct);
>
> dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH,
> - ¬ify_path);
> + &args_struct->notify_path);
> }
>
> -static int session_create(gboolean connect)
> +static int session_create(gboolean connect, char *args[], int num,
> + struct connman_option *options)
> {
> int res;
> char *notify_path;
> + struct session_options args_struct;
> + args_struct.args = args;
> + args_struct.num = num;
> + args_struct.options = options;
>
> notify_path = g_strdup_printf("/net/connman/connmanctl%d",
> getpid());
> session_notify_add(notify_path);
> + args_struct.notify_path = notify_path;
>
> res = __connmanctl_dbus_method_call(connection, "net.connman",
> "/",
> "net.connman.Manager", "CreateSession",
> session_create_cb, GINT_TO_POINTER(connect),
> - session_create_append, notify_path);
> + session_create_append, &args_struct);
>
> g_free(notify_path);
>
> @@ -1895,25 +2006,6 @@ static int session_config_return(DBusMessageIter
> *iter, const char *error,
> return 0;
> }
>
> -static void session_config_append_array(DBusMessageIter *iter,
> - void *user_data)
> -{
> - struct config_append *append = user_data;
> - char **opts = append->opts;
> - int i = 1;
> -
> - if (!opts)
> - return;
> -
> - while (opts[i] && strncmp(opts[i], "--", 2) != 0) {
> - dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING,
> - &opts[i]);
> - i++;
> - }
> -
> - append->values = i;
> -}
> -
> static int session_config(char *args[], int num,
> struct connman_option *options)
> {
> @@ -2018,12 +2110,13 @@ static int cmd_session(char *args[], int num,
> struct connman_option *options)
> case 1:
> if (session_path)
> return -EALREADY;
> - return session_create(FALSE);
> + return session_create(FALSE, &args[2], num - 2, options);
>
> default:
> if (!strcmp(command, "connect")) {
> if (!session_path)
> - return session_create(TRUE);
> + return session_create(TRUE, &args[2], num
> - 2,
> + options);
>
> return session_connect();
>
> --
> 2.7.4
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.01.org/pipermail/connman/attachments/20171124/d497b8d6/attachment-0001.html>
------------------------------
Message: 2
Date: Fri, 24 Nov 2017 13:38:20 +0530
From: Mounesh Sutar <[email protected]>
To: [email protected]
Cc: "Sutar, Mounesh" <[email protected]>, Mounesh Sutar
<[email protected]>
Subject: Re: [PATCH 2/2] client: Add session contextIdentifier config
support
Message-ID:
<CAHRsm5Po-W75yQVFfuCAn2k2M2Jrp_+YDsdDRj1+f=j=s03...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hi,
This change is a follow up of previous discussion:
https://lists.01.org/pipermail/connman/2017-October/022198.html
Regards,
Mounesh
On Thu, Nov 23, 2017 at 3:44 PM, <[email protected]> wrote:
> From: Mounesh Sutar <[email protected]>
>
> Added contextIdentifier field in session config.
> This allows processes to select a service context dependent
> behaviour for which the routing decision is made.
>
> diff --git a/client/commands.c b/client/commands.c
> index 4864ad1..a9e1906 100644
> --- a/client/commands.c
> +++ b/client/commands.c
> @@ -1908,6 +1908,16 @@ static void session_create_append_dict(DBusMessageIter
> *iter, void *user_data)
>
> &source_ip_rule);
> append.values = 2;
> break;
> + case 'c':
> + if (!args_struct->args[index + 1]) {
> + res = -EINVAL;
> + break;
> + }
> + __connmanctl_dbus_append_dict_entry(iter,
> "ContextIdentifier",
> +
> DBUS_TYPE_STRING,
> +
> &args_struct->args[index + 1]);
> + append.values = 2;
> + break;
> default:
> res = -EINVAL;
> }
> @@ -2075,6 +2085,18 @@ static int session_config(char *args[], int num,
> DBUS_TYPE_BOOLEAN,
> &source_ip_rule);
> append.values = 2;
> break;
> + case 'c':
> + if (!args[index + 1]) {
> + res = -EINVAL;
> + break;
> + }
> +
> + res = __connmanctl_dbus_session_
> change(connection,
> + session_path,
> session_config_return,
> + "ctxid", "ctxid",
> DBUS_TYPE_STRING,
> + &args[index + 1]);
> + append.values = 2;
> + break;
>
> default:
> res = -EINVAL;
> @@ -2366,6 +2388,7 @@ static struct connman_option session_options[] = {
> {"type", 't', "local|internet|any"},
> {"ifname", 'i', "[<interface_name>]"},
> {"srciprule", 's', "yes|no"},
> + {"ctxid", 'c', "Context identifier"},
> { NULL, }
> };
>
> --
> 2.7.4
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.01.org/pipermail/connman/attachments/20171124/540a8059/attachment.html>
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman
------------------------------
End of connman Digest, Vol 25, Issue 13
***************************************