diff options
Diffstat (limited to 'docs/Tox_middle_level_network_protocol.txt')
-rw-r--r-- | docs/Tox_middle_level_network_protocol.txt | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/docs/Tox_middle_level_network_protocol.txt b/docs/Tox_middle_level_network_protocol.txt index 7b65db51..f9b03196 100644 --- a/docs/Tox_middle_level_network_protocol.txt +++ b/docs/Tox_middle_level_network_protocol.txt | |||
@@ -41,8 +41,8 @@ Detailed implementation details: | |||
41 | cookie request packet: | 41 | cookie request packet: |
42 | [uint8_t 24][Senders DHT Public key (32 bytes)][Random nonce (24 | 42 | [uint8_t 24][Senders DHT Public key (32 bytes)][Random nonce (24 |
43 | bytes)][Encrypted message containing: [Senders real public key (32 | 43 | bytes)][Encrypted message containing: [Senders real public key (32 |
44 | bytes)][Recievers real public key (32 bytes)][uint64_t number (must be sent back | 44 | bytes)][Recievers real public key (32 bytes)][uint64_t number (must be sent |
45 | untouched in cookie response)]] | 45 | back untouched in cookie response)]] |
46 | Encrypted message is encrypted with sender DHT private key, recievers DHT | 46 | Encrypted message is encrypted with sender DHT private key, recievers DHT |
47 | public key and the nonce. | 47 | public key and the nonce. |
48 | 48 | ||
@@ -88,9 +88,30 @@ in the handshake will be used to encrypt the first data packet sent, the nonce | |||
88 | 88 | ||
89 | Data packets: | 89 | Data packets: |
90 | 90 | ||
91 | [uint8_t 27][uint16_t (in network byte order) the last 2 bytes of the nonce used | 91 | [uint8_t 27][uint16_t (in network byte order) the last 2 bytes of the nonce |
92 | to encrypt this][encrypted with the session key and a nonce:[data]] | 92 | used to encrypt this][encrypted with the session key and a nonce:[plain data]] |
93 | 93 | ||
94 | Data in the data packets: | 94 | Plain data in the data packets: |
95 | |||
96 | [uint32_t our recvbuffers buffer_start, (highest packet number handled + | ||
97 | 1)][uint32_t packet number if lossless, our sendbuffer buffer_end if | ||
98 | lossy][data] | ||
99 | |||
100 | data ids: | ||
101 | 0: padding (skipped until we hit a non zero (data id) byte) | ||
102 | 1: packet request packet (lossy packet) | ||
95 | ... | 103 | ... |
104 | 16+: reserved for Messenger usage (lossless packets). | ||
105 | |||
106 | packet request packet: [uint8_t (1)][uint8_t num][uint8_t num][uint8_t | ||
107 | num]...[uint8_t num] | ||
108 | |||
109 | the list of nums are a list of packet numbers the other is requesting. | ||
110 | to get the real packet numbers from this list take the recvbuffers buffer_start | ||
111 | from the packet, substract 1 to it and put it in packet_num then start from the | ||
112 | beggining of the num list: if num is zero, add 255 to packet_num then do the | ||
113 | next num. if num isn't zero, add its value to packet_num, note that the other | ||
114 | has requested we send this packet again to them then continue to the next num in | ||
115 | the list. | ||
116 | |||
96 | 117 | ||