RE: connman connection policy

2015-03-19 Thread Kallumari Nagaraja Rao, RammohanX
Hello All,

Thank you for the support. 
I am able to set it running by supplying required passphrase.

Great feeling :)

Regards,
Ram

-Original Message-
From: Jukka Rissanen [mailto:jukka.rissa...@linux.intel.com] 
Sent: Wednesday, March 18, 2015 6:54 PM
To: connman@connman.net
Cc: Kallumari Nagaraja Rao, RammohanX
Subject: Re: connman connection policy

Hi Ram,

On ke, 2015-03-18 at 13:12 +, Kallumari Nagaraja Rao, RammohanX
wrote:
 Hello Jukka,
 
 Is the Agent request input happens via a dictionary ?

Yes, the passphrase is sent as a dictionary element. See doc/agent-api.txt 
document for details (there are some examples at the end of the document).

 I was able to register a agent handler  getting RequestInput from the 
 ConnMan.
 However I am unable to send out the passphrase out.
 
 static DBusHandlerResult request_passkey_message(DBusConnection *conn, 
 DBusMessage *msg) {
   DBusMessage *reply;
   DBusError derr, error;
   const char *device;
   char passkey[17] = micromax;
   const char *psk = micromax;
 
   reply = dbus_message_new_method_return(msg);
   if (!reply)
   return DBUS_HANDLER_RESULT_NEED_MEMORY;
 
   dbus_error_init(derr);
   if (!dbus_message_get_args(msg, derr, DBUS_TYPE_OBJECT_PATH, device,
  DBUS_TYPE_INVALID)) {
   fprintf(stderr, %s, derr.message);
   dbus_error_free(derr);
   return  error_message(conn, msg, net.connman.Error.Rejected,
   Wrong signature);
   }
 
   if (device)
   printf(Device: %s\n, device);
 
   //memset(passkey, 0, sizeof(passkey));
   printf(Passkey sent over: %s\n, psk);
 
   dbus_message_append_args(reply, DBUS_TYPE_STRING, psk, 
 DBUS_TYPE_INVALID);
 
   dbus_connection_send(conn, reply, NULL);
 
   printf(reply success\n);
 
   dbus_message_unref(reply);
 
   return DBUS_HANDLER_RESULT_HANDLED;
 }
 
 I guess the passkey is currently sent out as a string  the ConnMan may not 
 be able to accept it.
 Not sure how to convert the input into a dictionary  append my passphrase 
 into it.

I am sure you can search the web for examples how to send a dictionary in dbus 
from C-program.

 
 I am able to print the service properly.
 
 Please help me on this. Thanks.
 
 Regards,
 Ram
 


Jukka


___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: connman connection policy

2015-03-18 Thread Jukka Rissanen
Hi Ram,

On ke, 2015-03-18 at 13:12 +, Kallumari Nagaraja Rao, RammohanX
wrote:
 Hello Jukka,
 
 Is the Agent request input happens via a dictionary ?

Yes, the passphrase is sent as a dictionary element. See
doc/agent-api.txt document for details (there are some examples at the
end of the document).

 I was able to register a agent handler  getting RequestInput from the 
 ConnMan.
 However I am unable to send out the passphrase out.
 
 static DBusHandlerResult request_passkey_message(DBusConnection *conn, 
 DBusMessage *msg)
 {
   DBusMessage *reply;
   DBusError derr, error;
   const char *device;
   char passkey[17] = micromax;
   const char *psk = micromax;
 
   reply = dbus_message_new_method_return(msg);
   if (!reply)
   return DBUS_HANDLER_RESULT_NEED_MEMORY;
 
   dbus_error_init(derr);
   if (!dbus_message_get_args(msg, derr, DBUS_TYPE_OBJECT_PATH, device,
  DBUS_TYPE_INVALID)) {
   fprintf(stderr, %s, derr.message);
   dbus_error_free(derr);
   return  error_message(conn, msg, net.connman.Error.Rejected,
   Wrong signature);
   }
 
   if (device)
   printf(Device: %s\n, device);
 
   //memset(passkey, 0, sizeof(passkey));
   printf(Passkey sent over: %s\n, psk);
 
   dbus_message_append_args(reply, DBUS_TYPE_STRING, psk, 
 DBUS_TYPE_INVALID);
 
   dbus_connection_send(conn, reply, NULL);
 
   printf(reply success\n);
 
   dbus_message_unref(reply);
 
   return DBUS_HANDLER_RESULT_HANDLED;
 }
 
 I guess the passkey is currently sent out as a string  the ConnMan may not 
 be able to accept it.
 Not sure how to convert the input into a dictionary  append my passphrase 
 into it.

