LDN services: Difference between revisions

No edit summary
Line 8: Line 8:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || [[#CreateMonitorService]]
| 0 || [[#CreateMonitorService|CreateMonitorService]]
|}
|}


Line 23: Line 23:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || [[#GetStateForMonitor]]
| 0 || [[#GetState|GetState]]
|-
|-
| 1 || [[#GetNetworkInfoForMonitor]]
| 1 || [[#GetNetworkInfo|GetNetworkInfo]]
|-
|-
| 2 || [[#GetIpv4AddressForMonitor]]
| 2 || [[#GetIpv4Address|GetIpv4Address]]
|-
|-
| 3 || [[#GetDisconnectReasonForMonitor]]
| 3 || [[#GetDisconnectReason|GetDisconnectReason]]
|-
|-
| 4 || [[#GetSecurityParameterForMonitor]]
| 4 || [[#GetSecurityParameter|GetSecurityParameter]]
|-
|-
| 5 || [[#GetNetworkConfigForMonitor]]
| 5 || [[#GetNetworkConfig|GetNetworkConfig]]
|-
|-
| 100 || [[#InitializeMonitor]]
| 100 || [[#Initialize]]
|-
|-
| 101 || [[#FinalizeMonitor]]
| 101 || [[#Finalize]]
|}
|}


=== GetStateForMonitor ===
=== GetState ===
No input, returns an output u32.
No input, returns an output u32.


sdknso implements this by <code>return</code>ing the u32, with 0 being returned on error.
sdknso implements this by <code>return</code>ing the u32, with 0 being returned on error.


=== GetNetworkInfoForMonitor ===
=== GetNetworkInfo ===
Takes a type-0x1A output buffer containing a [[#NetworkInfo]].
Takes a type-0x1A output buffer containing a [[#NetworkInfo]].


=== GetIpv4AddressForMonitor ===
=== GetIpv4Address ===
No input, returns an output [[#Ipv4Address]] and a [[#SubnetMask]].
No input, returns an output [[#Ipv4Address]] and a [[#SubnetMask]].


=== GetDisconnectReasonForMonitor ===
=== GetDisconnectReason ===
No input, returns an output s16.
No input, returns an output s16.


Line 58: Line 58:
This just returns 0.
This just returns 0.


=== GetSecurityParameterForMonitor ===
=== GetSecurityParameter ===
No input, returns an output [[#SecurityParameter]].
No input, returns an output [[#SecurityParameter]].


This is not exposed by sdknso.
This is not exposed by sdknso.


=== GetNetworkConfigForMonitor ===
=== GetNetworkConfig ===
No input, returns an output [[#NetworkConfig]].
No input, returns an output [[#NetworkConfig]].


This is not exposed by sdknso.
This is not exposed by sdknso.


=== InitializeMonitor ===
=== Initialize ===
No input/output.
No input/output.


Line 75: Line 75:
This just returns 0.
This just returns 0.


=== FinalizeMonitor ===
=== Finalize ===
No input/output.
No input/output.


Line 89: Line 89:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || [[#CreateSystemLocalCommunicationService]]
| 0 || [[#CreateSystemLocalCommunicationService|CreateSystemLocalCommunicationService]]
|-
|-
| 1 || [18.0.0+] [[#CreateClientProcessMonitor]]
| 1 || [18.0.0+] [[#CreateClientProcessMonitor|CreateClientProcessMonitor]]
|}
|}


Line 109: Line 109:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || [[#GetState]]
| 0 || [[#GetState_1|GetState]]
|-
|-
| 1 || [[#GetNetworkInfo]]
| 1 || [[#GetNetworkInfo_1|GetNetworkInfo]]
|-
|-
| 2 || [[#GetIpv4Address]]
| 2 || [[#GetIpv4Address_1|GetIpv4Address]]
|-
|-
| 3 || [[#GetDisconnectReason]]
| 3 || [[#GetDisconnectReason_1|GetDisconnectReason]]
|-
|-
| 4 || [[#GetSecurityParameter]]
| 4 || [[#GetSecurityParameter_1|GetSecurityParameter]]
|-
|-
| 5 || [[#GetNetworkConfig]]
| 5 || [[#GetNetworkConfig_1|GetNetworkConfig]]
|-
|-
| 100 || [[#AttachStateChangeEvent]]
| 100 || [[#GetStateChangeEvent|GetStateChangeEvent]]
|-
|-
| 101 || [[#GetNetworkInfoLatestUpdate]]
| 101 || [[#GetNetworkInfoAndHistory|GetNetworkInfoAndHistory]]
|-
|-
| 102 || [[#Scan]]
| 102 || [[#Scan|Scan]]
|-
|-
| 103 || [[#ScanPrivate]]
| 103 || [[#ScanPrivate|ScanPrivate]]
|-
|-
| 104 || [5.0.0+] [[#SetWirelessControllerRestriction]]
| 104 || [5.0.0+] [[#SetWirelessControllerPolicy|SetWirelessControllerPolicy]]
|-
|-
| 105 || [13.1.0+] [[#SetBluetoothAudioDeviceConnectableMode]]
| 105 || [13.1.0+] [[#SetWirelessAudioPolicy|SetWirelessAudioPolicy]]
|-
|-
| 106 || [18.0.0+]  
| 106 || [18.0.0+] [[#SetProtocol|SetProtocol]]
|-
|-
| 200 || [[#OpenAccessPoint]]
| 200 || [[#OpenAccessPoint|OpenAccessPoint]]
|-
|-
| 201 || [[#CloseAccessPoint]]
| 201 || [[#CloseAccessPoint|CloseAccessPoint]]
|-
|-
| 202 || [[#CreateNetwork]]
| 202 || [[#CreateNetwork|CreateNetwork]]
|-
|-
| 203 || [[#CreateNetworkPrivate]]
| 203 || [[#CreateNetworkPrivate|CreateNetworkPrivate]]
|-
|-
| 204 || [[#DestroyNetwork]]
| 204 || [[#DestroyNetwork|DestroyNetwork]]
|-
|-
| 205 || [[#Reject]]
| 205 || [[#Reject|Reject]]
|-
|-
| 206 || [[#SetAdvertiseData]]
| 206 || [[#SetAdvertiseData|SetAdvertiseData]]
|-
|-
| 207 || [[#SetStationAcceptPolicy]]
| 207 || [[#SetStationAcceptPolicy|SetStationAcceptPolicy]]
|-
|-
| 208 || [[#AddAcceptFilterEntry]]
| 208 || [[#AddAcceptFilterEntry|AddAcceptFilterEntry]]
|-
|-
| 209 || [[#ClearAcceptFilter]]
| 209 || [[#ClearAcceptFilter|ClearAcceptFilter]]
|-
|-
| 300 || [[#OpenStation]]
| 300 || [[#OpenStation|OpenStation]]
|-
|-
| 301 || [[#CloseStation]]
| 301 || [[#CloseStation|CloseStation]]
|-
|-
| 302 || [[#Connect]]
| 302 || [[#Connect|Connect]]
|-
|-
| 303 || [[#ConnectPrivate]]
| 303 || [[#ConnectPrivate|ConnectPrivate]]
|-
|-
| 304 || [[#Disconnect]]
| 304 || [[#Disconnect|Disconnect]]
|-
|-
| 400 || [[#InitializeSystem]]
| 400 || [[#Initialize_1|Initialize]]
|-
|-
| 401 || [[#FinalizeSystem]]
| 401 || [[#Finalize_1|Finalize]]
|-
|-
| 402 || [4.0.0+] [[#SetOperationMode]]
| 402 || [4.0.0+] [[#SetOperationMode|SetOperationMode]]
|-
|-
| 403 || [7.0.0+] [[#InitializeSystem2]]
| 403 || [7.0.0+] [[#InitializeWithVersion|InitializeWithVersion]]
|-
|-
| 404 || [19.0.0+]  
| 404 || [19.0.0+] [[#InitializeWithPriority|InitializeWithPriority]]
|-
|-
| 500 || [18.0.0+] EnableActionFrame
| 500 || [18.0.0+] EnableActionFrame
Line 212: Line 212:
No input, returns an output [[#NetworkConfig]].
No input, returns an output [[#NetworkConfig]].


=== AttachStateChangeEvent ===
=== GetStateChangeEvent ===
No input, returns an output Event handle.
No input, returns an output Event handle.


sdknso uses EventClearMode=1 with this. sdknso will Abort if this cmd fails.
sdknso uses EventClearMode=1 with this. sdknso will Abort if this cmd fails.


This is signaled when the data returned by [[#GetNetworkInfo]]/[[#GetNetworkInfoLatestUpdate]] is updated.
This is signaled when the data returned by [[#GetNetworkInfo]]/[[#GetNetworkInfoAndHistory]] is updated.


=== GetNetworkInfoLatestUpdate ===
=== GetNetworkInfoAndHistory ===
Takes a type-0x1A output buffer containing a [[#NetworkInfo]] and a type-0xA output buffer containing an array of [[#NodeLatestUpdate]].
Takes a type-0x1A output buffer containing a [[#NetworkInfo]] and a type-0xA output buffer containing an array of [[#NodeLatestUpdate]].


Line 242: Line 242:
See [[#Scan]].
See [[#Scan]].


=== SetWirelessControllerRestriction ===
=== SetWirelessControllerPolicy ===
Takes an input [[#WirelessControllerRestriction]], no output.
Takes an input [[#WirelessControllerRestriction]], no output.


Line 249: Line 249:
The input value is written into state.
The input value is written into state.


=== SetBluetoothAudioDeviceConnectableMode ===
=== SetWirelessAudioPolicy ===
Takes an input [[#BluetoothAudioDeviceConnectableMode]], no output.
Takes an input [[#BluetoothAudioDeviceConnectableMode]], no output.


=== Cmd106 ===
=== SetProtocol ===
Takes an input u32, no output.
Takes an input u32, no output.


Line 360: Line 360:
[[#GetState|State]] must be 5, this cmd eventually sets the State to value 4.
[[#GetState|State]] must be 5, this cmd eventually sets the State to value 4.


=== InitializeSystem ===
=== Initialize ===
Takes an input PID and an u64 pid_placeholder.
Takes an input PID and an u64 pid_placeholder.


This is used immediately after object creation.
This is used immediately after object creation.


With [7.0.0+] [[#InitializeSystem2]] is used instead.
With [7.0.0+] [[#InitializeWithVersion|InitializeWithVersion]] is used instead.


=== FinalizeSystem ===
=== Finalize ===
No input/output.
No input/output.


Line 383: Line 383:
The input value is written into state.
The input value is written into state.


=== InitializeSystem2 ===
=== InitializeWithVersion ===
Takes an input PID, an u32, and an u64 pid_placeholder.
Takes an input PID, an u32, and an u64 pid_placeholder.


Official sw uses hard-coded value 0x1 for the u32.
Official sw uses hard-coded value 0x1 for the u32.


The input u32 is ignored, the impl for this cmd is identical to [[#InitializeSystem]].
The input u32 is ignored, the impl for this cmd is identical to [[#Initialize_1|Initialize]].


Internally this calls a func with params: (..., PID, &{u16 value 0x38}). On success, this then calls another func (which sets two state fields to the input) with params: (state, 0) (these state fields are used during [[#Authentication]] to check which service is being used).
Internally this calls a func with params: (..., PID, &{u16 value 0x38}). On success, this then calls another func (which sets two state fields to the input) with params: (state, 0) (these state fields are used during [[#Authentication]] to check which service is being used).
Line 396: Line 396:
[[#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.


=== Cmd404 ===
=== InitializeWithPriority ===
Takes an input PID, an u32, an u32, and an u64 pid_placeholder.
Takes an input PID, an u32, an u32, and an u64 pid_placeholder.


This is similar to [[#InitializeSystem2]], with the additional cmd input u32 now being passed directly to the init func which is called here.
This is similar to [[#InitializeWithVersion_1|InitializeWithVersion]], with the additional cmd input u32 now being passed directly to the init func which is called here.


=== SetHomeChannel ===
=== SetHomeChannel ===
Line 423: Line 423:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || [[#CreateUserLocalCommunicationService]]
| 0 || [[#CreateUserLocalCommunicationService|CreateUserLocalCommunicationService]]
|-
|-
| 1 || [18.0.0+] [[#CreateClientProcessMonitor]]
| 1 || [18.0.0+] [[#CreateClientProcessMonitor|CreateClientProcessMonitor]]
|}
|}


Line 436: Line 436:
This is "nn::ldn::detail::IUserLocalCommunicationService".
This is "nn::ldn::detail::IUserLocalCommunicationService".


This is identical to [[#ISystemLocalCommunicationService]], except for the System-only cmd(s), and [[#Initialize]]/[[#Initialize2]] differ.
This is identical to [[#ISystemLocalCommunicationService]], except for the System-only cmd(s), and [[#Initialize_2|Initialize]]/[[#Initialize_2|InitializeWithVersion]] differ.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 442: Line 442:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || [[#GetState]]
| 0 || [[#GetState_1|GetState]]
|-
|-
| 1 || [[#GetNetworkInfo]]
| 1 || [[#GetNetworkInfo_1|GetNetworkInfo]]
|-
|-
| 2 || [[#GetIpv4Address]]
| 2 || [[#GetIpv4Address_1|GetIpv4Address]]
|-
|-
| 3 || [[#GetDisconnectReason]]
| 3 || [[#GetDisconnectReason_1|GetDisconnectReason]]
|-
|-
| 4 || [[#GetSecurityParameter]]
| 4 || [[#GetSecurityParameter_1|GetSecurityParameter]]
|-
|-
| 5 || [[#GetNetworkConfig]]
| 5 || [[#GetNetworkConfig_1|GetNetworkConfig]]
|-
|-
| 100 || [[#AttachStateChangeEvent]]
| 100 || [[#GetStateChangeEvent|GetStateChangeEvent]]
|-
|-
| 101 || [[#GetNetworkInfoLatestUpdate]]
| 101 || [[#GetNetworkInfoAndHistory|GetNetworkInfoAndHistory]]
|-
|-
| 102 || [[#Scan]]
| 102 || [[#Scan|Scan]]
|-
|-
| 103 || [[#ScanPrivate]]
| 103 || [[#ScanPrivate|ScanPrivate]]
|-
|-
| 104 || [5.0.0+] [[#SetWirelessControllerRestriction]]
| 104 || [5.0.0+] [[#SetWirelessControllerPolicy|SetWirelessControllerPolicy]]
|-
|-
| 105 || [13.1.0+] [[#SetBluetoothAudioDeviceConnectableMode]]
| 105 || [13.1.0+] [[#SetWirelessAudioPolicy|SetWirelessAudioPolicy]]
|-
|-
| 106 || [18.0.0+]
| 106 || [18.0.0+] [[#SetProtocol|SetProtocol]]
|-
|-
| 200 || [[#OpenAccessPoint]]
| 200 || [[#OpenAccessPoint|OpenAccessPoint]]
|-
|-
| 201 || [[#CloseAccessPoint]]
| 201 || [[#CloseAccessPoint|CloseAccessPoint]]
|-
|-
| 202 || [[#CreateNetwork]]
| 202 || [[#CreateNetwork|CreateNetwork]]
|-
|-
| 203 || [[#CreateNetworkPrivate]]
| 203 || [[#CreateNetworkPrivate|CreateNetworkPrivate]]
|-
|-
| 204 || [[#DestroyNetwork]]
| 204 || [[#DestroyNetwork|DestroyNetwork]]
|-
|-
| 205 || [[#Reject]]
| 205 || [[#Reject|Reject]]
|-
|-
| 206 || [[#SetAdvertiseData]]
| 206 || [[#SetAdvertiseData|SetAdvertiseData]]
|-
|-
| 207 || [[#SetStationAcceptPolicy]]
| 207 || [[#SetStationAcceptPolicy|SetStationAcceptPolicy]]
|-
|-
| 208 || [[#AddAcceptFilterEntry]]
| 208 || [[#AddAcceptFilterEntry|AddAcceptFilterEntry]]
|-
|-
| 209 || [[#ClearAcceptFilter]]
| 209 || [[#ClearAcceptFilter|ClearAcceptFilter]]
|-
|-
| 300 || [[#OpenStation]]
| 300 || [[#OpenStation|OpenStation]]
|-
|-
| 301 || [[#CloseStation]]
| 301 || [[#CloseStation|CloseStation]]
|-
|-
| 302 || [[#Connect]]
| 302 || [[#Connect|Connect]]
|-
|-
| 303 || [[#ConnectPrivate]]
| 303 || [[#ConnectPrivate|ConnectPrivate]]
|-
|-
| 304 || [[#Disconnect]]
| 304 || [[#Disconnect|Disconnect]]
|-
|-
| 400 || [[#Initialize]]
| 400 || [[#Initialize_2|Initialize]]
|-
|-
| 401 || [[#Finalize]]
| 401 || [[#Finalize_2|Finalize]]
|-
|-
| 402 || [7.0.0+] [[#Initialize2]]
| 402 || [7.0.0+] [[#InitializeWithVersion_2|InitializeWithVersion]]
|-
|-
| 403 || [19.0.0+]  
| 403 || [19.0.0+] [[#InitializeWithPriority|InitializeWithPriority]]
|-
|-
| 500 || [18.0.0+] EnableActionFrame
| 500 || [18.0.0+] EnableActionFrame
Line 526: Line 526:
This is used immediately after object creation.
This is used immediately after object creation.


With [7.0.0+] [[#Initialize2]] is used instead.
With [7.0.0+] [[#InitializeWithVersion_2|InitializeWithVersion]] is used instead.


This is identical to [[#InitializeSystem]] except different params are used for the funcs called internally.
This is identical to [[#Initialize_1|Initialize]] except different params are used for the funcs called internally.


=== Finalize ===
=== Finalize ===
Line 535: Line 535:
This is used during service exit, prior to closing the object. Official sw will Abort if this fails.
This is used during service exit, prior to closing the object. Official sw will Abort if this fails.


This is identical to [[#FinalizeSystem]].
=== InitializeWithVersion ===
 
=== Initialize2 ===
Takes an input PID, an u32, and an u64 pid_placeholder.
Takes an input PID, an u32, and an u64 pid_placeholder.


Official sw uses hard-coded value 0x1 for the u32.
Official sw uses hard-coded value 0x1 for the u32.


The input u32 is ignored, the impl for this cmd is identical to [[#Initialize]].
The input u32 is ignored, the impl for this cmd is identical to [[#Initialize_2|Initialize]].


This is identical to [[#InitializeSystem2]] except different params are used for the funcs called internally: the u16 value is 0x5A, and the value for the second func is 1.
This is identical to [[#InitializeWithVersion_2|InitializeWithVersion]] except different params are used for the funcs called internally: the u16 value is 0x5A, and the value for the second func is 1.


= ndd =
= ndd =
Line 617: Line 615:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || [[#CreateNetworkService]]
| 0 || [[#CreateNetworkService|CreateNetworkService]]
|-
|-
| 8 || [[#CreateNetworkServiceMonitor]]
| 8 || [[#CreateNetworkServiceMonitor|CreateNetworkServiceMonitor]]
|}
|}


Line 637: Line 635:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || [[#Initialize|Initialize]]
| 0 || [[#Initialize_3|Initialize]]
|-
|-
| [9.0.0-9.0.1] 256 || [[#AttachNetworkInterfaceStateChangeEvent]]
| 256 || [9.0.0-9.0.1] [[#AttachNetworkInterfaceStateChangeEvent|AttachNetworkInterfaceStateChangeEvent]]
|-
|-
| [9.0.0-9.0.1] 264 || [[#GetNetworkInterfaceLastError]]
| 264 || [9.0.0-9.0.1] [[#GetNetworkInterfaceLastError|GetNetworkInterfaceLastError]]
|-
|-
| [9.0.0-9.0.1] 272 || [[#GetRole]]
| 272 || [9.0.0-9.0.1] [[#GetRole|GetRole]]
|-
|-
| [9.0.0-9.0.1] 280 || [[#GetAdvertiseData]]
| 280 || [9.0.0-9.0.1] [[#GetAdvertiseData|GetAdvertiseData]]
|-
|-
| [9.0.0-9.0.1] 288 || [[#GetGroupInfo]]
| 288 || [9.0.0-9.0.1] [[#GetGroupInfo|GetGroupInfo]]
|-
|-
| [9.0.0-9.0.1] 296 || [[#GetGroupInfo2]]
| 296 || [9.0.0-9.0.1] [[#GetGroupInfo2|GetGroupInfo2]]
|-
|-
| [9.0.0-9.0.1] 304 || [[#GetGroupOwner]]
| 304 || [9.0.0-9.0.1] [[#GetGroupOwner|GetGroupOwner]]
|-
|-
| [9.0.0-9.0.1] 312 || [[#GetIpConfig]]
| 312 || [9.0.0-9.0.1] [[#GetIpConfig|GetIpConfig]]
|-
|-
| [9.0.0-9.0.1] 320 || [[#GetLinkLevel]]
| 320 || [9.0.0-9.0.1] [[#GetLinkLevel|GetLinkLevel]]
|-
|-
| 512 || [[#Scan]]
| 512 || [[#Scan_1|Scan]]
|-
|-
| 768 || [[#CreateGroup]]
| 768 || [[#CreateGroup|CreateGroup]]
|-
|-
| 776 || [[#DestroyGroup]]
| 776 || [[#DestroyGroup|DestroyGroup]]
|-
|-
| 784 || [[#SetAdvertiseData]]
| 784 || [[#SetAdvertiseData|SetAdvertiseData]]
|-
|-
| 1536 || [[#SendToOtherGroup]]
| 1536 || [[#SendToOtherGroup|SendToOtherGroup]]
|-
|-
| 1544 || [[#RecvFromOtherGroup]]
| 1544 || [[#RecvFromOtherGroup|RecvFromOtherGroup]]
|-
|-
| 1552 || [[#AddAcceptableGroupId]]
| 1552 || [[#AddAcceptableGroupId|AddAcceptableGroupId]]
|-
|-
| 1560 || [9.1.0+] [[#ClearAcceptableGroupId]]
| 1560 || [9.1.0+] [[#ClearAcceptableGroupId|ClearAcceptableGroupId]]
|}
|}


Line 750: Line 748:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || [[#Initialize_2|Initialize]]
| 0 || [[#Initialize_4|Initialize]]
|-
|-
| 256 || [[#AttachNetworkInterfaceStateChangeEvent]]
| 256 || [[#AttachNetworkInterfaceStateChangeEvent|AttachNetworkInterfaceStateChangeEvent]]
|-
|-
| 264 || [[#GetNetworkInterfaceLastError]]
| 264 || [[#GetNetworkInterfaceLastError|GetNetworkInterfaceLastError]]
|-
|-
| 272 || [[#GetRole]]
| 272 || [[#GetRole|GetRole]]
|-
|-
| 280 || [[#GetAdvertiseData]]
| 280 || [[#GetAdvertiseData|GetAdvertiseData]]
|-
|-
| 281 || [[#GetAdvertiseData2]]
| 281 || [[#GetAdvertiseData2|GetAdvertiseData2]]
|-
|-
| 288 || [[#GetGroupInfo]]
| 288 || [[#GetGroupInfo|GetGroupInfo]]
|-
|-
| 296 || [[#GetGroupInfo2]]
| 296 || [[#GetGroupInfo2|GetGroupInfo2]]
|-
|-
| 304 || [[#GetGroupOwner]]
| 304 || [[#GetGroupOwner|GetGroupOwner]]
|-
|-
| 312 || [[#GetIpConfig]]
| 312 || [[#GetIpConfig|GetIpConfig]]
|-
|-
| 320 || [[#GetLinkLevel]]
| 320 || [[#GetLinkLevel|GetLinkLevel]]
|-
|-
| 328 || [[#AttachJoinEvent]]
| 328 || [[#AttachJoinEvent|AttachJoinEvent]]
|-
|-
| 336 || [[#GetMembers]]
| 336 || [[#GetMembers|GetMembers]]
|}
|}


Line 845: Line 843:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || [[#CreateMonitorService]]
| 0 || [[#CreateMonitorService|CreateMonitorService]]
|}
|}


Line 858: Line 856:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || [[#Initialize_3|Initialize]]
| 0 || [[#Initialize_5|Initialize]]
|-
|-
| 288 || [[#GetGroupInfo]]
| 288 || [[#GetGroupInfo|GetGroupInfo]]
|-
|-
| 320 || [[#GetLinkLevel]]
| 320 || [[#GetLinkLevel|GetLinkLevel]]
|}
|}


Line 889: Line 887:
|-
|-
| 6 || Error
| 6 || Error
|-
|}
|}


Line 920: Line 917:
|}
|}


= NetworkInfo =
= MacAddress =
This is "nn::ldn::NetworkInfo". This is a 0x480-byte struct. The data at +0x50 is another struct.
This is "nn::ldn::MacAddress". This is a 6-byte struct with 1-byte alignment.
 
= NodeInfo =
This is "nn::ldn::NodeInfo".
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x4 || [[#Ipv4Address|Ipv4Address]]
|-
| 0x4 || 0x6 || [[#MacAddress|MacAddress]]
|-
| 0xA || 0x1 || NodeId
|-
| 0xB || 0x1 || IsConnected
|-
| 0xC || 0x21 || UserName
|-
| 0x2D || 0x1 || Reserved
|-
| 0x2E || 0x2 || LocalCommunicationVersion
|-
| 0x30 || 0x10 || Reserved
|}
 
= NodeLatestUpdate =
This is "nn::ldn::NodeLatestUpdate". This is a 0x8-byte struct.
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x1 || StateChange
|-
| 0x1 || 0x7 || Reserved
|}


The fields listed as Reserved (besides the fields before +0x10) are cleared during the memset and are not written to again afterwards, with cmds which return NetworkInfo.
= IntentId =
This is "nn::ldn::IntentId".


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 935: Line 973:
| 0x8 || 0x2 || Reserved
| 0x8 || 0x2 || Reserved
|-
|-
| 0xA || 0x2 || Arbitrary user data which can be used for filtering with [[#ScanFilter]].
| 0xA || 0x2 || SceneId
|-
|-
| 0xC || 0x4 || Reserved
| 0xC || 0x4 || Reserved
|}
= SessionId =
This is "nn::ldn::SessionId".
{| class="wikitable" border="1"
|-
|-
| 0x10 || 0x10 || Last 0x10-bytes of [[#SecurityParameter]]. NetworkId which is used to generate/overwrite the [[#Ssid]]. With [[#Scan]]/[[#ScanPrivate]], this is only done after filtering when +0x4B is value 0x2. The converted Ssid is a 0x20-byte lowercase hex string version of the input NetworkId.
! Offset
! Size
! Description
|-
|-
| 0x20 || 0x6 || [[#MacAddress|MacAddress]]
| 0x0 || 0x10 || Random
|}
 
= NetworkId =
This is "nn::ldn::NetworkId". This is a 0x20-byte struct.
 
{| class="wikitable" border="1"
|-
|-
| 0x26 || 0x22 || [[#Ssid]]
! Offset
! Size
! Description
|-
|-
| 0x48 || 0x2 || s16 NetworkChannel
| 0x0 || 0x10 || [[#IntentId|IntentId]]
|-
|-
| 0x4A || 0x1 || s8 LinkLevel
| 0x10 || 0x10 || [[#SessionId|SessionId]]
|}
 
= CommonNetworkInfo =
This is "nn::ldn::CommonNetworkInfo". This is a 0x30-byte struct.
 
{| class="wikitable" border="1"
|-
|-
| 0x4B || 0x1 || Set to hard-coded value 0x2 with output structs, except with [[#Scan]]/[[#ScanPrivate]] which can also set value 0x1 in certain cases. 0x1 = normal network without an [[#ActionFrame]], 0x2 = LDN network with a valid [[#ActionFrame]].
! Offset
! Size
! Description
|-
|-
| 0x4C || 0x4 || Padding
| 0x0 || 0x6 || [[#MacAddress|Bssid]]
|-
|-
| 0x50 || 0x10 || First 0x10-bytes of [[#SecurityParameter]].
| 0x6 || 0x22 || [[#Ssid|Ssid]]
|-
|-
| 0x60 || 0x2 || Same as [[#SecurityConfig]]+0x0.
| 0x28 || 0x2 || Channel
|-
|-
| 0x62 || 0x1 || [[#AcceptPolicy]]
| 0x2A || 0x1 || LinkLevel
|-
|-
| 0x63 || 0x1 || Only set with [[#Scan]]/[[#ScanPrivate]], when +0x4B is value 0x2. See [[#ActionFrame]].
| 0x2B || 0x1 || NetworkType
|-
| 0x2C || 0x4 || Reserved
|}
 
= LdnNetworkInfo =
This is "nn::ldn::LdnNetworkInfo". This is a 0x430-byte struct.
 
{| class="wikitable" border="1"
|-
|-
| 0x64 || 0x2 || Padding
! Offset
! Size
! Description
|-
|-
| 0x66 || 0x1 || Maximum participants, for the [[#NodeInfo|NodeInfo]] array.
| 0x0 || 0x10 || ServerRandom
|-
|-
| 0x67 || 0x1 || ParticipantNum, number of set entries in the [[#NodeInfo|NodeInfo]] array. If +0x4B is not 0x2, ParticipantNum should be handled as if it's 0.
| 0x10 || 0x2 || SecurityMode
|-
|-
| 0x68 || 0x200(0x40*8) || Array of [[#NodeInfo|NodeInfo]] with 8 entries, starting with the AccessPoint node.
| 0x12 || 0x1 || StationAcceptPolicy
|-
|-
| 0x268 || 0x2 || Reserved
| 0x13 || 0x1 || Version
|-
|-
| 0x26A || 0x2 || AdvertiseData size
| 0x14 || 0x2 || Reserved
|-
|-
| 0x26C || 0x180 || AdvertiseData
| 0x16 || 0x1 || NodeCountMax
|-
|-
| 0x3EC || 0x8C || Reserved
| 0x17 || 0x1 || NodeCount
|-
|-
| 0x478 || 0x8 || [6.0.0+] Random AuthenticationId. Set to the output from [[ETicket_services|es]] cmd1501 during network creation.
| 0x18 || 0x200 (0x40 * 8) || [[#NodeInfo|Nodes]]
|-
| 0x218 || 0x2 || Reserved
|-
| 0x21A || 0x2 || AdvertiseDataSize
|-
| 0x21C || 0x180 || AdvertiseData
|-
| 0x39C || 0x8C || Reserved
|-
| 0x428 || 0x8 || [6.0.0+] Challenge (set to the output from [[ETicket_services|es]] cmd1501 during network creation)
|}
|}


= ScanFilter =
= NetworkInfo =
This is "nn::ldn::ScanFilter". This is a 0x60-byte struct with 8-byte alignment.
This is "nn::ldn::NetworkInfo". This is a 0x480-byte struct.


sdknso copies the input ScanFilter to a tmp struct on stack, which is then used with the cmd.
The fields listed as Reserved (besides the fields before +0x10) are cleared during the memset and are not written to again afterwards, with cmds which return NetworkInfo.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 991: Line 1,073:
! Description
! Description
|-
|-
| 0x0 || 0x8 || When enabled, this will be overwritten if it's -1. The data written for this is the first [[NACP_Format|LocalCommunicationId]] for the user-process loaded via [[Glue_services|arp:r]], if loading fails value 0 is written instead. During filtering if enabled, u8 [[#NetworkInfo]]+0x4B must match 0x2, and this ScanFilter field must match [[#NetworkInfo]]+0x0.
| 0x0 || 0x20 || [[#NetworkId|NetworkId]]
|-
|-
| 0x8 || 0x2 || Padding
| 0x20 || 0x30 || [[#CommonNetworkInfo|Common]]
|-
|-
| 0xA || 0x2 || During filtering if enabled, u8 [[#NetworkInfo]]+0x4B must match 0x2, and this ScanFilter field must match [[#NetworkInfo]]+0xA.
| 0x50 || 0x430 || [[#LdnNetworkInfo|Ldn]]
|}
 
= ScanFilter =
This is "nn::ldn::ScanFilter". This is a 0x60-byte struct with 8-byte alignment.
 
sdknso copies the input ScanFilter to a tmp struct on stack, which is then used with the cmd.
 
{| class="wikitable" border="1"
|-
|-
| 0xC || 0x4 || Padding
! Offset
! Size
! Description
|-
|-
| 0x10 || 0x10 || During filtering if enabled, u8 [[#NetworkInfo]]+0x4B must match 0x2, and this ScanFilter data must match [[#NetworkInfo]]+0x10.
| 0x0 || 0x20 || [[#NetworkId|NetworkId]]
|-
|-
| 0x20 || 0x4 || When enabled, must be <=0x3, and during filtering must match u8 [[#NetworkInfo]]+0x4B.
| 0x20 || 0x4 || NetworkType
|-
|-
| 0x24 || 0x6 || [[#MacAddress|MacAddress]]. Only copied with [[#ScanPrivate]]. During filtering if enabled, this must match [[#NetworkInfo]]+0x20.
| 0x24 || 0x6 || [[#MacAddress|Bssid]]
|-
|-
| 0x2A || 0x22 || [[#Ssid]]. During filtering if enabled, this must match [[#NetworkInfo]]+0x26 (the [[#Ssid]] there must be valid for this as well). The strings are compared, without verifying the length field in [[#Ssid]] matches.
| 0x2A || 0x22 || [[#Ssid|Ssid]]
|-
|-
| 0x4C || 0x10 || Cleared to zero for the tmp struct.
| 0x4C || 0x10 || Reserved
|-
|-
| 0x5C || 0x4 || [[#ScanFilterFlag|Flag]] (masked with 0x37 for [[#Scan]], with [[#ScanPrivate]] this is masked with 0x3F)
| 0x5C || 0x4 || [[#ScanFilterFlag|Flag]]
|}
|}


Line 1,052: Line 1,144:
! Description
! Description
|-
|-
| 0x0 || 0x8 || LocalCommunicationId. Same as [[#NetworkInfo]]+0x0. [[#CreateNetwork]]/[[#CreateNetworkPrivate]]/[[#Connect]]/[[#ConnectPrivate]]: When -1, this is overwritten with the first [[NACP_Format|LocalCommunicationId]] for the user-process loaded via [[Glue_services|arp:r]], if loading fails value 0 is written instead. Otherwise when not -1, if control.nacp loading is successful with [[Glue_services|arp:r]], this field must match one of the LocalCommunicationIds from there otherwise an error is thrown.
| 0x0 || 0x10 || [[#IntentId|IntentId]]
|-
|-
| 0x8 || 0x2 || Cleared to zero during the copy.
| 0x10 || 0x2 || Channel
|-
|-
| 0xA || 0x2 || Same as [[#NetworkInfo]]+0xA.
| 0x12 || 0x1 || NodeCountMax
|-
|-
| 0xC || 0x4 || Cleared to zero during the copy.
| 0x13 || 0x1 || Reserved
|-
|-
| 0x10 || 0x2 || s16 Channel, can be zero. Same as [[#NetworkInfo]]+0x48.
| 0x14 || 0x2 || LocalCommunicationVersion
|-
|-
| 0x12 || 0x1 || s8. Same as [[#NetworkInfo]]+0x66. [[#CreateNetwork]]/[[#CreateNetworkPrivate]]: Must be 0x1-0x8.
| 0x16 || 0xA || Reserved
|-
| 0x13 || 0x1 || Cleared to zero during the copy.
|-
| 0x14 || 0x2 || Same as [[#NetworkInfo]]+0x96 (LocalCommunicationVersion from the first [[#NodeInfo|NodeInfo]]). Must not be negative. [[#Connect]]/[[#ConnectPrivate]]: This must match the value for the AccessPoint LocalCommunicationVersion.
|-
| 0x16 || 0xA || Cleared to zero during the copy.
|}
 
= NodeLatestUpdate =
This is "nn::ldn::NodeLatestUpdate". This is a 0x8-byte struct.
 
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x1 || The field in state is reset to zero by [[#GetNetworkInfoLatestUpdate]] after loading it. Official apps checks whether this is non-zero.
|-
| 0x1 || 0x7 || Not initialized with [[#GetNetworkInfoLatestUpdate]].
|}
|}


Line 1,100: Line 1,172:
|}
|}


= BluetoothAudioDeviceConnectableMode =
= WirelessAudioRestriction =
This is "nn::ldn::BluetoothAudioDeviceConnectableMode". This is an u32 enum.
This is "nn::ldn::WirelessAudioRestriction". This is an u32 enum.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 1,165: Line 1,237:
|-
|-
| 0x10 || 0x10 || [[#SessionId|SessionId]]
| 0x10 || 0x10 || [[#SessionId|SessionId]]
|}
= SessionId =
This is "nn::ldn::SessionId".
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x10 || Random
|}
|}


Line 1,226: Line 1,286:
|-
|-
| 3 || WhiteList (only addresses in the [[#AddAcceptFilterEntry|list]] are allowed)
| 3 || WhiteList (only addresses in the [[#AddAcceptFilterEntry|list]] are allowed)
|}
= MacAddress =
This is "nn::ldn::MacAddress". This is a 6-byte struct with 1-byte alignment.
= NodeInfo =
This is "nn::ldn::NodeInfo".
The fields listed as Reserved are cleared during the memset and are not written to again afterwards, with cmds which return [[#NetworkInfo]].
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x4 || [[#Ipv4Address]]
|-
| 0x4 || 0x6 || [[#MacAddress|MacAddress]]
|-
| 0xA || 0x1 || NodeId
|-
| 0xB || 0x1 || IsConnected
|-
| 0xC || 0x21 || UserName (first 0x21-bytes of [[#UserConfig]])
|-
| 0x2D || 0x1 || Reserved
|-
| 0x2E || 0x2 || LocalCommunicationVersion
|-
| 0x30 || 0x10 || Reserved
|}
|}


Line 1,308: Line 1,337:
|-
|-
| 1 || HighSpeed
| 1 || HighSpeed
|}
= Protocol =
This is "nn::ldn::Protocol". This is an u32 enum.
{| class="wikitable" border="1"
|-
!  Value
!  Description
|-
| 0 || Default
|-
| 1 || NX
|}
|}