LDN services: Difference between revisions
No edit summary |
|||
Line 320: | Line 320: | ||
=== AddAcceptFilterEntry === | === AddAcceptFilterEntry === | ||
Takes an input [[#MacAddress]], no output. | Takes an input [[#MacAddress_1|MacAddress]], no output. | ||
There are two sdknso funcs implementing this: one which takes a [[#MacAddress]] directly, the other loads the [[#MacAddress]] from the input [[#NodeInfo]]. | There are two sdknso funcs implementing this: one which takes a [[#MacAddress_1|MacAddress]] directly, the other loads the [[#MacAddress_1|MacAddress]] from the input [[#NodeInfo_1|NodeInfo]]. | ||
[[#GetState|State]] must be 2-3. | [[#GetState|State]] must be 2-3. | ||
Line 666: | Line 666: | ||
=== SendToOtherGroup === | === SendToOtherGroup === | ||
Takes an input [[#MacAddress]], a [[#GroupId]], a s16 frequency, a s16 channel, an u32 flags, a type-0x21 input buffer, no output. | Takes an input [[#MacAddress_2|MacAddress]], a [[#GroupId]], a s16 frequency, a s16 channel, an u32 flags, a type-0x21 input buffer, no output. | ||
The buffer size must be <=0x400. | The buffer size must be <=0x400. | ||
Line 678: | Line 678: | ||
This is only available when a group was previously [[#CreateGroup|created]]. | This is only available when a group was previously [[#CreateGroup|created]]. | ||
This sends an Action frame to the specified [[#GroupId]], with the specified destination [[#MacAddress]] (can be a broadcast address). | This sends an Action frame to the specified [[#GroupId]], with the specified destination [[#MacAddress_2|MacAddress]] (can be a broadcast address). | ||
The frequency param is the same as the [[#GroupInfo]]+0x84 field. | The frequency param is the same as the [[#GroupInfo]]+0x84 field. | ||
=== RecvFromOtherGroup === | === RecvFromOtherGroup === | ||
Takes an input u32 flags, a type-0x22 output buffer, returns a [[#MacAddress]], an u16, a s16, an u32 out_size, a s32. | Takes an input u32 flags, a type-0x22 output buffer, returns a [[#MacAddress_2|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. | The out_size is the original size used for copying to the output buffer, before it's clamped to the output-buffer size. | ||
Line 788: | Line 788: | ||
=== GetMembers === | === GetMembers === | ||
Takes a type-0x22 output buffer containing an array of [[#NodeInfo]], returns an output s32 total_out. | Takes a type-0x22 output buffer containing an array of [[#NodeInfo_2|NodeInfo]], returns an output s32 total_out. | ||
Validates that the [[#GetRole|role]] is value 0x1. Then any entries from state which are available are copied into the output array buffer, if there's space available. | Validates that the [[#GetRole|role]] is value 0x1. Then any entries from state which are available are copied into the output array buffer, if there's space available. | ||
Line 875: | Line 875: | ||
| 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. | ||
|- | |- | ||
| 0x20 || 0x6 || [[#MacAddress]] | | 0x20 || 0x6 || [[#MacAddress_1|MacAddress]] | ||
|- | |- | ||
| 0x26 || 0x22 || [[#Ssid]] | | 0x26 || 0x22 || [[#Ssid]] | ||
Line 897: | Line 897: | ||
| 0x64 || 0x2 || Padding | | 0x64 || 0x2 || Padding | ||
|- | |- | ||
| 0x66 || 0x1 || Maximum participants, for the [[#NodeInfo]] array. | | 0x66 || 0x1 || Maximum participants, for the [[#NodeInfo_1|NodeInfo]] array. | ||
|- | |- | ||
| 0x67 || 0x1 || ParticipantNum, number of set entries in the [[#NodeInfo]] array. If +0x4B is not 0x2, ParticipantNum should be handled as if it's 0. | | 0x67 || 0x1 || ParticipantNum, number of set entries in the [[#NodeInfo_1|NodeInfo]] array. If +0x4B is not 0x2, ParticipantNum should be handled as if it's 0. | ||
|- | |- | ||
| 0x68 || 0x200(0x40*8) || Array of [[#NodeInfo]] with 8 entries, starting with the AccessPoint node. | | 0x68 || 0x200(0x40*8) || Array of [[#NodeInfo_1|NodeInfo]] with 8 entries, starting with the AccessPoint node. | ||
|- | |- | ||
| 0x268 || 0x2 || Reserved | | 0x268 || 0x2 || Reserved | ||
Line 937: | Line 937: | ||
| 0x20 || 0x4 || When enabled, must be <=0x3, and during filtering must match u8 [[#NetworkInfo]]+0x4B. | | 0x20 || 0x4 || When enabled, must be <=0x3, and during filtering must match u8 [[#NetworkInfo]]+0x4B. | ||
|- | |- | ||
| 0x24 || 0x6 || [[#MacAddress]]. Only copied with [[#ScanPrivate]]. During filtering if enabled, this must match [[#NetworkInfo]]+0x20. | | 0x24 || 0x6 || [[#MacAddress_1|MacAddress]]. Only copied with [[#ScanPrivate]]. During filtering if enabled, this must match [[#NetworkInfo]]+0x20. | ||
|- | |- | ||
| 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]]. 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. | ||
Line 959: | Line 959: | ||
| 2 || When set, enables using ScanFilter+0x20. | | 2 || When set, enables using ScanFilter+0x20. | ||
|- | |- | ||
| 3 || When set, enables using the ScanFilter [[#MacAddress]]. | | 3 || When set, enables using the ScanFilter [[#MacAddress_1|MacAddress]]. | ||
|- | |- | ||
| 4 || When set, enables using the ScanFilter [[#Ssid]]. | | 4 || When set, enables using the ScanFilter [[#Ssid]]. | ||
Line 991: | Line 991: | ||
| 0x13 || 0x1 || Cleared to zero during the copy. | | 0x13 || 0x1 || Cleared to zero during the copy. | ||
|- | |- | ||
| 0x14 || 0x2 || Same as [[#NetworkInfo]]+0x96 (LocalCommunicationVersion from the first [[#NodeInfo]]). Must not be negative. [[#Connect]]/[[#ConnectPrivate]]: This must match the value for the AccessPoint LocalCommunicationVersion. | | 0x14 || 0x2 || Same as [[#NetworkInfo]]+0x96 (LocalCommunicationVersion from the first [[#NodeInfo_1|NodeInfo]]). Must not be negative. [[#Connect]]/[[#ConnectPrivate]]: This must match the value for the AccessPoint LocalCommunicationVersion. | ||
|- | |- | ||
| 0x16 || 0xA || Cleared to zero during the copy. | | 0x16 || 0xA || Cleared to zero during the copy. | ||
Line 1,089: | Line 1,089: | ||
| 0x0 || 0x4 || [[#Ipv4Address]] | | 0x0 || 0x4 || [[#Ipv4Address]] | ||
|- | |- | ||
| 0x4 || 0x6 || [[#MacAddress]] | | 0x4 || 0x6 || [[#MacAddress_1|MacAddress]] | ||
|- | |- | ||
| 0xA || 0x2 || Padding | | 0xA || 0x2 || Padding | ||
Line 1,113: | Line 1,113: | ||
= MacAddress = | = MacAddress = | ||
This is "nn::ldn::MacAddress". This is a 6-byte struct with 1-byte alignment. | This is "nn::ldn::MacAddress". This is a 6-byte struct with 1-byte alignment. | ||
= NodeInfo = | = NodeInfo = | ||
Line 1,132: | Line 1,127: | ||
| 0x0 || 0x4 || [[#Ipv4Address]] | | 0x0 || 0x4 || [[#Ipv4Address]] | ||
|- | |- | ||
| 0x4 || 0x6 || [[#MacAddress]] | | 0x4 || 0x6 || [[#MacAddress_1|MacAddress]] | ||
|- | |- | ||
| 0xA || 0x1 || s8 ID / index | | 0xA || 0x1 || s8 ID / index | ||
Line 1,171: | Line 1,166: | ||
|- | |- | ||
| 1 || | | 1 || | ||
|} | |||
= MacAddress = | |||
This is "nn::lp2p::MacAddress". Same as [[#MacAddress_1|MacAddress]]. | |||
= GroupId = | |||
This is "nn::lp2p::GroupId". This is a 6-byte struct with 1-byte alignment. | |||
This is a WiFi BSSID. | |||
= NodeInfo = | |||
This is "nn::lp2p::NodeInfo". This is a 0x80-byte struct. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 || 0x4 || [[#Ipv4Address]] | |||
|- | |||
| 0x4 || 0x6 || [[#MacAddress_2|MacAddress]] | |||
|} | |} | ||
Line 1,204: | Line 1,221: | ||
! Description | ! Description | ||
|- | |- | ||
| 0x18 || 0x6 || [[#MacAddress]]? | | 0x18 || 0x6 || [[#MacAddress_2|MacAddress]]? | ||
|- | |- | ||
| 0x86 || 0x1 || | | 0x86 || 0x1 || | ||
Line 1,223: | Line 1,240: | ||
Then the Station scans for an [[#ActionFrame]] for loading the [[#NetworkInfo]]. | Then the Station scans for an [[#ActionFrame]] for loading the [[#NetworkInfo]]. | ||
Once connected, the AccessPoint sends Epigram-vendor Action frame(s) (same data) to the Station, the Station doesn't require these frames: <code>dd1afeedfacedeadbeef010000000a00000000000000000000000000</code>. Then the Station must Authenticate with the AccessPoint, this is custom. The Station sends a frame (a maximum of 3 times in some cases if errors occur, with the same data), and the AccessPoint sends a response. Once Authenticated, the node is added to the [[#NodeInfo]] array in [[#NetworkInfo]]. If the Station does not successfully Authenticate X-seconds after connecting, the AccessPoint disconnects the Station. If the Station fails to Authenticate, the Station itself will disconnect as well. | Once connected, the AccessPoint sends Epigram-vendor Action frame(s) (same data) to the Station, the Station doesn't require these frames: <code>dd1afeedfacedeadbeef010000000a00000000000000000000000000</code>. Then the Station must Authenticate with the AccessPoint, this is custom. The Station sends a frame (a maximum of 3 times in some cases if errors occur, with the same data), and the AccessPoint sends a response. Once Authenticated, the node is added to the [[#NodeInfo_1|NodeInfo]] array in [[#NetworkInfo]]. If the Station does not successfully Authenticate X-seconds after connecting, the AccessPoint disconnects the Station. If the Station fails to Authenticate, the Station itself will disconnect as well. | ||
After Authentication the Station will scan for another [[#ActionFrame]], with frame-comparision enabled with the above frame (frame must have been updated since the previous scan). The Station locates the index for a [[#MacAddress]] matching itself in the [[#NetworkInfo]] [[#NodeInfo]] array (the entry for the AccessPoint is skipped), throwing an error if not found. After validating the LocalCommunicationVersion, it proceeds to handle ARP setup below. | After Authentication the Station will scan for another [[#ActionFrame]], with frame-comparision enabled with the above frame (frame must have been updated since the previous scan). The Station locates the index for a [[#MacAddress_1|MacAddress]] matching itself in the [[#NetworkInfo]] [[#NodeInfo_1|NodeInfo]] array (the entry for the AccessPoint is skipped), throwing an error if not found. After validating the LocalCommunicationVersion, it proceeds to handle ARP setup below. | ||
This does not use DHCP, each node on the network has to manually setup ARP (without sending ARP network requests) with the [[#NodeInfo]] array in [[#NetworkInfo]]. | This does not use DHCP, each node on the network has to manually setup ARP (without sending ARP network requests) with the [[#NodeInfo_1|NodeInfo]] array in [[#NetworkInfo]]. | ||
At this point standard sockets can be used over Data frames. | At this point standard sockets can be used over Data frames. | ||
Line 1,413: | Line 1,430: | ||
The data here is copied into [[#NetworkInfo]]. | The data here is copied into [[#NetworkInfo]]. | ||
Node data used in the above array (all fields big-endian), which are copied into the [[#NetworkInfo]] [[#NodeInfo]] array: | Node data used in the above array (all fields big-endian), which are copied into the [[#NetworkInfo]] [[#NodeInfo_1|NodeInfo]] array: | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 1,423: | Line 1,440: | ||
| 0x0 || 0x4 || [[#Ipv4Address]] | | 0x0 || 0x4 || [[#Ipv4Address]] | ||
|- | |- | ||
| 0x4 || 0x6 || [[#MacAddress]] | | 0x4 || 0x6 || [[#MacAddress_1|MacAddress]] | ||
|- | |- | ||
| 0xA || 0x1 || bool IsConnected | | 0xA || 0x1 || bool IsConnected |