diff options
author | mannol <eniz_vukovic@hotmail.com> | 2014-05-20 00:27:02 +0200 |
---|---|---|
committer | mannol <eniz_vukovic@hotmail.com> | 2014-05-20 00:27:02 +0200 |
commit | c9f1c6882dbf986685e3a900dae516f06832393c (patch) | |
tree | 6529505163b9a0d4fd0cb6c4aac0a19c5a108fb1 /docs/updates/DHT.md | |
parent | a1f2a18ae4146ebea11fbd3f83df803b715813da (diff) | |
parent | fc19327dccedf7950377856c3b09a13f2b0f5911 (diff) |
Merge upstream fo real now?
Diffstat (limited to 'docs/updates/DHT.md')
-rw-r--r-- | docs/updates/DHT.md | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/docs/updates/DHT.md b/docs/updates/DHT.md index db825a3c..17db70ce 100644 --- a/docs/updates/DHT.md +++ b/docs/updates/DHT.md | |||
@@ -79,18 +79,15 @@ Protocol | |||
79 | 79 | ||
80 | Node format: | 80 | Node format: |
81 | ``` | 81 | ``` |
82 | [char array (node_id), length=32 bytes][ip (in network byte order), length=4 bytes][port (in network byte order), length=2 bytes][Padding , length=2 bytes] | 82 | [uint8_t family (2 == IPv4, 10 == IPv6, 130 == TCP IPv4, 138 == TCP IPv6)][ip (in network byte order), length=4 bytes if ipv4, 16 bytes if ipv6][port (in network byte order), length=2 bytes][char array (node_id), length=32 bytes] |
83 | ``` | 83 | ``` |
84 | see also: DHT.h (Node4_format struct) | 84 | see also: DHT.h (pack_nodes() and unpack_nodes()) |
85 | |||
86 | IPv6 Node format: | ||
87 | see: DHT.h (Node_format struct) | ||
88 | 85 | ||
89 | Valid queries and Responses: | 86 | Valid queries and Responses: |
90 | 87 | ||
91 | Ping(Request and response): | 88 | Ping(Request and response): |
92 | ``` | 89 | ``` |
93 | [byte with value: 00 for request, 01 for response][char array (client node_id), length=32 bytes][random 24 byte nonce][Encrypted with the nonce and private key of the sender: [random 8 byte (ping_id)]] | 90 | [byte with value: 00 for request, 01 for response][char array (client node_id), length=32 bytes][random 24 byte nonce][Encrypted with the nonce and private key of the sender: [1 byte type (0 for request, 1 for response)][random 8 byte (ping_id)]] |
94 | ``` | 91 | ``` |
95 | ping_id = a random integer, the response must contain the exact same number as the request | 92 | ping_id = a random integer, the response must contain the exact same number as the request |
96 | 93 | ||
@@ -98,16 +95,11 @@ ping_id = a random integer, the response must contain the exact same number as t | |||
98 | Get nodes (Request): | 95 | Get nodes (Request): |
99 | Packet contents: | 96 | Packet contents: |
100 | ``` | 97 | ``` |
101 | [byte with value: 02][char array (client node_id), length=32 bytes][random 24 byte nonce][Encrypted with the nonce and private key of the sender:[char array: requested_node_id (node_id of which we want the ip), length=32 bytes][Encrypted data (must be sent back unmodified by in the response), length=NODES_ENCRYPTED_MESSAGE_LENGTH bytes]] | 98 | [byte with value: 02][char array (client node_id), length=32 bytes][random 24 byte nonce][Encrypted with the nonce and private key of the sender:[char array: requested_node_id (node_id of which we want the ip), length=32 bytes][Sendback data (must be sent back unmodified by in the response), length=1 to NODES_ENCRYPTED_MESSAGE_LENGTH bytes]] |
102 | ``` | 99 | ``` |
103 | Valid replies: a send_nodes packet | 100 | Valid replies: a send_nodes packet |
104 | 101 | ||
105 | Send_nodes (response (for ipv4 addresses)): | 102 | Send_nodes (response (for all addresses)): |
106 | ``` | ||
107 | [byte with value: 03][char array (client node_id), length=32 bytes][random 24 byte nonce][Encrypted with the nonce and private key of the sender:[Nodes in node format, length=40 * (number of nodes (maximum of 8 nodes)) bytes][Encrypted data, length=NODES_ENCRYPTED_MESSAGE_LENGTH bytes]] | ||
108 | ``` | ||
109 | |||
110 | Send_nodes_IPv6 (response (for ipv6 addresses)): | ||
111 | ``` | 103 | ``` |
112 | [byte with value: 04][char array (client node_id), length=32 bytes][random 24 byte nonce][Encrypted with the nonce and private key of the sender:[Nodes in ipv6_node format, length=56 * (number of nodes (maximum of 8 nodes)) bytes][Encrypted data, length=NODES_ENCRYPTED_MESSAGE_LENGTH bytes]] | 104 | [byte with value: 04][char array (client node_id), length=32 bytes][random 24 byte nonce][Encrypted with the nonce and private key of the sender:[uint8_t number of nodes in this packet][Nodes in node format, length=?? * (number of nodes (maximum of 8 nodes)) bytes][Sendback data, length=1 to NODES_ENCRYPTED_MESSAGE_LENGTH bytes]] |
113 | ``` | 105 | ``` |