MySQL 26.7.0
Source Code Documentation
gcs_plugin_messages.h
Go to the documentation of this file.
1/* Copyright (c) 2014, 2026, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef GCS_PLUGIN_MESSAGES_INCLUDED
25#define GCS_PLUGIN_MESSAGES_INCLUDED
26
27/*
28 Since this file is used on unit tests, through member_info.h,
29 includes must set here and not through plugin_server_include.h.
30*/
31#include <string>
32#include <vector>
33
34#include "my_inttypes.h"
35#include "mysql/utils/error.h"
36
37/**
38 This is the base GCS plugin message.
39 It is composed by a fixed header and 1 or more payload items.
40
41 The on-the-wire layout looks like this:
42
43 +-----------------------------------+
44 | fixed header | payload |
45 +-----------------------------------+
46
47 The on-the-wire representation of the message is:
48
49 +-------------------+-----------+--------------------------------------+
50 | field | wire size | description |
51 +===================+===========+======================================+
52 | version | 4 bytes | protocol version |
53 | fixed_hdr_len | 2 bytes | length of the fixed header |
54 | message_len | 8 bytes | length of the message |
55 | cargo_type | 2 bytes | the cargo type in the payload |
56 +-------------------+-----------+--------------------------------------+
57 | payload_item_type | 2 bytes | the item type in the payload |
58 | payload_item_len | 8 bytes | length of the payload item |
59 | payload_item | X bytes | payload item |
60 +-------------------+-----------+--------------------------------------+
61
62 The last tree lines can occur one or more times.
63*/
64
66 public:
68
69 /**
70 The protocol version number.
71 */
73
74 /**
75 The protocol version number.
76 */
77 static const unsigned int WIRE_VERSION_SIZE;
78
79 /**
80 The on-the-wire size of the header length field.
81 */
82 static const unsigned int WIRE_HD_LEN_SIZE;
83
84 /**
85 The on-the-wire size of the message size field.
86 */
87 static const unsigned int WIRE_MSG_LEN_SIZE;
88
89 /**
90 The on-the-wire size of the cargo type field.
91 */
92 static const unsigned int WIRE_CARGO_TYPE_SIZE;
93
94 /**
95 The on-the-wire size of the fixed header.
96 */
97 static const unsigned int WIRE_FIXED_HEADER_SIZE;
98
99 /**
100 The on-the-wire size of the each payload item type field.
101 */
102 static const unsigned int WIRE_PAYLOAD_ITEM_TYPE_SIZE;
103
104 /**
105 The on-the-wire size of the each payload item size field.
106 */
107 static const unsigned int WIRE_PAYLOAD_ITEM_LEN_SIZE;
108
109 /**
110 The on-the-wire size of the payload item header.
111 */
112 static const unsigned int WIRE_PAYLOAD_ITEM_HEADER_SIZE;
113
114 /**
115 The different cargo type codes.
116
117 NOTE: all type values must fit into WIRE_CARGO_TYPE_SIZE bytes storage.
118 */
120 // This type should not be used anywhere.
122
123 // This cargo type is used for certification events, GTID_EXECUTED
124 // broadcast.
126
127 // This cargo type is used for transaction data.
129
130 // This cargo type is used for recovery events, signal when a given member
131 // becomes online.
133
134 // This cargo type is used for messaging related to stage exchanges,
135 // on which it represents one member.
137
138 // This cargo type is used for messaging related to stage exchanges,
139 // on which it represents a set of members.
141
142 // This cargo type is used for messaging related to members pipeline
143 // stats.
145
146 // This cargo type is used for messaging related to single primary
147 // mode.
149
150 // This cargo type is used for messaging related to group coordinated
151 // actions.
153
154 // This cargo type is used for messaging when checking if a group is valid
155 // for some task
157
158 // This cargo type is used for synchronization before executing a
159 // transaction.
161
162 // This cargo type is used for transaction data with guarantee.
164
165 // This cargo type is used to inform about prepared transactions.
167
168 // This cargo type is used for messages that are for
169 // senders/consumers outside the GR plugin.
171
172 // This cargo type is used for GR Recovery Metadata
174
175 // No valid type codes can appear after this one.
176 CT_MAX = 15
177 };
178
179 private:
180 /**
181 This header instance protocol version.
182 */
184
185 /**
186 This header instance length.
187 */
188 unsigned short m_fixed_header_len;
189
190 /**
191 This is the message length field.
192 */
193 unsigned long long m_msg_len;
194
195 /**
196 The cargo type code.
197 */
199
200 /**
201 Holds information about error that might occur during encoding/decoding
202 */
204
205 public:
206 virtual ~Plugin_gcs_message() = default;
207
208 /**
209 Copy constructor.
210
211 Note that @c m_error is transient state and is intentionally not copied.
212
213 @param[in] other the source object to copy from
214 */
216
217 /**
218 Copy-assignment operator.
219
220 Note that @c m_error is transient state and is intentionally not copied.
221
222 @param[in] other the source object to copy from
223 @return a reference to this object
224 */
226
227 /**
228 @return true if this object already has an error recorded.
229 */
230 bool has_error() const;
231
232 /**
233 @return the decoding error, if any.
234 */
235 const Error_ptr &get_error() const;
236
237 /**
238 @return the value of the version field.
239 */
240 int get_version() { return m_version; }
241
242 /**
243 @return the value of the header length field value.
244 */
245 unsigned short get_header_length() { return m_fixed_header_len; }
246
247 /**
248 @return the cargo type.
249 */
251
252 /**
253 @return the message length field value.
254 */
255 unsigned long long get_msg_length() { return m_msg_len; }
256
257 /**
258 Encodes the contents of this instance into the buffer.
259
260 @param[out] buffer the buffer to encode to.
261 */
262 void encode(std::vector<unsigned char> *buffer) const;
263
264 /**
265 Decodes the contents of the buffer and sets the field values
266 according to the values decoded.
267
268 Note that if this object is already in an error state
269 (that is, @c has_error() returns true), the error state is reset
270 before decoding starts.
271
272 @param[in] buffer the buffer to decode from.
273 @param[in] length the length of the buffer.
274 */
275 void decode(const unsigned char *buffer, size_t length);
276
277 /**
278 Return the cargo type of a given message buffer, without decode
279 the complete message.
280
281 @param[in] buffer the buffer to decode from.
282 @param[in] length the length of the buffer.
283 @param[out] cargo_type the decoded cargo type.
284
285 @return the operation status
286 @retval false OK
287 @retval true Error
288 */
289 static bool get_cargo_type(const unsigned char *buffer, size_t length,
290 enum_cargo_type *cargo_type);
291
292 /**
293 Return the raw data of the first payload item of a given message buffer,
294 without decode the complete message.
295
296 @param[in] buffer the buffer to decode from.
297 @param[in] length the length of the buffer.
298 @param[out] payload_item_data the data.
299 @param[out] payload_item_length the length of the data.
300
301 @return the operation status
302 @retval false OK
303 @retval true Error
304 */
306 const unsigned char *buffer, size_t length,
307 const unsigned char **payload_item_data, size_t *payload_item_length);
308
309 /**
310 Return the raw data of the payload item of a given payload type of a given
311 message buffer.
312
313 @param[in] buffer the buffer to decode from.
314 @param[in] end the end of buffer from which it decode.
315 @param[in] payload_item_type the payload type to be searched.
316 @param[out] payload_item_data the data for the given payload type.
317 @param[out] payload_item_length the length of the data for the given
318 payload type.
319
320 @return the operation status
321 @retval false OK
322 @retval true Error
323 */
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);
328
329 protected:
330 /**
331 Plugin_gcs_message constructor. Only to be called by derivative classes
332
333 @param[in] cargo_type Message type to be sent
334 */
335 explicit Plugin_gcs_message(enum_cargo_type cargo_type);
336
337 /**
338 Return the time at which the message contained in the buffer was sent.
339 @see Metrics_handler::get_current_time()
340
341 @note The method
342 static uint64_t get_sent_timestamp(const unsigned char *buffer,
343 size_t length);
344 must be implemented on all children classes in order to allow read
345 the sent timestamp without requiring a object creation and complete
346 message deserialization.
347
348 @param[in] buffer the buffer to decode from.
349 @param[in] length the buffer length
350 @param[in] timestamp_payload_item_type the payload item type of the
351 timestamp.
352
353 @return the time on which the message was sent.
354 */
355 static int64_t get_sent_timestamp(const unsigned char *buffer, size_t length,
356 const uint16 timestamp_payload_item_type);
357
358 /**
359 Encodes the header of this instance into the buffer.
360
361 @param[out] buffer the buffer to encode to.
362 */
363 void encode_header(std::vector<unsigned char> *buffer) const;
364
365 /**
366 Decodes the header of the buffer into this instance.
367
368 @param[out] slider before call `decode_header`: the start of the buffer
369 after call `decode_header`: the position on which the
370 header ends on the buffer.
371 */
372 void decode_header(const unsigned char **slider);
373
374 /**
375 Encodes the contents of this instance payload into the buffer.
376
377 @param[out] buffer the buffer to encode to.
378 */
379 virtual void encode_payload(std::vector<unsigned char> *buffer) const = 0;
380
381 /**
382 Decodes the contents of the buffer and sets the payload field
383 values according to the values decoded.
384
385 @param[in] buffer the buffer to decode from.
386 @param[in] end the end of the buffer.
387 */
388 virtual void decode_payload(const unsigned char *buffer,
389 const unsigned char *end) = 0;
390
391 /**
392 Stores a decode error if one has not already been recorded.
393
394 Note that if this object already has an error (@c has_error() returns true),
395 this member function retains the existing error value and does not set a
396 new one.
397
398 @param[in] type the logical message type reporting the decode error
399 @param[in] file the source file where the error was detected
400 @param[in] line the source line where the error was detected
401 @param[in] message the decode error description
402 */
403 void set_error(const char *type, const char *file, size_t line,
404 const char *message);
405
406 /**
407 Encodes the given payload item type and length into the buffer.
408
409 @param[out] buffer the buffer to encode to
410 @param[in] payload_item_type the type of the payload item
411 @param[in] payload_item_length the length of the payload item
412 */
414 std::vector<unsigned char> *buffer, uint16 payload_item_type,
415 unsigned long long payload_item_length) const;
416
417 /**
418 Decodes the given payload item type and length from the buffer.
419
420 @param[in] buffer the buffer to encode from
421 @param[out] payload_item_type the type of the payload item
422 @param[out] payload_item_length the length of the payload item
423 */
425 const unsigned char **buffer, uint16 *payload_item_type,
426 unsigned long long *payload_item_length);
427
428 /**
429 Encodes the given payload item (type, length and value) into the buffer as
430 a char (1 byte).
431
432 @param[out] buffer the buffer to encode to
433 @param[in] type the type of the payload item
434 @param[in] value the value of the payload item
435 */
436 void encode_payload_item_char(std::vector<unsigned char> *buffer, uint16 type,
437 unsigned char value) const;
438
439 /**
440 Decodes the given payload item (type, length and value) from the buffer as
441 a char (1 byte).
442
443 @param[in] buffer the buffer to encode from
444 @param[out] type the type of the payload item
445 @param[out] value the value of the payload item
446 */
447 static void decode_payload_item_char(const unsigned char **buffer,
448 uint16 *type, unsigned char *value);
449
450 /**
451 Decodes the given payload item (type, length and value) from the buffer as
452 a char (1 byte) while validating the bounds.
453
454 @param[in] buffer the buffer to encode from
455 @param[in] end the end of the buffer
456 @param[out] type the type of the payload item
457 @param[out] value the value of the payload item
458
459 @return the operation status
460 @retval false OK
461 @retval true Error
462 */
463 static bool decode_payload_item_char(const unsigned char **buffer,
464 uint16 *type, const unsigned char *end,
465 unsigned char *value);
466
467 /**
468 Encodes the given payload item (type, length and value) into the buffer as
469 a 2 bytes integer.
470
471 @param[out] buffer the buffer to encode to
472 @param[in] type the type of the payload item
473 @param[in] value the value of the payload item
474 */
475 void encode_payload_item_int2(std::vector<unsigned char> *buffer, uint16 type,
476 uint16 value) const;
477
478 /**
479 Decodes the given payload item (type, length and value) from the buffer as
480 a 2 bytes integer.
481
482 @param[in] buffer the buffer to encode from
483 @param[out] type the type of the payload item
484 @param[out] value the value of the payload item
485 */
486 void decode_payload_item_int2(const unsigned char **buffer, uint16 *type,
487 uint16 *value);
488
489 /**
490 Decodes the given payload item (type, length and value) from the buffer as
491 a 2 bytes integer while validating the bounds.
492
493 @param[in] buffer the buffer to encode from
494 @param[in] end the end of the buffer
495 @param[out] type the type of the payload item
496 @param[out] value the value of the payload item
497
498 @return the operation status
499 @retval false OK
500 @retval true Error
501 */
502 bool decode_payload_item_int2(const unsigned char **buffer, uint16 *type,
503 const unsigned char *end, uint16 *value);
504
505 /**
506 Encodes the given payload item (type, length and value) into the buffer as
507 a 4 bytes integer.
508
509 @param[out] buffer the buffer to encode to
510 @param[in] type the type of the payload item
511 @param[in] value the value of the payload item
512 */
513 void encode_payload_item_int4(std::vector<unsigned char> *buffer, uint16 type,
514 uint32 value) const;
515
516 /**
517 Decodes the given payload item (type, length and value) from the buffer as
518 a 4 bytes integer.
519
520 @param[in] buffer the buffer to encode from
521 @param[out] type the type of the payload item
522 @param[out] value the value of the payload item
523 */
524 void decode_payload_item_int4(const unsigned char **buffer, uint16 *type,
525 uint32 *value);
526
527 /**
528 Decodes the given payload item (type, length and value) from the buffer as
529 a 4 bytes integer while validating the bounds.
530
531 @param[in] buffer the buffer to encode from
532 @param[in] end the end of the buffer
533 @param[out] type the type of the payload item
534 @param[out] value the value of the payload item
535
536 @return the operation status
537 @retval false OK
538 @retval true Error
539 */
540 bool decode_payload_item_int4(const unsigned char **buffer, uint16 *type,
541 const unsigned char *end, uint32 *value);
542
543 /**
544 Encodes the given payload item (type, length and value) into the buffer as
545 a 8 bytes integer.
546
547 @param[out] buffer the buffer to encode to
548 @param[in] type the type of the payload item
549 @param[in] value the value of the payload item
550 */
551 void encode_payload_item_int8(std::vector<unsigned char> *buffer, uint16 type,
552 ulonglong value) const;
553
554 /**
555 Decodes the given payload item (type, length and value) from the buffer as
556 a 8 bytes integer.
557
558 @param[in] buffer the buffer to encode from
559 @param[out] type the type of the payload item
560 @param[out] value the value of the payload item
561 */
562 static void decode_payload_item_int8(const unsigned char **buffer,
564
565 /**
566 Decodes the given payload item (type, length and value) from the buffer as
567 a 8 bytes integer while validating the bounds.
568
569 @param[in] buffer the buffer to encode from
570 @param[in] end the end of the buffer
571 @param[out] type the type of the payload item
572 @param[out] value the value of the payload item
573
574 @return the operation status
575 @retval false OK
576 @retval true Error
577 */
578 static bool decode_payload_item_int8(const unsigned char **buffer,
579 uint16 *type, const unsigned char *end,
580 uint64 *value);
581
582 /**
583 Encodes the given payload item (type, length and value) into the buffer as
584 a char array (variable size).
585
586 @param[out] buffer the buffer to encode to
587 @param[in] type the type of the payload item
588 @param[in] value the value of the payload item
589 @param[in] length the length of the payload item
590 */
591 void encode_payload_item_string(std::vector<unsigned char> *buffer,
592 uint16 type, const char *value,
593 unsigned long long length) const;
594
595 /**
596 Decodes the given payload item (type, length and value) from the buffer as
597 a char array (variable size).
598
599 @param[in] buffer the buffer to encode from
600 @param[in] end the end of the buffer
601 @param[out] type the type of the payload item
602 @param[out] value the value of the payload item
603 @param[out] length the length of the payload item
604 */
605 bool decode_payload_item_string(const unsigned char **buffer, uint16 *type,
606 const unsigned char *end, std::string *value,
607 unsigned long long *length);
608
609 /**
610 Encodes the given payload item (type, length and value) into the buffer as
611 a byte buffer (variable size).
612
613 @param[out] buffer the buffer to encode to
614 @param[in] type the type of the payload item
615 @param[in] value the value of the payload item
616 @param[in] length the length of the payload item
617 */
618 void encode_payload_item_bytes(std::vector<unsigned char> *buffer,
619 uint16 type, const unsigned char *value,
620 unsigned long long length) const;
621
622 /**
623 Decodes the given payload item (type, length and value) from the buffer as
624 a byte buffer (variable size).
625
626 @param[in] buffer the buffer to encode from
627 @param[in] end the end of the buffer
628 @param[out] type the type of the payload item
629 @param[out] value the value of the payload item
630 @param[out] length the length of the payload item
631 */
632 bool decode_payload_item_bytes(const unsigned char **buffer, uint16 *type,
633 const unsigned char *end, unsigned char *value,
634 unsigned long long *length);
635};
636
637#endif /* GCS_PLUGIN_MESSAGES_INCLUDED */
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
Experimental API header.
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
Definition: os0file.h:89
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