You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.2 KiB
47 lines
1.2 KiB
--- DDTU PROTOCOL v1 --- |
|
|
|
- High level overview - |
|
|
|
- Node Modes - |
|
|
|
[Receive] |
|
Is for receiving information. |
|
|
|
[Send] |
|
Is for sending data to the receiving end. |
|
|
|
[Sync] |
|
Is for syncing one directory among 2 ends. (Make contents the same on both sides) |
|
|
|
[Daemon] |
|
Is used to create a longstanding sync daemon which syncs the directory with all incoming |
|
sync connections |
|
|
|
|
|
All infomation|commands are sent via packets with specific structure |
|
|
|
- Packet bytes representation - |
|
|
|
First 16 bytes - the total packet length |
|
The next 1 byte - number that represents this packet's type (ID) where: |
|
1: HANDSHAKE PACKET |
|
2: HANDSHAKE ACCEPT |
|
3: CONNECTION SHUTDOWN PACKET |
|
4: TEXT PACKET |
|
5: FILEINFO PACKET |
|
6: FILEDATA PACKET |
|
7: FILE ACCEPT PACKET |
|
8: FILE REJECT PACKET |
|
|
|
Then the internal structure varies from one packet type to the other, |
|
but the content-types are encoded as follows: |
|
u8 - just 1 BE byte |
|
u128 - 16 BE bytes |
|
String - u128 representing the string length and then UTF-8 encoded character bytes |
|
[u8] - u128 as the length of a byte array, then the array itself |
|
bool - convert it to u8 where 0 == false, 1 == true |
|
|
|
- Packets - |
|
[Handshake] |
|
This is the first packet that must be sent by connecting node to waiting node. |
|
Its existence tells the receiving end that the
|
|
|