-
Notifications
You must be signed in to change notification settings - Fork 0
Overview
The TF Protocol works by sending text commands from client to the server in a TCP connection. Every time a command is received at the server it responds with a command execution status. The buffer used for all the communication must be of 512 * 1024 bytes.
The communication between the server and the client occurs in an encrypted way. This encryption is a client-to-server one. It uses at first public key encryption to exchange a session key. This session key is used for the encryption to transmit and receive commands, data, etc.
This protocol has two works modes. The standard mode, and the notification mode. In the standard mode the server holds on for commands from the client, then it executes it, and it returns the result and the possible extra data depending on the command. In the notification mode the client holds on for the server to receive data. Every sent or received data must be preceded by a header indicating the size of the message that will be received. The only exception of this, are for those modules and commands that implements their own header mechanism. The header for the current version of TFPROTOCOL looks like this:
struct tfhdr {
int32_t sz;
}
It only contains one field of 32bits (integer). Before sending it must be converted to network byte order (big-endian). It must be two of this header to allow multi-threaded communication (full-duplex comm). One used for TX ‘transmit data’ and the other one used for RX ‘receive data’.
TFProtocol