LDN services: Difference between revisions
(11 intermediate revisions by the same user not shown) | |||
Line 379: | Line 379: | ||
This is used immediately after object creation. | This is used immediately after object creation. | ||
With [7.0.0+] [[#InitializeWithVersion|InitializeWithVersion]] is used instead. The cmd impl for Initialize uses [[#InitializeWithVersion|InitializeWithVersion]] with | On old sysvers the cmd impl for User/System are identical, except different params are used for the funcs called internally. | ||
With [7.0.0+] [[#InitializeWithVersion|InitializeWithVersion]] is used instead. The cmd impl for Initialize uses [[#InitializeWithVersion|InitializeWithVersion]] with version=0. | |||
=== Finalize === | === Finalize === | ||
Line 398: | Line 400: | ||
=== InitializeWithVersion === | === InitializeWithVersion === | ||
Takes an input PID, | Takes an input PID, a s32 version, and an u64 pid_placeholder. | ||
The version must not be negative. | |||
The | |||
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). | ||
The first func uses various [[Network_Interface_services|nifm]] funcs. The input value is used to determine the value for [[Network_Interface_services#CreateRequest|nn::nifm::RequestParameters]]: essentially, value 0x4 is used for ldn:u, and value 0x8 is used for ldn:s. The input value is also copied into state. | The first func uses various [[Network_Interface_services|nifm]] funcs. The input value is used to determine the value for [[Network_Interface_services#CreateRequest|nn::nifm::RequestParameters]]: essentially, value 0x4 is used for ldn:u, and value 0x8 is used for ldn:s. The input value is also copied into state. | ||
On old sysvers the cmd impl for User/System are identical, except different params are used for the funcs called internally: with User the u16 value is 0x5A, and the value for the second func is 1. With newer sysvers the cmd impl is now identical. | |||
[[#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. | ||
Version values passed by official sw: | |||
{| class="wikitable" border="1" | |||
|- | |||
! Value || SystemVersion | |||
|- | |||
| 0x1 || [7.0.0+] | |||
|- | |||
| 0x2 || [18.0.0+] | |||
|- | |||
| 0x3 || [19.0.0+] | |||
|- | |||
| 0x4 || [20.0.0+] | |||
|} | |||
=== InitializeWithPriority === | === InitializeWithPriority === | ||
Takes an input PID, | Takes an input PID, a s32 version, a s32, and an u64 pid_placeholder. | ||
This is similar to [[#InitializeWithVersion|InitializeWithVersion]], with the additional cmd input u32 now being passed directly to the init func which is called here. | This is similar to [[#InitializeWithVersion|InitializeWithVersion]], with the additional cmd input u32 now being passed directly to the init func which is called here. | ||
Line 486: | Line 503: | ||
[18.0.0+] [[#CreateClientProcessMonitor|CreateClientProcessMonitor]] and RegisterClient are used by sdknso at the end of the ldn initialization functionality. | [18.0.0+] [[#CreateClientProcessMonitor|CreateClientProcessMonitor]] and RegisterClient are used by sdknso at the end of the ldn initialization functionality. | ||
If the objptr in IClientProcessMonitor state is already set from using this cmd previously, this just returns 0. | |||
This goes through global state to locate an entry with a matching PID, if none found 0 is returned. The objptr from the state entry is loaded, if NULL this returns 0. This obj is then incref'd and written into the IClientProcessMonitor state. When PID is 0, 0 is returned. It then locates the above state entry again with a matching PID, clearing the entry which matches. Lastly 0 is returned. | |||
The initialization [[#InitializeWithPriority|cmds]] adds an entry to the above global state. | |||
= ldn:u = | = ldn:u = | ||
Line 508: | Line 531: | ||
== IUserLocalCommunicationService == | == IUserLocalCommunicationService == | ||
This is "nn::ldn::detail::IUserLocalCommunicationService". | This is "nn::ldn::detail::IUserLocalCommunicationService". | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 571: | Line 592: | ||
| 304 || [[#Disconnect|Disconnect]] | | 304 || [[#Disconnect|Disconnect]] | ||
|- | |- | ||
| 400 || [[# | | 400 || [[#Initialize_2|Initialize]] | ||
|- | |- | ||
| 401 || [[# | | 401 || [[#Finalize_2|Finalize]] | ||
|- | |- | ||
| 402 || [7.0.0+] [[# | | 402 || [7.0.0+] [[#InitializeWithVersion|InitializeWithVersion]] | ||
|- | |- | ||
| 403 || [19.0.0+] [[# | | 403 || [19.0.0+] [[#SetOperationMode|SetOperationMode]] | ||
|- | |- | ||
| 500 || [18.0.0+] [[#EnableActionFrame|EnableActionFrame]] | | 500 || [18.0.0+] [[#EnableActionFrame|EnableActionFrame]] | ||
Line 593: | Line 614: | ||
| 601 || [18.0.0+] [[#ResetTxPower|ResetTxPower]] | | 601 || [18.0.0+] [[#ResetTxPower|ResetTxPower]] | ||
|} | |} | ||
= ndd = | = ndd = | ||
Line 995: | Line 993: | ||
= NodeInfo = | = NodeInfo = | ||
This is "nn::ldn::NodeInfo". | This is "nn::ldn::NodeInfo". | ||
The first node in the nodes array is always the AccessPoint (NodeId 0x0). NodeId is the index of the node in the nodes array. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 1,050: | Line 1,050: | ||
| 0xC || 0x4 || Reserved | | 0xC || 0x4 || Reserved | ||
|} | |} | ||
* LocalCommunicationId: [[#CreateNetwork|CreateNetwork]], [[#CreateNetworkPrivate|CreateNetworkPrivate]], [[#Connect|Connect]], [[#ConnectPrivate|ConnectPrivate]] (also [[#ScanFilter|ScanFilter]] when enabled with the flag): When -1, this is overwritten with the first LocalCommunicationId from the user-process [[NACP]], if loading fails value 0 is written instead. Otherwise when not -1, if [[NACP]] loading is successful, this field must match one of the LocalCommunicationIds from there. | |||
* SceneId: Arbitrary user data, this can be used for filtering with [[#ScanFilter|ScanFilter]] for example. | |||
= SessionId = | = SessionId = | ||
This is "nn::ldn::SessionId". | This is "nn::ldn::SessionId". | ||
This is used to generate/overwrite the Ssid when needed. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 1,330: | Line 1,335: | ||
! Description | ! Description | ||
|- | |- | ||
| 0x0 || 0x21 || UserName (NUL-terminated string for the user | | 0x0 || 0x21 || UserName (NUL-terminated string for the user name) | ||
|- | |- | ||
| 0x21 || 0xF || Reserved | | 0x21 || 0xF || Reserved |