MySQL 9.1.0
Source Code Documentation
Gcs_dynamic_header Class Reference

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_headeroperator= (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_headeroperator= (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...
 

Detailed Description

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 | +---------------—+--------—+-----------------------------------—+

Constructor & Destructor Documentation

◆ Gcs_dynamic_header() [1/4]

Gcs_dynamic_header::Gcs_dynamic_header ( Stage_code  stage_code,
unsigned long long  payload_length 
)
explicitnoexcept

Constructor for the dynamic header.

Parameters
stage_codeStage code.
payload_lengthPayload length while the packet is in the stage.

◆ Gcs_dynamic_header() [2/4]

Gcs_dynamic_header::Gcs_dynamic_header ( )
explicitdefaultnoexcept

Default constructor is to be used when creating an empty dynamic header.

◆ Gcs_dynamic_header() [3/4]

Gcs_dynamic_header::Gcs_dynamic_header ( Gcs_dynamic_header &&  )
defaultnoexcept

These constructors are to be used when move semantics may be needed.

◆ Gcs_dynamic_header() [4/4]

Gcs_dynamic_header::Gcs_dynamic_header ( const Gcs_dynamic_header )
defaultnoexcept

These constructors are to be used when copy semantics may be needed.

Member Function Documentation

◆ calculate_length()

static constexpr unsigned long long Gcs_dynamic_header::calculate_length ( )
inlinestaticconstexpr

Return length of dynamic header.

◆ decode()

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.

Parameters
bufferThe buffer to decode from.
Returns
Length of decoded information in bytes.

◆ dump()

void Gcs_dynamic_header::dump ( std::ostringstream &  output) const

Create a string representation of the dynamic header to be logged.

Parameters
outputReference to the output stream where the string will be created.

◆ encode()

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.

Parameters
bufferThe buffer to encode to.
Returns
Length of encoded information in bytes.

◆ get_dynamic_header_length()

unsigned short Gcs_dynamic_header::get_dynamic_header_length ( ) const

Return the dynamic header length.

◆ get_payload_length()

unsigned long long Gcs_dynamic_header::get_payload_length ( ) const

Return the payload length the packet had before this stage was applied.

◆ get_stage_code()

Stage_code Gcs_dynamic_header::get_stage_code ( ) const

Return the stage code.

◆ operator=() [1/2]

Gcs_dynamic_header & Gcs_dynamic_header::operator= ( const Gcs_dynamic_header )
defaultnoexcept

◆ operator=() [2/2]

Gcs_dynamic_header & Gcs_dynamic_header::operator= ( Gcs_dynamic_header &&  )
defaultnoexcept

◆ set_payload_length()

void Gcs_dynamic_header::set_payload_length ( unsigned long long  new_length)

Set the payload length the packet had before this stage was applied.

Parameters
new_lengthpayload length before this stage

Member Data Documentation

◆ m_dynamic_header_length

unsigned short Gcs_dynamic_header::m_dynamic_header_length {0}
private

Dynamic header length.

◆ m_payload_length

unsigned long long Gcs_dynamic_header::m_payload_length {0}
private

Payload length when the packet went through the stage.

◆ m_stage_code

Stage_code Gcs_dynamic_header::m_stage_code {Stage_code::ST_UNKNOWN}
private

Stage that created the dynamic header.

◆ WIRE_HD_LEN_OFFSET

constexpr unsigned short Gcs_dynamic_header::WIRE_HD_LEN_OFFSET = 0
staticconstexpr

The offset of the header length within the stage header.

◆ WIRE_HD_LEN_SIZE

constexpr unsigned short Gcs_dynamic_header::WIRE_HD_LEN_SIZE = 2
staticconstexpr

On-the-wire field size for the stage type code.

◆ WIRE_HD_PAYLOAD_LEN_OFFSET

constexpr unsigned short Gcs_dynamic_header::WIRE_HD_PAYLOAD_LEN_OFFSET
staticconstexpr
Initial value:
=
static constexpr unsigned short WIRE_HD_TYPE_OFFSET
The offset of the stage type code within the stage header.
Definition: gcs_internal_message_headers.h:458
static constexpr unsigned short WIRE_HD_TYPE_SIZE
On-the-wire field size for the stage type code.
Definition: gcs_internal_message_headers.h:463

The offset of the payload length within the stage header.

◆ WIRE_HD_PAYLOAD_LEN_SIZE

constexpr unsigned short Gcs_dynamic_header::WIRE_HD_PAYLOAD_LEN_SIZE = 8
staticconstexpr

On-the-wire field size for the stage payload length.

◆ WIRE_HD_TYPE_OFFSET

constexpr unsigned short Gcs_dynamic_header::WIRE_HD_TYPE_OFFSET = WIRE_HD_LEN_SIZE
staticconstexpr

The offset of the stage type code within the stage header.

◆ WIRE_HD_TYPE_SIZE

constexpr unsigned short Gcs_dynamic_header::WIRE_HD_TYPE_SIZE = 4
staticconstexpr

On-the-wire field size for the stage type code.


The documentation for this class was generated from the following files: