Difference between revisions of "LDN services"

From Nintendo Switch Brew
Jump to navigation Jump to search
Line 13: Line 13:
 
== CreateMonitorService ==
 
== CreateMonitorService ==
 
Returns an [[#IMonitorService]].
 
Returns an [[#IMonitorService]].
 +
 +
The user-process closes the IMonitorServiceCreator object immediately after using this cmd.
  
 
== IMonitorService ==
 
== IMonitorService ==
Line 33: Line 35:
 
| 5 || GetNetworkConfigForMonitor
 
| 5 || GetNetworkConfigForMonitor
 
|-
 
|-
| 100 || InitializeMonitor
+
| 100 || [[#InitializeMonitor]]
 
|-
 
|-
| 101 || FinalizeMonitor
+
| 101 || [[#FinalizeMonitor]]
 
|}
 
|}
 +
 +
=== InitializeMonitor ===
 +
No input/output.
 +
 +
This is used immediately after object creation. Official sw will Abort if this fails.
 +
 +
=== FinalizeMonitor ===
 +
No input/output.
 +
 +
This is used during service exit, prior to closing the object. Official sw will Abort if this fails.
  
 
= ldn:s =
 
= ldn:s =
Line 50: Line 62:
 
== CreateSystemLocalCommunicationService ==
 
== CreateSystemLocalCommunicationService ==
 
Returns an [[#ISystemLocalCommunicationService]].
 
Returns an [[#ISystemLocalCommunicationService]].
 +
 +
The user-process closes the ISystemServiceCreator object immediately after using this cmd. Official sw ignores errors from this cmd.
  
 
== ISystemLocalCommunicationService ==
 
== ISystemLocalCommunicationService ==
Line 112: Line 126:
 
| 400 || InitializeSystem
 
| 400 || InitializeSystem
 
|-
 
|-
| 401 || FinalizeSystem
+
| 401 || [[#FinalizeSystem]]
 
|-
 
|-
 
| 402 || [4.0.0+] SetOperationMode
 
| 402 || [4.0.0+] SetOperationMode
 
|-
 
|-
| 403 || [7.0.0+] InitializeSystem2
+
| 403 || [7.0.0+] [[#InitializeSystem2]]
 
|}
 
|}
 +
 +
=== FinalizeSystem ===
 +
No input/output.
 +
 +
This is used during service exit, prior to closing the object. Official sw will Abort if this fails.
 +
 +
=== InitializeSystem2 ===
 +
Takes an input PID, an u32, and an u64 pid_placeholder.
 +
 +
Official sw uses hard-coded value 0x1 for the u32. This is used immediately after object creation.
  
 
= ldn:u =
 
= ldn:u =
Line 131: Line 155:
 
== CreateUserLocalCommunicationService==
 
== CreateUserLocalCommunicationService==
 
Returns an [[#IUserLocalCommunicationService]].
 
Returns an [[#IUserLocalCommunicationService]].
 +
 +
The user-process closes the IUserServiceCreator object immediately after using this cmd. Official sw ignores errors from this cmd.
  
 
== IUserLocalCommunicationService ==
 
== IUserLocalCommunicationService ==
Line 193: Line 219:
 
| 400 || Initialize
 
| 400 || Initialize
 
|-
 
|-
| 401 || Finalize
+
| 401 || [[#Finalize]]
 
|-
 
|-
| 402 || [7.0.0+] Initialize2
+
| 402 || [7.0.0+] [[#Initialize2]]
 
|}
 
|}
 +
 +
=== Finalize ===
 +
No input/output.
 +
 +
This is used during service exit, prior to closing the object. Official sw will Abort if this fails.
 +
 +
=== Initialize2 ===
 +
Takes an input PID, an u32, and an u64 pid_placeholder.
 +
 +
Official sw uses hard-coded value 0x1 for the u32. This is used immediately after object creation.
  
 
= ndd =
 
= ndd =

Revision as of 02:21, 11 May 2020

LDN handles all local network communication.

ldn:m

This is "nn::ldn::detail::IMonitorServiceCreator".

Cmd Name
0 #CreateMonitorService

CreateMonitorService

Returns an #IMonitorService.

The user-process closes the IMonitorServiceCreator object immediately after using this cmd.

IMonitorService

This is "nn::ldn::detail::IMonitorService".

Cmd Name
0 GetStateForMonitor
1 GetNetworkInfoForMonitor
2 GetIpv4AddressForMonitor
3 GetDisconnectReasonForMonitor
4 GetSecurityParameterForMonitor
5 GetNetworkConfigForMonitor
100 #InitializeMonitor
101 #FinalizeMonitor

InitializeMonitor

No input/output.

This is used immediately after object creation. Official sw will Abort if this fails.

FinalizeMonitor

No input/output.

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

ldn:s

This is "nn::ldn::detail::ISystemServiceCreator".

Cmd Name
0 #CreateSystemLocalCommunicationService

CreateSystemLocalCommunicationService

Returns an #ISystemLocalCommunicationService.

The user-process closes the ISystemServiceCreator object immediately after using this cmd. Official sw ignores errors from this cmd.

ISystemLocalCommunicationService

This is "nn::ldn::detail::ISystemLocalCommunicationService".

Cmd Name
0 GetState
1 GetNetworkInfo
2 GetIpv4Address
3 GetDisconnectReason
4 GetSecurityParameter
5 GetNetworkConfig
100 AttachStateChangeEvent
101 GetNetworkInfoLatestUpdate
102 Scan
103 ScanPrivate
104 [5.0.0+] SetWirelessControllerRestriction
200 OpenAccessPoint
201 CloseAccessPoint
202 CreateNetwork
203 CreateNetworkPrivate
204 DestroyNetwork
205 Reject
206 SetAdvertiseData
207 SetStationAcceptPolicy
208 AddAcceptFilterEntry
209 ClearAcceptFilter
300 OpenStation
301 CloseStation
302 Connect
303 ConnectPrivate
304 Disconnect
400 InitializeSystem
401 #FinalizeSystem
402 [4.0.0+] SetOperationMode
403 [7.0.0+] #InitializeSystem2

FinalizeSystem

No input/output.

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

InitializeSystem2

Takes an input PID, an u32, and an u64 pid_placeholder.

Official sw uses hard-coded value 0x1 for the u32. This is used immediately after object creation.

ldn:u

This is "nn::ldn::detail::IUserServiceCreator".

Cmd Name
0 #CreateUserLocalCommunicationService

CreateUserLocalCommunicationService

Returns an #IUserLocalCommunicationService.

The user-process closes the IUserServiceCreator object immediately after using this cmd. Official sw ignores errors from this cmd.

IUserLocalCommunicationService

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

Cmd Name
0 GetState
1 GetNetworkInfo
2 GetIpv4Address
3 GetDisconnectReason
4 GetSecurityParameter
5 GetNetworkConfig
100 AttachStateChangeEvent
101 GetNetworkInfoLatestUpdate
102 Scan
103 ScanPrivate
104 [5.0.0+] SetWirelessControllerRestriction
200 OpenAccessPoint
201 CloseAccessPoint
202 CreateNetwork
203 CreateNetworkPrivate
204 DestroyNetwork
205 Reject
206 SetAdvertiseData
207 SetStationAcceptPolicy
208 AddAcceptFilterEntry
209 ClearAcceptFilter
300 OpenStation
301 CloseStation
302 Connect
303 ConnectPrivate
304 Disconnect
400 Initialize
401 #Finalize
402 [7.0.0+] #Initialize2

Finalize

No input/output.

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

Initialize2

Takes an input PID, an u32, and an u64 pid_placeholder.

Official sw uses hard-coded value 0x1 for the u32. This is used immediately after object creation.

ndd

This is "nn::ndd::IService".

This was added with [5.0.0] and removed with [6.0.0].

Cmd Name
0 EnableAutoCommunication
1 DisableAutoCommunication
2 IsAutoCommunicationEnabled
3 EnablePowerSave
4 DisablePowerSave
5 IsPowerSaveEnabled
6 IsNetworkActive
7 AcquireSendDataUpdateEvent
8 AddSendData
9 ClearSendData
10 GetSendData
11 AcquireReceiveDataEvent
12 GetCurrentReceiveDataCounter
13 GetOldestReceiveDataCounter
14 GetNextReceiveDataCounter
15 GetAvailableReceiveDataCount
16 GetRecentReceiveDataCounter
17 GetReceiveData
18 AddReceiveData
19 ClearReceiveData
20 ClearDataIdFilter
21 AcquireDeviceScanEvent
22 StartDeviceScan
23 CancelDeviceScan
24 GetDeviceScanResult

lp2p:app, lp2p:sys

These are "nn::lp2p::detail::INetworkServiceCreator".

These were added with [9.0.0+].

Cmd Name
0 CreateNetworkService
8 CreateNetworkServiceMonitor

INetworkService

This is "nn::lp2p::detail::INetworkService".

Cmd Name
0 Initialize
[9.0.0-9.0.1] 256 AttachNetworkInterfaceStateChangeEvent
[9.0.0-9.0.1] 264 GetNetworkInterfaceLastError
[9.0.0-9.0.1] 272 GetRole
[9.0.0-9.0.1] 280
[9.0.0-9.0.1] 288 GetGroupInfo
[9.0.0-9.0.1] 296
[9.0.0-9.0.1] 304
[9.0.0-9.0.1] 312
[9.0.0-9.0.1] 320
512
768
776
784
1536 SendToOtherGroup
1544 RecvFromOtherGroup
1552 AddAcceptableGroupId
1560 [9.1.0+]

Initialize

Returns 0.

INetworkServiceMonitor

This is "nn::lp2p::detail::INetworkServiceMonitor".

This interface has no commands, until [9.1.0+] which added actual commands.

Cmd Name
0 Initialize
256 AttachNetworkInterfaceStateChangeEvent
264 GetNetworkInterfaceLastError
272 GetRole
280
281
288 GetGroupInfo
296
304
312
320
328 AttachJoinEvent
336

Initialize

Returns 0.

lp2p:m

This is "nn::lp2p::detail::IMonitorServiceCreator".

This was added with [9.1.0+].

Cmd Name
0 #CreateMonitorService

CreateMonitorService

Takes a PID, a total of 0x10-bytes of input, and returns an #IMonitorService.

IMonitorService

This is "nn::lp2p::detail::IMonitorService".

Cmd Name
0 Initialize
288 GetGroupInfo
320

Initialize

Returns 0.

Ssid

This is "nn::ldn::Ssid".

When converting a Ssid to a string, the loaded chars from the string must be in the range of 0x20-0x7F, otherwise the byte written to the string will be 0.

Offset Size Description
0x0 0x1 Length excluding NUL-terminator, must be 0x1-0x1F.
0x1 0x21 SSID string including NUL-terminator, str[{above length}] must be 0.