Skip to content

Commit 0a7580b

Browse files
committed
add doc for TelegramHeader and TelegramFrame structures
1 parent edb8fd4 commit 0a7580b

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

vpr/src/server/telegramframe.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88

99
namespace comm {
1010

11+
12+
/**
13+
* @brief Structure representing a TelegramFrame.
14+
*
15+
* A TelegramFrame consists of a TelegramHeader followed by data.
16+
*
17+
* @var header The TelegramHeader containing metadata about the telegram message. @see TelegramHeader
18+
* @var data The actual data of the telegram message.
19+
*/
1120
struct TelegramFrame {
1221
TelegramHeader header;
1322
ByteArray data;

vpr/src/server/telegramheader.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@
88

99
namespace comm {
1010

11+
/**
12+
* @brief The fixed size bytes sequence where the metadata of a telegram message is stored.
13+
*
14+
* This structure is used to describe the message frame sequence in order to successfully extract it.
15+
* The TelegramHeader structure follows this format:
16+
* ------------------------------------------------------
17+
* [ 4 bytes ][ 4 bytes ][ 4 bytes ][ 1 byte ]
18+
* [SIGNATURE][DATA_LENGTH][DATA_CHECKSUM][COMPRESSOR_ID]
19+
* ------------------------------------------------------
20+
*
21+
* The SIGNATURE is a 4-byte constant sequence "I", "P", "A", "\0" which indicates the valid start of a TelegramHeader.
22+
* The DATA_LENGTH is a 4-byte field where the data length is stored, allowing for proper identification of the start and end of the TelegramFrame sequence.
23+
* The DATA_CHECKSUM is a 4-byte field where the data checksum is stored to validate the attached data.
24+
* The COMPRESSOR_ID is a 1-byte field where the compressor id is stored. If it's NULL, it means the data is not compressed (in text/json format).
25+
*/
1126
class TelegramHeader {
1227
public:
1328
static constexpr const char SIGNATURE[] = "IPA";

0 commit comments

Comments
 (0)