Communication header: common fields to all communication commands. More...
#include "comm.hpp"
Public Member Functions | |
CommHeader1 (void) | |
Constructor. More... | |
void | set (const EPS::ECommType type, const size_t bytes) |
Initialize the header. More... | |
size_t | size_of_packet (void) const |
A safe way to get number_of_bytes, automatically converting it to host order and resizing it as a size_t. More... | |
EPS::ECommType | type (void) const |
A safe way to get comm_type as a EPS::ECommType value. More... | |
Public Attributes | |
uint8_t | protocol_version |
protocol version identifier More... | |
uint16_t | number_of_bytes |
number of bytes in the comm structure including every byte in the header structure (stored in network byte order) More... | |
uint8_t | comm_type |
structure type More... | |
uint8_t | reserved_5 |
Reserved for future use. More... | |
uint32_t | reserved_1 |
reserved for future use, and to ensure the common header is exactly 16 bytes in length More... | |
uint32_t | reserved_2 |
reserved for future use, and to ensure the common header is exactly 16 bytes in length More... | |
uint16_t | reserved_3 |
reserved for future use, and to ensure the common header is exactly 16 bytes in length More... | |
uint8_t | reserved_4 |
reserved for future use, and to ensure the common header is exactly 16 bytes in length More... | |
Communication header: common fields to all communication commands.
It is padded out to 16 bytes so it is exactly 1 block once we AES-encrypt it. This makes it easier when it comes time to read packets off the wire if we know the common header is exactly 1 AES cipher block.
EPS::CommHeader1::CommHeader1 | ( | void | ) |
Constructor.
void EPS::CommHeader1::set | ( | const EPS::ECommType | type, |
const size_t | bytes | ||
) |
Initialize the header.
size_t EPS::CommHeader1::size_of_packet | ( | void | ) | const |
A safe way to get number_of_bytes, automatically converting it to host order and resizing it as a size_t.
EPS::ECommType EPS::CommHeader1::type | ( | void | ) | const |
uint8_t EPS::CommHeader1::comm_type |
structure type
uint16_t EPS::CommHeader1::number_of_bytes |
number of bytes in the comm structure including every byte in the header structure (stored in network byte order)
uint8_t EPS::CommHeader1::protocol_version |
protocol version identifier
uint32_t EPS::CommHeader1::reserved_1 |
reserved for future use, and to ensure the common header is exactly 16 bytes in length
uint32_t EPS::CommHeader1::reserved_2 |
reserved for future use, and to ensure the common header is exactly 16 bytes in length
uint16_t EPS::CommHeader1::reserved_3 |
reserved for future use, and to ensure the common header is exactly 16 bytes in length
uint8_t EPS::CommHeader1::reserved_4 |
reserved for future use, and to ensure the common header is exactly 16 bytes in length
uint8_t EPS::CommHeader1::reserved_5 |
Reserved for future use.
Try and leave this last reserved value at zero, so that when we decrypt the header bytes (the first 16 bytes of the message) we don't mistake this 16th byte as a PKCS #5 / PKCS #7 padding value and accidentally truncate the header.