MySQL 9.1.0
Source Code Documentation
|
This is a default header created per stage and contains information to decode it. More...
#include <gcs_internal_message_headers.h>
Public Member Functions | |
Gcs_dynamic_header (Stage_code stage_code, unsigned long long payload_length) noexcept | |
Constructor for the dynamic header. More... | |
Gcs_dynamic_header () noexcept=default | |
Default constructor is to be used when creating an empty dynamic header. More... | |
Gcs_dynamic_header (Gcs_dynamic_header &&) noexcept=default | |
These constructors are to be used when move semantics may be needed. More... | |
Gcs_dynamic_header & | operator= (Gcs_dynamic_header &&) noexcept=default |
Gcs_dynamic_header (const Gcs_dynamic_header &) noexcept=default | |
These constructors are to be used when copy semantics may be needed. More... | |
Gcs_dynamic_header & | operator= (const Gcs_dynamic_header &) noexcept=default |
unsigned short | get_dynamic_header_length () const |
Return the dynamic header length. More... | |
Stage_code | get_stage_code () const |
Return the stage code. More... | |
unsigned long long | get_payload_length () const |
Return the payload length the packet had before this stage was applied. More... | |
void | set_payload_length (unsigned long long new_length) |
Set the payload length the packet had before this stage was applied. More... | |
unsigned long long | decode (const unsigned char *buffer) |
Decode the contents of the buffer and sets the field values according to the values decoded. More... | |
unsigned long long | encode (unsigned char *buffer) const |
Encode the contents of this instance into the buffer. More... | |
void | dump (std::ostringstream &output) const |
Create a string representation of the dynamic header to be logged. More... | |
Static Public Member Functions | |
static constexpr unsigned long long | calculate_length () |
Return length of dynamic header. More... | |
Static Public Attributes | |
static constexpr unsigned short | WIRE_HD_LEN_OFFSET = 0 |
The offset of the header length within the stage header. More... | |
static constexpr unsigned short | WIRE_HD_LEN_SIZE = 2 |
On-the-wire field size for the stage type code. More... | |
static constexpr unsigned short | WIRE_HD_TYPE_OFFSET = WIRE_HD_LEN_SIZE |
The offset of the stage type code within the stage header. More... | |
static constexpr unsigned short | WIRE_HD_TYPE_SIZE = 4 |
On-the-wire field size for the stage type code. More... | |
static constexpr unsigned short | WIRE_HD_PAYLOAD_LEN_OFFSET |
The offset of the payload length within the stage header. More... | |
static constexpr unsigned short | WIRE_HD_PAYLOAD_LEN_SIZE = 8 |
On-the-wire field size for the stage payload length. More... | |
Private Attributes | |
unsigned short | m_dynamic_header_length {0} |
Dynamic header length. More... | |
Stage_code | m_stage_code {Stage_code::ST_UNKNOWN} |
Stage that created the dynamic header. More... | |
unsigned long long | m_payload_length {0} |
Payload length when the packet went through the stage. More... | |
This is a default header created per stage and contains information to decode it.
The on-the-wire-layout representation of a dynamic header is:
+---------------—+--------—+-----------------------------------—+ | field | wire size | description | +==================+===========+======================================+ | dyn_hdr_len | 2 bytes | length of the dynamic header | | stage_code | 4 bytes | stage code | | old_payload_len | 8 bytes | length of the previous stage payload | +---------------—+--------—+-----------------------------------—+
|
explicitnoexcept |
Constructor for the dynamic header.
stage_code | Stage code. |
payload_length | Payload length while the packet is in the stage. |
|
explicitdefaultnoexcept |
Default constructor is to be used when creating an empty dynamic header.
|
defaultnoexcept |
These constructors are to be used when move semantics may be needed.
|
defaultnoexcept |
These constructors are to be used when copy semantics may be needed.
|
inlinestaticconstexpr |
Return length of dynamic header.
unsigned long long Gcs_dynamic_header::decode | ( | const unsigned char * | buffer | ) |
Decode the contents of the buffer and sets the field values according to the values decoded.
The buffer MUST be encoded in little endian format.
buffer | The buffer to decode from. |
void Gcs_dynamic_header::dump | ( | std::ostringstream & | output | ) | const |
Create a string representation of the dynamic header to be logged.
output | Reference to the output stream where the string will be created. |
unsigned long long Gcs_dynamic_header::encode | ( | unsigned char * | buffer | ) | const |
Encode the contents of this instance into the buffer.
The encoding SHALL be done in little endian format.
buffer | The buffer to encode to. |
unsigned short Gcs_dynamic_header::get_dynamic_header_length | ( | ) | const |
Return the dynamic header length.
unsigned long long Gcs_dynamic_header::get_payload_length | ( | ) | const |
Return the payload length the packet had before this stage was applied.
Stage_code Gcs_dynamic_header::get_stage_code | ( | ) | const |
Return the stage code.
|
defaultnoexcept |
|
defaultnoexcept |
void Gcs_dynamic_header::set_payload_length | ( | unsigned long long | new_length | ) |
Set the payload length the packet had before this stage was applied.
new_length | payload length before this stage |
|
private |
Dynamic header length.
|
private |
Payload length when the packet went through the stage.
|
private |
Stage that created the dynamic header.
|
staticconstexpr |
The offset of the header length within the stage header.
|
staticconstexpr |
On-the-wire field size for the stage type code.
|
staticconstexpr |
The offset of the payload length within the stage header.
|
staticconstexpr |
On-the-wire field size for the stage payload length.
|
staticconstexpr |
The offset of the stage type code within the stage header.
|
staticconstexpr |
On-the-wire field size for the stage type code.