24#ifndef GCS_PLUGIN_MESSAGES_INCLUDED
25#define GCS_PLUGIN_MESSAGES_INCLUDED
307 const unsigned char **payload_item_data,
size_t *payload_item_length);
325 const unsigned char *
buffer,
const unsigned char *
end,
326 uint16 payload_item_type,
const unsigned char **payload_item_data,
327 unsigned long long *payload_item_length);
356 const uint16 timestamp_payload_item_type);
389 const unsigned char *
end) = 0;
404 const char *message);
414 std::vector<unsigned char> *
buffer,
uint16 payload_item_type,
415 unsigned long long payload_item_length)
const;
425 const unsigned char **
buffer,
uint16 *payload_item_type,
426 unsigned long long *payload_item_length);
437 unsigned char value)
const;
465 unsigned char *
value);
593 unsigned long long length)
const;
606 const unsigned char *
end, std::string *
value,
607 unsigned long long *
length);
620 unsigned long long length)
const;
633 const unsigned char *
end,
unsigned char *
value,
634 unsigned long long *
length);
This is the base GCS plugin message.
Definition: gcs_plugin_messages.h:65
void decode_payload_item_int2(const unsigned char **buffer, uint16 *type, uint16 *value)
Decodes the given payload item (type, length and value) from the buffer as a 2 bytes integer.
Definition: gcs_plugin_messages.cc:359
enum_cargo_type get_cargo_type() const
Definition: gcs_plugin_messages.h:250
void set_error(const char *type, const char *file, size_t line, const char *message)
Stores a decode error if one has not already been recorded.
Definition: gcs_plugin_messages.cc:232
void encode(std::vector< unsigned char > *buffer) const
Encodes the contents of this instance into the buffer.
Definition: gcs_plugin_messages.cc:98
Error_ptr m_error
Holds information about error that might occur during encoding/decoding.
Definition: gcs_plugin_messages.h:203
void encode_payload_item_type_and_length(std::vector< unsigned char > *buffer, uint16 payload_item_type, unsigned long long payload_item_length) const
Encodes the given payload item type and length into the buffer.
Definition: gcs_plugin_messages.cc:278
static const int PLUGIN_GCS_MESSAGE_VERSION
The protocol version number.
Definition: gcs_plugin_messages.h:72
int m_version
This header instance protocol version.
Definition: gcs_plugin_messages.h:183
void encode_payload_item_string(std::vector< unsigned char > *buffer, uint16 type, const char *value, unsigned long long length) const
Encodes the given payload item (type, length and value) into the buffer as a char array (variable siz...
Definition: gcs_plugin_messages.cc:472
void encode_header(std::vector< unsigned char > *buffer) const
Encodes the header of this instance into the buffer.
Definition: gcs_plugin_messages.cc:76
unsigned long long get_msg_length()
Definition: gcs_plugin_messages.h:255
Plugin_gcs_message & operator=(const Plugin_gcs_message &other)
Copy-assignment operator.
Definition: gcs_plugin_messages.cc:62
bool has_error() const
Definition: gcs_plugin_messages.cc:224
void encode_payload_item_int2(std::vector< unsigned char > *buffer, uint16 type, uint16 value) const
Encodes the given payload item (type, length and value) into the buffer as a 2 bytes integer.
Definition: gcs_plugin_messages.cc:349
unsigned short get_header_length()
Definition: gcs_plugin_messages.h:245
static const unsigned int WIRE_PAYLOAD_ITEM_LEN_SIZE
The on-the-wire size of the each payload item size field.
Definition: gcs_plugin_messages.h:107
enum_cargo_type
The different cargo type codes.
Definition: gcs_plugin_messages.h:119
@ CT_TRANSACTION_MESSAGE
Definition: gcs_plugin_messages.h:128
@ CT_CERTIFICATION_MESSAGE
Definition: gcs_plugin_messages.h:125
@ CT_RECOVERY_MESSAGE
Definition: gcs_plugin_messages.h:132
@ CT_RECOVERY_METADATA_MESSAGE
Definition: gcs_plugin_messages.h:173
@ CT_TRANSACTION_WITH_GUARANTEE_MESSAGE
Definition: gcs_plugin_messages.h:163
@ CT_GROUP_ACTION_MESSAGE
Definition: gcs_plugin_messages.h:152
@ CT_SINGLE_PRIMARY_MESSAGE
Definition: gcs_plugin_messages.h:148
@ CT_MAX
Definition: gcs_plugin_messages.h:176
@ CT_SYNC_BEFORE_EXECUTION_MESSAGE
Definition: gcs_plugin_messages.h:160
@ CT_MEMBER_INFO_MESSAGE
Definition: gcs_plugin_messages.h:136
@ CT_TRANSACTION_PREPARED_MESSAGE
Definition: gcs_plugin_messages.h:166
@ CT_UNKNOWN
Definition: gcs_plugin_messages.h:121
@ CT_MESSAGE_SERVICE_MESSAGE
Definition: gcs_plugin_messages.h:170
@ CT_MEMBER_INFO_MANAGER_MESSAGE
Definition: gcs_plugin_messages.h:140
@ CT_GROUP_VALIDATION_MESSAGE
Definition: gcs_plugin_messages.h:156
@ CT_PIPELINE_STATS_MEMBER_MESSAGE
Definition: gcs_plugin_messages.h:144
static const unsigned int WIRE_PAYLOAD_ITEM_TYPE_SIZE
The on-the-wire size of the each payload item type field.
Definition: gcs_plugin_messages.h:102
static const unsigned int WIRE_FIXED_HEADER_SIZE
The on-the-wire size of the fixed header.
Definition: gcs_plugin_messages.h:97
static bool get_first_payload_item_raw_data(const unsigned char *buffer, size_t length, const unsigned char **payload_item_data, size_t *payload_item_length)
Return the raw data of the first payload item of a given message buffer, without decode the complete ...
Definition: gcs_plugin_messages.cc:169
bool decode_payload_item_bytes(const unsigned char **buffer, uint16 *type, const unsigned char *end, unsigned char *value, unsigned long long *length)
Decodes the given payload item (type, length and value) from the buffer as a byte buffer (variable si...
Definition: gcs_plugin_messages.cc:511
virtual void encode_payload(std::vector< unsigned char > *buffer) const =0
Encodes the contents of this instance payload into the buffer.
static const unsigned int WIRE_PAYLOAD_ITEM_HEADER_SIZE
The on-the-wire size of the payload item header.
Definition: gcs_plugin_messages.h:112
enum_cargo_type m_cargo_type
The cargo type code.
Definition: gcs_plugin_messages.h:198
void encode_payload_item_bytes(std::vector< unsigned char > *buffer, uint16 type, const unsigned char *value, unsigned long long length) const
Encodes the given payload item (type, length and value) into the buffer as a byte buffer (variable si...
Definition: gcs_plugin_messages.cc:501
static int64_t get_sent_timestamp(const unsigned char *buffer, size_t length, const uint16 timestamp_payload_item_type)
Return the time at which the message contained in the buffer was sent.
Definition: gcs_plugin_messages.cc:239
static void decode_payload_item_char(const unsigned char **buffer, uint16 *type, unsigned char *value)
Decodes the given payload item (type, length and value) from the buffer as a char (1 byte).
Definition: gcs_plugin_messages.cc:317
const Error_ptr & get_error() const
Definition: gcs_plugin_messages.cc:228
static const unsigned int WIRE_MSG_LEN_SIZE
The on-the-wire size of the message size field.
Definition: gcs_plugin_messages.h:87
int get_version()
Definition: gcs_plugin_messages.h:240
void decode(const unsigned char *buffer, size_t length)
Decodes the contents of the buffer and sets the field values according to the values decoded.
Definition: gcs_plugin_messages.cc:124
void encode_payload_item_int8(std::vector< unsigned char > *buffer, uint16 type, ulonglong value) const
Encodes the given payload item (type, length and value) into the buffer as a 8 bytes integer.
Definition: gcs_plugin_messages.cc:431
static bool get_payload_item_type_raw_data(const unsigned char *buffer, const unsigned char *end, uint16 payload_item_type, const unsigned char **payload_item_data, unsigned long long *payload_item_length)
Return the raw data of the payload item of a given payload type of a given message buffer.
Definition: gcs_plugin_messages.cc:193
static void decode_payload_item_type_and_length(const unsigned char **buffer, uint16 *payload_item_type, unsigned long long *payload_item_length)
Decodes the given payload item type and length from the buffer.
Definition: gcs_plugin_messages.cc:294
static const unsigned int WIRE_HD_LEN_SIZE
The on-the-wire size of the header length field.
Definition: gcs_plugin_messages.h:82
void encode_payload_item_int4(std::vector< unsigned char > *buffer, uint16 type, uint32 value) const
Encodes the given payload item (type, length and value) into the buffer as a 4 bytes integer.
Definition: gcs_plugin_messages.cc:390
unsigned long long m_msg_len
This is the message length field.
Definition: gcs_plugin_messages.h:193
virtual ~Plugin_gcs_message()=default
Plugin_gcs_message(const Plugin_gcs_message &other)
Copy constructor.
Definition: gcs_plugin_messages.cc:56
void encode_payload_item_char(std::vector< unsigned char > *buffer, uint16 type, unsigned char value) const
Encodes the given payload item (type, length and value) into the buffer as a char (1 byte).
Definition: gcs_plugin_messages.cc:306
mysql::utils::Error_ptr Error_ptr
Definition: gcs_plugin_messages.h:67
bool decode_payload_item_string(const unsigned char **buffer, uint16 *type, const unsigned char *end, std::string *value, unsigned long long *length)
Decodes the given payload item (type, length and value) from the buffer as a char array (variable siz...
Definition: gcs_plugin_messages.cc:481
static const unsigned int WIRE_VERSION_SIZE
The protocol version number.
Definition: gcs_plugin_messages.h:77
void decode_payload_item_int4(const unsigned char **buffer, uint16 *type, uint32 *value)
Decodes the given payload item (type, length and value) from the buffer as a 4 bytes integer.
Definition: gcs_plugin_messages.cc:400
virtual void decode_payload(const unsigned char *buffer, const unsigned char *end)=0
Decodes the contents of the buffer and sets the payload field values according to the values decoded.
unsigned short m_fixed_header_len
This header instance length.
Definition: gcs_plugin_messages.h:188
static const unsigned int WIRE_CARGO_TYPE_SIZE
The on-the-wire size of the cargo type field.
Definition: gcs_plugin_messages.h:92
static void decode_payload_item_int8(const unsigned char **buffer, uint16 *type, uint64 *value)
Decodes the given payload item (type, length and value) from the buffer as a 8 bytes integer.
Definition: gcs_plugin_messages.cc:441
void decode_header(const unsigned char **slider)
Decodes the header of the buffer into this instance.
Definition: gcs_plugin_messages.cc:105
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
uint64_t uint64
Definition: my_inttypes.h:69
uint16_t uint16
Definition: my_inttypes.h:65
uint32_t uint32
Definition: my_inttypes.h:67
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
ValueType value(const std::optional< ValueType > &v)
Definition: gtid.h:83
std::unique_ptr< mysql::utils::Error > Error_ptr
Definition: error.h:41
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:192
required string type
Definition: replication_group_member_actions.proto:34