Difference between revisions of "LDN services"
Line 209: | Line 209: | ||
=== CreateNetwork === | === CreateNetwork === | ||
+ | Takes an input [[#SecurityConfig]], a 0x30-byte struct with 1-byte alignment, a 0x20-byte struct with 8-byte alignment, no output. | ||
=== CreateNetworkPrivate === | === CreateNetworkPrivate === | ||
+ | Takes an input [[#SecurityConfig]], a [[#SecurityParameter]], a 0x30-byte struct with 1-byte alignment, a 0x20-byte struct with 8-byte alignment, a type-0x9 input buffer containing an array of [[#AddressEntry]], no output. | ||
=== DestroyNetwork === | === DestroyNetwork === | ||
Line 588: | Line 590: | ||
= WirelessControllerRestriction = | = WirelessControllerRestriction = | ||
This is "nn::ldn::WirelessControllerRestriction". This is an u32 enum. | This is "nn::ldn::WirelessControllerRestriction". This is an u32 enum. | ||
+ | |||
+ | = SecurityConfig = | ||
+ | This is "nn::ldn::SecurityConfig". This is a 0x44-byte struct with 2-byte alignment. | ||
+ | |||
+ | = SecurityParameter = | ||
+ | This is "nn::ldn::SecurityParameter". This is a 0x20-byte struct with 1-byte alignment. | ||
+ | |||
+ | = AddressEntry = | ||
+ | This is "nn::ldn::AddressEntry". This is a 0x24-byte struct. | ||
[[Category:Services]] | [[Category:Services]] |
Revision as of 23:26, 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".
GetStateForMonitor
No input, returns an output u32.
sdknso implements this by return
ing the u32, with 0 being returned on error.
GetNetworkInfoForMonitor
Takes a type-0x1A output buffer containing a #NetworkInfo.
GetIpv4AddressForMonitor
No input, returns an output #Ipv4Address and a #SubnetMask.
GetDisconnectReasonForMonitor
No input, returns an output s16.
This is not exposed by sdknso.
GetSecurityParameterForMonitor
No input, returns an output #SecurityParameter.
This is not exposed by sdknso.
GetNetworkConfigForMonitor
No input, returns an output #NetworkConfig.
This is not exposed by sdknso.
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 |
GetState
No input, returns an output u32.
sdknso implements this by return
ing the u32, with 0 being returned on error / when service isn't initialized.
GetNetworkInfo
Takes a type-0x1A output buffer containing a #NetworkInfo.
GetIpv4Address
No input, returns an output #Ipv4Address and a #SubnetMask.
GetDisconnectReason
No input, returns an output s16.
sdknso implements this by return
ing the s16 as a s32, with -1 being returned on error.
GetSecurityParameter
No input, returns an output #SecurityParameter.
GetNetworkConfig
No input, returns an output #NetworkConfig.
AttachStateChangeEvent
No input, returns an output Event handle.
sdknso uses EventClearMode=1 with this. sdknso will Abort if this cmd fails.
GetNetworkInfoLatestUpdate
Takes a type-0x1A output buffer containing a #NetworkInfo and a type-0xA output buffer containing an array of #NodeLatestUpdate.
Scan
Takes a type-0x22 output buffer containing an array of #NetworkInfo, a s16, a 0x60-byte struct with 8-byte alignment, returns an output s16.
sdknso copies the output s16 to a s32, the value passed for the input s16 is from an user-specified s32.
ScanPrivate
Takes a type-0x22 output buffer containing an array of #NetworkInfo, a s16, a 0x60-byte struct with 8-byte alignment, returns an output s16.
sdknso copies the output s16 to a s32, the value passed for the input s16 is from an user-specified s32.
SetWirelessControllerRestriction
Takes an input #WirelessControllerRestriction, no output.
OpenAccessPoint
No input/output.
CloseAccessPoint
No input/output.
CreateNetwork
Takes an input #SecurityConfig, a 0x30-byte struct with 1-byte alignment, a 0x20-byte struct with 8-byte alignment, no output.
CreateNetworkPrivate
Takes an input #SecurityConfig, a #SecurityParameter, a 0x30-byte struct with 1-byte alignment, a 0x20-byte struct with 8-byte alignment, a type-0x9 input buffer containing an array of #AddressEntry, no output.
DestroyNetwork
No input/output.
Reject
SetAdvertiseData
SetStationAcceptPolicy
AddAcceptFilterEntry
ClearAcceptFilter
No input/output.
OpenStation
No input/output.
CloseStation
No input/output.
Connect
ConnectPrivate
Disconnect
No input/output.
InitializeSystem
Takes an input PID and an u64 pid_placeholder.
This is used immediately after object creation.
With [7.0.0+] #InitializeSystem2 is used instead.
FinalizeSystem
No input/output.
This is used during service exit, prior to closing the object. Official sw will Abort if this fails.
SetOperationMode
InitializeSystem2
Takes an input PID, an u32, and an u64 pid_placeholder.
Official sw uses hard-coded value 0x1 for the u32.
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 |
Initialize
Takes an input PID and an u64 pid_placeholder.
This is used immediately after object creation.
With [7.0.0+] #Initialize2 is used instead.
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.
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.
Ipv4Address
This is "nn::ldn::Ipv4Address". This is a 0x4-byte struct with 4-byte alignment.
This is essentially the same as struct in_addr
.
SubnetMask
This is "nn::ldn::SubnetMask". This is a 0x4-byte struct with 4-byte alignment.
This is essentially the same as struct in_addr
.
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-0x20. |
0x1 | 0x21 | SSID string including NUL-terminator, str[{above length}] must be 0. |
NetworkInfo
This is "nn::ldn::NetworkInfo". This is a 0x480-byte struct.
SecurityParameter
This is "nn::ldn::SecurityParameter". This is a 0x20-byte struct with 1-byte alignment.
NetworkConfig
This is "nn::ldn::NetworkConfig". This is a 0x20-byte struct with 8-byte alignment.
NodeLatestUpdate
This is "nn::ldn::NodeLatestUpdate". This is a 0x8-byte struct.
WirelessControllerRestriction
This is "nn::ldn::WirelessControllerRestriction". This is an u32 enum.
SecurityConfig
This is "nn::ldn::SecurityConfig". This is a 0x44-byte struct with 2-byte alignment.
SecurityParameter
This is "nn::ldn::SecurityParameter". This is a 0x20-byte struct with 1-byte alignment.
AddressEntry
This is "nn::ldn::AddressEntry". This is a 0x24-byte struct.