24#ifndef GCS_GCS_MESSAGE_INCLUDED
25#define GCS_GCS_MESSAGE_INCLUDED
36#define WIRE_PAYLOAD_LEN_SIZE 8
37#define WIRE_HEADER_LEN_SIZE 4
60 const uint64_t payload_capacity);
This represents the unique identification of a group.
Definition: gcs_group_identifier.h:35
It represents the identity of a group member within a certain group.
Definition: gcs_member_identifier.h:40
This class serves as data container for information flowing in the GCS ecosystem.
Definition: gcs_message.h:48
bool report_allocate_memory(size_t size)
On memory allocation this function is called, so that memory consumption can be tracked.
Definition: gcs_message.cc:97
uint64_t m_buffer_len
Definition: gcs_message.h:257
bool decode(const uchar *data, uint64_t data_len)
Decodes data received via GCS and that belongs to a message.
Definition: gcs_message.cc:266
uchar * m_payload
Definition: gcs_message.h:230
bool append_to_payload(const uchar *to_append, uint64_t to_append_len)
Appends data to the payload of the message.
Definition: gcs_message.cc:160
uint64_t m_payload_capacity
Definition: gcs_message.h:245
void report_deallocate_memory(size_t size)
On memory free this function is called to reduce count of allocated memory.
Definition: gcs_message.cc:108
virtual ~Gcs_message_data()
Definition: gcs_message.cc:90
uint32_t get_header_length() const
Definition: gcs_message.cc:117
Gcs_message_data & operator=(Gcs_message_data const &)
virtual uint64_t get_encode_size() const
Definition: gcs_message.cc:123
uint64_t get_encode_payload_size() const
Definition: gcs_message.cc:127
const uchar * get_header() const
Definition: gcs_message.cc:115
bool m_owner
Definition: gcs_message.h:263
bool encode(uchar **buffer, uint64_t *buffer_len) const
Encodes the header and payload into an internal buffer.
Definition: gcs_message.cc:181
uchar * m_payload_slider
Definition: gcs_message.h:235
const uchar * get_payload() const
Definition: gcs_message.cc:119
Gcs_message_data()
Gcs_message_data implementation.
Definition: gcs_message.cc:39
bool append_to_header(const uchar *to_append, uint32_t to_append_len)
Appends data to the header of the message.
Definition: gcs_message.cc:141
uchar * m_header_slider
Definition: gcs_message.h:215
uchar * m_header
Definition: gcs_message.h:210
uchar * m_buffer
Definition: gcs_message.h:251
uint32_t m_header_capacity
Definition: gcs_message.h:225
void release_ownership()
Release the buffer's ownership which means that this object will not be responsible for deallocating ...
Definition: gcs_message.cc:179
uint64_t get_payload_length() const
Definition: gcs_message.cc:121
Gcs_message_data(Gcs_message_data const &)
uint64_t get_encode_header_size() const
Definition: gcs_message.cc:135
uint64_t m_payload_len
Definition: gcs_message.h:240
uint32_t m_header_len
Definition: gcs_message.h:220
Class that represents the data that is exchanged within a group.
Definition: gcs_message.h:357
const Gcs_member_identifier & get_origin() const
Definition: gcs_message.cc:342
Gcs_message(Gcs_message const &)
Gcs_message & operator=(Gcs_message const &)
virtual ~Gcs_message()
Definition: gcs_message.cc:336
const Gcs_group_identifier * get_destination() const
Definition: gcs_message.cc:347
Gcs_member_identifier * m_origin
Definition: gcs_message.h:413
Gcs_message_data & get_message_data() const
Definition: gcs_message.cc:352
Gcs_group_identifier * m_destination
Definition: gcs_message.h:414
Gcs_message_data * m_data
Definition: gcs_message.h:415
void init(const Gcs_member_identifier *origin, const Gcs_group_identifier *destination, Gcs_message_data *message_data)
Definition: gcs_message.cc:354
Gcs_message(const Gcs_member_identifier &origin, const Gcs_group_identifier &destination, Gcs_message_data *message_data)
Gcs_message 1st constructor.
Definition: gcs_message.cc:323
unsigned char uchar
Definition: my_inttypes.h:52
size_t size(const char *const c)
Definition: base64.h:46
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418