From: Ruben Beltran del Rio Date: Sun, 11 Feb 2024 13:14:43 +0000 (+0100) Subject: Add tables of the commands X-Git-Url: https://git.r.bdr.sh/rbdr/tiny-command-pal/commitdiff_plain/511d85182bb53df674e3fc870a7ab8c1ec17ab26 Add tables of the commands --- diff --git a/README.md b/README.md index f6e8a11..62c1262 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ This command is used to confirm whether the current host is authorized to send t ``` ## Header, 4 bytes 1. Magic Byte (0x7C), 1 byte -2. Command Message Flag (0x01), 1 byte +2. Authorization Check Message Flag (0x00), 1 byte 3. Length of command in bytes (0x00-0xFF), 1 byte 4. Start of Text Byte (0x02), 1 byte ## The Command (Variable) @@ -51,7 +51,19 @@ This command is used to confirm whether the current host is authorized to send t 3. The signature of the command, signed by a private ed25519 key, 64 bytes 4. End of Text Byte (0x03), 1 byte ## Footer, 1 byte -2. End of Transmission Byte (0x04), 1 byte +1. End of Transmission Byte (0x04), 1 byte +``` + +``` +All numbers in hexadecimal. +┌───────────────────┬──────────────────────────────────┬────┐ +│ HEADER │ BODY │FOOT│ +├────┬────┬────┬────┼────┬─────────┬────┬────┬────┬────┼────┤ +│ 00 │ 01 │ 02 │ 03 │ 04 ┊ 04+CLEN │A+01│A+02┊A+41│A+42│A+43│ +├────┼────┼────┼────┼────┴─────────┼────┼────┴────┼────┼────┤ +│ 7C │ 00 │CLEN│ 02 │ COMMAND │ 1F │SIGNATURE│ 03 │ 04 │ +└────┴────┴────┴────┴──────────────┴────┴─────────┴────┴────┘ + A ``` ### The Authorization Response Message (0x80) @@ -69,9 +81,22 @@ This signature should be used to confirm whether the client is talking to the ri 1. Authorization Response Code (0x00-0xFF), 1 byte 2. Record Separator Byte (0x1E), 1 byte 3. The signature of the command, signed by the server's private ed25519 key, 64 bytes +4. End of Text Byte (0x03), 1 byte +## Footer, 1 byte 4. End of Transmission Byte (0x04), 1 byte ``` +``` +All numbers in hexadecimal. +┌──────────────┬────────────────────────┬────┐ +│ HEADER │ BODY │FOOT│ +├────┬────┬────┼────┬────┬────┬────┬────┼────┤ +│ 00 │ 01 │ 02 │ 03 ┊ 04 │ 05 ┊ 44 │ 45 ┊ 41 │ +├────┼────┼────┼────┼────┼────┴────┼────┼────┤ +│ 7C │ 80 │ 02 │AUTH│ 1E │SIGNATURE│ 03 │ 04 │ +└────┴────┴────┴────┴────┴─────────┴────┴────┘ +``` + The codes are as follows: - 00 Authorized @@ -105,6 +130,18 @@ This is an actual command. 2. End of Transmission Byte (0x04), 1 byte ``` +``` +All numbers in hexadecimal. +┌─────────────────────────────┬─────────────────────────────────────────────────────────────────────┬────┐ +│ HEADER │ BODY BODY │FOOT│ +├────┬────┬────┬────┬────┬────┼────┬─────────┬────┬────┬────┬────┬────┬─────────┬────┬────┬────┬────┼────┤ +│ 00 │ 01 │ 02 │ 03 ┊ 06 │ 07 │ 08 ┊ 07+CLEN │A+01│A+02┊A+41│A+42│A+43┊A+42+PLEN│B+01│B+02┊B+41│B+42│B+43│ +├────┼────┼────┼────┴────┼────┼────┴─────────┼────┼────┴────┼────┼────┴─────────┼────┼────┴────┼────┼────┤ +│ 7C │ 01 │CLEN│ PLEN │ 02 │ COMMAND │ 1F │SIGNATURE│ 1E │ PAYLOAD │ 1F │SIGNATURE│ 03 │ 04 │ +└────┴────┴────┴─────────┴────┴──────────────┴────┴─────────┴────┴──────────────┴────┴─────────┴────┴────┘ + A B +``` + ### The Command Result Message (0x81) Sent as a response to an 0x01 command, it includes the authorization code, the exit status of the command, and the signature of the command sent. @@ -114,7 +151,7 @@ If authorization is anything other than 0x00, then exit status will always be 0x ``` ## Header, 3 bytes 1. Magic Byte (0x7C), 1 byte -2. Authorization Response Message Flag (0x80), 1 byte +2. Command Result Message Flag (0x81), 1 byte 3. Start of Text Byte (0x02), 1 byte ## Body, 69 Bytes 1. Authorization Response Code (0x00-0xFF), 1 byte @@ -122,7 +159,20 @@ If authorization is anything other than 0x00, then exit status will always be 0x 3. Command Exit Status Code (0x00-0xFF), 1 byte 4. Record Separator Byte (0x1E), 1 byte 5. The signature of the command, signed by the server's private ed25519 key, 64 bytes -6. End of Transmission Byte (0x04), 1 byte +6. End of Text Byte (0x03), 1 byte +## Footer, 1 byte +1. End of Transmission Byte (0x04), 1 byte +``` + +``` +All numbers in hexadecimal. +┌──────────────┬──────────────────────────────────┬────┐ +│ HEADER │ BODY │FOOT│ +├────┬────┬────┼────┬────┬────┬────┬────┬────┬────┼────┤ +│ 00 │ 01 │ 02 │ 03 ┊ 04 │ 05 ┊ 06 │ 07 ┊ 46 │ 47 ┊ 48 │ +├────┼────┼────┼────┼────┼────┼────┼────┴────┼────┼────┤ +│ 7C │ 81 │ 02 │AUTH│ 1E │CODE│ 1E │SIGNATURE│ 03 │ 04 │ +└────┴────┴────┴────┴────┴────┴────┴─────────┴────┴────┘ ``` The authorization codes are the same as for the authorization response message.