LDN services: Difference between revisions

No edit summary
(7 intermediate revisions by the same user not shown)
Line 561: Line 561:
! Cmd || Name
! Cmd || Name
|-
|-
| 0 || CreateNetworkService
| 0 || [[#CreateNetworkService]]
|-
|-
| 8 || CreateNetworkServiceMonitor
| 8 || [[#CreateNetworkServiceMonitor]]
|}
|}
== CreateNetworkService ==
Takes an input u32, an u64 pid_reserved, a PID, returns an output [[#INetworkService]].
The input u32 must be value 0x1.
== CreateNetworkServiceMonitor ==
Takes an input u64 pid_reserved, a PID, returns an output [[#INetworkServiceMonitor]].


== INetworkService ==
== INetworkService ==
Line 601: Line 609:
| 784 ||
| 784 ||
|-
|-
| 1536 || SendToOtherGroup
| 1536 || [[#SendToOtherGroup]]
|-
|-
| 1544 || RecvFromOtherGroup
| 1544 || [[#RecvFromOtherGroup]]
|-
|-
| 1552 || AddAcceptableGroupId
| 1552 || [[#AddAcceptableGroupId]]
|-
|-
| 1560 || [9.1.0+]
| 1560 || [9.1.0+]
Line 611: Line 619:


=== Initialize ===
=== Initialize ===
No input/output.
Returns 0.
Returns 0.
=== Cmd512 ===
Takes a type-0x19 input buffer containing a 0x200-byte struct, a type-0x22 output buffer containing an array of a 0x300-byte struct, returns an output u32.
=== Cmd768 ===
Takes a type-0x31 input buffer containing a 0x200-byte struct, no output.
=== Cmd776 ===
No input/output.
=== Cmd784 ===
Takes a type-0x21 input buffer, no output.
The buffer size must be <=0x80.
=== SendToOtherGroup ===
Takes an input [[#MacAddress]], a [[#MacAddress]], a s16, a s16, an u32 flags, a type-0x21 input buffer, no output.
The buffer size must be <=0x400.
The s16s must be >=1.
Flags is only used for selecting which func to call internally, via bit0.
=== RecvFromOtherGroup ===
Takes an input u32 flags, a type-0x22 output buffer, returns a [[#MacAddress]], an u16, a s16, an u32 out_size, a s32.
The out_size is the original size used for copying to the output buffer, before it's clamped to the output-buffer size.
Flags is only used for selecting which func to call internally, via bit0.
=== AddAcceptableGroupId ===
Takes an input [[#MacAddress]], no output.
=== Cmd1560 ===
No input/output.


== INetworkServiceMonitor ==
== INetworkServiceMonitor ==
Line 713: Line 759:
This is "nn::ldn::NetworkInfo". This is a 0x480-byte struct. The data at +0x50 is another struct.
This is "nn::ldn::NetworkInfo". This is a 0x480-byte struct. The data at +0x50 is another struct.


The fields listed as Reserved are cleared during the memset and are not written to again afterwards, with cmds which return NetworkInfo.
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 723: Line 769:
| 0x0 || 0x8 || LocalCommunicationId
| 0x0 || 0x8 || LocalCommunicationId
|-
|-
| 0x8 || 0x2 ||  
| 0x8 || 0x2 || Reserved
|-
|-
| 0xA || 0x2 ||  
| 0xA || 0x2 || Arbitrary user data which can be used for filtering with [[#ScanFilter]].
|-
|-
| 0xC || 0x4 ||  
| 0xC || 0x4 || Reserved
|-
|-
| 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.
| 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.
Line 749: Line 795:
| 0x62 || 0x1 || [[#AcceptPolicy]]
| 0x62 || 0x1 || [[#AcceptPolicy]]
|-
|-
| 0x63 || 0x3 || Padding
| 0x63 || 0x1 || Only set with [[#Scan]]/[[#ScanPrivate]], when +0x4B is value 0x2.
|-
| 0x64 || 0x2 || Padding
|-
|-
| 0x66 || 0x1 || Maximum participants, for the [[#NodeInfo]] array.
| 0x66 || 0x1 || Maximum participants, for the [[#NodeInfo]] array.
Line 886: Line 934:
! Description
! Description
|-
|-
| 0x0 || 0x2 || Type, a default of value 0x1 can be used here. Overwritten by [[#CreateNetwork]]/[[#CreateNetworkPrivate]] and [[#Connect]]/[[#ConnectPrivate]]. The value used internally by these cmds must be 0x1-0x3.
| 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.
|-
|-
| 0x2 || 0x2 || Data size. Must be 0x10-0x40.
| 0x2 || 0x2 || Data size. Must be 0x10-0x40.
Line 892: Line 940:
| 0x4 || 0x40 || Data, used with key derivation.
| 0x4 || 0x40 || Data, used with key derivation.
|}
|}
Type:
* 1-2: Broadcast Action frame data is encrypted and is verified with SHA256.
* 3: Broadcast Action frame data is plaintext and is verified with SHA256.
* 1: Data frames are encrypted.
* 2-3: Data frames for normal data-transfer are plaintext - the network is Open.


= SecurityParameter =
= SecurityParameter =