Skip to contentSkip to conversation

Document P2P dbus interfaces

RFC In review Andrew Zaborowski 3 participants 19 messages Oct 10, 2019 – Nov 16, 2019

lore
Share & tools
lore
#0 lore raw

RFC v3 1/1 Document P2P dbus interfaces

From: Andrew Zaborowski <[email protected]>

Proposed minimum P2P interfaces for establishing basic connections. The device discovery results in creation of P2PPeer objects.

In the Wi-Fi Display API we are passing raw IE data because there's a relatively big set of different values that may be encoded in them. We could reduce them to 2-3 bools and integers but this might limit the client implementations feature set.

---
 doc/p2p-api.txt                | 82 ++++++++++++++++++++++++++++++++++
 doc/p2p-peer-api.txt           | 66 +++++++++++++++++++++++++++
 doc/p2p-wfd-agent-api.txt      | 34 ++++++++++++++
 doc/signal-level-agent-api.txt |  4 ++
 4 files changed, 186 insertions(+)
 create mode 100644 doc/p2p-api.txt
 create mode 100644 doc/p2p-peer-api.txt
 create mode 100644 doc/p2p-wfd-agent-api.txt
doc/p2p-api.txt new file +82 -0
new file mode 100644
index 00000000..84f862e5
@@ -0,0 +1,82 @@
+P2P hierarchy
+=============
+
+Service		net.connman.iwd
+Interface	net.connman.iwd.P2P [Experimental]
+Object path	/{phy0,phy1,...}
+
+Methods		array(on) GetPeers()
+
+			Returns a list (possibly empty) of detected P2P peers.
+			Each record returned contains a tuple of the following
+			values.
+
+			object Object
+
+				net.connman.iwd.P2PPeer object representing
+				the peer device.
+
+			int16 SignalStrength
+
+				Peer's maximum signal strength expressed
+				in 100 * dBm.  The value is the range of 0
+				(strongest signal) to -10000 (weakest signal)
+
+		void RegisterSignalLevelAgent(object path,
+						 array(int16) levels)
+
+			Register the agent object to receive signal strength
+			level change notifications on the
+			net.connman.iwd.SignalLevelAgent interface, see
+			signal-level-agent-api.txt.  The "levels"
+			parameters decides the thresholds in dBm that will
+			generate a call to the agent's Changed
+			method whenever current RSSI crosses any of the
+			values.  The values must be passed in descending
+			order.  The number and distance between requested
+			threshold values is a compromise between resolution
+			and the frequency of system wakeups and
+			context-switches that are going to be occuring to
+			update the client's signal meter.  Only one agent
+			can be registered at any time.
+
+			Possible Errors: [service].Error.InvalidArguments
+					 [service].Error.Failed
+					 [service].Error.AlreadyExists
+					 [service].Error.NotSupported
+
+		void RegisterWFDService(object path, array(byte) payload)
+
+			Register the Wi-Fi Display service running on local
+			host with this P2P device so that device discovery
+			and connection setup phases include necessary WFD
+			information for the peers and receive peer's WFD
+			service information.  An object may be provided to
+			receive relevant WFD information about peers and
+			connections through method calls on the object's
+			net.connman.iwd.P2PWFDAgent interface.  See
+			p2p-wfd-agent-api.txt.  Only one agent can be
+			registered at any time.  The byte array provided
+			will be included in WFD Information Elements
+			present in relevant frames sent to peers.
+
+			Possible Errors: [service].Error.InvalidArguments
+					 [service].Error.AlreadyExists
+					 [service].Error.NotSupported
+
+Properties	boolean Enabled [readwrite]
+
+			Whether local P2P device is started, i.e. is scanning
+			for peers, is discoverable by peers and/or connected
+			to peer(s).
+
+		string Name [readwrite]
+
+			Sets local P2P device name as it is going to be
+			presented on other devices that we will connect to
+			or ones that discover us in scanning.
+
+		uint16 MaxConnections [readonly]
+
+			Maximum number of concurrent P2P peers that local
+			hardware is capable of connecting to.  Often 1.
doc/p2p-peer-api.txt new file +66 -0

66 lines not on this page · raw message

doc/p2p-wfd-agent-api.txt new file +34 -0
new file mode 100644
index 00000000..be0ee01b
@@ -0,0 +1,34 @@
+P2PWFDAgent hierarchy
+=====================
+
+Service		unique name
+Interface	net.connman.iwd.P2PWFDAgent
+Object path	freely definable
+
+Methods		void Release(object device)
+
+			This method gets called when IWD unregisters the
+			WFD service on a specific P2P device. An agent can
+			use it to do cleanup tasks. There is no need to
+			unregister the agent, because when this method
+			gets called it has already been unregistered.
+
+		void WFDPeersChanged(object device,
+					array(object, array(byte)) peers)
+
+			Called when the set of discovered WFD-capable
+			peers has changed during device discovery.
+
+			The device object has the net.connman.iwd.P2P
+			interface while the objects in the peers array
+			have net.connman.iwd.P2PPeer interfaces.  The byte
+			array included contains the reassembled payload of
+			the WFD Information Elements presented by the peer.
+
+		void NewConnection(object peer, array(byte) payload)
+
+			Called when a new P2P connection has been established
+			to a WFD-capable peer.  The peer object has the
+			net.connman.iwd.P2PPerr interface.  The byte array
+			contains the reassembled payload of the WFD
+			Information Elements presented by the peer.
doc/signal-level-agent-api.txt +4 -0
index 847e7ca3..1c786d96 100644
@@ -31,3 +31,7 @@ Methods		void Release(object device)
 			0 would mean signal is received at -40 or more dBm
 			and 3 would mean below -60 dBm and might correspond
 			to 1 out of 4 bars on a UI signal meter.
+
+			The device parameter may be either a
+			net.connman.iwd.Station object or a
+			net.connman.iwd.P2PPeer object.
Signature · 1 line
2.20.1
#1 lore raw

Hi Andrew,

Quoted 9 lines · Andrew Zaborowski

From: Andrew Zaborowski <[email protected]>

Proposed minimum P2P interfaces for establishing basic connections. The device discovery results in creation of P2PPeer objects.

In the Wi-Fi Display API we are passing raw IE data because there's a relatively big set of different values that may be encoded in them. We could reduce them to 2-3 bools and integers but this might limit the client implementations feature set.

So I'm not really a huge fan of this. We'd still need to be able to understand what is inside the IE in order to verify it properly. I'd err on the side of providing some attributes instead of full on binary IEs.

Also, some of the subelements involved should really be filled in by iwd itself and not the external application. Otherwise you'll end up with some sort of Frankenstein where the app provides some info but we'd need to rewrite or modify it anyway.

Quoted 16 lines
---
  doc/p2p-api.txt                | 82 ++++++++++++++++++++++++++++++++++
  doc/p2p-peer-api.txt           | 66 +++++++++++++++++++++++++++
  doc/p2p-wfd-agent-api.txt      | 34 ++++++++++++++
  doc/signal-level-agent-api.txt |  4 ++
  4 files changed, 186 insertions(+)

create mode 100644 doc/p2p-api.txt
create mode 100644 doc/p2p-peer-api.txt
create mode 100644 doc/p2p-wfd-agent-api.txt

doc/p2p-api.txt new file +0 -0
new file mode 100644
index 00000000..84f862e5

doc/p2p-api.txt line 6

Quoted 6 lines
doc/p2p-api.txt new file +6 -0
@@ -0,0 +1,82 @@
+P2P hierarchy
+=============
+
+Service		net.connman.iwd
+Interface	net.connman.iwd.P2P [Experimental]
+Object path	/{phy0,phy1,...}

So we changed the paths for 1.0 and this might need to be updated.

doc/p2p-api.txt line 16

Quoted 10 lines
doc/p2p-api.txt new file +10 -0
+
+Methods		array(on) GetPeers()
+
+			Returns a list (possibly empty) of detected P2P peers.
+			Each record returned contains a tuple of the following
+			values.
+
+			object Object
+
+				net.connman.iwd.P2PPeer object representing

Name this iwd.Peer?

Quoted 5 lines
doc/p2p-api.txt new file +5 -0
+				the peer device.
+
+			int16 SignalStrength
+
+				Peer's maximum signal strength expressed

doc/p2p-api.txt line 31

Quoted 10 lines
doc/p2p-api.txt new file +10 -0
+				in 100 * dBm.  The value is the range of 0
+				(strongest signal) to -10000 (weakest signal)
+
+		void RegisterSignalLevelAgent(object path,
+						 array(int16) levels)
+
+			Register the agent object to receive signal strength
+			level change notifications on the
+			net.connman.iwd.SignalLevelAgent interface, see
+			signal-level-agent-api.txt.  The "levels"

We moved this into the station api. So maybe just refer to that here...

Though really, I wonder if you even want to bother with this for the first iteration? I'd maybe leave this out?

Quoted 7 lines
doc/p2p-api.txt new file +7 -0
+			parameters decides the thresholds in dBm that will
+			generate a call to the agent's Changed
+			method whenever current RSSI crosses any of the
+			values.  The values must be passed in descending
+			order.  The number and distance between requested
+			threshold values is a compromise between resolution
+			and the frequency of system wakeups and

doc/p2p-api.txt line 48

Quoted 10 lines
doc/p2p-api.txt new file +10 -0
+			context-switches that are going to be occuring to
+			update the client's signal meter.  Only one agent
+			can be registered at any time.
+
+			Possible Errors: [service].Error.InvalidArguments
+					 [service].Error.Failed
+					 [service].Error.AlreadyExists
+					 [service].Error.NotSupported
+
+		void RegisterWFDService(object path, array(byte) payload)

I would maybe make this a bit more generic in case other P2P services are supported in the future, like file sharing, etc.

But, I'm not sure this belongs here? P2P is a per-phy interface; do you really want the clients to register WiFi Display per phy? Or just once and have it apply to all devices in the system, current or ones yet to be plugged in? Perhaps we need a ServiceManager or add this to AgentManager API?

I suppose it might be in theory possible to support both a Sink and a Source role on different phys, but then shouldn't you be distinguishing between the roles somehow?

doc/p2p-api.txt line 52

Quoted 4 lines
doc/p2p-api.txt new file +4 -0
+
+			Register the Wi-Fi Display service running on local
+			host with this P2P device so that device discovery
+			and connection setup phases include necessary WFD

okay...

doc/p2p-api.txt line 61

Quoted 9 lines
doc/p2p-api.txt new file +9 -0
+			information for the peers and receive peer's WFD
+			service information.  An object may be provided to
+			receive relevant WFD information about peers and
+			connections through method calls on the object's
+			net.connman.iwd.P2PWFDAgent interface.  See
+			p2p-wfd-agent-api.txt.  Only one agent can be
+			registered at any time.  The byte array provided
+			will be included in WFD Information Elements
+			present in relevant frames sent to peers.

So besides the IE information (which I don't really want transported in binary), what real use is the WFD agent?

Quoted 11 lines
doc/p2p-api.txt new file +11 -0
+
+			Possible Errors: [service].Error.InvalidArguments
+					 [service].Error.AlreadyExists
+					 [service].Error.NotSupported
+
+Properties	boolean Enabled [readwrite]
+
+			Whether local P2P device is started, i.e. is scanning
+			for peers, is discoverable by peers and/or connected
+			to peer(s).
+

doc/p2p-api.txt line 82

Quoted 10 lines
doc/p2p-api.txt new file +10 -0
+		string Name [readwrite]
+
+			Sets local P2P device name as it is going to be
+			presented on other devices that we will connect to
+			or ones that discover us in scanning.
+
+		uint16 MaxConnections [readonly]
+
+			Maximum number of concurrent P2P peers that local
+			hardware is capable of connecting to.  Often 1.

I think we've talked about this before. Given what we now know, I would drop this for now. I think the likelihood of this becoming > 1 is astronomically small and we shouldn't even worry about this. This means we can also move some attributes / methods from the Peer interface onto this one.

doc/p2p-peer-api.txt line 5

Quoted 11 lines
doc/p2p-peer-api.txt new file +5 -0
new file mode 100644
index 00000000..898f4fb9
@@ -0,0 +1,66 @@
+P2PPeer hierarchy
+=================
+
+Service		net.connman.iwd
+Interface	net.connman.iwd.P2PPeer [Experimental]

.iwd.Peer?

doc/p2p-peer-api.txt line 6

Quoted 1 line
doc/p2p-peer-api.txt new file +1 -0
+Object path	/{phy0,phy1,...}/p2p_peers/{aa_bb_cc_dd_ee_ff}

Object path needs to be updated post 1.0

doc/p2p-peer-api.txt line 12

Quoted 6 lines
doc/p2p-peer-api.txt new file +6 -0
+
+Methods		ConnectPushButton()
+
+			Connect to the P2P peer in the Push Button mode
+			using the device pointed to by the .Device property.
+			Returns when connection is complete.

Why are you method names different from SimpleConfiguration? in fact, why not just add .SimpleConfiguration interface to the same object path and just have clients use that?

Quoted 14 lines
doc/p2p-peer-api.txt new file +14 -0
+
+			Possible errors: net.connman.iwd.Aborted
+					 net.connman.iwd.Busy
+					 net.connman.iwd.Failed
+					 net.connman.iwd.NotSupported
+					 net.connman.iwd.Timeout
+					 net.connman.iwd.InProgress
+
+		ConnectPIN(string pin)
+
+			Connect to the P2P peer in PIN mode.  Returns when
+			connection is complete.
+
+			See net.connman.iwd.WiFiSimpleConfiguration.StartPIN()

doc/p2p-peer-api.txt line 36

Quoted 10 lines
doc/p2p-peer-api.txt new file +10 -0
+			for how the pin argument is used.
+
+			Possible errors: net.connman.iwd.Aborted
+					 net.connman.iwd.Busy
+					 net.connman.iwd.Failed
+					 net.connman.iwd.NotSupported
+					 net.connman.iwd.Timeout
+					 net.connman.iwd.InProgress
+
+		Disconnect() [optional]

A method can't be optional? Anyway, I'd put this on the P2P interface instead.

Quoted 13 lines
doc/p2p-peer-api.txt new file +13 -0
+
+			If connected, disconnect from this peer.
+
+			Possible errors: net.connman.iwd.Failed
+
+Properties	string Name [readonly]
+
+			P2P Peer's display name
+
+		string DeviceCategory [readonly]
+
+			The category part of the peer's declared
+			Primary Device Type.

doc/p2p-peer-api.txt line 59

Quoted 10 lines
doc/p2p-peer-api.txt new file +10 -0
+
+		string DeviceSubcategory [readonly, optional]
+
+			The Sub Category part of the peer's declared
+			Primary Device Type.
+
+		object Device [readonly]
+
+			The object with a net.connman.iwd.P2P interface
+			that discovered this peer.

Okay

doc/p2p-peer-api.txt line 66

Quoted 7 lines
doc/p2p-peer-api.txt new file +7 -0
+
+		boolean Connected [readonly]
+
+			Whether there's currently an active connection
+			to this peer.  The property is read-only and
+			changes as a result of the Connect and
+			Disconnect methods calls.

This wording might need to be updated....

Quoted 22 lines
doc/p2p-wfd-agent-api.txt new file +16 -0
new file mode 100644
index 00000000..be0ee01b
@@ -0,0 +1,34 @@
+P2PWFDAgent hierarchy
+=====================
+
+Service		unique name
+Interface	net.connman.iwd.P2PWFDAgent
+Object path	freely definable
+
+Methods		void Release(object device)
+
+			This method gets called when IWD unregisters the
+			WFD service on a specific P2P device. An agent can
+			use it to do cleanup tasks. There is no need to
+			unregister the agent, because when this method
+			gets called it has already been unregistered.
+
+		void WFDPeersChanged(object device,

doc/p2p-wfd-agent-api.txt line 26

Quoted 10 lines
doc/p2p-wfd-agent-api.txt new file +10 -0
+					array(object, array(byte)) peers)
+
+			Called when the set of discovered WFD-capable
+			peers has changed during device discovery.
+
+			The device object has the net.connman.iwd.P2P
+			interface while the objects in the peers array
+			have net.connman.iwd.P2PPeer interfaces.  The byte
+			array included contains the reassembled payload of
+			the WFD Information Elements presented by the peer.

Okay, so you want to notify the agent instead of adding a WFD specific interface to the Peer object. I still wonder if we can avoid transporting raw IEs here... Also, how are you making sure that the peers are actually ones that the agent cares about? There's no sense in sending Source role peer info if we're also a Source...

Can we be a source and a sink at the same time?

doc/p2p-wfd-agent-api.txt line 32

Quoted 6 lines
doc/p2p-wfd-agent-api.txt new file +6 -0
+
+		void NewConnection(object peer, array(byte) payload)
+
+			Called when a new P2P connection has been established
+			to a WFD-capable peer.  The peer object has the
+			net.connman.iwd.P2PPerr interface.  The byte array

typo

doc/p2p-wfd-agent-api.txt line 34

Quoted 2 lines
doc/p2p-wfd-agent-api.txt new file +2 -0
+			contains the reassembled payload of the WFD
+			Information Elements presented by the peer.

So I'm not entirely sure how this is useful? The fact that we made a connection to a peer is already available via the Peer.Connected property. Is the payload somehow different from what was sent via WFDPeersChanged?

doc/signal-level-agent-api.txt Methods void Release(object device) · line 37

Quoted 13 lines
doc/signal-level-agent-api.txt +4 -0
index 847e7ca3..1c786d96 100644
@@ -31,3 +31,7 @@ Methods		void Release(object device)
  			0 would mean signal is received at -40 or more dBm
  			and 3 would mean below -60 dBm and might correspond
  			to 1 out of 4 bars on a UI signal meter.
+
+			The device parameter may be either a
+			net.connman.iwd.Station object or a
+			net.connman.iwd.P2PPeer object.

This file no longer exists FYI.

Regards,
-Denis

#2 lore raw

Hi Denis,

Quoted 14 lines · Denis Kenzior
Quoted 7 lines · Andrew Zaborowski

Proposed minimum P2P interfaces for establishing basic connections. The device discovery results in creation of P2PPeer objects.

In the Wi-Fi Display API we are passing raw IE data because there's a relatively big set of different values that may be encoded in them. We could reduce them to 2-3 bools and integers but this might limit the client implementations feature set.

So I'm not really a huge fan of this. We'd still need to be able to understand what is inside the IE in order to verify it properly. I'd err on the side of providing some attributes instead of full on binary IEs.

Quoted 4 lines

Also, some of the subelements involved should really be filled in by iwd itself and not the external application. Otherwise you'll end up with some sort of Frankenstein where the app provides some info but we'd need to rewrite or modify it anyway.

I didn't plan to interpret the contents of the IE in any way. The idea would be to have little service-specific code, and in case of WFD there's no need to do anything more than passing the ies.

So I see only two options, either full on binary IE passed in both directions between iwd and the service implementation, or full on individual values from the WFD subelements. There's a lot of them though, for example for a probe response you have at least:

* 12 capability bits in a bitmap
* RTSP tcp port
* throughput
* optional coupled sink status
* optional coupled sink MAC
* R2 support (true/false)

+ 10 or more optional values...

I just had a look at the how gnome-screencast is passing those to NM / wpa_supplicant and they basically hardcode the IE in one place in the code and never touch the contents... On receival they only check if the WFD IEs were present and don't really look at the contents either. This is very new code though and I haven't looked at openwfd or miraclecast in detail.

Quoted 11 lines
Quoted 11 lines
---
  doc/p2p-api.txt                | 82 ++++++++++++++++++++++++++++++++++
  doc/p2p-peer-api.txt           | 66 +++++++++++++++++++++++++++
  doc/p2p-wfd-agent-api.txt      | 34 ++++++++++++++
  doc/signal-level-agent-api.txt |  4 ++
  4 files changed, 186 insertions(+)

create mode 100644 doc/p2p-api.txt
create mode 100644 doc/p2p-peer-api.txt
create mode 100644 doc/p2p-wfd-agent-api.txt

Quoted 14 lines

doc/p2p-api.txt line 6

Quoted 12 lines
doc/p2p-api.txt new file +6 -0
new file mode 100644
index 00000000..84f862e5
@@ -0,0 +1,82 @@
+P2P hierarchy
+=============
+
+Service              net.connman.iwd
+Interface    net.connman.iwd.P2P [Experimental]
+Object path  /{phy0,phy1,...}

So we changed the paths for 1.0 and this might need to be updated.

Right.

Quoted 13 lines

doc/p2p-api.txt line 16

Quoted 11 lines
doc/p2p-api.txt new file +10 -0
+
+Methods              array(on) GetPeers()
+
+                     Returns a list (possibly empty) of detected P2P peers.
+                     Each record returned contains a tuple of the following
+                     values.
+
+                     object Object
+
+                             net.connman.iwd.P2PPeer object representing

Name this iwd.Peer?

Sounds very generic, are we sure we won't have another spec that uses "peers" too?

Quoted 19 lines
Quoted 6 lines
doc/p2p-api.txt new file +5 -0
+                             the peer device.
+
+                     int16 SignalStrength
+
+                             Peer's maximum signal strength expressed

doc/p2p-api.txt line 31

Quoted 10 lines
doc/p2p-api.txt new file +10 -0
+                             in 100 * dBm.  The value is the range of 0
+                             (strongest signal) to -10000 (weakest signal)
+
+             void RegisterSignalLevelAgent(object path,
+                                              array(int16) levels)
+
+                     Register the agent object to receive signal strength
+                     level change notifications on the
+                     net.connman.iwd.SignalLevelAgent interface, see
+                     signal-level-agent-api.txt.  The "levels"

We moved this into the station api. So maybe just refer to that here...

Quoted 2 lines

Though really, I wonder if you even want to bother with this for the first iteration? I'd maybe leave this out?

Yeah, I wasn't going to implement it at this time. But since you'll have RSSI in every mode of wireless connections, AP, adhoc, ... wouldn't it make sense to have a common interface and share code in iwd and in the clients?

Quoted 13 lines
Quoted 13 lines
doc/p2p-api.txt new file +12 -0
+                     parameters decides the thresholds in dBm that will
+                     generate a call to the agent's Changed
+                     method whenever current RSSI crosses any of the
+                     values.  The values must be passed in descending
+                     order.  The number and distance between requested
+                     threshold values is a compromise between resolution
+                     and the frequency of system wakeups and
+                     context-switches that are going to be occuring to
+                     update the client's signal meter.  Only one agent
+                     can be registered at any time.
+
+                     Possible Errors: [service].Error.InvalidArguments
Quoted 8 lines

doc/p2p-api.txt line 48

Quoted 5 lines
doc/p2p-api.txt new file +5 -0
+                                      [service].Error.Failed
+                                      [service].Error.AlreadyExists
+                                      [service].Error.NotSupported
+
+             void RegisterWFDService(object path, array(byte) payload)

I would maybe make this a bit more generic in case other P2P services are supported in the future, like file sharing, etc.

I was thinking of having a separate agent interface and separate register method for each service, the parameters are going to be different... but we could also have a common register method and another method on the service's agent to query the actual values of the parameters (at the cost of additional round trips)

Quoted 6 lines

But, I'm not sure this belongs here? P2P is a per-phy interface; do you really want the clients to register WiFi Display per phy? Or just once and have it apply to all devices in the system, current or ones yet to be plugged in? Perhaps we need a ServiceManager or add this to AgentManager API?

Yep, perhaps a ServiceManager (P2PServiceManager?) is a better place...

Quoted 4 lines

I suppose it might be in theory possible to support both a Sink and a Source role on different phys, but then shouldn't you be distinguishing between the roles somehow?

It is possible but luckily it's all up to the wfd implementation. We'd only see this information if we wanted to build the WFD IEs ourselves like you suggest but we wouldn't be doing anything more than encoding / decoding it from the IEs.

Quoted 18 lines

doc/p2p-api.txt line 52

Quoted 5 lines
doc/p2p-api.txt new file +4 -0
+
+                     Register the Wi-Fi Display service running on local
+                     host with this P2P device so that device discovery
+                     and connection setup phases include necessary WFD

okay...

doc/p2p-api.txt line 61

Quoted 9 lines
doc/p2p-api.txt new file +9 -0
+                     information for the peers and receive peer's WFD
+                     service information.  An object may be provided to
+                     receive relevant WFD information about peers and
+                     connections through method calls on the object's
+                     net.connman.iwd.P2PWFDAgent interface.  See
+                     p2p-wfd-agent-api.txt.  Only one agent can be
+                     registered at any time.  The byte array provided
+                     will be included in WFD Information Elements
+                     present in relevant frames sent to peers.
Quoted 2 lines

So besides the IE information (which I don't really want transported in binary), what real use is the WFD agent?

So it would be receiving events on a new WFD connection and during discovery it would be receiving the capabilities etc. of the discovered peers.

Quoted 18 lines
Quoted 18 lines
doc/p2p-api.txt new file +17 -0
+
+                     Possible Errors: [service].Error.InvalidArguments
+                                      [service].Error.AlreadyExists
+                                      [service].Error.NotSupported
+
+Properties   boolean Enabled [readwrite]
+
+                     Whether local P2P device is started, i.e. is scanning
+                     for peers, is discoverable by peers and/or connected
+                     to peer(s).
+
+             string Name [readwrite]
+
+                     Sets local P2P device name as it is going to be
+                     presented on other devices that we will connect to
+                     or ones that discover us in scanning.
+
Quoted 8 lines

doc/p2p-api.txt line 82

Quoted 4 lines
doc/p2p-api.txt new file +4 -0
+             uint16 MaxConnections [readonly]
+
+                     Maximum number of concurrent P2P peers that local
+                     hardware is capable of connecting to.  Often 1.

I think we've talked about this before. Given what we now know, I would drop this for now. I think the likelihood of this becoming > 1 is astronomically small and we shouldn't even worry about this.

So I don't really have enough information to say that, the 2 P2P capable adapters that I worked with only support one client or one GO interface but those are only 2 adapters.

I have actually changed this since this proposal to be named AvailableConnections and switch between 1 and 0 as the device becomes busy. So it has an additional use of indicating whether a connection is in progress... the Connected property on the Peer only becomes 1 when the connection is operative.

Quoted 3 lines

This means
we can also move some attributes / methods from the Peer interface onto this one.

So this is a slightly different topic and I wouldn't do it. Apparently some device will make sure they become the GO during GO Negotiation (or as soon as P2P is enabled) and then use the invitation procedure instead of the group formation procedure, so then they can be connected to multiple peripherals and this seems to be an actual use case.

MaxConnections still doesn't sound right because in theory there's no maximum, but we still need some way to indicate if we're busy.

Quoted 18 lines

doc/p2p-peer-api.txt line 5

Quoted 12 lines
doc/p2p-peer-api.txt new file +5 -0
new file mode 100644
index 00000000..898f4fb9
@@ -0,0 +1,66 @@
+P2PPeer hierarchy
+=================
+
+Service              net.connman.iwd
+Interface    net.connman.iwd.P2PPeer [Experimental]

.iwd.Peer?

doc/p2p-peer-api.txt line 6

Quoted 1 line
doc/p2p-peer-api.txt new file +1 -0
+Object path  /{phy0,phy1,...}/p2p_peers/{aa_bb_cc_dd_ee_ff}

Object path needs to be updated post 1.0

Quoted 10 lines

doc/p2p-peer-api.txt line 12

Quoted 6 lines
doc/p2p-peer-api.txt new file +6 -0
+
+Methods              ConnectPushButton()
+
+                     Connect to the P2P peer in the Push Button mode
+                     using the device pointed to by the .Device property.
+                     Returns when connection is complete.

Why are you method names different from SimpleConfiguration? in fact, why not just add .SimpleConfiguration interface to the same object path and just have clients use that?

Could do this, yes, although it would have been nice to have "Connect" in the method names. And I'm not sure how to resolve this in the code since the implementation of the methods will be very different from the one in wsc.c, preferably I wouldn't duplicate setup_wsc_interface.

Quoted 19 lines
Quoted 19 lines
doc/p2p-peer-api.txt new file +18 -0
+
+                     Possible errors: net.connman.iwd.Aborted
+                                      net.connman.iwd.Busy
+                                      net.connman.iwd.Failed
+                                      net.connman.iwd.NotSupported
+                                      net.connman.iwd.Timeout
+                                      net.connman.iwd.InProgress
+
+             ConnectPIN(string pin)
+
+                     Connect to the P2P peer in PIN mode.  Returns when
+                     connection is complete.
+
+                     See net.connman.iwd.WiFiSimpleConfiguration.StartPIN()
+                     for how the pin argument is used.
+
+                     Possible errors: net.connman.iwd.Aborted
+                                      net.connman.iwd.Busy
Quoted 8 lines

doc/p2p-peer-api.txt line 36

Quoted 6 lines
doc/p2p-peer-api.txt new file +6 -0
+                                      net.connman.iwd.Failed
+                                      net.connman.iwd.NotSupported
+                                      net.connman.iwd.Timeout
+                                      net.connman.iwd.InProgress
+
+             Disconnect() [optional]

A method can't be optional?

Well since the optional concept is kind of made up it just means returning an error when the method or property doesn't apply.

Quoted 29 lines

Anyway, I'd put this on the P2P interface
instead.

Quoted 13 lines
doc/p2p-peer-api.txt new file +13 -0
+
+                     If connected, disconnect from this peer.
+
+                     Possible errors: net.connman.iwd.Failed
+
+Properties   string Name [readonly]
+
+                     P2P Peer's display name
+
+             string DeviceCategory [readonly]
+
+                     The category part of the peer's declared
+                     Primary Device Type.

doc/p2p-peer-api.txt line 59

Quoted 10 lines
doc/p2p-peer-api.txt new file +10 -0
+
+             string DeviceSubcategory [readonly, optional]
+
+                     The Sub Category part of the peer's declared
+                     Primary Device Type.
+
+             object Device [readonly]
+
+                     The object with a net.connman.iwd.P2P interface
+                     that discovered this peer.

Okay

Quoted 9 lines

doc/p2p-peer-api.txt line 66

Quoted 7 lines
doc/p2p-peer-api.txt new file +7 -0
+
+             boolean Connected [readonly]
+
+                     Whether there's currently an active connection
+                     to this peer.  The property is read-only and
+                     changes as a result of the Connect and
+                     Disconnect methods calls.

This wording might need to be updated....

You mean because we'd only have one connection?

Quoted 40 lines
Quoted 23 lines
doc/p2p-wfd-agent-api.txt new file +16 -0
new file mode 100644
index 00000000..be0ee01b
@@ -0,0 +1,34 @@
+P2PWFDAgent hierarchy
+=====================
+
+Service              unique name
+Interface    net.connman.iwd.P2PWFDAgent
+Object path  freely definable
+
+Methods              void Release(object device)
+
+                     This method gets called when IWD unregisters the
+                     WFD service on a specific P2P device. An agent can
+                     use it to do cleanup tasks. There is no need to
+                     unregister the agent, because when this method
+                     gets called it has already been unregistered.
+
+             void WFDPeersChanged(object device,

doc/p2p-wfd-agent-api.txt line 26

Quoted 10 lines
doc/p2p-wfd-agent-api.txt new file +10 -0
+                                     array(object, array(byte)) peers)
+
+                     Called when the set of discovered WFD-capable
+                     peers has changed during device discovery.
+
+                     The device object has the net.connman.iwd.P2P
+                     interface while the objects in the peers array
+                     have net.connman.iwd.P2PPeer interfaces.  The byte
+                     array included contains the reassembled payload of
+                     the WFD Information Elements presented by the peer.

Okay, so you want to notify the agent instead of adding a WFD specific interface to the Peer object. I still wonder if we can avoid transporting raw IEs here... Also, how are you making sure that the peers are actually ones that the agent cares about? There's no sense in sending Source role peer info if we're also a Source...

Quoted 1 line

Can we be a source and a sink at the same time?

Yeah, but I don't really see benefit in hiding the WFD sources if we're the source, or WFD sinks if we're a sink. It'll be simpler for everyone if the WFD service takes care of this.

Quoted 10 lines

doc/p2p-wfd-agent-api.txt line 32

Quoted 7 lines
doc/p2p-wfd-agent-api.txt new file +6 -0
+
+             void NewConnection(object peer, array(byte) payload)
+
+                     Called when a new P2P connection has been established
+                     to a WFD-capable peer.  The peer object has the
+                     net.connman.iwd.P2PPerr interface.  The byte array

typo

Quoted 7 lines

doc/p2p-wfd-agent-api.txt line 34

Quoted 2 lines
doc/p2p-wfd-agent-api.txt new file +2 -0
+                     contains the reassembled payload of the WFD
+                     Information Elements presented by the peer.

So I'm not entirely sure how this is useful? The fact that we made a connection to a peer is already available via the Peer.Connected property. Is the payload somehow different from what was sent via WFDPeersChanged?

Hmm, no, it should be the same in practice, so yeah, we can maybe drop this.

The spec actually has a different subset of subelements allowed in each frame (Associate vs. Beacon or Probe Response) but in wpa_supplicant for example, you set one WFD IE for all possible frames.

The bit that might change is "Available for WFD Session" now that I think of it... but I assume when a device is not available it simply won't be discovering or entering group formation. But it could be a candidate for modifying inside iwd rather than taking a value from the DBus client.

By the way, one thing that needs to change in this proposal is how peer discovery (scanning) is triggered and how the current state is signalled. Discovery is more expensive than we previously thought and can't be automatically enabled whenever the P2P interface is enabled.

Best regards

#3 lore raw

Hi Andrew,

Quoted 17 lines · Andrew Zaborowski

Hi Denis,

Quoted 14 lines · Denis Kenzior
Quoted 7 lines · Andrew Zaborowski

Proposed minimum P2P interfaces for establishing basic connections. The device discovery results in creation of P2PPeer objects.

In the Wi-Fi Display API we are passing raw IE data because there's a relatively big set of different values that may be encoded in them. We could reduce them to 2-3 bools and integers but this might limit the client implementations feature set.

So I'm not really a huge fan of this. We'd still need to be able to understand what is inside the IE in order to verify it properly. I'd err on the side of providing some attributes instead of full on binary IEs.

Quoted 8 lines
Quoted 4 lines

Also, some of the subelements involved should really be filled in by iwd itself and not the external application. Otherwise you'll end up with some sort of Frankenstein where the app provides some info but we'd need to rewrite or modify it anyway.

I didn't plan to interpret the contents of the IE in any way. The idea would be to have little service-specific code, and in case of WFD there's no need to do anything more than passing the ies.

So two issues:
- Passing in unchecked binary info from an unprivileged process is just not going to happen though. We have to look inside anyway to sanitize it.
- Some of the sub elements are dynamic (connected bssid for example). So you will end up having to interpret it anyway.

Quoted 6 lines

So I see only two options, either full on binary IE passed in both directions between iwd and the service implementation, or full on individual values from the WFD subelements. There's a lot of them though, for example for a probe response you have at least:

Quoted 8 lines

* 12 capability bits in a bitmap
* RTSP tcp port
* throughput
* optional coupled sink status
* optional coupled sink MAC
* R2 support (true/false)

+ 10 or more optional values...

So lets start with the bare minimum and see. In the end this API is experimental, so we can still change things.

Quoted 7 lines

I just had a look at the how gnome-screencast is passing those to NM / wpa_supplicant and they basically hardcode the IE in one place in the code and never touch the contents... On receival they only check if the WFD IEs were present and don't really look at the contents either. This is very new code though and I haven't looked at openwfd or miraclecast in detail.

Even more reason not to bother with passing IEs around.

<snip>

Quoted 14 lines
Quoted 13 lines

doc/p2p-api.txt line 16

Quoted 11 lines
doc/p2p-api.txt new file +10 -0
+
+Methods              array(on) GetPeers()
+
+                     Returns a list (possibly empty) of detected P2P peers.
+                     Each record returned contains a tuple of the following
+                     values.
+
+                     object Object
+
+                             net.connman.iwd.P2PPeer object representing

Name this iwd.Peer?

Quoted 2 lines

Sounds very generic, are we sure we won't have another spec that uses "peers" too?

I'm not aware of any. But P2PPeer does not CamelCase well regardless. I'm happy to hear other ideas.

<snip>

Quoted 10 lines
Quoted 10 lines

doc/p2p-api.txt line 31

Quoted 7 lines
doc/p2p-api.txt new file +7 -0
+             void RegisterSignalLevelAgent(object path,
+                                              array(int16) levels)
+
+                     Register the agent object to receive signal strength
+                     level change notifications on the
+                     net.connman.iwd.SignalLevelAgent interface, see
+                     signal-level-agent-api.txt.  The "levels"

We moved this into the station api. So maybe just refer to that here...

Quoted 7 lines
Quoted 2 lines

Though really, I wonder if you even want to bother with this for the first iteration? I'd maybe leave this out?

Yeah, I wasn't going to implement it at this time. But since you'll have RSSI in every mode of wireless connections, AP, adhoc, ... wouldn't it make sense to have a common interface and share code in iwd and in the clients?

You don't though. For AP you have multiple clients, which rssi are you going to show? Same goes for p2p-go really. With adhoc you have an even weirder problem.

Quoted 11 lines
Quoted 4 lines
Quoted 1 line

+ void RegisterWFDService(object path, array(byte) payload)

I would maybe make this a bit more generic in case other P2P services are supported in the future, like file sharing, etc.

I was thinking of having a separate agent interface and separate register method for each service, the parameters are going to be different... but we could also have a common register method and another method on the service's agent to query the actual values of the parameters (at the cost of additional round trips)

I'd just make this into a dictionary of parameters and have it depend on the service type.

Quoted 10 lines
Quoted 6 lines

But, I'm not sure this belongs here? P2P is a per-phy interface; do you really want the clients to register WiFi Display per phy? Or just once and have it apply to all devices in the system, current or ones yet to be plugged in? Perhaps we need a ServiceManager or add this to AgentManager API?

Yep, perhaps a ServiceManager (P2PServiceManager?) is a better place...

Quoted 1 line
Quoted 8 lines
Quoted 3 lines

I suppose it might be in theory possible to support both a Sink and a Source role on different phys, but then shouldn't you be distinguishing between the roles somehow?

It is possible but luckily it's all up to the wfd implementation. We'd only see this information if we wanted to build the WFD IEs ourselves like you suggest but we wouldn't be doing anything more than encoding / decoding it from the IEs.

Then we can't do this as a global registration. Because some sub-elements are dynamic it would be up to the application to update the IE properly. I'm really not sure we can avoid building the WFD IE ourselves.

<snip.

Quoted 13 lines
Quoted 8 lines

doc/p2p-api.txt line 82

Quoted 4 lines
doc/p2p-api.txt new file +4 -0
+             uint16 MaxConnections [readonly]
+
+                     Maximum number of concurrent P2P peers that local
+                     hardware is capable of connecting to.  Often 1.

I think we've talked about this before. Given what we now know, I would drop this for now. I think the likelihood of this becoming > 1 is astronomically small and we shouldn't even worry about this.

So I don't really have enough information to say that, the 2 P2P capable adapters that I worked with only support one client or one GO interface but those are only 2 adapters.

Quoted 5 lines

I have actually changed this since this proposal to be named AvailableConnections and switch between 1 and 0 as the device becomes busy. So it has an additional use of indicating whether a connection is in progress... the Connected property on the Peer only becomes 1 when the connection is operative.

Yeah, but that's the problem. What do you actually mean by AvailableConnections? Do you mean:

1. connections on a given P2P_CLIENT or P2P_GO interface? or
2. number of P2P_CLIENT & P2P_GO interfaces?

If 1, then this makes no sense anyway. For P2P_CLIENT it is always 1. For P2P_GO it is essentially unlimited.

For 2, I doubt you will ever find any hardware capable of doing more than 1 anyway. And it is a complication I wouldn't worry about now regardless. So if the v1 API is limited to a single connection and we later find out it is actually possible to do more, then we worry about it then.

Quoted 11 lines
Quoted 4 lines

This means
we can also move some attributes / methods from the Peer interface onto this one.

So this is a slightly different topic and I wouldn't do it. Apparently some device will make sure they become the GO during GO Negotiation (or as soon as P2P is enabled) and then use the invitation procedure instead of the group formation procedure, so then they can be connected to multiple peripherals and this seems to be an actual use case.

Yeah, see above. You're talking about 1 here. And I'd argue that AvailableConnections or MaxConnections still doesn't make sense in this context.

Quoted 3 lines

MaxConnections still doesn't sound right because in theory there's no maximum, but we still need some way to indicate if we're busy.

Exactly. So you need to find another way.

Quoted 11 lines
Quoted 10 lines

doc/p2p-peer-api.txt line 12

Quoted 6 lines
doc/p2p-peer-api.txt new file +6 -0
+
+Methods              ConnectPushButton()
+
+                     Connect to the P2P peer in the Push Button mode
+                     using the device pointed to by the .Device property.
+                     Returns when connection is complete.

Why are you method names different from SimpleConfiguration? in fact, why not just add .SimpleConfiguration interface to the same object path and just have clients use that?

Quoted 4 lines

Could do this, yes, although it would have been nice to have "Connect" in the method names. And I'm not sure how to resolve this in the code since the implementation of the methods will be very different from the one in wsc.c, preferably I wouldn't duplicate setup_wsc_interface.

Pretty easy I would think? I mean you do have the netdev associated with it, so you can simply check the interface type.

Quoted 7 lines
Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+             Disconnect() [optional]

A method can't be optional?

Well since the optional concept is kind of made up it just means returning an error when the method or property doesn't apply.

Made up? I don't think so. Properties are explicitly allowed to be optional. Methods are not. Check the D-Bus spec ;) We never had any optional methods and never will :)

Quoted 10 lines
Quoted 8 lines

doc/p2p-peer-api.txt line 66

Quoted 6 lines
doc/p2p-peer-api.txt new file +6 -0
+             boolean Connected [readonly]
+
+                     Whether there's currently an active connection
+                     to this peer.  The property is read-only and
+                     changes as a result of the Connect and
+                     Disconnect methods calls.

This wording might need to be updated....

You mean because we'd only have one connection?

Sorry, should have been more clear. The Connect and maybe even Disconnect method calls will be named differently. So the wording needs to be updated accordingly.

Quoted 7 lines
Quoted 7 lines

Okay, so you want to notify the agent instead of adding a WFD specific interface to the Peer object. I still wonder if we can avoid transporting raw IEs here... Also, how are you making sure that the peers are actually ones that the agent cares about? There's no sense in sending Source role peer info if we're also a Source...

Quoted 5 lines
Quoted 1 line

Can we be a source and a sink at the same time?

Yeah, but I don't really see benefit in hiding the WFD sources if we're the source, or WFD sinks if we're a sink. It'll be simpler for everyone if the WFD service takes care of this.

That goes against our core design principles and you know it :)

Quoted 14 lines
Quoted 14 lines

doc/p2p-wfd-agent-api.txt line 32

Quoted 8 lines
doc/p2p-wfd-agent-api.txt new file +6 -0
+
+             void NewConnection(object peer, array(byte) payload)
+
+                     Called when a new P2P connection has been established
+                     to a WFD-capable peer.  The peer object has the
+                     net.connman.iwd.P2PPerr interface.  The byte array

typo

Quoted 2 lines
doc/p2p-wfd-agent-api.txt new file +2 -0
+                     contains the reassembled payload of the WFD
+                     Information Elements presented by the peer.
Quoted 6 lines
Quoted 4 lines

So I'm not entirely sure how this is useful? The fact that we made a connection to a peer is already available via the Peer.Connected property. Is the payload somehow different from what was sent via WFDPeersChanged?

Hmm, no, it should be the same in practice, so yeah, we can maybe drop this.

okay

Quoted 12 lines

The spec actually has a different subset of subelements allowed in each frame (Associate vs. Beacon or Probe Response) but in wpa_supplicant for example, you set one WFD IE for all possible frames.

The bit that might change is "Available for WFD Session" now that I think of it... but I assume when a device is not available it simply won't be discovering or entering group formation. But it could be a candidate for modifying inside iwd rather than taking a value from the DBus client.

Quoted 5 lines

By the way, one thing that needs to change in this proposal is how peer discovery (scanning) is triggered and how the current state is signalled. Discovery is more expensive than we previously thought and can't be automatically enabled whenever the P2P interface is enabled.

Funny, okay I'm curious to learn more now.

Regards,
-Denis

#4 lore raw
Quoted 8 lines · Denis Kenzior
Quoted 3 lines · Andrew Zaborowski

I didn't plan to interpret the contents of the IE in any way. The idea would be to have little service-specific code, and in case of WFD there's no need to do anything more than passing the ies.

So two issues:
- Passing in unchecked binary info from an unprivileged process is just not going to happen though. We have to look inside anyway to sanitize it.

Fair enough, although I think the level of sanitization would only need to be the same as when we send out an SSID provided by an unprivileged process... we only check it's utf-8, not too long and such.

Quoted 2 lines

- Some of the sub elements are dynamic (connected bssid for example). So you will end up having to interpret it anyway.

AFAIK we don't strictly need to do anything and things will work just like with wpa_supplicant... but we could.

Quoted 14 lines
Quoted 14 lines

So I see only two options, either full on binary IE passed in both directions between iwd and the service implementation, or full on individual values from the WFD subelements. There's a lot of them though, for example for a probe response you have at least:

* 12 capability bits in a bitmap
* RTSP tcp port
* throughput
* optional coupled sink status
* optional coupled sink MAC
* R2 support (true/false)

Quoted 4 lines
Quoted 1 line

+ 10 or more optional values...

So lets start with the bare minimum and see. In the end this API is experimental, so we can still change things.

Ok, let's do it. I don't like that because we're again creating barriers for client software to start supporting iwd, and adding more work for iwd to do while doing this.

Quoted 48 lines
Quoted 8 lines

I just had a look at the how gnome-screencast is passing those to NM / wpa_supplicant and they basically hardcode the IE in one place in the code and never touch the contents... On receival they only check if the WFD IEs were present and don't really look at the contents either. This is very new code though and I haven't looked at openwfd or miraclecast in detail.

Even more reason not to bother with passing IEs around.

<snip>

Quoted 14 lines
Quoted 13 lines

doc/p2p-api.txt line 16

Quoted 11 lines
doc/p2p-api.txt new file +10 -0
+
+Methods              array(on) GetPeers()
+
+                     Returns a list (possibly empty) of detected P2P peers.
+                     Each record returned contains a tuple of the following
+                     values.
+
+                     object Object
+
+                             net.connman.iwd.P2PPeer object representing

Name this iwd.Peer?

Quoted 2 lines

Sounds very generic, are we sure we won't have another spec that uses "peers" too?

I'm not aware of any. But P2PPeer does not CamelCase well regardless. I'm happy to hear other ideas.

<snip>

Quoted 13 lines
Quoted 12 lines

doc/p2p-api.txt line 31

Quoted 7 lines
doc/p2p-api.txt new file +7 -0
+             void RegisterSignalLevelAgent(object path,
+                                              array(int16) levels)
+
+                     Register the agent object to receive signal strength
+                     level change notifications on the
+                     net.connman.iwd.SignalLevelAgent interface, see
+                     signal-level-agent-api.txt.  The "levels"

We moved this into the station api. So maybe just refer to that here...

Though really, I wonder if you even want to bother with this for the first iteration? I'd maybe leave this out?

Quoted 7 lines
Quoted 4 lines

Yeah, I wasn't going to implement it at this time. But since you'll have RSSI in every mode of wireless connections, AP, adhoc, ... wouldn't it make sense to have a common interface and share code in iwd and in the clients?

You don't though. For AP you have multiple clients, which rssi are you going to show?

That would be per client obviously, when/if information about the clients is added.

Quoted 1 line

Same goes for p2p-go really.

With P2P we are initiating the connections, so we have to expose information about each peer anyway.

Quoted 15 lines

With adhoc you have an
even weirder problem.

Quoted 11 lines
Quoted 4 lines
Quoted 1 line

+ void RegisterWFDService(object path, array(byte) payload)

I would maybe make this a bit more generic in case other P2P services are supported in the future, like file sharing, etc.

I was thinking of having a separate agent interface and separate register method for each service, the parameters are going to be different... but we could also have a common register method and another method on the service's agent to query the actual values of the parameters (at the cost of additional round trips)

Quoted 2 lines

I'd just make this into a dictionary of parameters and have it depend on the service type.

Ok, sounds good.

Quoted 20 lines
Quoted 11 lines
Quoted 7 lines

But, I'm not sure this belongs here? P2P is a per-phy interface; do you really want the clients to register WiFi Display per phy? Or just once and have it apply to all devices in the system, current or ones yet to be plugged in? Perhaps we need a ServiceManager or add this to AgentManager API?

Yep, perhaps a ServiceManager (P2PServiceManager?) is a better place...

Quoted 1 line
Quoted 8 lines
Quoted 3 lines

I suppose it might be in theory possible to support both a Sink and a Source role on different phys, but then shouldn't you be distinguishing between the roles somehow?

It is possible but luckily it's all up to the wfd implementation. We'd only see this information if we wanted to build the WFD IEs ourselves like you suggest but we wouldn't be doing anything more than encoding / decoding it from the IEs.

Quoted 4 lines

Then we can't do this as a global registration. Because some sub-elements are dynamic it would be up to the application to update the IE properly. I'm really not sure we can avoid building the WFD IE ourselves.

I think it should still be global actually, but maybe we need to expand the API somehow. I think it should be global because an application like gnome-screencast is not going to know which device to use. But we may need to add a way for the service to say it's connected now so that its not considered for any simultaneous connections, until the first connection is closed.

So since our assumption is that we're always initiating our connections (or in the future responing to an invitation, but the response is again our initiative), we could also register services per-connection and per-scan? This would work for gnome-screencast, since I believe it has its own dialog that shows you available devices to connect to... not sure about other services.

Quoted 22 lines

<snip.

Quoted 13 lines
Quoted 8 lines

doc/p2p-api.txt line 82

Quoted 4 lines
doc/p2p-api.txt new file +4 -0
+             uint16 MaxConnections [readonly]
+
+                     Maximum number of concurrent P2P peers that local
+                     hardware is capable of connecting to.  Often 1.

I think we've talked about this before. Given what we now know, I would drop this for now. I think the likelihood of this becoming > 1 is astronomically small and we shouldn't even worry about this.

So I don't really have enough information to say that, the 2 P2P capable adapters that I worked with only support one client or one GO interface but those are only 2 adapters.

Quoted 5 lines

I have actually changed this since this proposal to be named AvailableConnections and switch between 1 and 0 as the device becomes busy. So it has an additional use of indicating whether a connection is in progress... the Connected property on the Peer only becomes 1 when the connection is operative.

Quoted 5 lines

Yeah, but that's the problem. What do you actually mean by AvailableConnections? Do you mean:

1. connections on a given P2P_CLIENT or P2P_GO interface? or
2. number of P2P_CLIENT & P2P_GO interfaces?

So this should not bleed into the API. As long as we allow the user to make another connection, it should be signalled to the user somehow. Whether we're using a separate interface or just make another connection from our GO interface.

Quoted 3 lines

If 1, then this makes no sense anyway. For P2P_CLIENT it is always 1. For P2P_GO it is essentially unlimited.

Right, but we need to inform the user somehow whether we can make another connection with whatever role we have currently negotiated or because we're idle.

(and for P2P_GO we may want to set an artificial limit, it's only unlimited in theory)

Quoted 6 lines

For 2, I doubt you will ever find any hardware capable of doing more than 1 anyway. And it is a complication I wouldn't worry about now regardless. So if the v1 API is limited to a single connection and we later find out it is actually possible to do more, then we worry about it then.

So from what I've seen, it is possible, but not until we support the GO role. However our main usecase right now (I believe...) is a PC, phone, tablet, rather than a peripheral device, so I think this is definitely going to be expected from iwd, so are you sure you want to limit the API to a single connection?

AFAIK the android API for apps doesn't have this limit for example.

Quoted 18 lines
Quoted 6 lines
Quoted 5 lines

This means
we can also move some attributes / methods from the Peer interface onto this one.

Quoted 6 lines

So this is a slightly different topic and I wouldn't do it. Apparently some device will make sure they become the GO during GO Negotiation (or as soon as P2P is enabled) and then use the invitation procedure instead of the group formation procedure, so then they can be connected to multiple peripherals and this seems to be an actual use case.

Yeah, see above. You're talking about 1 here. And I'd argue that AvailableConnections or MaxConnections still doesn't make sense in this context.

Quoted 1 line
Quoted 4 lines
Quoted 2 lines

MaxConnections still doesn't sound right because in theory there's no maximum, but we still need some way to indicate if we're busy.

Exactly. So you need to find another way.

Hmm, maybe a 'State' property but I'm not sure how to call the different states to make this clear...

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

doc/p2p-peer-api.txt line 12

Quoted 7 lines
doc/p2p-peer-api.txt new file +6 -0
+
+Methods              ConnectPushButton()
+
+                     Connect to the P2P peer in the Push Button mode
+                     using the device pointed to by the .Device property.
+                     Returns when connection is complete.

Why are you method names different from SimpleConfiguration? in fact, why not just add .SimpleConfiguration interface to the same object path and just have clients use that?

Quoted 7 lines
Quoted 4 lines

Could do this, yes, although it would have been nice to have "Connect" in the method names. And I'm not sure how to resolve this in the code since the implementation of the methods will be very different from the one in wsc.c, preferably I wouldn't duplicate setup_wsc_interface.

Pretty easy I would think? I mean you do have the netdev associated with it, so you can simply check the interface type.

We only have a netdev after the GO Negotiation.

Esentially I'd need to have a new struct wsc, which would encapsulate either:

* a current struct wsc for a station interface, or
* a P2P peer that corresponds to a scan result.

Then the wsc.c PushButton method, for instance, would need to either do its current work or delegate it to a p2p.c function and exit.

Quoted 11 lines
Quoted 8 lines
Quoted 5 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+
+             Disconnect() [optional]

A method can't be optional?

Well since the optional concept is kind of made up it just means returning an error when the method or property doesn't apply.

Made up? I don't think so. Properties are explicitly allowed to be optional. Methods are not. Check the D-Bus spec ;)

You mean https://dbus.freedesktop.org/doc/dbus-specification.html ? I think we've talked about optional properties not being considered in the specs before...

Quoted 25 lines

We never had any
optional methods and never will :)

Quoted 10 lines
Quoted 8 lines

doc/p2p-peer-api.txt line 66

Quoted 6 lines
doc/p2p-peer-api.txt new file +6 -0
+             boolean Connected [readonly]
+
+                     Whether there's currently an active connection
+                     to this peer.  The property is read-only and
+                     changes as a result of the Connect and
+                     Disconnect methods calls.

This wording might need to be updated....

You mean because we'd only have one connection?

Sorry, should have been more clear. The Connect and maybe even Disconnect method calls will be named differently. So the wording needs to be updated accordingly.

Quoted 7 lines
Quoted 7 lines

Okay, so you want to notify the agent instead of adding a WFD specific interface to the Peer object. I still wonder if we can avoid transporting raw IEs here... Also, how are you making sure that the peers are actually ones that the agent cares about? There's no sense in sending Source role peer info if we're also a Source...

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Can we be a source and a sink at the same time?

Yeah, but I don't really see benefit in hiding the WFD sources if we're the source, or WFD sinks if we're a sink. It'll be simpler for everyone if the WFD service takes care of this.

That goes against our core design principles and you know it :)

I think it depends on the point of view. You might as well want the caller to specify what service or device class or WSC method it's interested in and only show them matching peers. You could even do things like this for normal infrastructure-mode networks.

Best regards

#5 lore raw

Hi Andrew,

Quoted 6 lines · Andrew Zaborowski
Quoted 5 lines · Denis Kenzior
Quoted 3 lines · Andrew Zaborowski

I didn't plan to interpret the contents of the IE in any way. The idea would be to have little service-specific code, and in case of WFD there's no need to do anything more than passing the ies.

Quoted 8 lines
Quoted 3 lines

So two issues:
- Passing in unchecked binary info from an unprivileged process is just not going to happen though. We have to look inside anyway to sanitize it.

Fair enough, although I think the level of sanitization would only need to be the same as when we send out an SSID provided by an unprivileged process... we only check it's utf-8, not too long and such.

Well, about the only place we do this is in Adhoc and AP code. And the SSID gets sanitized by the kernel (and maybe even the firmware) as well.
So there are multiple layers of protection here.

But in general, we do not allow arbitrary binary blobs to be passed around. That's just not our design philosophy.

Quoted 7 lines
Quoted 3 lines

- Some of the sub elements are dynamic (connected bssid for example). So you will end up having to interpret it anyway.

AFAIK we don't strictly need to do anything and things will work just like with wpa_supplicant... but we could.

Fair enough

Quoted 10 lines
Quoted 7 lines
Quoted 4 lines

Yeah, I wasn't going to implement it at this time. But since you'll have RSSI in every mode of wireless connections, AP, adhoc, ... wouldn't it make sense to have a common interface and share code in iwd and in the clients?

You don't though. For AP you have multiple clients, which rssi are you going to show?

That would be per client obviously, when/if information about the clients is added.

And the kernel has APIs for this? AFAIK you don't even get this info without polling. So trying to use our agent for this is not going to work.

Quoted 6 lines
Quoted 2 lines

Same goes for p2p-go really.

With P2P we are initiating the connections, so we have to expose information about each peer anyway.

So lets see how that works out given the above. I think for now I would leave all of this out.

Quoted 11 lines
Quoted 4 lines

Then we can't do this as a global registration. Because some sub-elements are dynamic it would be up to the application to update the IE properly. I'm really not sure we can avoid building the WFD IE ourselves.

I think it should still be global actually, but maybe we need to expand the API somehow. I think it should be global because an application like gnome-screencast is not going to know which device to use. But we may need to add a way for the service to say it's connected now so that its not considered for any simultaneous connections, until the first connection is closed.

Well, it is explicitly allowed to run multiple WFD sessions if the infrastructure is there, even without a P2P link.

So I generally agree this should be global, just pointing out that certain elements would need to be dynamic. This also (probably?) precludes us from advertising a Sink role and a Source role for example.
And also makes things like doing simultaneous P2P_GO + P2P_CLIENT sort
of pointless.

So overall I'd say we should ignore the possibility of multiple P2P iftypes. It will be either a P2P_GO with multiple clients or a P2P_CLIENT and we're limited to 1.

Quoted 8 lines

So since our assumption is that we're always initiating our connections (or in the future responing to an invitation, but the response is again our initiative), we could also register services per-connection and per-scan? This would work for gnome-screencast, since I believe it has its own dialog that shows you available devices to connect to... not sure about other services.

We can always introduce a per phy agent that would override the global one if we really encounter a use case that required this. Or allow multiple agents to be registered and if an application triggers a connection, then the agent registered on that application's dbus unique name (if any) gets preferred for any IEs broadcast.

For now I'd ignore this and assume we can only do one role at a time.

Quoted 11 lines
Quoted 6 lines

Yeah, but that's the problem. What do you actually mean by AvailableConnections? Do you mean:

1. connections on a given P2P_CLIENT or P2P_GO interface? or
2. number of P2P_CLIENT & P2P_GO interfaces?

So this should not bleed into the API. As long as we allow the user to make another connection, it should be signalled to the user somehow. Whether we're using a separate interface or just make another connection from our GO interface.

Then just indicate what role we have and let the application make that choice. So if we're in P2P_GO mode, it can try to establish another connection. And if we're in P2P_CLIENT mode, tough luck.

Quoted 11 lines
Quoted 4 lines

If 1, then this makes no sense anyway. For P2P_CLIENT it is always 1. For P2P_GO it is essentially unlimited.

Right, but we need to inform the user somehow whether we can make another connection with whatever role we have currently negotiated or because we're idle.

(and for P2P_GO we may want to set an artificial limit, it's only unlimited in theory)

Why? The hardware is the arbiter of this in the end.

Quoted 8 lines
Quoted 7 lines

For 2, I doubt you will ever find any hardware capable of doing more than 1 anyway. And it is a complication I wouldn't worry about now regardless. So if the v1 API is limited to a single connection and we later find out it is actually possible to do more, then we worry about it then.

Quoted 5 lines

So from what I've seen, it is possible, but not until we support the GO role. However our main usecase right now (I believe...) is a PC, phone, tablet, rather than a peripheral device, so I think this is definitely going to be expected from iwd, so are you sure you want to limit the API to a single connection?

Ah, imprecise wording here. By single connection I mean a single P2P_GO/P2P_CLIENT interface active at a time. So if we're in P2P_GO mode, we can do multiple 'connections'. But since we're not doing P2P_GO yet, then effectively we would only support a single active peer today.

Quoted 3 lines

AFAIK the android API for apps doesn't have this limit for example.

Right, but they still expect apps to setup the topology appropriately. And this is maybe something you need to consider for the future: being able to force one mode vs the other.

Quoted 23 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines

doc/p2p-peer-api.txt line 12

Quoted 8 lines
doc/p2p-peer-api.txt new file +6 -0
+
+Methods              ConnectPushButton()
+
+                     Connect to the P2P peer in the Push Button mode
+                     using the device pointed to by the .Device property.
+                     Returns when connection is complete.

Why are you method names different from SimpleConfiguration? in fact, why not just add .SimpleConfiguration interface to the same object path and just have clients use that?

Quoted 7 lines
Quoted 4 lines

Could do this, yes, although it would have been nice to have "Connect" in the method names. And I'm not sure how to resolve this in the code since the implementation of the methods will be very different from the one in wsc.c, preferably I wouldn't duplicate setup_wsc_interface.

Pretty easy I would think? I mean you do have the netdev associated with it, so you can simply check the interface type.

We only have a netdev after the GO Negotiation.

Quoted 7 lines

Esentially I'd need to have a new struct wsc, which would encapsulate either:

* a current struct wsc for a station interface, or
* a P2P peer that corresponds to a scan result.

Then the wsc.c PushButton method, for instance, would need to either do its current work or delegate it to a p2p.c function and exit.

Then make wsc work more like struct network. And have it register the interface when a station is available or on request for a p2p peer. We may have to be creative.

Regards,
-Denis

#6 lore raw
Quoted 6 lines · Denis Kenzior
Quoted 5 lines · Andrew Zaborowski
Quoted 5 lines
Quoted 4 lines

Yeah, I wasn't going to implement it at this time. But since you'll have RSSI in every mode of wireless connections, AP, adhoc, ... wouldn't it make sense to have a common interface and share code in iwd and in the clients?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

You don't though. For AP you have multiple clients, which rssi are you going to show?

That would be per client obviously, when/if information about the clients is added.

And the kernel has APIs for this? AFAIK you don't even get this info without polling. So trying to use our agent for this is not going to work.

I think there's a patchset that's being rebased occasionally. But what I mean is that maybe that interface doc shouldn't be buried in station-api.txt.

Quoted 10 lines
Quoted 7 lines
Quoted 3 lines

Same goes for p2p-go really.

With P2P we are initiating the connections, so we have to expose information about each peer anyway.

So lets see how that works out given the above. I think for now I would leave all of this out.

Ok.

Quoted 13 lines
Quoted 6 lines
Quoted 5 lines

Then we can't do this as a global registration. Because some sub-elements are dynamic it would be up to the application to update the IE properly. I'm really not sure we can avoid building the WFD IE ourselves.

Quoted 6 lines

I think it should still be global actually, but maybe we need to expand the API somehow. I think it should be global because an application like gnome-screencast is not going to know which device to use. But we may need to add a way for the service to say it's connected now so that its not considered for any simultaneous connections, until the first connection is closed.

Quoted 8 lines

Well, it is explicitly allowed to run multiple WFD sessions if the infrastructure is there, even without a P2P link.

So I generally agree this should be global, just pointing out that certain elements would need to be dynamic. This also (probably?) precludes us from advertising a Sink role and a Source role for example.
And also makes things like doing simultaneous P2P_GO + P2P_CLIENT sort
of pointless.

When talking about the API it's only a question of whether the parameters dictionary should have to booleans, one for sink, one for source, or one "role" variable. We're not acting on that information anyway, it's only so we can encode it in the IE.

Quoted 4 lines

So overall I'd say we should ignore the possibility of multiple P2P iftypes. It will be either a P2P_GO with multiple clients or a P2P_CLIENT and we're limited to 1.

In the code I'm currently ignoring that possibilty, but talking about the API it wouldn't make much difference.

Quoted 10 lines
Quoted 9 lines

So since our assumption is that we're always initiating our connections (or in the future responing to an invitation, but the response is again our initiative), we could also register services per-connection and per-scan? This would work for gnome-screencast, since I believe it has its own dialog that shows you available devices to connect to... not sure about other services.

Quoted 7 lines

We can always introduce a per phy agent that would override the global one if we really encounter a use case that required this. Or allow multiple agents to be registered and if an application triggers a connection, then the agent registered on that application's dbus unique name (if any) gets preferred for any IEs broadcast.

For now I'd ignore this and assume we can only do one role at a time.

Right. But I'm thinking if there is a whole better way of doing the service registration, i.e. per connection instead of globally. Say your use case is you're connecting first to a TV and then to a keyboard, or simultaneously (as a GO). There's no point advertising the WFD capabilities to the keyboard device or to anyone other than the TV, once your WFD session is running and functional. Maybe the ServiceManager is the wrong way to go and the Connect / PushButton method should receive the relevant information.

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

Yeah, but that's the problem. What do you actually mean by AvailableConnections? Do you mean:

1. connections on a given P2P_CLIENT or P2P_GO interface? or
2. number of P2P_CLIENT & P2P_GO interfaces?

Quoted 8 lines
Quoted 4 lines

So this should not bleed into the API. As long as we allow the user to make another connection, it should be signalled to the user somehow. Whether we're using a separate interface or just make another connection from our GO interface.

Then just indicate what role we have and let the application make that choice. So if we're in P2P_GO mode, it can try to establish another connection. And if we're in P2P_CLIENT mode, tough luck.

I think it would be nicer to just prefer GO automatically (maybe without forcing it), for example by having the GO Intent default to 14 out of 15 and be configurable in main.conf.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

If 1, then this makes no sense anyway. For P2P_CLIENT it is always 1. For P2P_GO it is essentially unlimited.

Quoted 8 lines
Quoted 6 lines

Right, but we need to inform the user somehow whether we can make another connection with whatever role we have currently negotiated or because we're idle.

(and for P2P_GO we may want to set an artificial limit, it's only unlimited in theory)

Why? The hardware is the arbiter of this in the end.

Some dedicated access points have trouble serving 10 connections simultaneously on one radio channel so for our off the shelf hardware and minimal ap.c code it's going to be very difficult.

Quoted 15 lines
Quoted 9 lines
Quoted 8 lines

For 2, I doubt you will ever find any hardware capable of doing more than 1 anyway. And it is a complication I wouldn't worry about now regardless. So if the v1 API is limited to a single connection and we later find out it is actually possible to do more, then we worry about it then.

Quoted 5 lines

So from what I've seen, it is possible, but not until we support the GO role. However our main usecase right now (I believe...) is a PC, phone, tablet, rather than a peripheral device, so I think this is definitely going to be expected from iwd, so are you sure you want to limit the API to a single connection?

Quoted 5 lines

Ah, imprecise wording here. By single connection I mean a single P2P_GO/P2P_CLIENT interface active at a time. So if we're in P2P_GO mode, we can do multiple 'connections'. But since we're not doing P2P_GO yet, then effectively we would only support a single active peer today.

So I assume you're Ok having the Disconnect method on the Peer interface, not on P2PDevice? So that our DBus clients are prepared to support multiple connections instead of 1?

Or I wonder if we should repurpose WSC.Cancel to also disconnect a fully established connection. There's no need for separate Cancel and Disconnect methods, but Disconnect sounds more correct.

Quoted 37 lines
Quoted 4 lines

AFAIK the android API for apps doesn't have this limit for example.

Right, but they still expect apps to setup the topology appropriately. And this is maybe something you need to consider for the future: being able to force one mode vs the other.

Quoted 28 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines

doc/p2p-peer-api.txt line 12

Quoted 8 lines
doc/p2p-peer-api.txt new file +6 -0
+
+Methods              ConnectPushButton()
+
+                     Connect to the P2P peer in the Push Button mode
+                     using the device pointed to by the .Device property.
+                     Returns when connection is complete.

Why are you method names different from SimpleConfiguration? in fact, why not just add .SimpleConfiguration interface to the same object path and just have clients use that?

Quoted 7 lines
Quoted 4 lines

Could do this, yes, although it would have been nice to have "Connect" in the method names. And I'm not sure how to resolve this in the code since the implementation of the methods will be very different from the one in wsc.c, preferably I wouldn't duplicate setup_wsc_interface.

Pretty easy I would think? I mean you do have the netdev associated with it, so you can simply check the interface type.

We only have a netdev after the GO Negotiation.

Esentially I'd need to have a new struct wsc, which would encapsulate either:

* a current struct wsc for a station interface, or
* a P2P peer that corresponds to a scan result.

Quoted 6 lines
Quoted 2 lines

Then the wsc.c PushButton method, for instance, would need to either do its current work or delegate it to a p2p.c function and exit.

Then make wsc work more like struct network. And have it register the interface when a station is available or on request for a p2p peer. We may have to be creative.

Right, I was just thinking that there's going to be little common code between the two usages of the WSC interface. For the first case it's going to be the same wsc.c code there is today, but for the latter the 3 methods will directly call into p2p.c and exit. (specifically PushButton, StartPin and Cancel)

Best regards

#7 lore raw

Hi Andrew,

Quoted 6 lines
Quoted 2 lines

And the kernel has APIs for this? AFAIK you don't even get this info without polling. So trying to use our agent for this is not going to work.

I think there's a patchset that's being rebased occasionally. But what I mean is that maybe that interface doc shouldn't be buried in station-api.txt.

Sure. But until we know that this is possible this step is premature. Right now the signal agent logically belongs in station since that is the only thing using it.

Quoted 7 lines
Quoted 6 lines

So I generally agree this should be global, just pointing out that certain elements would need to be dynamic. This also (probably?) precludes us from advertising a Sink role and a Source role for example.
And also makes things like doing simultaneous P2P_GO + P2P_CLIENT sort
of pointless.

Quoted 5 lines

When talking about the API it's only a question of whether the parameters dictionary should have to booleans, one for sink, one for source, or one "role" variable. We're not acting on that information anyway, it's only so we can encode it in the IE.

By the way, to answer my earlier question. It is possible to be both a Sink and a Source at the same time:
"0b11: dual-role possible, i.e., either a WFD Source or a Primary Sink"

Quoted 7 lines
Quoted 1 line

For now I'd ignore this and assume we can only do one role at a time.

Right. But I'm thinking if there is a whole better way of doing the service registration, i.e. per connection instead of globally. Say your use case is you're connecting first to a TV and then to a keyboard, or simultaneously (as a GO). There's no point advertising the WFD capabilities to the keyboard device or to anyone other than

I actually wouldn't expect this to be a good idea. Once you start advertising a set of IEs as a P2P GO, I'm not sure changing these is really something that is expected, particularly when you already have a peer connection established. Changing the contents to signal some state is probably OK (this is done in WSC for example). But taking out IEs entirely is a bit of a gray area.

See for example:

WFD Session Availability bits:
0b00: Not available for WFD Session

Or Section 5.2.1:
"If a WFD Device acts as a P2P Group Owner, the WFD Device shall insert one or more WFD IEs after the other information elements in the Beacon frames it transmits. "

I assume that at least the WFD spec wants you to twiddle the contents of the IEs and not remove IEs entirely.

Quoted 3 lines

the TV, once your WFD session is running and functional. Maybe the ServiceManager is the wrong way to go and the Connect / PushButton method should receive the relevant information.

And don't you need the advertising data before you even get to the point where you can invoke operations on the Peer interface?

Quoted 8 lines
Quoted 3 lines

Then just indicate what role we have and let the application make that choice. So if we're in P2P_GO mode, it can try to establish another connection. And if we're in P2P_CLIENT mode, tough luck.

I think it would be nicer to just prefer GO automatically (maybe without forcing it), for example by having the GO Intent default to 14 out of 15 and be configurable in main.conf.

Yes, sure. What I'm saying though is that once we're connected, we should indicate the topology somehow.

Quoted 5 lines
Quoted 1 line

Why? The hardware is the arbiter of this in the end.

Some dedicated access points have trouble serving 10 connections simultaneously on one radio channel so for our off the shelf hardware and minimal ap.c code it's going to be very difficult.

And? Any limit you pick will end up being wrong for someone.

Quoted 10 lines
Quoted 6 lines

Ah, imprecise wording here. By single connection I mean a single P2P_GO/P2P_CLIENT interface active at a time. So if we're in P2P_GO mode, we can do multiple 'connections'. But since we're not doing P2P_GO yet, then effectively we would only support a single active peer today.

So I assume you're Ok having the Disconnect method on the Peer interface, not on P2PDevice? So that our DBus clients are prepared to support multiple connections instead of 1?

I think these two things are somewhat orthogonal. We can still have Disconnect on the Device and not the peer. All that would do is preclude us from disconnecting individual links in P2P GO mode. But sure, I suppose it can remain on the Peer object.

Quoted 5 lines

Or I wonder if we should repurpose WSC.Cancel to also disconnect a fully established connection. There's no need for separate Cancel and Disconnect methods, but Disconnect sounds more correct.

Cancel only applies to the discovery and configuration procedure. The WSC is a separate handshake. So having a separate disconnect method is still needed once you get into the actual connection process.

Regards,
-Denis

#8 lore raw
Quoted 8 lines · Denis Kenzior
Quoted 7 lines
Quoted 1 line

For now I'd ignore this and assume we can only do one role at a time.

Right. But I'm thinking if there is a whole better way of doing the service registration, i.e. per connection instead of globally. Say your use case is you're connecting first to a TV and then to a keyboard, or simultaneously (as a GO). There's no point advertising the WFD capabilities to the keyboard device or to anyone other than

Quoted 6 lines

I actually wouldn't expect this to be a good idea. Once you start advertising a set of IEs as a P2P GO, I'm not sure changing these is really something that is expected, particularly when you already have a peer connection established. Changing the contents to signal some state is probably OK (this is done in WSC for example). But taking out IEs entirely is a bit of a gray area.

Right, but passing the WFD IE in the Association Request kind of signals that you want to establish a WFD connection and you don't want it for your second connection. You can keep signalling it in your beacons, although once the user has closed the screencasting app, I wouldn't worry about just removing those IEs from the beacons even though you may still be connected to the hypothetical P2P keyboard.

Quoted 14 lines

See for example:

WFD Session Availability bits:
0b00: Not available for WFD Session

Or Section 5.2.1:
"If a WFD Device acts as a P2P Group Owner, the WFD Device shall insert one or more WFD IEs after the other information elements in the Beacon frames it transmits. "

I assume that at least the WFD spec wants you to twiddle the contents of the IEs and not remove IEs entirely.

Quoted 6 lines
Quoted 3 lines

the TV, once your WFD session is running and functional. Maybe the ServiceManager is the wrong way to go and the Connect / PushButton method should receive the relevant information.

And don't you need the advertising data before you even get to the point where you can invoke operations on the Peer interface?

In theory you need to advertise it in your scan. Like I mentioned in another email, I think the scans should also be explicitly triggered by the apps because they're expensive, so those would also need to know the service parameters.

Maybe that's too complicated for now and we better try a global P2PServiceManager thing first.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

Then just indicate what role we have and let the application make that choice. So if we're in P2P_GO mode, it can try to establish another connection. And if we're in P2P_CLIENT mode, tough luck.

Quoted 7 lines
Quoted 4 lines

I think it would be nicer to just prefer GO automatically (maybe without forcing it), for example by having the GO Intent default to 14 out of 15 and be configurable in main.conf.

Yes, sure. What I'm saying though is that once we're connected, we should indicate the topology somehow.

I think we should just indicate that we can still attempt more connections, optimally without exposing the P2P roles.

Quoted 26 lines
Quoted 6 lines
Quoted 2 lines

Why? The hardware is the arbiter of this in the end.

Some dedicated access points have trouble serving 10 connections simultaneously on one radio channel so for our off the shelf hardware and minimal ap.c code it's going to be very difficult.

And? Any limit you pick will end up being wrong for someone.

Quoted 10 lines
Quoted 6 lines

Ah, imprecise wording here. By single connection I mean a single P2P_GO/P2P_CLIENT interface active at a time. So if we're in P2P_GO mode, we can do multiple 'connections'. But since we're not doing P2P_GO yet, then effectively we would only support a single active peer today.

So I assume you're Ok having the Disconnect method on the Peer interface, not on P2PDevice? So that our DBus clients are prepared to support multiple connections instead of 1?

I think these two things are somewhat orthogonal. We can still have Disconnect on the Device and not the peer. All that would do is preclude us from disconnecting individual links in P2P GO mode. But sure, I suppose it can remain on the Peer object.

Quoted 1 line
Quoted 8 lines
Quoted 4 lines

Or I wonder if we should repurpose WSC.Cancel to also disconnect a fully established connection. There's no need for separate Cancel and Disconnect methods, but Disconnect sounds more correct.

Cancel only applies to the discovery and configuration procedure. The WSC is a separate handshake. So having a separate disconnect method is still needed once you get into the actual connection process.

In any case on of the two is redundant ;) Disconnect already aborts a connection attempt (device discovery, group owner negotiation / provision discovery, provisioning or the PSK connection).

Of these only the provisioning uses WSC so conceptually the WSC interface is not a great match.

Best regards

#9 lore raw

Hi Andrew,

Quoted 16 lines · Andrew Zaborowski
Quoted 8 lines · Denis Kenzior
Quoted 7 lines
Quoted 1 line

For now I'd ignore this and assume we can only do one role at a time.

Right. But I'm thinking if there is a whole better way of doing the service registration, i.e. per connection instead of globally. Say your use case is you're connecting first to a TV and then to a keyboard, or simultaneously (as a GO). There's no point advertising the WFD capabilities to the keyboard device or to anyone other than

Quoted 6 lines

I actually wouldn't expect this to be a good idea. Once you start advertising a set of IEs as a P2P GO, I'm not sure changing these is really something that is expected, particularly when you already have a peer connection established. Changing the contents to signal some state is probably OK (this is done in WSC for example). But taking out IEs entirely is a bit of a gray area.

Quoted 7 lines

Right, but passing the WFD IE in the Association Request kind of signals that you want to establish a WFD connection and you don't want it for your second connection. You can keep signalling it in your beacons, although once the user has closed the screencasting app, I wouldn't worry about just removing those IEs from the beacons even though you may still be connected to the hypothetical P2P keyboard.

So you want two separate registrations? A global capability and a per-connection "I want to use this profile" type of thing. It sounded like you only wanted the latter above.

So really, I don't see the point. If iwd understands about WFD, then it simply wouldn't send any WFD IEs to a WFD-incapable device.

One can argue that the capability you propose would still be wanted in some weird situations.

For example, WFD allows 'Dual mode Sink & Source' only in the Beacon and Probe Response frames. For Association, it needs to pick one role.

Or maybe the Keyboard in your example is actually also WFD capable.. But then the spec mysteriously says:

"Depending on the availability of the WFD Device for a WFD Session, the value for WFD Session Availability bits (B5B4) of the WFD Device Information field of WFD Device Information subelement within the WFD IE may change" in Section 4.5.2.1 "Usage of a WFD IE to establish P2P connection". So who knows what they actually mean by that? Maybe we can always send WFD IEs and just twiddle those bits off?

I really wouldn't worry about these bizarre cases right now until you have something that actually works.

Quoted 18 lines
Quoted 18 lines

See for example:

WFD Session Availability bits:
0b00: Not available for WFD Session

Or Section 5.2.1:
"If a WFD Device acts as a P2P Group Owner, the WFD Device shall insert one or more WFD IEs after the other information elements in the Beacon frames it transmits. "

I assume that at least the WFD spec wants you to twiddle the contents of the IEs and not remove IEs entirely.

Quoted 3 lines

the TV, once your WFD session is running and functional. Maybe the ServiceManager is the wrong way to go and the Connect / PushButton method should receive the relevant information.

Quoted 7 lines
Quoted 2 lines

And don't you need the advertising data before you even get to the point where you can invoke operations on the Peer interface?

In theory you need to advertise it in your scan. Like I mentioned in another email, I think the scans should also be explicitly triggered by the apps because they're expensive, so those would also need to know the service parameters.

Okay. So you need to present those details then.

Quoted 5 lines
Quoted 2 lines

Yes, sure. What I'm saying though is that once we're connected, we should indicate the topology somehow.

I think we should just indicate that we can still attempt more connections, optimally without exposing the P2P roles.

I don't know why you'd want to hide that, but I'm fine either way.

Quoted 7 lines
Quoted 3 lines

Cancel only applies to the discovery and configuration procedure. The WSC is a separate handshake. So having a separate disconnect method is still needed once you get into the actual connection process.

In any case on of the two is redundant ;) Disconnect already aborts a connection attempt (device discovery, group owner negotiation / provision discovery, provisioning or the PSK connection).

I think about this differently. You have 2 phases:
1. Simple Configuration (WiFi Direct flavor) which involves the group
formation and wsc negotiation
2. Actual connection establishment

I don't see why Disconnect can't just affect 2 without affecting 1. The operations are on different interfaces after all.

Quoted 3 lines

Of these only the provisioning uses WSC so conceptually the WSC interface is not a great match.

Honestly, I'm not convinced that reinventing the wheel and duplicating the SimpleConfiguration API on the P2P Peer is any better.

Even in the classic station case WSC involves device discovery as well. So, in P2P, arguably everything up to the PSK connection establishment can be viewed as part of WSC.

It sounds like you need to send a v4 before we can go further.

Regards,
-Denis

#10 lore raw
Quoted 3 lines · Denis Kenzior

So you want two separate registrations? A global capability and a per-connection "I want to use this profile" type of thing. It sounded like you only wanted the latter above.

I was rather thinking of borth Scan() and PushButton() taking the information about services to advertise but it's a complication.

Quoted 51 lines

So really, I don't see the point. If iwd understands about WFD, then it simply wouldn't send any WFD IEs to a WFD-incapable device.

One can argue that the capability you propose would still be wanted in some weird situations.

For example, WFD allows 'Dual mode Sink & Source' only in the Beacon and Probe Response frames. For Association, it needs to pick one role.

Or maybe the Keyboard in your example is actually also WFD capable.. But then the spec mysteriously says:

"Depending on the availability of the WFD Device for a WFD Session, the value for WFD Session Availability bits (B5B4) of the WFD Device Information field of WFD Device Information subelement within the WFD IE may change" in Section 4.5.2.1 "Usage of a WFD IE to establish P2P connection". So who knows what they actually mean by that? Maybe we can always send WFD IEs and just twiddle those bits off?

I really wouldn't worry about these bizarre cases right now until you have something that actually works.

Quoted 18 lines
Quoted 18 lines

See for example:

WFD Session Availability bits:
0b00: Not available for WFD Session

Or Section 5.2.1:
"If a WFD Device acts as a P2P Group Owner, the WFD Device shall insert one or more WFD IEs after the other information elements in the Beacon frames it transmits. "

I assume that at least the WFD spec wants you to twiddle the contents of the IEs and not remove IEs entirely.

Quoted 3 lines

the TV, once your WFD session is running and functional. Maybe the ServiceManager is the wrong way to go and the Connect / PushButton method should receive the relevant information.

Quoted 7 lines
Quoted 2 lines

And don't you need the advertising data before you even get to the point where you can invoke operations on the Peer interface?

In theory you need to advertise it in your scan. Like I mentioned in another email, I think the scans should also be explicitly triggered by the apps because they're expensive, so those would also need to know the service parameters.

Okay. So you need to present those details then.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Yes, sure. What I'm saying though is that once we're connected, we should indicate the topology somehow.

I think we should just indicate that we can still attempt more connections, optimally without exposing the P2P roles.

I don't know why you'd want to hide that, but I'm fine either way.

It sounds more like the typo of information you want on a diagnostics interface because it is not supposed to affect your connection, like your AP's BSSID.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

Cancel only applies to the discovery and configuration procedure. The WSC is a separate handshake. So having a separate disconnect method is still needed once you get into the actual connection process.

Quoted 7 lines
Quoted 3 lines

In any case on of the two is redundant ;) Disconnect already aborts a connection attempt (device discovery, group owner negotiation / provision discovery, provisioning or the PSK connection).

I think about this differently. You have 2 phases:
1. Simple Configuration (WiFi Direct flavor) which involves the group
formation and wsc negotiation

Well, it simply isn't part of WSC, but ok.

Quoted 4 lines

2. Actual connection establishment

I don't see why Disconnect can't just affect 2 without affecting 1. The operations are on different interfaces after all.

We just don't need 2 methods and I already have Disconnect working this way (consistent with Station.Disconnect) so it'd mean just artificially crippling it, also adding a race where your Cancel call may work or not.

(Tecnically provisioning and the connection are both on the P2P_CLIENT interface)

Quoted 5 lines
Quoted 4 lines

Of these only the provisioning uses WSC so conceptually the WSC interface is not a great match.

Quoted 8 lines

Honestly, I'm not convinced that reinventing the wheel and duplicating the SimpleConfiguration API on the P2P Peer is any better.

Even in the classic station case WSC involves device discovery as well. So, in P2P, arguably everything up to the PSK connection establishment can be viewed as part of WSC.

It sounds like you need to send a v4 before we can go further.

Right, I'm still not sure about how discovery should be triggered but I can go on with the code with the answers and ideas I got from you already.

Best regards

#11 lore raw

Hi Andrew,

Quoted 6 lines
Quoted 3 lines

I think about this differently. You have 2 phases:
1. Simple Configuration (WiFi Direct flavor) which involves the group
formation and wsc negotiation

Well, it simply isn't part of WSC, but ok.

P2P in the end just took WSC and changed the discovery bits a bit. Fundamentally its still WSC in the end. But I guess depends on how you think about it...

Quoted 9 lines
Quoted 4 lines

2. Actual connection establishment

I don't see why Disconnect can't just affect 2 without affecting 1. The operations are on different interfaces after all.

We just don't need 2 methods and I already have Disconnect working this way (consistent with Station.Disconnect) so it'd mean just artificially crippling it, also adding a race where your Cancel call may work or not.

Station.Disconnect does not affect WSC state FYI. It can't since Station doesn't even know about the ongoing WSC process until after station_connect_network is invoked. So in that respect we'd be completely consistent.

Quoted 4 lines

(Tecnically provisioning and the connection are both on the P2P_CLIENT interface)

Same as Station/WSC today...

Regards,
-Denis

#12 lore raw
Quoted 21 lines · Denis Kenzior
Quoted 6 lines
Quoted 3 lines

I think about this differently. You have 2 phases:
1. Simple Configuration (WiFi Direct flavor) which involves the group
formation and wsc negotiation

Well, it simply isn't part of WSC, but ok.

P2P in the end just took WSC and changed the discovery bits a bit. Fundamentally its still WSC in the end. But I guess depends on how you think about it...

Quoted 9 lines
Quoted 4 lines

2. Actual connection establishment

I don't see why Disconnect can't just affect 2 without affecting 1. The operations are on different interfaces after all.

We just don't need 2 methods and I already have Disconnect working this way (consistent with Station.Disconnect) so it'd mean just artificially crippling it, also adding a race where your Cancel call may work or not.

Quoted 4 lines

Station.Disconnect does not affect WSC state FYI. It can't since Station doesn't even know about the ongoing WSC process until after station_connect_network is invoked. So in that respect we'd be completely consistent.

What I meant is that Disconnect() can cancel your station connection attempt at any point, while with Peer.Disconnect() you're going to have to be more careful for no reason.

Quoted 7 lines
Quoted 5 lines

(Tecnically provisioning and the connection are both on the P2P_CLIENT interface)

Same as Station/WSC today...

I was just noting they're not happening on different interfaces.

Best regards

#13 lore raw

Hi Andrew,

Quoted 8 lines
Quoted 4 lines

Station.Disconnect does not affect WSC state FYI. It can't since Station doesn't even know about the ongoing WSC process until after station_connect_network is invoked. So in that respect we'd be completely consistent.

What I meant is that Disconnect() can cancel your station connection attempt at any point, while with Peer.Disconnect() you're going to have to be more careful for no reason.

You will have to explain that then, because I don't get it? How is Peer.Disconnect any different? Your 'Peer' state doesn't change to connecting until after WSC runs. And if we become a GO, then things become even more funny since we can only send invites, not actually initiate a connection. So all these methods become somewhat irrelevant.
In fact, I wonder if we should be removing the WSC interface when we
become the GO and adding another one for performing invitations.

Quoted 1 line

I was just noting they're not happening on different interfaces.

Of course. That's because P2P_CLIENT is just a station iftype under the hood in the kernel with some extra stuff bolted on. But we knew that ;)

Maybe what we should do is just implement the bare minimum client side API, learn from it and assume that whatever API we come up with now will likely not survive when we start implementing GO side.

Regards,
-Denis

#14 lore raw

Hi Denis,

Quoted 5 lines · Denis Kenzior
Quoted 5 lines
Quoted 4 lines

Station.Disconnect does not affect WSC state FYI. It can't since Station doesn't even know about the ongoing WSC process until after station_connect_network is invoked. So in that respect we'd be completely consistent.

Quoted 7 lines
Quoted 3 lines

What I meant is that Disconnect() can cancel your station connection attempt at any point, while with Peer.Disconnect() you're going to have to be more careful for no reason.

You will have to explain that then, because I don't get it? How is Peer.Disconnect any different? Your 'Peer' state doesn't change to connecting until after WSC runs.

That's needlessly complicating things for the users. From the user's point of view there's a device they want to connect to and use it. They call a single method and get a connection established, and if they need to interrupt the process then it's still single process. You could split it in any number of ways, as before WSC there's a bunch of other things happening, but from the user's point of view those are details they don't want to see. WSC is one of 4 or 5 steps (you can make up more) in the P2P connection but there's no benefit from making the user aware of them.

Quoted 3 lines

And if we become a GO, then things
become even more funny since we can only send invites, not actually initiate a connection.

Invitation is just a technical name for a frame sequence, group formation is another, but it's just ways to connect to a device. Note how Android shows the same Accept/Decline dialog whether you're using group formation or invitation. (same or similar... I thought the wording was the same but don't have screenshots at hand)

On a similar note:
The P2P devices I've seen don't have a physical WSC button (not surprising), but they don't even have a virtual button or the word Push Button anywhere in the user interfaces. Take for example Android connecting to a wifi-display TV, neither mentions any WSC term like Push Button in their UIs. The verbs are connect and accept/decline connection (and similar). WSC is really just a protocol used at the network level and an implementation detail, as are the P2P roles.

Quoted 7 lines

So all these methods become somewhat irrelevant.
In fact, I wonder if we should be removing the WSC interface when we
become the GO and adding another one for performing invitations.

Quoted 1 line

I was just noting they're not happening on different interfaces.

Of course.

Oh so this was just a typo I was replying to I guess.

Quoted 6 lines

That's because P2P_CLIENT is just a station iftype under the
hood in the kernel with some extra stuff bolted on. But we knew that ;)

Maybe what we should do is just implement the bare minimum client side API, learn from it and assume that whatever API we come up with now will likely not survive when we start implementing GO side.

There really shouldn't be any difference to the user.

Quoted 6 lines

Regards,
-Denis
_______________________________________________
iwd mailing list -- iwd(a)lists.01.org
To unsubscribe send an email to iwd-leave(a)lists.01.org

#15 lore raw

Hi Andrew,

Quoted 9 lines
Quoted 3 lines

And if we become a GO, then things
become even more funny since we can only send invites, not actually initiate a connection.

Invitation is just a technical name for a frame sequence, group formation is another, but it's just ways to connect to a device. Note how Android shows the same Accept/Decline dialog whether you're using group formation or invitation. (same or similar... I thought the wording was the same but don't have screenshots at hand)

- How are you handling the case where the Peer wants us to display our PIN? And provision discovery in general?
- Invitations?
- invitation by a P2P Device (not group owner) of another P2P Device?
- The fact that GO has a bunch of stats about its clients and you probably want to expose that similarly to AP mode?
- The fact that GO has to handle connections from legacy clients and thus needs to provide legacy WPS methods?
- persistent groups, with custom or saved credentials?

To me it seems quite impractical to mix GO and client and to try and hide these details. I have very strong doubts you will succeed here.

And I also think you're not avoiding exposing topology details. For example, is Peer.Disconnect resulting in a disconnection of a single peer or group tear down?

I think you really need to send a v4. I just don't see how you're handling many of the P2P concepts, much less P2P-GO specific ones in this one.

Regards,
-Denis

#16 lore raw
Quoted 4 lines · Denis Kenzior
Quoted 4 lines
Quoted 3 lines

And if we become a GO, then things
become even more funny since we can only send invites, not actually initiate a connection.

Quoted 8 lines
Quoted 5 lines

Invitation is just a technical name for a frame sequence, group formation is another, but it's just ways to connect to a device. Note how Android shows the same Accept/Decline dialog whether you're using group formation or invitation. (same or similar... I thought the wording was the same but don't have screenshots at hand)

- How are you handling the case where the Peer wants us to display our PIN? And provision discovery in general?

We can add a signal for this, but this is independent of the role and not a high priority.

Do we have a use case for this?

Quoted 2 lines

- Invitations?
- invitation by a P2P Device (not group owner) of another P2P Device?

We don't need to unless we're also going to be running on peripheral devices, but that's not our current use case.

Quoted 2 lines

- The fact that GO has a bunch of stats about its clients and you probably want to expose that similarly to AP mode?

We don't expose anything in AP mode?

Our main use case is to provide bluetooth-like connections to devices.

Quoted 2 lines

- The fact that GO has to handle connections from legacy clients and thus needs to provide legacy WPS methods?

Is there a use case for this?

Quoted 1 line

- persistent groups, with custom or saved credentials?

We will need to start saving credentials because that's something that's actually in use, and we need to do this both on the GO and client.

Quoted 7 lines

To me it seems quite impractical to mix GO and client and to try and hide these details. I have very strong doubts you will succeed here.

And I also think you're not avoiding exposing topology details. For example, is Peer.Disconnect resulting in a disconnection of a single peer or group tear down?

Assuming that is the last peer in that group then either will work, I don't see the difference here.

If there are more peers then obviously you don't want to break things by disconnecting them?

Quoted 2 lines

I think you really need to send a v4. I just don't see how you're

Yes, we agreed on that, although I'm still missing any reasoning for the Cancel method for example. If you have ideas on how to handle the following I'd also welcome them:

* how to best signal whether the device is available to start a new connection, assuming you didn't like the AvailableConnections (int) property.

* how to trigger device discovery, optimally in a way that forces the
client to stop it after
a while, basically to make sure it's not left running when the UI
isn't active. For
example for our "agents" we automatically detect if they're
disconnected, here we
probably also want the client to "own" the scan in some way.

Quoted 2 lines

handling many of the P2P concepts, much less P2P-GO specific ones in this one.

What are some P2P-GO specific concepts that would affect the DBus API?
As long as we provide for having multiple active connections, and we
allow for new properties on the Peer interface in the future, we should be fine.

Best regards

#17 lore raw

Hi Andrew,

Quoted 11 lines · Andrew Zaborowski
Quoted 10 lines · Denis Kenzior
Quoted 9 lines
Quoted 3 lines

And if we become a GO, then things
become even more funny since we can only send invites, not actually initiate a connection.

Invitation is just a technical name for a frame sequence, group formation is another, but it's just ways to connect to a device. Note how Android shows the same Accept/Decline dialog whether you're using group formation or invitation. (same or similar... I thought the wording was the same but don't have screenshots at hand)

Quoted 5 lines
Quoted 2 lines

- How are you handling the case where the Peer wants us to display our PIN? And provision discovery in general?

We can add a signal for this, but this is independent of the role and not a high priority.

It sort of is. How is the user notified that some other device is trying to connect to us? How do they know its time to enter the password or just display it on the screen?

And a signal is not enough as the UI might want to perform an authorization step here as well.

Quoted 2 lines

Do we have a use case for this?

Absolutely.

Quoted 6 lines
Quoted 3 lines

- Invitations?
- invitation by a P2P Device (not group owner) of another P2P Device?

We don't need to unless we're also going to be running on peripheral devices, but that's not our current use case.

The latter is optional and of dubious value. The former might be kind of important.

Quoted 6 lines
Quoted 3 lines

- The fact that GO has a bunch of stats about its clients and you probably want to expose that similarly to AP mode?

We don't expose anything in AP mode?

AP mode isn't really finished. We need to add this some day.

Quoted 7 lines

Our main use case is to provide bluetooth-like connections to devices.

Quoted 2 lines

- The fact that GO has to handle connections from legacy clients and thus needs to provide legacy WPS methods?

Is there a use case for this?

If you want to pass conformance tests it is. See Table 7: GOUT Protocol Conformance Tests in the Wi-Fi Direct Test plan.

Quoted 5 lines
Quoted 1 line

- persistent groups, with custom or saved credentials?

We will need to start saving credentials because that's something that's actually in use, and we need to do this both on the GO and client.

Fair enough.

Quoted 11 lines
Quoted 8 lines

To me it seems quite impractical to mix GO and client and to try and hide these details. I have very strong doubts you will succeed here.

And I also think you're not avoiding exposing topology details. For example, is Peer.Disconnect resulting in a disconnection of a single peer or group tear down?

Assuming that is the last peer in that group then either will work, I don't see the difference here.

But you may want to keep the group around. Anyway, this is not a
biggie but I think you're making an assumption this would never be wanted.

Quoted 3 lines

If there are more peers then obviously you don't want to break things by disconnecting them?

Sure, this one is obvious.

Quoted 6 lines
Quoted 3 lines

I think you really need to send a v4. I just don't see how you're

Yes, we agreed on that, although I'm still missing any reasoning for the Cancel method for example. If you have ideas on how to handle the

That's just how Station & WSC work today, and actually work pretty well compared to any other WPS API I saw. I don't see why following the same pattern is so bad? In the end the user still invokes a single method and gets connected.

Really, all your criticisms apply to station/wsc as well. But then aborts are sort of an uncommon case anyway.

Quoted 4 lines

following I'd also welcome them:

* how to best signal whether the device is available to start a new connection, assuming you didn't like the AvailableConnections (int) property.

At the moment I think exposing the role is the way to go. But feel free to convince me otherwise.

Quoted 8 lines

* how to trigger device discovery, optimally in a way that forces the
client to stop it after
a while, basically to make sure it's not left running when the UI
isn't active. For
example for our "agents" we automatically detect if they're
disconnected, here we
probably also want the client to "own" the scan in some way.

One idea would be to add a StartDiscovery / StopDiscovery methods and track client state. So if a client drops off the bus, then we automatically stop discovery sessions initiated by it. This could also be used to send parameters for the discovery. E.g. only WFD devices. Each distinct dbus client (i.e. dbus unique service name) can set its own parameters for peers it is interested in.

However, these commands might need to be limited if we're in some existing connection or not. You're the expert on the details here.

Quoted 9 lines
Quoted 3 lines

handling many of the P2P concepts, much less P2P-GO specific ones in this one.

What are some P2P-GO specific concepts that would affect the DBus API?
As long as we provide for having multiple active connections, and we
allow for new properties on the Peer interface in the future, we should be fine.

I think this was already covered. If you can unify the API, great. I think there are some nasty stumbling blocks though.

Regards,
-Denis

#18 lore raw

Hi Denis,

Quoted 15 lines · Denis Kenzior
Quoted 14 lines · Andrew Zaborowski
Quoted 12 lines · Denis Kenzior
Quoted 9 lines
Quoted 3 lines

And if we become a GO, then things
become even more funny since we can only send invites, not actually initiate a connection.

Invitation is just a technical name for a frame sequence, group formation is another, but it's just ways to connect to a device. Note how Android shows the same Accept/Decline dialog whether you're using group formation or invitation. (same or similar... I thought the wording was the same but don't have screenshots at hand)

- How are you handling the case where the Peer wants us to display our PIN? And provision discovery in general?

Quoted 6 lines
Quoted 2 lines

We can add a signal for this, but this is independent of the role and not a high priority.

It sort of is. How is the user notified that some other device is trying to connect to us? How do they know its time to enter the password or just display it on the screen?

Device to device connections weren't really my concern for this iteration of the API, but I think we may have even talked about having an optional agent to receive the invitations / new connections. I guess your use case is something like file sharing? Note that there's no standard service for this, you need to choose one of a hundred apps incompatible between each other, and you need to have a compatible app on the other end.

Quoted 20 lines

And a signal is not enough as the UI might want to perform an authorization step here as well.

Quoted 2 lines

Do we have a use case for this?

Absolutely.

Quoted 6 lines
Quoted 3 lines

- Invitations?
- invitation by a P2P Device (not group owner) of another P2P Device?

We don't need to unless we're also going to be running on peripheral devices, but that's not our current use case.

The latter is optional and of dubious value. The former might be kind of important.

Quoted 1 line
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

- The fact that GO has a bunch of stats about its clients and you probably want to expose that similarly to AP mode?

We don't expose anything in AP mode?

AP mode isn't really finished. We need to add this some day.

Things like bandwidth usage, IP? They should probably use the same property names for both AP and P2P.

Quoted 11 lines
Quoted 8 lines

Our main use case is to provide bluetooth-like connections to devices.

Quoted 2 lines

- The fact that GO has to handle connections from legacy clients and thus needs to provide legacy WPS methods?

Is there a use case for this?

If you want to pass conformance tests it is. See Table 7: GOUT Protocol Conformance Tests in the Wi-Fi Direct Test plan.

I can't find this document right now but I assume there's a few more things that may be not worth the effort implementing and are required for certification.

Quoted 18 lines
Quoted 6 lines
Quoted 2 lines

- persistent groups, with custom or saved credentials?

We will need to start saving credentials because that's something that's actually in use, and we need to do this both on the GO and client.

Fair enough.

Quoted 9 lines
Quoted 8 lines

To me it seems quite impractical to mix GO and client and to try and hide these details. I have very strong doubts you will succeed here.

And I also think you're not avoiding exposing topology details. For example, is Peer.Disconnect resulting in a disconnection of a single peer or group tear down?

Quoted 5 lines
Quoted 2 lines

Assuming that is the last peer in that group then either will work, I don't see the difference here.

But you may want to keep the group around. Anyway, this is not a
biggie but I think you're making an assumption this would never be wanted.

It may be wanted or it may be the default if we manage to become the GO (the peer may in theory require the GO role). But it may be a config setting.

Quoted 22 lines
Quoted 4 lines

If there are more peers then obviously you don't want to break things by disconnecting them?

Sure, this one is obvious.

Quoted 6 lines
Quoted 3 lines

I think you really need to send a v4. I just don't see how you're

Yes, we agreed on that, although I'm still missing any reasoning for the Cancel method for example. If you have ideas on how to handle the

That's just how Station & WSC work today, and actually work pretty well compared to any other WPS API I saw. I don't see why following the same pattern is so bad? In the end the user still invokes a single method and gets connected.

Really, all your criticisms apply to station/wsc as well. But then aborts are sort of an uncommon case anyway.

Quoted 7 lines
Quoted 4 lines

following I'd also welcome them:

* how to best signal whether the device is available to start a new connection, assuming you didn't like the AvailableConnections (int) property.

At the moment I think exposing the role is the way to go. But feel free to convince me otherwise.

So I was rather thinking of one simple property to indicate if we can start a new connection and/or how many. This would combine at least:

* our P2P role,

* whether we're already connected (in other words whether we have as
many active connections as max allowed P2P interfaces...)

* whether we're currently connecting/disconnecting as a P2P client
(during those operations the Connected property will be false in my current design)

* whether we're currently in Group Formation in which case we're not
allowed do anything as either client or GO.

Quoted 10 lines
Quoted 9 lines

* how to trigger device discovery, optimally in a way that forces the
client to stop it after
a while, basically to make sure it's not left running when the UI
isn't active. For
example for our "agents" we automatically detect if they're
disconnected, here we
probably also want the client to "own" the scan in some way.

Quoted 6 lines

One idea would be to add a StartDiscovery / StopDiscovery methods and track client state. So if a client drops off the bus, then we automatically stop discovery sessions initiated by it. This could also be used to send parameters for the discovery. E.g. only WFD devices. Each distinct dbus client (i.e. dbus unique service name) can set its own parameters for peers it is interested in.

Ok.

Best regards