This section defines the protocol used by the server and the client.
Everything defined as an interaction by this document implicitly is assumed to use Little-Endian encoding unless explicitly specified otherwise.
A session begins by opening a TCP socket and starting a connection with the server. Then both the client and the server should proceed to exchanging keys using the SSL/TLS protocol.
Aftr establishing a secure connection, the client should proceed with sending a password to the server. The format of the password itself is not specifically defined. It can be a static password, combination of username and password, or any other combination of factors as long as it is within 255 bytes in length.
The format of the authentication packet is the following:
+-----------------+---------------------------+
| Length [1 Byte] | Password [`Length` Bytes] |
+-----------------+---------------------------+
The authentication packet must be sent within a period of 2500 milliseconds, 2.5 seconds, after the SSL/TLS session is established. In the case, where it isn't, the server may/should close the connection with the client as this can be considered as a timeout.
In case, the authentication fails, the server should close the connection.
Otherwise, the server should send back a packet consisting of one zero (0
) byte.
From that moment client is considered authenticated and therefore able to access resources of/on the server. This also means that the connection timeout time is at least 600 seconds, 10 minutes.
In order to keep the connection open in case of inactivity, the client should send a packet consisting of one zero (0
) byte.
When such packet is received by the server, the client should not expect any packet as a response as the server itself should not send anything in response to such packet.
The following (main mode) commands are defined as part of this protocol:
Type | Packet format | Response format | Description |
---|---|---|---|
Keep alive | 0 |
N/A | A command that effectively doesn't do anything apart from resetting the timeout timer. |
List | 1 |
0 , count (4 byte), {is directory (1 byte; 0 = file, otherwise = folder), length (2 byte), name ("length" bytes)}..."count" times |
Lists all subdirectory and file entries. |
Go to root directory | 2 |
0 |
Changes the session scope to the root directory of the session. |
Enter directory | 3 , length (2 byte), name ("length" bytes) |
0 |
Changes the session scope to the subdirectory that was selected. |
Leave directory | 4 |
0 |
Changes the session scope to the (sub)directory in which the current subdirectory resides. |
Download file | 5 , length (2 byte), name ("length" bytes) |
0 , file size (8 byte) |
Changes session's mode from the main (this) one to the downloading one. |
Only entries which contain only those characters should be listed:
- Alphabetic characters.
- Numeric characters.
- Spacebar (
0x20
). - Tab (
0x9
). - Full stop,
.
(0x2E
). - Dash,
-
(0x2D
). - Underscore,
_
(0x5F
). - Equals,
=
(0x3D
). - Tilde,
~
(0x7E
). - Exclamation mark,
!
(0x21
). - Comma,
,
(0x2C
). - Parenthesis,
(
&)
(0x28
&0x29
). - Square brackets,
[
&]
(0x5B
&0x5D
). - Curly brackets,
{
&}
(0x7B
&0x7D
).
A filename which is exactly equal to ..
has to be treated as invalid as it poses a security threat.
Type | Packet format | Response format | Description |
---|---|---|---|
Keep alive | 0 |
N/A | A command that effectively doesn't do anything apart from resetting the timeout timer. |
Chunk count | 1 , chunk size (2 byte; represents high 16 bits of a 20 bit integer; this cannot be equal to zero (0 )) |
0 , chunk count (7 byte), last chunk size (3 byte) |
This command returns the chunk count and the last chunk size in case it is incomplete. Otherwise, last chunk size is equal to zero (0 ). |
Chunk hash | 2 , index of the chunk (7 byte), chunk size (2 byte; represents high 16 bits) |
0 , segment hash (32 byte) |
Returns the SHA2-256 hash of the chunk with the specified size and index. |
Download chunk | 3 , index of the chunk (7 byte), chunk size (2 byte; represents high 16 bits) |
0 , returned chunk size (3 byte), chunk ("returned chunk size" bytes) |
Returns the chunk with given size at the respective index, calculated as: index * size . |
Close file | 4 |
0 |
Closes file and returns to the main mode of operation. |