LDN services: Difference between revisions

No edit summary
No edit summary
Line 128: Line 128:
| 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 170:
| 403 || [7.0.0+] [[#InitializeSystem2]]
| 403 || [7.0.0+] [[#InitializeSystem2]]
|-
|-
| 500 || [18.0.0+]  
| 500 || [18.0.0+] EnableActionFrame
|-
|-
| 501 || [18.0.0+]  
| 501 || [18.0.0+] DisableActionFrame
|-
|-
| 502 || [18.0.0+]  
| 502 || [18.0.0+] SendActionFrame
|-
|-
| 503 || [18.0.0+]  
| 503 || [18.0.0+] RecvActionFrame
|-
|-
| 505 || [18.0.0+]  
| 505 || [18.0.0+] SetHomeChannel
|-
|-
| 600 || [18.0.0+]  
| 600 || [18.0.0+] SetTxPower
|-
|-
| 601 || [18.0.0+]  
| 601 || [18.0.0+] ResetTxPower
|}
|}


=== GetState ===
=== GetState ===
No input, returns an output u32.
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.
{| class="wikitable" border="1"
|-
!  Value
!  Description
|-
| 0 || None
|-
| 1 || Initialized
|-
| 2 || AccessPointOpened
|-
| 3 || AccessPointCreated
|-
| 4 || StationOpened
|-
| 5 || StationConnected
|-
| 6 || Error
|-
|}


=== GetNetworkInfo ===
=== GetNetworkInfo ===
Line 218: Line 197:


=== GetDisconnectReason ===
=== GetDisconnectReason ===
No input, returns an output s16.
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.
{| class="wikitable" border="1"
|-
!  Value
!  Description
|-
| -1 || See above.
|-
| 0 || None
|-
| 1 || User
|-
| 2 || SystemRequest
|-
| 3 || DestroyedByAdmin
|-
| 4 || DestroyedBySystemRequest
|-
| 5 || Admin
|-
| 6 || SignalLost
|}


=== GetSecurityParameter ===
=== GetSecurityParameter ===
Line 286: Line 243:


The input value is written into state.
The input value is written into state.
=== SetBluetoothAudioDeviceConnectableMode ===
Takes an input [[#BluetoothAudioDeviceConnectableMode]], no output.


=== OpenAccessPoint ===
=== OpenAccessPoint ===
Line 468: Line 428:
| 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 508: Line 468:
| 402 || [7.0.0+] [[#Initialize2]]
| 402 || [7.0.0+] [[#Initialize2]]
|-
|-
| 500 || [18.0.0+]
| 500 || [18.0.0+] EnableActionFrame
|-
|-
| 501 || [18.0.0+]
| 501 || [18.0.0+] DisableActionFrame
|-
|-
| 502 || [18.0.0+]
| 502 || [18.0.0+] SendActionFrame
|-
|-
| 503 || [18.0.0+]
| 503 || [18.0.0+] RecvActionFrame
|-
|-
| 505 || [18.0.0+]
| 505 || [18.0.0+] SetHomeChannel
|-
|-
| 600 || [18.0.0+]
| 600 || [18.0.0+] SetTxPower
|-
|-
| 601 || [18.0.0+]
| 601 || [18.0.0+] ResetTxPower
|}
|}


Line 869: Line 829:
=== 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 893: Line 877:
! 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 987: Line 971:
| 0x4C || 0x10 || Cleared to zero for the tmp struct.
| 0x4C || 0x10 || Cleared to zero for the tmp struct.
|-
|-
| 0x5C || 0x4 || Flags. Masked with 0x37 for [[#Scan]], with [[#ScanPrivate]] this is masked with 0x3F.
| 0x5C || 0x4 || [[#ScanFilterFlag|Flag]] (masked with 0x37 for [[#Scan]], with [[#ScanPrivate]] this is masked with 0x3F)
|}
|}


Flags:
= ScanFilterFlag =
This is "nn::ldn::ScanFilterFlag".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Bit
! Value
! Description
! Description
|-
| 0x0 || None
|-
| 0x1 || LocalCommunicationId
|-
| 0x2 || SessionId
|-
| 0x4 || NetworkType
|-
|-
| 0 || When set, enables using ScanFilter+0.
| 0x8 || Bssid
|-
|-
| 1 || When set, enables using ScanFilter+0x10.
| 0x10 || Ssid
|-
|-
| 2 || When set, enables using ScanFilter+0x20.
| 0x20 || SceneId
|-
|-
| 3 || When set, enables using the ScanFilter [[#MacAddress|MacAddress]].
| 0x21 || IntentId
|-
|-
| 4 || When set, enables using the ScanFilter [[#Ssid]].
| 0x23 || NetworkId
|-
|-
| 5 || When set, enables using ScanFilter+0xA.
| 0x3F || All
|}
|}


Line 1,064: Line 1,057:
!  Description
!  Description
|-
|-
| 0 ||  
| 0 || Disabled
|-
| 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 || This is the default.
| 1 || Product
|-
| 2 || Debug
|-
| 3 || SystemDebug
|}
|}


Line 1,078: Line 1,101:
! Description
! Description
|-
|-
| 0x0 || 0x2 || Type, a default of value 1 can be used here. Overwritten by [[#CreateNetwork]]/[[#CreateNetworkPrivate]] and [[#Connect]]/[[#ConnectPrivate]]. The value used internally by these cmds must be 1-3.
| 0x0 || 0x2 || [[#SecurityMode|SecurityMode]] (overwritten by [[#CreateNetwork]]/[[#CreateNetworkPrivate]] and [[#Connect]]/[[#ConnectPrivate]], the value used internally by these cmds must be 1-3)
|-
|-
| 0x2 || 0x2 || Data size. Must be 0x10-0x40.
| 0x2 || 0x2 || PassphraseSize (must be 0x10-0x40)
|-
|-
| 0x4 || 0x40 || Data, used with key derivation.
| 0x4 || 0x40 || Passphrase (used with key derivation)
|}
|}


Line 1,101: Line 1,124:
! Description
! Description
|-
|-
| 0x0 || 0x10 || Data, used with the same key derivation as [[#SecurityConfig]].
| 0x0 || 0x10 || ServerRandom (used with the same key derivation as [[#SecurityConfig]])
|-
|-
| 0x10 || 0x10 || NetworkId, see [[#NetworkInfo]].
| 0x10 || 0x10 || [[#SessionId|SessionId]]
|}
 
= SessionId =
This is "nn::ldn::SessionId".
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x10 || Random
|}
|}


Line 1,117: Line 1,152:
! Description
! Description
|-
|-
| 0x0 || 0x20 || NUL-terminated string for the user nickname.
| 0x0 || 0x21 || UserName (NUL-terminated string for the user nickname)
|-
|-
| 0x20 || 0x10 || Cleared to zero during the copy.
| 0x21 || 0xF || Reserved (cleared to zero during the copy)
|}
|}


Line 1,135: Line 1,170:
| 0x4 || 0x6 || [[#MacAddress|MacAddress]]
| 0x4 || 0x6 || [[#MacAddress|MacAddress]]
|-
|-
| 0xA || 0x2 || Padding
| 0xA || 0x2 || Reserved
|}
|}


Line 1,146: Line 1,181:
!  Description
!  Description
|-
|-
| 0 || Allow all.
| 0 || AlwaysAccept
|-
|-
| 1 || Deny all.
| 1 || AlwaysReject
|-
|-
| 2 || Blacklist, addresses in the [[#AddAcceptFilterEntry|list]] are not allowed.
| 2 || BlackList (addresses in the [[#AddAcceptFilterEntry|list]] are not allowed)
|-
|-
| 3 || Whitelist, only addresses in the [[#AddAcceptFilterEntry|list]] are allowed.
| 3 || WhiteList (only addresses in the [[#AddAcceptFilterEntry|list]] are allowed)
|}
|}


Line 1,173: Line 1,208:
| 0x4 || 0x6 || [[#MacAddress|MacAddress]]
| 0x4 || 0x6 || [[#MacAddress|MacAddress]]
|-
|-
| 0xA || 0x1 || s8 ID / index
| 0xA || 0x1 || NodeId
|-
|-
| 0xB || 0x1 || IsConnected
| 0xB || 0x1 || IsConnected
|-
|-
| 0xC || 0x20 || First 0x20-bytes of [[#UserConfig]].
| 0xC || 0x21 || UserName (first 0x21-bytes of [[#UserConfig]])
|-
|-
| 0x2C || 0x2 || Reserved
| 0x2D || 0x1 || Reserved
|-
|-
| 0x2E || 0x2 || s16 LocalCommunicationVersion
| 0x2E || 0x2 || LocalCommunicationVersion
|-
|-
| 0x30 || 0x10 || Reserved
| 0x30 || 0x10 || Reserved
Line 1,194: Line 1,229:


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,207: Line 1,267:
!  Description
!  Description
|-
|-
| 0 || This is the default.
| 0 || Stable
|-
|-
| 1 ||  
| 1 || HighSpeed
|}
|}


Line 1,313: Line 1,373:
** 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):