LDN services: Difference between revisions

No edit summary
Line 1,197: Line 1,197:
|-
|-
| 0x28 || 0x20 || SHA256 hash over the entire frame starting at +0x0, with the above size + 0x48. During hashing, this hash is cleared, with the new hash overwriting the original in memory (the original is copied to stack for comparing).
| 0x28 || 0x20 || SHA256 hash over the entire frame starting at +0x0, with the above size + 0x48. During hashing, this hash is cleared, with the new hash overwriting the original in memory (the original is copied to stack for comparing).
|}
When encryption is enabled, the encrypted data is +0x28 with size {remaining frame size}. This is encrypted with AES-128-CTR. The key is derived from the raw 0x20-bytes at +0x0. The CTR is {raw Counter above without byte-swap}, with the rest cleared to zeros.
The content data at +0x48 follows, which has the size specified above (which must be >=0x500), where all fields are big-endian:
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x10 || [[#NetworkInfo]]+0x50
|-
| 0x10 || 0x2 || [[#NetworkInfo]]+0x60
|-
| 0x12 || 0x1 || [[#NetworkInfo]]+0x62
|-
| 0x13 || 0x3 || Unused
|-
| 0x16 || 0x1 || s8 [[#NetworkInfo]]+0x66, clamped to range 1-8.
|-
| 0x17 || 0x1 || s8 [[#NetworkInfo]]+0x67, clamped to range 1-8.
|-
| 0x18 || 0x1C0(0x38*8) || Array of the below node struct.
|-
| 0x1D8 || 0x2 || Unused
|-
| 0x1DA || 0x2 || [[#NetworkInfo]]+0x26A
|-
| 0x1DC || 0x180 || [[#NetworkInfo]]+0x26C
|-
| 0x35C || 0x19C || Unused
|-
|-
| 0x48 || ||  
| 0x4F8 || 0x8 || [[#NetworkInfo]]+0x478
|}
|}


When encryption is enabled, the encrypted data is +0x28 with size {remaining frame size}. This is encrypted with AES-128-CTR. The key is derived from the raw 0x20-bytes at +0x0. The CTR is {raw Counter above without byte-swap}, with the rest cleared to zeros.
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:


<fill this in>
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x4 || [[#Ipv4Address]]
|-
| 0x4 || 0x6 || [[#MacAddress]]
|-
| 0xA || 0x1 || bool IsConnected
|-
| 0xB || 0x1 || Unused
|-
| 0xC || 0x20 || First 0x20-bytes of [[#UserConfig]].
|-
| 0x2C || 0x2 || s16 LocalCommunicationVersion
|-
| 0x2E || 0xA || Unused
|}


== lp2p ==
== lp2p ==