I am sure you can search the web for examples how to send a dictionary
in dbus from C-program.

 
 I am able to print the service properly.
 
 Please help me on this. Thanks.
 
 Regards,
 Ram
 


Jukka


___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


RE: connman connection policy

2015-03-18 Thread Kallumari Nagaraja Rao, RammohanX
Hello Jukka,

Is the Agent request input happens via a dictionary ?
I was able to register a agent handler  getting RequestInput from the ConnMan.
However I am unable to send out the passphrase out.

static DBusHandlerResult request_passkey_message(DBusConnection *conn, 
DBusMessage *msg)
{
DBusMessage *reply;
DBusError derr, error;
const char *device;
char passkey[17] = micromax;
const char *psk = micromax;

reply = dbus_message_new_method_return(msg);
if (!reply)
return DBUS_HANDLER_RESULT_NEED_MEMORY;

dbus_error_init(derr);
if (!dbus_message_get_args(msg, derr, DBUS_TYPE_OBJECT_PATH, device,
   DBUS_TYPE_INVALID)) {
fprintf(stderr, %s, derr.message);
dbus_error_free(derr);
return  error_message(conn, msg, net.connman.Error.Rejected,
Wrong signature);
}

if (device)
printf(Device: %s\n, device);

//memset(passkey, 0, sizeof(passkey));
printf(Passkey sent over: %s\n, psk);

dbus_message_append_args(reply, DBUS_TYPE_STRING, psk, 
DBUS_TYPE_INVALID);

dbus_connection_send(conn, reply, NULL);

printf(reply success\n);

dbus_message_unref(reply);

return DBUS_HANDLER_RESULT_HANDLED;
}

I guess the passkey is currently sent out as a string  the ConnMan may not be 
able to accept it.
Not sure how to convert the input into a dictionary  append my passphrase into 
it.

I am able to print the service properly.

Please help me on this. Thanks.

Regards,
Ram

-Original Message-
From: connman [mailto:connman-boun...@connman.net] On Behalf Of Jukka Rissanen
Sent: Tuesday, March 17, 2015 7:53 PM
To: connman@connman.net
Subject: Re: connman connection policy

On ti, 2015-03-17 at 10:25 +, Kallumari Nagaraja Rao, RammohanX
wrote:
 This is what I tried doing it, I am very new to these stuffs :(
 
 DBusMessage * agent_update_passphrase(DBusConnection *connection, char 
 * serv_str, char * pass) {
   DBusMessage *message, *reply;
   DBusError error;
   DBusMessageIter iter;
   DBusMessageIter args;
   static char *path = NULL;
   char *property = Passphrase;
   int type = DBUS_TYPE_STRING;
   char *param = AGENT_PATH;
   
   path = g_strdup_printf(/net/connman/service/%s, serv_str);
   message = dbus_message_new_method_call( CONNMAN_SERVICE,
   
 path,
   
 CONNMAN_AGENT_INTERFACE,
   
 RequestInput );

This is wrong. ConnMan will call RequestInput method so you will need to create 
a listener in your application for that. You are not suppose to call 
RequestInput in ConnMan as there will not be such method there.


Jukka


___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


RE: connman connection policy

2015-03-17 Thread Kallumari Nagaraja Rao, RammohanX
Patrik,

Is there a simple way to update a service with the passphrase we receive as a 
parameter ?

Regards,
Ram


-Original Message-
From: connman [mailto:connman-boun...@connman.net] On Behalf Of Patrik Flykt
Sent: Tuesday, March 17, 2015 2:23 PM
To: connman@connman.net
Subject: Re: connman connection policy

On Tue, 2015-03-17 at 07:40 +, Kallumari Nagaraja Rao, RammohanX
wrote:
 We basically want to handle dynamic update of the passphrase, instead 
 of updating in the settings file.
 
 Is Agent mandate ?

Yes.

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


RE: connman connection policy

2015-03-17 Thread Kallumari Nagaraja Rao, RammohanX
Yes I knew about the settings under the respective service. 

We basically want to handle dynamic update of the passphrase, instead of 
updating in the settings file.

Is Agent mandate ?

Regards,
Ram


-Original Message-
From: connman [mailto:connman-boun...@connman.net] On Behalf Of Patrik Flykt
Sent: Tuesday, March 17, 2015 12:14 PM
To: connman@connman.net
Subject: Re: connman connection policy

On Tue, 2015-03-17 at 04:25 +, Kallumari Nagaraja Rao, RammohanX
wrote:
 Is it possible to implement in a way to pass passphrase as a string 
 via a C parameter  activate ? Without having to request any input 
 from the user ?

Of course. It's all up to your C program how it wants to handle the situation. 
ConnMan only expects to use the Agent API in doc/agent-api.txt when querying 
for the passphrase.

But if you're about to supply a pre-configured passphrase, 
doc/config-format.txt already exists to solve the problem.


Cheers,

Patrik


___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: connman connection policy

2015-03-17 Thread Patrik Flykt
On Tue, 2015-03-17 at 04:25 +, Kallumari Nagaraja Rao, RammohanX
wrote:
 Is it possible to implement in a way to pass passphrase as a string
 via a C parameter  activate ? Without having to request any input
 from the user ?

Of course. It's all up to your C program how it wants to handle the
situation. ConnMan only expects to use the Agent API in
doc/agent-api.txt when querying for the passphrase.

But if you're about to supply a pre-configured passphrase,
doc/config-format.txt already exists to solve the problem.


Cheers,

Patrik


___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: connman connection policy

2015-03-17 Thread Patrik Flykt
On Tue, 2015-03-17 at 07:40 +, Kallumari Nagaraja Rao, RammohanX
wrote:
 We basically want to handle dynamic update of the passphrase, instead
 of updating in the settings file.
 
 Is Agent mandate ?

Yes.

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: connman connection policy

2015-03-17 Thread Patrik Flykt
On Tue, 2015-03-17 at 08:54 +, Kallumari Nagaraja Rao, RammohanX
wrote:
 Is there a simple way to update a service with the passphrase we
 receive as a parameter ?

Yes, by replying to the Agent API RequestInput D-Bus method call.

HTH,

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


RE: connman connection policy

2015-03-17 Thread Kallumari Nagaraja Rao, RammohanX
This is what I tried doing it, I am very new to these stuffs :(

DBusMessage * agent_update_passphrase(DBusConnection *connection, char * 
serv_str, char * pass)
{
DBusMessage *message, *reply;
DBusError error;
DBusMessageIter iter;
DBusMessageIter args;
static char *path = NULL;
char *property = Passphrase;
int type = DBUS_TYPE_STRING;
char *param = AGENT_PATH;

path = g_strdup_printf(/net/connman/service/%s, serv_str);
message = dbus_message_new_method_call( CONNMAN_SERVICE,

path,

CONNMAN_AGENT_INTERFACE,

RequestInput );
if (message == NULL)
return NULL;

dbus_error_init(error);

dbus_message_iter_init_append(message, iter);

if (append_variant(iter, property, type, pass)  0) {
dbus_message_unref(message);
return -EINVAL;
}

reply = dbus_connection_send_with_reply_and_block(connection,
message, -1, error);
if (reply == NULL) {
if (dbus_error_is_set(error) == TRUE) {
printf(%s, error.message);
dbus_error_free(error);
} else {
printf(%s, error.message);
}
dbus_message_unref(message);
return NULL;
}

dbus_message_unref(message);
dbus_message_unref(reply);

return reply;
}

Regards,
Ram


-Original Message-
From: connman [mailto:connman-boun...@connman.net] On Behalf Of Patrik Flykt
Sent: Tuesday, March 17, 2015 3:31 PM
To: connman@connman.net
Subject: Re: connman connection policy

On Tue, 2015-03-17 at 08:54 +, Kallumari Nagaraja Rao, RammohanX
wrote:
 Is there a simple way to update a service with the passphrase we 
 receive as a parameter ?

Yes, by replying to the Agent API RequestInput D-Bus method call.

HTH,

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


RE: connman connection policy

2015-03-17 Thread Kallumari Nagaraja Rao, RammohanX
Patrik,

Can you please help me out on this ?

Regards,
Ram


-Original Message-
From: connman [mailto:connman-boun...@connman.net] On Behalf Of Patrik Flykt
Sent: Tuesday, March 17, 2015 3:31 PM
To: connman@connman.net
Subject: Re: connman connection policy

On Tue, 2015-03-17 at 08:54 +, Kallumari Nagaraja Rao, RammohanX
wrote:
 Is there a simple way to update a service with the passphrase we 
 receive as a parameter ?

Yes, by replying to the Agent API RequestInput D-Bus method call.

HTH,

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: connman connection policy

2015-03-17 Thread Jukka Rissanen
On ti, 2015-03-17 at 10:25 +, Kallumari Nagaraja Rao, RammohanX
wrote:
 This is what I tried doing it, I am very new to these stuffs :(
 
 DBusMessage * agent_update_passphrase(DBusConnection *connection, char * 
 serv_str, char * pass)
 {
   DBusMessage *message, *reply;
   DBusError error;
   DBusMessageIter iter;
   DBusMessageIter args;
   static char *path = NULL;
   char *property = Passphrase;
   int type = DBUS_TYPE_STRING;
   char *param = AGENT_PATH;
   
   path = g_strdup_printf(/net/connman/service/%s, serv_str);
   message = dbus_message_new_method_call( CONNMAN_SERVICE,
   
 path,
   
 CONNMAN_AGENT_INTERFACE,
   
 RequestInput );

This is wrong. ConnMan will call RequestInput method so you will need to
create a listener in your application for that. You are not suppose to
call RequestInput in ConnMan as there will not be such method there.


Jukka


___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: connman connection policy

2015-03-16 Thread Patrik Flykt

Hi,

On Mon, 2015-03-16 at 11:43 +, Kallumari Nagaraja Rao, RammohanX
wrote:

 I am trying to write a sample C application to connect to a specific
 wifi access point. I am able to do it for an unprotected access point,
 however is there a way I can pass the required passphrase ?
 
 Do we have a different procedure to it ? [may be something like as
 below]
 1. assign passphrase to a service
 2. connect to the service
 
 Or something like above.

Implement Agent API in your C application, see doc/agent-api.txt for the
documentation and client/agent.c or test/simple-agent for general
directions on what to implement. But do notice that both parts are
covered by GPLv2 before reusing any code.

Cheers,

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


RE: connman connection policy

2015-03-16 Thread Kallumari Nagaraja Rao, RammohanX
Hi Patrik,

I am trying to write a sample C application to connect to a specific wifi 
access point.
I am able to do it for an unprotected access point, however is there a way I 
can pass the required passphrase ?

Do we have a different procedure to it ? [may be something like as below]
1. assign passphrase to a service
2. connect to the service

Or something like above.

Please help me. Waiting for your response.

Regards,
Ram

-Original Message-
From: connman [mailto:connman-boun...@connman.net] On Behalf Of Patrik Flykt
Sent: Wednesday, March 11, 2015 8:05 PM
To: connman@connman.net
Subject: Re: connman connection policy

On Wed, 2015-03-11 at 10:56 +, Kallumari Nagaraja Rao, RammohanX
wrote:
 Following stuffs are happening,
 1. I am initially connected to wifi - out of wifi connection - 
 switches back to cellular 2. otherway round when I come inside the 
 purview of a wifi access, it does not disconnect from cellular and 
 connect to wifi service.

Please provide the relevant output from 'connmanctl monitor services' so that 
there is a complete high level picture of what is going on. If you have 
manually manually connected some of these networks use connmanctl in 
interactive mode so that the monitoring output and the commands you use are 
nicely pretty-printed in sequence.

As you may have hit a bug of some sort, please also provide the log output with 
'connmand -d' for the above case.

Cheers,

Patrik


___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


RE: connman connection policy

2015-03-16 Thread Kallumari Nagaraja Rao, RammohanX
Hello Patrik,

Thanks for your inputs. 

Is it possible to implement in a way to pass passphrase as a string via a C 
parameter  activate ?
Without having to request any input from the user ?

Regards,
Ram

-Original Message-
From: connman [mailto:connman-boun...@connman.net] On Behalf Of Patrik Flykt
Sent: Monday, March 16, 2015 7:04 PM
To: connman@connman.net
Subject: Re: connman connection policy


Hi,

On Mon, 2015-03-16 at 11:43 +, Kallumari Nagaraja Rao, RammohanX
wrote:

 I am trying to write a sample C application to connect to a specific 
 wifi access point. I am able to do it for an unprotected access point, 
 however is there a way I can pass the required passphrase ?
 
 Do we have a different procedure to it ? [may be something like as 
 below] 1. assign passphrase to a service 2. connect to the service
 
 Or something like above.

Implement Agent API in your C application, see doc/agent-api.txt for the 
documentation and client/agent.c or test/simple-agent for general directions on 
what to implement. But do notice that both parts are covered by GPLv2 before 
reusing any code.

Cheers,

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


RE: connman connection policy

2015-03-11 Thread Kallumari Nagaraja Rao, RammohanX
Following stuffs are happening,
1. I am initially connected to wifi - out of wifi connection - switches back 
to cellular
2. otherway round when I come inside the purview of a wifi access, it does not 
disconnect from cellular 
and connect to wifi service.

Regards,
Ram


-Original Message-
From: connman [mailto:connman-boun...@connman.net] On Behalf Of Patrik Flykt
Sent: Wednesday, March 11, 2015 2:38 PM
To: connman@connman.net
Subject: Re: connman connection policy

On Wed, 2015-03-11 at 08:53 +, Kallumari Nagaraja Rao, RammohanX
wrote:
 I do not see this happening. Can you please let me know if I need any 
 other config or some something else required ?

Exactly what is not happening? Please describe the steps done, using e.g. the 
relevant output from connmanctl (connmanctl monitor is helpful
here) and provide log output from connmand -d for the same attempt.

Cheers,

Patrik


___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: connman connection policy

2015-03-11 Thread Patrik Flykt
On Mon, 2015-03-09 at 12:29 +, Kallumari Nagaraja Rao, RammohanX
wrote:
 I am currently using connmanctl application to connect to
 wifi/cellular network.
 
 Individually yes I can connect to each, however, I am looking out to
 policy which says something like below, If we are in the vicinity of
 wifi network, connect to it otherwise get connected to cellular
 network.
 
 I tried creating mani.conf @ /etc/connman  added the following,
 PreferredTechnologies = wifi,cellular
 SingleConnectedTechnology = true

Quicky looking at this setup makes me think it should work. Does it?

Cheers,

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


RE: connman connection policy

2015-03-11 Thread Kallumari Nagaraja Rao, RammohanX
Dear Patrik,

I do not see this happening. Can you please let me know if I need any other 
config or some something else required ?

Regards,
Ram

-Original Message-
From: connman [mailto:connman-boun...@connman.net] On Behalf Of Patrik Flykt
Sent: Wednesday, March 11, 2015 2:21 PM
To: connman@connman.net
Subject: Re: connman connection policy

On Mon, 2015-03-09 at 12:29 +, Kallumari Nagaraja Rao, RammohanX
wrote:
 I am currently using connmanctl application to connect to 
 wifi/cellular network.
 
 Individually yes I can connect to each, however, I am looking out to 
 policy which says something like below, If we are in the vicinity of 
 wifi network, connect to it otherwise get connected to cellular 
 network.
 
 I tried creating mani.conf @ /etc/connman  added the following, 
 PreferredTechnologies = wifi,cellular SingleConnectedTechnology = true

Quicky looking at this setup makes me think it should work. Does it?

Cheers,

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: connman connection policy

2015-03-11 Thread Patrik Flykt
On Wed, 2015-03-11 at 08:53 +, Kallumari Nagaraja Rao, RammohanX
wrote:
 I do not see this happening. Can you please let me know if I need any
 other config or some something else required ?

Exactly what is not happening? Please describe the steps done, using
e.g. the relevant output from connmanctl (connmanctl monitor is helpful
here) and provide log output from connmand -d for the same attempt.

Cheers,

Patrik


___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: connman connection policy

2015-03-11 Thread Patrik Flykt
On Wed, 2015-03-11 at 10:56 +, Kallumari Nagaraja Rao, RammohanX
wrote:
 Following stuffs are happening,
 1. I am initially connected to wifi - out of wifi connection -
 switches back to cellular
 2. otherway round when I come inside the purview of a wifi access, it
 does not disconnect from cellular and connect to wifi service.

Please provide the relevant output from 'connmanctl monitor services' so
that there is a complete high level picture of what is going on. If you
have manually manually connected some of these networks use connmanctl
in interactive mode so that the monitoring output and the commands you
use are nicely pretty-printed in sequence.

As you may have hit a bug of some sort, please also provide the log
output with 'connmand -d' for the above case.

Cheers,

Patrik


___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


connman connection policy

2015-03-09 Thread Kallumari Nagaraja Rao, RammohanX
I am currently using connmanctl application to connect to wifi/cellular network.

Individually yes I can connect to each, however, I am looking out to policy 
which says something like below,
If we are in the vicinity of wifi network, connect to it otherwise get 
connected to cellular network.

I tried creating mani.conf @ /etc/connman  added the following,
PreferredTechnologies = wifi,cellular
SingleConnectedTechnology = true

Is there anything else needs to be done or this entire thing needs to be 
handled in another proprietary application ?

Regards,
Ram

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman