Skip to contentSkip to conversation

doc: Add initial Network Management API definition

RFC In review Johan Hedberg 2 participants 4 messages Jun 22, 2015 – Jul 27, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC v3 1/1 doc: Add initial Network Management API definition

From: Johan Hedberg <[email protected]>

---
This was formerly known as "doc: Add initial 6LoWPAN API definition". It now has a more generic name so that other Networking profiles could potentially be included behind the same channel in the future. I've skipped event code 0x03 ("HW Error") since we couldn't reach concensus there. So 0x03 is effectively a "reserved" value for now.

 Makefile.am              |   2 +-
 doc/network-mgmt-api.txt | 326 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 327 insertions(+), 1 deletion(-)
 create mode 100644 doc/network-mgmt-api.txt
Makefile.am +1 -1
index 76d17239783f..d322117dabec 100644
@@ -243,7 +243,7 @@ EXTRA_DIST += doc/assigned-numbers.txt doc/supported-features.txt \
 				doc/test-runner.txt \
 				doc/settings-storage.txt
 
-EXTRA_DIST += doc/mgmt-api.txt \
+EXTRA_DIST += doc/mgmt-api.txt doc/network-mgmt-api.txt \
 		doc/adapter-api.txt doc/device-api.txt \
 		doc/agent-api.txt doc/profile-api.txt \
 		doc/network-api.txt doc/media-api.txt \
doc/network-mgmt-api.txt new file +326 -0

326 lines not on this page · raw message

Signature · 4 lines
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
maintainer
#1 lore raw

Hi Johan,

Quoted 127 lines

This was formerly known as "doc: Add initial 6LoWPAN API definition". It now has a more generic name so that other Networking profiles could potentially be included behind the same channel in the future. I've skipped event code 0x03 ("HW Error") since we couldn't reach concensus there. So 0x03 is effectively a "reserved" value for now.

Makefile.am | 2 +-
doc/network-mgmt-api.txt | 326 +++++++++++++++++++++++++++++++++++++++++++++++

2 files changed, 327 insertions(+), 1 deletion(-)

create mode 100644 doc/network-mgmt-api.txt

Makefile.am +1 -1
index 76d17239783f..d322117dabec 100644
@@ -243,7 +243,7 @@ EXTRA_DIST += doc/assigned-numbers.txt doc/supported-features.txt \
 				doc/test-runner.txt \
 				doc/settings-storage.txt
 
-EXTRA_DIST += doc/mgmt-api.txt \
+EXTRA_DIST += doc/mgmt-api.txt doc/network-mgmt-api.txt \
 		doc/adapter-api.txt doc/device-api.txt \
 		doc/agent-api.txt doc/profile-api.txt \
 		doc/network-api.txt doc/media-api.txt \
doc/network-mgmt-api.txt new file +97 -0
new file mode 100644
index 000000000000..29e506c8283b
@@ -0,0 +1,326 @@
+Network Management API
+**********************
+
+Copyright (C) 2015  Intel Corporation
+
+
+Overview
+========
+
+The Network Management API follows largely the same principles as the main
+Bluetooth Management API described in mgmt-api.txt. The main difference is
+a separate namespace for command and event codes, distinguished by using
+HCI_CHANNEL_NETWORK rather than HCI_CHANNEL_CONTROL when creating the mgmt
+socket.
+
+
+Read Version Information Command
+================================
+
+	Command Code:		0x0001
+	Controller Index:	<non-controller>
+	Command Parameters:
+	Return Parameters:	Version (1 Octets)
+				Revision (2 Octets)
+
+	This command returns the Network Management version and
+	revision. In addition to being informational the information can
+	be used to determine whether certain behavior has changed or
+	bugs fixed when interacting with the kernel.
+
+	This command generates a Command Complete event on success or
+	a Command Status event on failure.
+
+
+Read Supported Commands Command
+===============================
+
+	Command Code:		0x0002
+	Controller Index:	<non-controller>
+	Command Parameters:
+	Return Parameters:	Num_Of_Commands (2 Octets)
+				Num_Of_Events (2 Octets)
+				Command1 (2 Octets)
+				Command2 (2 Octets)
+				...
+				Event1 (2 Octets)
+				Event2 (2 Octets)
+				...
+
+	This command returns the list of supported Network commands
+	and events.
+
+	The commands Read Version Information and Read Supported
+	Commands are not included in this list. Both commands are always
+	supported and mandatory.
+
+	The events Command Status and Command Complete are not included
+	in this list. Both are implicit and mandatory.
+
+	This command generates a Command Complete event on success or
+	a Command Status event on failure.
+
+
+Read Controller Index List Command
+==================================
+
+	Command Code:		0x0003
+	Controller Index:	<non-controller>
+	Command Parameters:
+	Return Parameters:	Num_Controllers (2 Octets)
+				Controller_Index[i] (2 Octets)
+
+	This command returns the list of currently known controllers
+	that can be used for Network connections. Controllers added or
+	removed after calling this command can be monitored using the
+	Index Added and Index Removed events.
+
+	This command generates a Command Complete event on success or
+	a Command Status event on failure.
+
+
+Read Controller Information Command
+===================================
+
+	Command Code:		0x0004
+	Controller Index:	<controller id>
+	Command Parameters:
+	Return Parameters:	Address (6 Octets)
+				Address_Type (6 Octets)
+				Supported_Settings (4 Octets)
+				Current_Settings (4 Octets)
+				6LoWPAN_Interface_Index (4 Octets)
+
+	This command is used to retreive the current state and basic
+	information of a controller. It is typically used right after
+	getting the response to the Read Controller Index List command
+	or an Index Added event.

doc/network-mgmt-api.txt line 107

Quoted 10 lines
doc/network-mgmt-api.txt new file +10 -0
+
+	Current_Settings and Supported_Settings is a bitmask with
+	currently the following available bits:
+
+		0	6LoWPAN
+		1	6LoWPAN Server (Node)
+
+	The 6LoWPAN_Interface_Index parameter value is only valid if the
+	6LoWPAN settings bit is set in the Current_Settings, otherwise
+	it should be ignored.

I have no idea what this is going to do. I wonder if should really have this in this command. Especially since the index might be even there if it is not enabled yet. This sound more like a parameter that should be returned by an individual command or when enabling the 6LoWPAN support.

On a site note, we might need to stay away from calling this 6LoWPAN since the IETF is not even sure how they want to name stuff. Some comments say that 6LoWPAN is for 802.15.4 and 6LoBTLE or similar will be for LE. So it might be better to start using generic terms like 6lo, IPv6 and IPSP.

Quoted 8 lines
doc/network-mgmt-api.txt new file +8 -0
+	This command generates a Command Complete event on success or
+	a Command Status event on failure.
+
+	Possible errors:	Invalid Parameters
+				Invalid Index
+
+
+Connect 6LoWPAN Command

doc/network-mgmt-api.txt line 126

Quoted 10 lines
doc/network-mgmt-api.txt new file +10 -0
+=======================
+
+	Command Code:		0x0005
+	Controller Index:	<controller id>
+	Command Parameters:	Address (6 Octets)
+				Address_Type (1 Octet)
+	Return Parameters:	Address (6 Octets)
+				Address_Type (1 Octet)
+
+	This command is used to connect to a remote 6LoWPAN Node.

Same as above, we might better just call this IPSP or Connect Internet Protocol.

One additional thing could be that we just return the interface index this new connection is using. I think that could be beneficial. Especially if we would actually create the 6lo interface for each controller on demand. Which might makes sense in case we only ever have client connections.

doc/network-mgmt-api.txt line 139

Quoted 13 lines
doc/network-mgmt-api.txt new file +13 -0
+
+	Possible values for the Address_Type parameter:
+		1	LE Public
+		2	LE Random
+
+	This command generates a Command Complete event on success
+	or failure.
+
+	Possible errors:	Busy
+				Refused
+				Invalid Parameters
+				Not Powered
+				Invalid Index

Don't we miss an already connected error here?

Quoted 31 lines
doc/network-mgmt-api.txt new file +31 -0
+
+
+Disconnect 6LoWPAN Command
+==========================
+
+	Command Code:		0x0006
+	Controller Index:	<controller id>
+	Command Parameters:	Address (6 Octets)
+				Address_Type (1 Octet)
+	Return Parameters:	Address (6 Octets)
+				Address_Type (1 Octet)
+
+	This command is used to disconnect from a remote 6LoWPAN device.
+
+	Possible values for the Address_Type parameter:
+		1	LE Public
+		2	LE Random
+
+	This command generates a Command Complete event on success
+	or failure.
+
+	Possible errors:	Busy
+				Not Connected
+				Invalid Parameters
+				Not Powered
+				Invalid Index
+
+
+Get 6LoWPAN Connections Command
+===============================
+

doc/network-mgmt-api.txt line 180

Quoted 10 lines
doc/network-mgmt-api.txt new file +10 -0
+	Command Code:		0x0007
+	Controller Index:	<controller id>
+	Command Parameters:
+	Return Parameters:	Connection_Count (2 Octets)
+				Address1 {
+					Address (6 Octets)
+					Address_Type (1 Octet)
+				}
+				Address2 { }
+				...

We could include the interface index here. Since you really want to know the interface index and what connections belong to it.

Quoted 19 lines
doc/network-mgmt-api.txt new file +19 -0
+
+	This command is used to retrieve a list of currently connected
+	6LoWPAN devices.
+
+	Possible values for the Address_Type parameter:
+		1	LE Public
+		2	LE Random
+
+	For devices using resolvable random addresses with a known
+	identity resolving key, the Address and Address_Type will
+	contain the identity information.
+
+	This command can only be used when the controller is powered.
+
+	This command generates a Command Complete event on success or
+	a Command Status event on failure.
+
+	Possible errors:	Invalid Parameters
+				Not Powered

doc/network-mgmt-api.txt line 209

Quoted 10 lines
doc/network-mgmt-api.txt new file +10 -0
+				Invalid Index
+
+
+Enable 6LoWPAN Server Command
+=============================
+
+	Command Code:		0x0008
+	Controller Index:	<controller id>
+	Command Parameters:	Enable (1 Octet)
+	Return Parameters:	Current_Settings (4 Octets)

As mentioned above, I might have included the interface index here.

doc/network-mgmt-api.txt line 218

Quoted 9 lines
doc/network-mgmt-api.txt new file +9 -0
+
+	This command is used start a 6LoWPAN Server (Node rols) on a
+	specified controller.
+
+	This command generates a Command Complete event on success or
+	a Command Status event on failure.
+
+	Possible errors:	Busy
+				Invalid Index

Since this does enable and disable, I think this should be rather called Set Internet Protocol Gateway or something similar. I am even fine with using the terms client and server.

I think we also want this command to start advertising. So it should grab an instance in the multi-advertising feature and add the IPSP service. Might be also an option to the command to selective choose if it advertises. Maybe as 0x02 option.

Quoted 71 lines
doc/network-mgmt-api.txt new file +71 -0
+
+
+Command Complete Event
+======================
+
+	Event Code:		0x0001
+	Controller Index:	<controller id> or <non-controller>
+	Event Parameters:	Command_Opcode (2 Octets)
+				Status (1 Octet)
+				Return_Parameters
+
+	This event is an indication that a command has completed. The
+	fixed set of parameters includes the opcode to identify the
+	command that completed as well as a status value to indicate
+	success or failure. The rest of the parameters are command
+	specific and documented in the section for each command
+	separately.
+
+
+Command Status Event
+====================
+
+	Event Code:		0x0002
+	Controller Index:	<controller id> or <non-controller>
+	Event Parameters:	Command_Opcode (2 Octets)
+				Status (1 Octet)
+
+	The command status event is used to indicate an early status for
+	a pending command. In the case that the status indicates failure
+	(anything else except success status) this also means that the
+	command has finished executing.
+
+
+Index Added Event
+=================
+
+	Event Code:		0x0004
+	Controller Index:	<controller id>
+	Event Parameters:
+
+	This event indicates that a new Networking capable controller
+	has been added to the system. It is usually followed by a Read
+	Controller Information command.
+
+
+Index Removed Event
+===================
+
+	Event Code:		0x0005
+	Controller Index:	<controller id>
+	Event Parameters:
+
+	This event indicates that a Network-capable controller has been
+	removed from the system.
+
+
+New Settings Event
+==================
+
+	Event Code:		0x0006
+	Controller Index:	<controller id>
+	Event Parameters:	Current_Settings (4 Octets)
+
+	This event indicates that one or more of the settings for a
+	controller has changed.
+
+
+6LoWPAN Connected Event
+=======================
+
+	Event Code:		0x0007

doc/network-mgmt-api.txt line 299

Quoted 10 lines
doc/network-mgmt-api.txt new file +10 -0
+	Controller Index:	<controller id>
+	Event Parameters:	Address (6 Octets)
+				Address_Type (1 Octet)
+
+	This event indicates that a successful 6LoWPAN connection has
+	been created to the remote device.
+
+	For devices using resolvable random addresses with a known
+	identity resolving key, the Address and Address_Type will
+	contain the identity information.

This would also be a good candidate for including the interface index.

Quoted 17 lines
doc/network-mgmt-api.txt new file +17 -0
+
+
+6LoWPAN Disconnected Event
+==========================
+
+	Event Code:		0x0008
+	Controller Index:	<controller id>
+	Event Parameters:	Address (6 Octets)
+				Address_Type (1 Octet)
+				Reason (1 Octet)
+
+	This event indicates that the 6LoWPAN connection was lost to a
+	remote device.
+
+	Possible values for the Address_Type parameter:
+		1	LE Public
+		2	LE Random

doc/network-mgmt-api.txt line 326

Quoted 10 lines
doc/network-mgmt-api.txt new file +10 -0
+
+	For devices using resolvable random addresses with a known
+	identity resolving key, the Address and Address_Type will
+	contain the identity information.
+
+	Possible values for the Reason parameter:
+		0	Unspecified
+		1	Connection timeout
+		2	Connection terminated by local host
+		3	Connection terminated by remote host

I wonder what we are doing with this reason. The core API had some good uses for this. I am not sure this one is a good one.

The way I am seeing this is that we should have an automatic mode to connect to all IPSP service we find. Which of course means we keep scanning in the background. And another one where the kernel scans and connects to known device. So something similar to Add Device where userspace that includes known devices and then the kernel will connect them when found. We could include a limited to only connect to n device. So by default only 1 IPSP device and when disconnected, it tries to find another one.

Regards

Marcel

#2 lore raw

Hi Marcel,

Quoted 24 lines · Marcel Holtmann
Quoted 24 lines
doc/network-mgmt-api.txt new file +24 -0
+Read Controller Information Command
+===================================
+
+	Command Code:		0x0004
+	Controller Index:	<controller id>
+	Command Parameters:
+	Return Parameters:	Address (6 Octets)
+				Address_Type (6 Octets)
+				Supported_Settings (4 Octets)
+				Current_Settings (4 Octets)
+				6LoWPAN_Interface_Index (4 Octets)
+
+	This command is used to retreive the current state and basic
+	information of a controller. It is typically used right after
+	getting the response to the Read Controller Index List command
+	or an Index Added event.
+
+	Current_Settings and Supported_Settings is a bitmask with
+	currently the following available bits:
+
+		0	6LoWPAN
+		1	6LoWPAN Server (Node)
+
+	The 6LoWPAN_Interface_Index parameter value is only valid if the
Quoted 8 lines

doc/network-mgmt-api.txt line 107

Quoted 2 lines
doc/network-mgmt-api.txt new file +2 -0
+	6LoWPAN settings bit is set in the Current_Settings, otherwise
+	it should be ignored.

I have no idea what this is going to do. I wonder if should really have this in this command. Especially since the index might be even there if it is not enabled yet. This sound more like a parameter that should be returned by an individual command or when enabling the 6LoWPAN support.

When we're acting as initiator there's no "enable" command as such but just the connect command. Should then the connect command return the interface index? IIRC I had that in my very early drafts/ideas of this API. For the acceptor (Node) role we do have an "enable" command however.

Quoted 6 lines
Quoted 6 lines
doc/network-mgmt-api.txt new file +6 -0
+Connect 6LoWPAN Command
+=======================
+
+	Command Code:		0x0005
+	Controller Index:	<controller id>
+	Command Parameters:	Address (6 Octets)
Quoted 8 lines

doc/network-mgmt-api.txt line 126

Quoted 5 lines
doc/network-mgmt-api.txt new file +5 -0
+				Address_Type (1 Octet)
+	Return Parameters:	Address (6 Octets)
+				Address_Type (1 Octet)
+
+	This command is used to connect to a remote 6LoWPAN Node.

Same as above, we might better just call this IPSP or Connect Internet Protocol.

Sure (I'd go with IPSP)

Quoted 5 lines

One additional thing could be that we just return the interface index this new connection is using. I think that could be beneficial. Especially if we would actually create the 6lo interface for each controller on demand. Which might makes sense in case we only ever have client connections.

Yes, we'd need to do that if it's not going to be in the Read Info response.

Quoted 6 lines
Quoted 6 lines
doc/network-mgmt-api.txt new file +6 -0
+	Possible values for the Address_Type parameter:
+		1	LE Public
+		2	LE Random
+
+	This command generates a Command Complete event on success
+	or failure.
Quoted 8 lines

doc/network-mgmt-api.txt line 139

Quoted 6 lines
doc/network-mgmt-api.txt new file +6 -0
+
+	Possible errors:	Busy
+				Refused
+				Invalid Parameters
+				Not Powered
+				Invalid Index

Don't we miss an already connected error here?

Do we want that? We could also be "friendly" and simply return the information for the existing connection instead of an error.

Quoted 8 lines
Quoted 8 lines
doc/network-mgmt-api.txt new file +8 -0
+Get 6LoWPAN Connections Command
+===============================
+
+	Command Code:		0x0007
+	Controller Index:	<controller id>
+	Command Parameters:
+	Return Parameters:	Connection_Count (2 Octets)
+				Address1 {
Quoted 8 lines

doc/network-mgmt-api.txt line 180

Quoted 5 lines
doc/network-mgmt-api.txt new file +5 -0
+					Address (6 Octets)
+					Address_Type (1 Octet)
+				}
+				Address2 { }
+				...

We could include the interface index here. Since you really want to know the interface index and what connections belong to it.

Sure, though right now it'd be the same for each connection as this is a per-adapter command.

Quoted 9 lines

doc/network-mgmt-api.txt line 209

Quoted 7 lines
doc/network-mgmt-api.txt new file +7 -0
+Enable 6LoWPAN Server Command
+=============================
+
+	Command Code:		0x0008
+	Controller Index:	<controller id>
+	Command Parameters:	Enable (1 Octet)
+	Return Parameters:	Current_Settings (4 Octets)

As mentioned above, I might have included the interface index here.

Sure, though would we still keep the Current_Settings there? (I'd guess yes so one can track that this has been enabled or not).

Quoted 4 lines
Quoted 4 lines
doc/network-mgmt-api.txt new file +4 -0
+	This command is used start a 6LoWPAN Server (Node rols) on a
+	specified controller.
+
+	This command generates a Command Complete event on success or
Quoted 8 lines

doc/network-mgmt-api.txt line 139

Quoted 4 lines
doc/network-mgmt-api.txt new file +4 -0
+	a Command Status event on failure.
+
+	Possible errors:	Busy
+				Invalid Index

Since this does enable and disable, I think this should be rather called Set Internet Protocol Gateway or something similar. I am even fine with using the terms client and server.

This is actually the Node and not a Gateway/Router. With IPSP it's the Node side that has the L2CAP server and the Router is the one that initiates a connection to it. Anyway, since a device can act in both roles I'd just keep "Server".

Quoted 4 lines

I think we also want this command to start advertising. So it should grab an instance in the multi-advertising feature and add the IPSP service. Might be also an option to the command to selective choose if it advertises. Maybe as 0x02 option.

Here we run into trouble since we've specified the multi-advertising so that there's a single user-space daemon that manages the instance numbers. Simplest solution would be to let the user space bluetoothd plugin (the network one, I suppose) manage this through the existing multi-advertising mgmt API.

Quoted 8 lines
Quoted 8 lines

+6LoWPAN Connected Event
+=======================

doc/network-mgmt-api.txt new file +6 -0
+
+	Event Code:		0x0007
+	Controller Index:	<controller id>
+	Event Parameters:	Address (6 Octets)
+				Address_Type (1 Octet)
+
Quoted 8 lines

doc/network-mgmt-api.txt line 299

Quoted 6 lines
doc/network-mgmt-api.txt new file +6 -0
+	This event indicates that a successful 6LoWPAN connection has
+	been created to the remote device.
+
+	For devices using resolvable random addresses with a known
+	identity resolving key, the Address and Address_Type will
+	contain the identity information.

This would also be a good candidate for including the interface index.

Sure.

Quoted 20 lines
Quoted 20 lines

+6LoWPAN Disconnected Event
+==========================

doc/network-mgmt-api.txt new file +18 -0
+
+	Event Code:		0x0008
+	Controller Index:	<controller id>
+	Event Parameters:	Address (6 Octets)
+				Address_Type (1 Octet)
+				Reason (1 Octet)
+
+	This event indicates that the 6LoWPAN connection was lost to a
+	remote device.
+
+	Possible values for the Address_Type parameter:
+		1	LE Public
+		2	LE Random
+
+	For devices using resolvable random addresses with a known
+	identity resolving key, the Address and Address_Type will
+	contain the identity information.
+
Quoted 8 lines

doc/network-mgmt-api.txt line 326

Quoted 5 lines
doc/network-mgmt-api.txt new file +5 -0
+	Possible values for the Reason parameter:
+		0	Unspecified
+		1	Connection timeout
+		2	Connection terminated by local host
+		3	Connection terminated by remote host

I wonder what we are doing with this reason. The core API had some good uses for this. I am not sure this one is a good one.

I can't think of any good uses. I'll remove it.

Quoted 8 lines

The way I am seeing this is that we should have an automatic mode to connect to all IPSP service we find. Which of course means we keep scanning in the background. And another one where the kernel scans and connects to known device. So something similar to Add Device where userspace that includes known devices and then the kernel will connect them when found. We could include a limited to only connect to n device. So by default only 1 IPSP device and when disconnected, it tries to find another one.

Maybe, but we should consider this kind of policy from the perspective of both roles (node vs server). Would we e.g. at some point want to do directed advertising to a specified Router when we're acting as Node.

Johan

maintainer
#3 lore raw

Hi Johan,

Quoted 33 lines
Quoted 24 lines
Quoted 24 lines
doc/network-mgmt-api.txt new file +24 -0
+Read Controller Information Command
+===================================
+
+	Command Code:		0x0004
+	Controller Index:	<controller id>
+	Command Parameters:
+	Return Parameters:	Address (6 Octets)
+				Address_Type (6 Octets)
+				Supported_Settings (4 Octets)
+				Current_Settings (4 Octets)
+				6LoWPAN_Interface_Index (4 Octets)
+
+	This command is used to retreive the current state and basic
+	information of a controller. It is typically used right after
+	getting the response to the Read Controller Index List command
+	or an Index Added event.
+
+	Current_Settings and Supported_Settings is a bitmask with
+	currently the following available bits:
+
+		0	6LoWPAN
+		1	6LoWPAN Server (Node)
+
+	The 6LoWPAN_Interface_Index parameter value is only valid if the
Quoted 8 lines

doc/network-mgmt-api.txt line 107

Quoted 2 lines
doc/network-mgmt-api.txt new file +2 -0
+	6LoWPAN settings bit is set in the Current_Settings, otherwise
+	it should be ignored.

I have no idea what this is going to do. I wonder if should really have this in this command. Especially since the index might be even there if it is not enabled yet. This sound more like a parameter that should be returned by an individual command or when enabling the 6LoWPAN support.

Quoted 5 lines

When we're acting as initiator there's no "enable" command as such but just the connect command. Should then the connect command return the interface index? IIRC I had that in my very early drafts/ideas of this API. For the acceptor (Node) role we do have an "enable" command however.

so unless we have any IPSP role enabled (be it node or router), we do not have a bt0 interface for that controller. So I really doubt this should be part of the basic information.

Quoted 42 lines
Quoted 15 lines

doc/network-mgmt-api.txt line 126

Quoted 12 lines
doc/network-mgmt-api.txt new file +11 -0
+Connect 6LoWPAN Command
+=======================
+
+	Command Code:		0x0005
+	Controller Index:	<controller id>
+	Command Parameters:	Address (6 Octets)
+				Address_Type (1 Octet)
+	Return Parameters:	Address (6 Octets)
+				Address_Type (1 Octet)
+
+	This command is used to connect to a remote 6LoWPAN Node.

Same as above, we might better just call this IPSP or Connect Internet Protocol.

Sure (I'd go with IPSP)

Quoted 5 lines

One additional thing could be that we just return the interface index this new connection is using. I think that could be beneficial. Especially if we would actually create the 6lo interface for each controller on demand. Which might makes sense in case we only ever have client connections.

Yes, we'd need to do that if it's not going to be in the Read Info response.

Quoted 6 lines
Quoted 6 lines
doc/network-mgmt-api.txt new file +6 -0
+	Possible values for the Address_Type parameter:
+		1	LE Public
+		2	LE Random
+
+	This command generates a Command Complete event on success
+	or failure.
Quoted 8 lines

doc/network-mgmt-api.txt line 139

Quoted 6 lines
doc/network-mgmt-api.txt new file +6 -0
+
+	Possible errors:	Busy
+				Refused
+				Invalid Parameters
+				Not Powered
+				Invalid Index

Don't we miss an already connected error here?

Quoted 2 lines

Do we want that? We could also be "friendly" and simply return the information for the existing connection instead of an error.

We could do that as well, but then it needs to be documented. However it might be better to be able to list the existing connections and then just return errors if you try to connect twice. Since you can figure out if are already connected or not.

Quoted 18 lines
Quoted 17 lines
Quoted 4 lines
doc/network-mgmt-api.txt new file +3 -0
+Get 6LoWPAN Connections Command
+===============================
+

doc/network-mgmt-api.txt line 180

Quoted 10 lines
doc/network-mgmt-api.txt new file +10 -0
+	Command Code:		0x0007
+	Controller Index:	<controller id>
+	Command Parameters:
+	Return Parameters:	Connection_Count (2 Octets)
+				Address1 {
+					Address (6 Octets)
+					Address_Type (1 Octet)
+				}
+				Address2 { }
+				...

We could include the interface index here. Since you really want to know the interface index and what connections belong to it.

Quoted 2 lines

Sure, though right now it'd be the same for each connection as this is a per-adapter command.

Then it might be the first return parameter.

Quoted 11 lines
Quoted 10 lines

doc/network-mgmt-api.txt line 209

Quoted 8 lines
doc/network-mgmt-api.txt new file +7 -0
+Enable 6LoWPAN Server Command
+=============================
+
+	Command Code:		0x0008
+	Controller Index:	<controller id>
+	Command Parameters:	Enable (1 Octet)
+	Return Parameters:	Current_Settings (4 Octets)

As mentioned above, I might have included the interface index here.

Quoted 2 lines

Sure, though would we still keep the Current_Settings there? (I'd guess yes so one can track that this has been enabled or not).

I am not sure we need them here. Then again, this worked nicely for the existing API, so why not repeat it. However I am open for keeping things a lot simpler this time.

Quoted 24 lines
Quoted 13 lines

doc/network-mgmt-api.txt line 218

Quoted 9 lines
doc/network-mgmt-api.txt new file +8 -0
+	This command is used start a 6LoWPAN Server (Node rols) on a
+	specified controller.
+
+	This command generates a Command Complete event on success or
+	a Command Status event on failure.
+
+	Possible errors:	Busy
+				Invalid Index

Since this does enable and disable, I think this should be rather called Set Internet Protocol Gateway or something similar. I am even fine with using the terms client and server.

This is actually the Node and not a Gateway/Router. With IPSP it's the Node side that has the L2CAP server and the Router is the one that initiates a connection to it. Anyway, since a device can act in both roles I'd just keep "Server".

Quoted 4 lines

I think we also want this command to start advertising. So it should grab an instance in the multi-advertising feature and add the IPSP service. Might be also an option to the command to selective choose if it advertises. Maybe as 0x02 option.

Quoted 5 lines

Here we run into trouble since we've specified the multi-advertising so that there's a single user-space daemon that manages the instance numbers. Simplest solution would be to let the user space bluetoothd plugin (the network one, I suppose) manage this through the existing multi-advertising mgmt API.

I would tell userspace that there are say 5 instances it can manager. However internally inside the kernel we have more than 5 and then it can grab on of the kernel internal ones.

Quoted 59 lines
Quoted 8 lines
Quoted 8 lines

+6LoWPAN Connected Event
+=======================

doc/network-mgmt-api.txt new file +6 -0
+
+	Event Code:		0x0007
+	Controller Index:	<controller id>
+	Event Parameters:	Address (6 Octets)
+				Address_Type (1 Octet)
+
Quoted 8 lines

doc/network-mgmt-api.txt line 299

Quoted 6 lines
doc/network-mgmt-api.txt new file +6 -0
+	This event indicates that a successful 6LoWPAN connection has
+	been created to the remote device.
+
+	For devices using resolvable random addresses with a known
+	identity resolving key, the Address and Address_Type will
+	contain the identity information.

This would also be a good candidate for including the interface index.

Sure.

Quoted 20 lines
Quoted 20 lines

+6LoWPAN Disconnected Event
+==========================

doc/network-mgmt-api.txt new file +18 -0
+
+	Event Code:		0x0008
+	Controller Index:	<controller id>
+	Event Parameters:	Address (6 Octets)
+				Address_Type (1 Octet)
+				Reason (1 Octet)
+
+	This event indicates that the 6LoWPAN connection was lost to a
+	remote device.
+
+	Possible values for the Address_Type parameter:
+		1	LE Public
+		2	LE Random
+
+	For devices using resolvable random addresses with a known
+	identity resolving key, the Address and Address_Type will
+	contain the identity information.
+
Quoted 8 lines

doc/network-mgmt-api.txt line 326

Quoted 5 lines
doc/network-mgmt-api.txt new file +5 -0
+	Possible values for the Reason parameter:
+		0	Unspecified
+		1	Connection timeout
+		2	Connection terminated by local host
+		3	Connection terminated by remote host

I wonder what we are doing with this reason. The core API had some good uses for this. I am not sure this one is a good one.

I can't think of any good uses. I'll remove it.

Quoted 8 lines

The way I am seeing this is that we should have an automatic mode to connect to all IPSP service we find. Which of course means we keep scanning in the background. And another one where the kernel scans and connects to known device. So something similar to Add Device where userspace that includes known devices and then the kernel will connect them when found. We could include a limited to only connect to n device. So by default only 1 IPSP device and when disconnected, it tries to find another one.

Quoted 3 lines

Maybe, but we should consider this kind of policy from the perspective of both roles (node vs server). Would we e.g. at some point want to do directed advertising to a specified Router when we're acting as Node.

I think we should go towards such an API. Letting the kernel do most of these details is a good idea. It has a better chance to interface with background scanning anyway.

Regards

Marcel