LDN services: Difference between revisions
No edit summary |
No edit summary |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 91: | Line 91: | ||
| 0 || [[#CreateSystemLocalCommunicationService]] | | 0 || [[#CreateSystemLocalCommunicationService]] | ||
|- | |- | ||
| 1 || [18.0.0+] | | 1 || [18.0.0+] [[#CreateClientProcessMonitor]] | ||
|} | |} | ||
== CreateSystemLocalCommunicationService == | == CreateSystemLocalCommunicationService == | ||
Returns an [[#ISystemLocalCommunicationService]]. | No input. Returns an [[#ISystemLocalCommunicationService]]. | ||
The user-process closes the ISystemServiceCreator object immediately after using this cmd. Official sw ignores errors from this cmd. | The user-process closes the ISystemServiceCreator object immediately after using this cmd. Official sw ignores errors from this cmd. | ||
== CreateClientProcessMonitor == | |||
No input. Returns an [[#IClientProcessMonitor]]. | |||
== ISystemLocalCommunicationService == | == ISystemLocalCommunicationService == | ||
| Line 128: | Line 131: | ||
| 104 || [5.0.0+] [[#SetWirelessControllerRestriction]] | | 104 || [5.0.0+] [[#SetWirelessControllerRestriction]] | ||
|- | |- | ||
| 105 || [13.1.0+] SetBluetoothAudioDeviceConnectableMode | | 105 || [13.1.0+] [[#SetBluetoothAudioDeviceConnectableMode]] | ||
|- | |- | ||
| 106 || [18.0.0+] | | 106 || [18.0.0+] | ||
| Line 170: | Line 173: | ||
| 403 || [7.0.0+] [[#InitializeSystem2]] | | 403 || [7.0.0+] [[#InitializeSystem2]] | ||
|- | |- | ||
| | | 404 || [19.0.0+] | ||
|- | |- | ||
| | | 500 || [18.0.0+] EnableActionFrame | ||
|- | |- | ||
| | | 501 || [18.0.0+] DisableActionFrame | ||
|- | |- | ||
| | | 502 || [18.0.0+] SendActionFrame | ||
|- | |- | ||
| | | 503 || [18.0.0+] RecvActionFrame | ||
|- | |- | ||
| | | 505 || [18.0.0+] [[#SetHomeChannel|SetHomeChannel]] | ||
|- | |- | ||
| 601 || [18.0.0+] | | 600 || [18.0.0+] SetTxPower | ||
|- | |||
| 601 || [18.0.0+] ResetTxPower | |||
|} | |} | ||
=== GetState === | === GetState === | ||
No input, returns an output | No input, returns an output [[#State]]. | ||
sdknso implements this by <code>return</code>ing the u32, with 0 being returned on error / when service isn't initialized. | sdknso implements this by <code>return</code>ing the u32, with 0 being returned on error / when service isn't initialized. | ||
=== GetNetworkInfo === | === GetNetworkInfo === | ||
| Line 218: | Line 202: | ||
=== GetDisconnectReason === | === GetDisconnectReason === | ||
No input, returns an output | No input, returns an output [[#DisconnectReason]]. | ||
sdknso implements this by <code>return</code>ing the s16 as a s32, with -1 being returned on error. | sdknso implements this by <code>return</code>ing the s16 as a s32, with -1 being returned on error. | ||
=== GetSecurityParameter === | === GetSecurityParameter === | ||
| Line 286: | Line 248: | ||
The input value is written into state. | The input value is written into state. | ||
=== SetBluetoothAudioDeviceConnectableMode === | |||
Takes an input [[#BluetoothAudioDeviceConnectableMode]], no output. | |||
=== OpenAccessPoint === | === OpenAccessPoint === | ||
| Line 419: | Line 384: | ||
[[#GetState|State]] must be 0, this cmd eventually sets the State to value 1. | [[#GetState|State]] must be 0, this cmd eventually sets the State to value 1. | ||
=== SetHomeChannel === | |||
[20.0.0+] Now takes a total of 2-bytes of input instead of 4-bytes. | |||
== IClientProcessMonitor == | |||
This is "nn::ldn::detail::IClientProcessMonitor". | |||
This was added with [18.0.0+]. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Cmd || Name | |||
|- | |||
| 0 || RegisterClient | |||
|} | |||
= ldn:u = | = ldn:u = | ||
| Line 429: | Line 409: | ||
| 0 || [[#CreateUserLocalCommunicationService]] | | 0 || [[#CreateUserLocalCommunicationService]] | ||
|- | |- | ||
| 1 || [18.0.0+] | | 1 || [18.0.0+] [[#CreateClientProcessMonitor]] | ||
|} | |} | ||
| Line 468: | Line 448: | ||
| 104 || [5.0.0+] [[#SetWirelessControllerRestriction]] | | 104 || [5.0.0+] [[#SetWirelessControllerRestriction]] | ||
|- | |- | ||
| 105 || [13.1.0+] SetBluetoothAudioDeviceConnectableMode | | 105 || [13.1.0+] [[#SetBluetoothAudioDeviceConnectableMode]] | ||
|- | |||
| 106 || [18.0.0+] | |||
|- | |- | ||
| 200 || [[#OpenAccessPoint]] | | 200 || [[#OpenAccessPoint]] | ||
| Line 505: | Line 487: | ||
|- | |- | ||
| 402 || [7.0.0+] [[#Initialize2]] | | 402 || [7.0.0+] [[#Initialize2]] | ||
|- | |||
| 403 || [19.0.0+] | |||
|- | |||
| 500 || [18.0.0+] EnableActionFrame | |||
|- | |||
| 501 || [18.0.0+] DisableActionFrame | |||
|- | |||
| 502 || [18.0.0+] SendActionFrame | |||
|- | |||
| 503 || [18.0.0+] RecvActionFrame | |||
|- | |||
| 505 || [18.0.0+] [[#SetHomeChannel|SetHomeChannel]] | |||
|- | |||
| 600 || [18.0.0+] SetTxPower | |||
|- | |||
| 601 || [18.0.0+] ResetTxPower | |||
|} | |} | ||
| Line 853: | Line 851: | ||
=== Initialize === | === Initialize === | ||
Returns 0. | Returns 0. | ||
= State = | |||
This is "nn::ldn::State". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Value | |||
! Description | |||
|- | |||
| 0 || None | |||
|- | |||
| 1 || Initialized | |||
|- | |||
| 2 || AccessPoint | |||
|- | |||
| 3 || AccessPointCreated | |||
|- | |||
| 4 || Station | |||
|- | |||
| 5 || StationConnected | |||
|- | |||
| 6 || Error | |||
|- | |||
|} | |||
= Ipv4Address = | = Ipv4Address = | ||
| Line 877: | Line 899: | ||
! Description | ! Description | ||
|- | |- | ||
| 0x0 || 0x1 || Length excluding NUL-terminator, must be 0x1-0x20 | | 0x0 || 0x1 || Length (excluding NUL-terminator, must be 0x1-0x20) | ||
|- | |- | ||
| 0x1 || 0x21 || SSID string including NUL-terminator, str[{above length}] must be 0 | | 0x1 || 0x21 || Raw (SSID string including NUL-terminator, str[{above length}] must be 0) | ||
|} | |} | ||
| Line 971: | Line 993: | ||
| 0x4C || 0x10 || Cleared to zero for the tmp struct. | | 0x4C || 0x10 || Cleared to zero for the tmp struct. | ||
|- | |- | ||
| 0x5C || 0x4 || | | 0x5C || 0x4 || [[#ScanFilterFlag|Flag]] (masked with 0x37 for [[#Scan]], with [[#ScanPrivate]] this is masked with 0x3F) | ||
|} | |} | ||
= ScanFilterFlag = | |||
This is "nn::ldn::ScanFilterFlag". | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! | ! Value | ||
! Description | ! Description | ||
|- | |||
| 0x0 || None | |||
|- | |||
| 0x1 || LocalCommunicationId | |||
|- | |||
| 0x2 || SessionId | |||
|- | |||
| 0x4 || NetworkType | |||
|- | |- | ||
| | | 0x8 || Bssid | ||
|- | |- | ||
| | | 0x10 || Ssid | ||
|- | |- | ||
| | | 0x20 || SceneId | ||
|- | |- | ||
| | | 0x21 || IntentId | ||
|- | |- | ||
| | | 0x23 || NetworkId | ||
|- | |- | ||
| | | 0x3F || All | ||
|} | |} | ||
| Line 1,048: | Line 1,079: | ||
! Description | ! Description | ||
|- | |- | ||
| 0 || | | 0 || Disabled | ||
|- | |- | ||
| 1 || This is | | 1 || Enabled | ||
|} | |||
= BluetoothAudioDeviceConnectableMode = | |||
This is "nn::ldn::BluetoothAudioDeviceConnectableMode". This is an u32 enum. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Value | |||
! Description | |||
|- | |||
| 0 || Disabled | |||
|- | |||
| 1 || Enabled | |||
|} | |||
= SecurityMode = | |||
This is "nn::ldn::SecurityMode". This is an u32 enum. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Value | |||
! Description | |||
|- | |||
| 0 || Any | |||
|- | |||
| 1 || Product | |||
|- | |||
| 2 || Debug | |||
|- | |||
| 3 || SystemDebug | |||
|} | |} | ||
| Line 1,062: | Line 1,123: | ||
! Description | ! Description | ||
|- | |- | ||
| 0x0 || 0x2 || | | 0x0 || 0x2 || [[#SecurityMode|SecurityMode]] (overwritten by [[#CreateNetwork]]/[[#CreateNetworkPrivate]] and [[#Connect]]/[[#ConnectPrivate]], the value used internally by these cmds must be 1-3) | ||
|- | |- | ||
| 0x2 || 0x2 || | | 0x2 || 0x2 || PassphraseSize (must be 0x10-0x40) | ||
|- | |- | ||
| 0x4 || 0x40 || | | 0x4 || 0x40 || Passphrase (used with key derivation) | ||
|} | |} | ||
| Line 1,085: | Line 1,146: | ||
! Description | ! Description | ||
|- | |- | ||
| 0x0 || 0x10 || | | 0x0 || 0x10 || ServerRandom (used with the same key derivation as [[#SecurityConfig]]) | ||
|- | |||
| 0x10 || 0x10 || [[#SessionId|SessionId]] | |||
|} | |||
= SessionId = | |||
This is "nn::ldn::SessionId". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |- | ||
| | | 0x0 || 0x10 || Random | ||
|} | |} | ||
| Line 1,101: | Line 1,174: | ||
! Description | ! Description | ||
|- | |- | ||
| 0x0 || | | 0x0 || 0x21 || UserName (NUL-terminated string for the user nickname) | ||
|- | |- | ||
| | | 0x21 || 0xF || Reserved (cleared to zero during the copy) | ||
|} | |} | ||
| Line 1,119: | Line 1,192: | ||
| 0x4 || 0x6 || [[#MacAddress|MacAddress]] | | 0x4 || 0x6 || [[#MacAddress|MacAddress]] | ||
|- | |- | ||
| 0xA || 0x2 || | | 0xA || 0x2 || Reserved | ||
|} | |} | ||
| Line 1,130: | Line 1,203: | ||
! Description | ! Description | ||
|- | |- | ||
| 0 || | | 0 || AlwaysAccept | ||
|- | |- | ||
| 1 || | | 1 || AlwaysReject | ||
|- | |- | ||
| 2 || | | 2 || BlackList (addresses in the [[#AddAcceptFilterEntry|list]] are not allowed) | ||
|- | |- | ||
| 3 || | | 3 || WhiteList (only addresses in the [[#AddAcceptFilterEntry|list]] are allowed) | ||
|} | |} | ||
| Line 1,157: | Line 1,230: | ||
| 0x4 || 0x6 || [[#MacAddress|MacAddress]] | | 0x4 || 0x6 || [[#MacAddress|MacAddress]] | ||
|- | |- | ||
| 0xA || 0x1 || | | 0xA || 0x1 || NodeId | ||
|- | |- | ||
| 0xB || 0x1 || IsConnected | | 0xB || 0x1 || IsConnected | ||
|- | |- | ||
| 0xC || | | 0xC || 0x21 || UserName (first 0x21-bytes of [[#UserConfig]]) | ||
|- | |- | ||
| | | 0x2D || 0x1 || Reserved | ||
|- | |- | ||
| 0x2E || 0x2 || | | 0x2E || 0x2 || LocalCommunicationVersion | ||
|- | |- | ||
| 0x30 || 0x10 || Reserved | | 0x30 || 0x10 || Reserved | ||
| Line 1,178: | Line 1,251: | ||
This must be <=0x1, besides this validation ConnectOption is ignored by [[#Connect]]/[[#ConnectPrivate]]. | This must be <=0x1, besides this validation ConnectOption is ignored by [[#Connect]]/[[#ConnectPrivate]]. | ||
= DisconnectReason = | |||
This is "nn::ldn::DisconnectReason". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Value | |||
! Description | |||
|- | |||
| -1 || Unknown | |||
|- | |||
| 0 || None | |||
|- | |||
| 1 || DisconnectedByUser | |||
|- | |||
| 2 || DisconnectedBySystem | |||
|- | |||
| 3 || DestroyedByUser | |||
|- | |||
| 4 || DestroyedBySystem | |||
|- | |||
| 5 || Rejected | |||
|- | |||
| 6 || SignalLost | |||
|} | |||
= OperationMode = | = OperationMode = | ||
| Line 1,191: | Line 1,289: | ||
! Description | ! Description | ||
|- | |- | ||
| 0 || | | 0 || Stable | ||
|- | |- | ||
| 1 || | | 1 || HighSpeed | ||
|} | |} | ||
| Line 1,297: | Line 1,395: | ||
** All string characters which were already written are summed same way as above. Then: <code>return character_lookup_table[sum % 0x2B];</code> (If the length passed to this function is 0, this will instead just return character_lookup_table[0]) | ** All string characters which were already written are summed same way as above. Then: <code>return character_lookup_table[sum % 0x2B];</code> (If the length passed to this function is 0, this will instead just return character_lookup_table[0]) | ||
*** character_lookup_table contains 0x2B entries: [V-A][k-a][5-0][Z-W]. | *** character_lookup_table contains 0x2B entries: [V-A][k-a][5-0][Z-W]. | ||
loaded_flags are first loaded from elsewhere, then masked with the above flags when available. loaded_flags are used when +0x8A is 0. global_flags are loaded from global data. These flags are only used with [[#CreateGroup]]/[[#Join]]. Flags (note that the following was updated with [11.0.0+], and differs from below): | loaded_flags are first loaded from elsewhere, then masked with the above flags when available. loaded_flags are used when +0x8A is 0. global_flags are loaded from global data. These flags are only used with [[#CreateGroup]]/[[#Join]]. Flags (note that the following was updated with [11.0.0+], and differs from below): | ||