Re: [PATCH] doc: Add RequestPeerInput method to agent API
Hi, On Mon, 2014-07-28 at 15:41 +0300, Tomasz Bursztyka wrote: This method will be used to handle extra input which might be requested when connecting to a peer or in case a peer wants to connect to us. --- I have already the code for this, but I figured out it could be better to discuss and agree on the Peer Agent API first. Please review, doc/agent-api.txt | 54 -- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/doc/agent-api.txt b/doc/agent-api.txt index a98343f..65b65a9 100644 --- a/doc/agent-api.txt +++ b/doc/agent-api.txt @@ -58,6 +58,24 @@ Methodsvoid Release() Possible Errors: net.connman.Agent.Error.Canceled net.connman.Agent.Error.LaunchBrowser + dict RequestPeerInput(object peer, dict fields) Following Bluez way of naming things, this one should be called RequestPeerAuthorization. + This method gets called when trying to connect to a + peer or when an incoming peer connection is requested, + for which some extra input is required. In this case, + it will only deal with WPS input as well as accepting + or rejecting an incoming connection. The fields dict can be empty in case of WPS pushbutton? + The return value should be a dictionary where the + keys are the field names and the values are the + actual fields. Alternatively an error indicating that + the request got canceled can be returned. + + The dictionary arguments contains field names with + their input parameters. In case of WPS pushbutton, the returned dict can be empty? + Possible Errors: net.connman.Agent.Error.Canceled Should we have an net.connman.Error.Rejected similar to Bluez? void Cancel() This method gets called to indicate that the agent @@ -107,6 +125,9 @@ Fieldsstring Name method, or a pin code if user wants to use the pin method. + In case of a RequestPeerInput, this field will be set + as mandatory. This one is fine, on could end with ...whenever WPS is requested or something. string Username Username for WISPr authentication. This field will be @@ -117,11 +138,17 @@ Fields string Name Password for WISPr authentication. This field will be requested when connecting to a WISPr-enabled hotspot. + string AcceptConnection + + The answer about an incoming peer connection. This + field will be requested only in this situation through + RequestPeerInput. I'd go for net.connman.Error.Rejected error response instead. Argumentsstring Type Contains the type of a field. For example psk, wep - passphrase, response, ssid, wpspin or plain - string. + passphrase, response, ssid, wpspin, plain + string or boolean. Boolean is complicated. string Requirement @@ -254,3 +281,26 @@ Examples Requesting a passphrase for WPA2 network } == { Username : foo, Password: secret } + + Requesting a answer about an inconming peer connection: + + RequestPeerInput(/peer3, + { AcceptConnection : + { Type: boolean, + Requirement : mandatory + } + } Here I'd expect something like RequestPeerAuthorization(/peer3, { } ) + == { AcceptConnection : false } ...with a successful method call return, with an empty dict passed from the agent. And of course no dict passed from the agent qualifies as an empty one. == { } + Requesting the WPS details when connecting to a peer: + + RequestPeerInput(/peer4, + { WPS: + { Type: wpspin, + Requirement : mandatory + } + } + + == { WPS : } This one is fine. As discussed elsewhere, ConnMan should autoaccept an incoming peer if the connection was initiated via ConnMan's D-Bus API but the peer ended up as
[PATCH] peer: Fix a dbus issue when raising PeersChanged signal
This fixes a warning issued by DBus telling a dict is expected instead of a struct end. Also, using the proper variable when calling append_peer_struct so it's more readable. Reported by Eduardo Abinader eduardoabina...@gmail.com --- src/peer.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/peer.c b/src/peer.c index 2179a2d..b50a3fa 100644 --- a/src/peer.c +++ b/src/peer.c @@ -353,7 +353,7 @@ static void append_existing_and_new_peers(gpointer key, { struct connman_peer *peer = value; DBusMessageIter *iter = user_data; - DBusMessageIter entry; + DBusMessageIter entry, dict; if (!peer || !peer-registered) return; @@ -361,7 +361,7 @@ static void append_existing_and_new_peers(gpointer key, if (g_hash_table_lookup(peers_notify-add, peer-path)) { DBG(new %s, peer-path); - append_peer_struct(key, value, user_data); + append_peer_struct(key, peer, iter); g_hash_table_remove(peers_notify-add, peer-path); } else if (!g_hash_table_lookup(peers_notify-remove, peer-path)) { DBG(existing %s, peer-path); @@ -370,6 +370,9 @@ static void append_existing_and_new_peers(gpointer key, NULL, entry); dbus_message_iter_append_basic(entry, DBUS_TYPE_OBJECT_PATH, peer-path); + connman_dbus_dict_open(entry, dict); + connman_dbus_dict_close(entry, dict); + dbus_message_iter_close_container(iter, entry); } } -- 1.8.5.5 ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
Re: [PATCH] doc: Add RequestPeerInput method to agent API
Hi Patrik, doc/agent-api.txt | 54 -- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/doc/agent-api.txt b/doc/agent-api.txt index a98343f..65b65a9 100644 --- a/doc/agent-api.txt +++ b/doc/agent-api.txt @@ -58,6 +58,24 @@ Methods void Release() Possible Errors: net.connman.Agent.Error.Canceled net.connman.Agent.Error.LaunchBrowser + dict RequestPeerInput(object peer, dict fields) Following Bluez way of naming things, this one should be called RequestPeerAuthorization. But here it's not only to request the authorization, it would be handling both case: outgoing connection (which requires the user to choose between pbc/pin) or incoming connection which in this case is only about authorizing the connection yes. + This method gets called when trying to connect to a + peer or when an incoming peer connection is requested, + for which some extra input is required. In this case, + it will only deal with WPS input as well as accepting + or rejecting an incoming connection. The fields dict can be empty in case of WPS pushbutton? No it follows WPS fields as for service RequestInput + The return value should be a dictionary where the + keys are the field names and the values are the + actual fields. Alternatively an error indicating that + the request got canceled can be returned. + + The dictionary arguments contains field names with + their input parameters. In case of WPS pushbutton, the returned dict can be empty? Same here. + Possible Errors: net.connman.Agent.Error.Canceled Should we have an net.connman.Error.Rejected similar to Bluez? Why not indeed, it would simplify the AcceptConnection field then. void Cancel() This method gets called to indicate that the agent @@ -107,6 +125,9 @@ Fields string Name method, or a pin code if user wants to use the pin method. + In case of a RequestPeerInput, this field will be set + as mandatory. This one is fine, on could end with ...whenever WPS is requested or something. string Username Username for WISPr authentication. This field will be @@ -117,11 +138,17 @@ Fieldsstring Name Password for WISPr authentication. This field will be requested when connecting to a WISPr-enabled hotspot. + string AcceptConnection + + The answer about an incoming peer connection. This + field will be requested only in this situation through + RequestPeerInput. I'd go for net.connman.Error.Rejected error response instead. Ok, but we still need to tell it's an incoming connection. Thus I would change this field to AuthorizeConnection or something like that. Accepting it would require to return this field (empty). Arguments string Type Contains the type of a field. For example psk, wep - passphrase, response, ssid, wpspin or plain - string. + passphrase, response, ssid, wpspin, plain + string or boolean. Boolean is complicated. Agree, let's drop this. string Requirement @@ -254,3 +281,26 @@ Examples Requesting a passphrase for WPA2 network } == { Username : foo, Password: secret } + + Requesting a answer about an inconming peer connection: + + RequestPeerInput(/peer3, + { AcceptConnection : + { Type: boolean, + Requirement : mandatory + } + } Here I'd expect something like RequestPeerAuthorization(/peer3, { } ) + == { AcceptConnection : false } ...with a successful method call return, with an empty dict passed from the agent. And of course no dict passed from the agent qualifies as an empty one. == { } As said previously, the problem here is the name of the method: it only fits for incoming connection. Or should I create 2 methods? RequestPeerInput and RequestPerrAuthorization? (though is seems a bit too much) + Requesting the WPS details when connecting to a peer: + + RequestPeerInput(/peer4, +
[PATCH 1/1] Update p2p scan status, when disabling wifi
Whenever wifi plugin is disabled and p2p find is running, a double device unref was occurring. By setting scanning to false, avoids duplicated device unref. --- plugins/wifi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/wifi.c b/plugins/wifi.c index ce6d7e7..5f383bd 100644 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -1119,6 +1119,7 @@ static int wifi_disable(struct connman_device *device) if (wifi-p2p_find_timeout) { g_source_remove(wifi-p2p_find_timeout); wifi-p2p_find_timeout = 0; + connman_device_set_scanning(device, CONNMAN_SERVICE_TYPE_P2P, false); connman_device_unref(wifi-device); } -- 1.9.1 ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
[PATCH v2] doc: Add RequestPeerAuthorization method to agent API
This method will be used to handle extra input which might be requested when connecting to a peer or in case a peer wants to connect to us. --- - v2: Moved towards RequestPeerAuthorization name. Input could mean that much more fields could appear at some point but this will never happen. Added the Rejected Error, it's much nicer to reject an incoming connection doc/agent-api.txt | 51 +++ 1 file changed, 51 insertions(+) diff --git a/doc/agent-api.txt b/doc/agent-api.txt index a98343f..7d9aa53 100644 --- a/doc/agent-api.txt +++ b/doc/agent-api.txt @@ -58,6 +58,25 @@ Methods void Release() Possible Errors: net.connman.Agent.Error.Canceled net.connman.Agent.Error.LaunchBrowser + dict RequestPeerAuthorization(object peer, dict fields) + + This method gets called when trying to connect to a + peer or when an incoming peer connection is requested, + for which some extra input is required. In this case, + it will only deal with WPS input as well as accepting + or rejecting an incoming connection. + + The return value should be a dictionary where the + keys are the field names and the values are the + actual fields. Alternatively an error indicating that + the request got canceled or rejected can be returned. + + The dictionary arguments contains field names with + their input parameters. + + Possible Errors: net.connman.Agent.Error.Canceled +net.connman.Agent.Error.Rejected + void Cancel() This method gets called to indicate that the agent @@ -107,6 +126,9 @@ Fields string Name method, or a pin code if user wants to use the pin method. + In case of a RequestPeerAuthorization, this field will + be set as mandatory. + string Username Username for WISPr authentication. This field will be @@ -117,6 +139,12 @@ Fields string Name Password for WISPr authentication. This field will be requested when connecting to a WISPr-enabled hotspot. + string AcceptConnection + + The answer about an incoming peer connection. This + field will be requested only in this situation through + RequestPeerAuthorization. + Arguments string Type Contains the type of a field. For example psk, wep @@ -254,3 +282,26 @@ Examples Requesting a passphrase for WPA2 network } == { Username : foo, Password: secret } + + Requesting a answer about an inconming peer connection: + + RequestPeerAuthorization(/peer3, + { AcceptConnection : + { Type: string, + Requirement : mandatory + } + } + + == { AcceptConnection : } + + Requesting the WPS details when connecting to a peer: + + RequestPeerAuthorization(/peer4, + { WPS: + { Type: wpspin, + Requirement : mandatory + } + } + + == { WPS : } + -- 1.8.5.5 ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
Re: [PATCH 1/1] Update p2p scan status, when disabling wifi
Hi Eduardo, Can you add wifi: as a prefix of your commit title? I noticed that your 2 previous accepted patches lacked this prefix rule also. (and got applied, but that's not your mistake) Besides that, ack on the patch itself. Tomasz ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
[PATCH 1/1 v2] wifi: Update p2p scan status, when disabling wifi
Whenever wifi plugin is disabled and p2p find is running, a double device unref was occurring. By setting scanning to false, avoids duplicated device unref. --- plugins/wifi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/wifi.c b/plugins/wifi.c index ce6d7e7..5f383bd 100644 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -1119,6 +1119,7 @@ static int wifi_disable(struct connman_device *device) if (wifi-p2p_find_timeout) { g_source_remove(wifi-p2p_find_timeout); wifi-p2p_find_timeout = 0; + connman_device_set_scanning(device, CONNMAN_SERVICE_TYPE_P2P, false); connman_device_unref(wifi-device); } -- 1.9.1 ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
[PATCH v3] doc: Add RequestPeerAuthorization method to agent API
This method will be used to handle extra input which might be requested when connecting to a peer or in case a peer wants to connect to us. --- - v3: Added the method ReportPeerError() - v2: Moved towards RequestPeerAuthorization name. Input could mean that much more fields could appear at some point but this will never happen. Added the Rejected Error, it's much nicer to reject an incoming connection doc/agent-api.txt | 61 +++ 1 file changed, 61 insertions(+) diff --git a/doc/agent-api.txt b/doc/agent-api.txt index a98343f..a4db44b 100644 --- a/doc/agent-api.txt +++ b/doc/agent-api.txt @@ -23,6 +23,16 @@ Methods void Release() Possible Errors: net.connman.Agent.Error.Retry + void ReportPeerError(object peer, string error) + + This method gets called when an error has to be + reported to the user about a peer connection. + + A special return value can be used to trigger a + retry of the failed transaction. + + Possible Errors: net.connman.Agent.Error.Retry + void RequestBrowser(object service, string url) This method gets called when it is required @@ -58,6 +68,25 @@ Methods void Release() Possible Errors: net.connman.Agent.Error.Canceled net.connman.Agent.Error.LaunchBrowser + dict RequestPeerAuthorization(object peer, dict fields) + + This method gets called when trying to connect to a + peer or when an incoming peer connection is requested, + for which some extra input is required. In this case, + it will only deal with WPS input as well as accepting + or rejecting an incoming connection. + + The return value should be a dictionary where the + keys are the field names and the values are the + actual fields. Alternatively an error indicating that + the request got canceled or rejected can be returned. + + The dictionary arguments contains field names with + their input parameters. + + Possible Errors: net.connman.Agent.Error.Canceled +net.connman.Agent.Error.Rejected + void Cancel() This method gets called to indicate that the agent @@ -107,6 +136,9 @@ Fields string Name method, or a pin code if user wants to use the pin method. + In case of a RequestPeerAuthorization, this field will + be set as mandatory. + string Username Username for WISPr authentication. This field will be @@ -117,6 +149,12 @@ Fields string Name Password for WISPr authentication. This field will be requested when connecting to a WISPr-enabled hotspot. + string AcceptConnection + + The answer about an incoming peer connection. This + field will be requested only in this situation through + RequestPeerAuthorization. + Arguments string Type Contains the type of a field. For example psk, wep @@ -254,3 +292,26 @@ Examples Requesting a passphrase for WPA2 network } == { Username : foo, Password: secret } + + Requesting a answer about an inconming peer connection: + + RequestPeerAuthorization(/peer3, + { AcceptConnection : + { Type: string, + Requirement : mandatory + } + } + + == { AcceptConnection : } + + Requesting the WPS details when connecting to a peer: + + RequestPeerAuthorization(/peer4, + { WPS: + { Type: wpspin, + Requirement : mandatory + } + } + + == { WPS : } + -- 1.8.5.5 ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
Re: [PATCH 1/1] Update p2p scan status, when disabling wifi
On 07/29/2014 12:23 PM, Tomasz Bursztyka wrote: Hi Eduardo, Can you add wifi: as a prefix of your commit title? I noticed that your 2 previous accepted patches lacked this prefix rule also. (and got applied, but that's not your mistake) Sorry, my bad. ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman