23#ifndef GCS_GCS_MESSAGE_INCLUDED
24#define GCS_GCS_MESSAGE_INCLUDED
35#define WIRE_PAYLOAD_LEN_SIZE 8
36#define WIRE_HEADER_LEN_SIZE 4
59 const uint64_t payload_capacity);
This represents the unique identification of a group.
Definition: gcs_group_identifier.h:34
It represents the identity of a group member within a certain group.
Definition: gcs_member_identifier.h:39
This class serves as data container for information flowing in the GCS ecosystem.
Definition: gcs_message.h:47
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:96
uint64_t m_buffer_len
Definition: gcs_message.h:256
bool decode(const uchar *data, uint64_t data_len)
Decodes data received via GCS and that belongs to a message.
Definition: gcs_message.cc:267
uchar * m_payload
Definition: gcs_message.h:229
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:161
uint64_t m_payload_capacity
Definition: gcs_message.h:244
void report_deallocate_memory(size_t size)
On memory free this function is called to reduce count of allocated memory.
Definition: gcs_message.cc:109
virtual ~Gcs_message_data()
Definition: gcs_message.cc:89
uint32_t get_header_length() const
Definition: gcs_message.cc:118
Gcs_message_data & operator=(Gcs_message_data const &)
virtual uint64_t get_encode_size() const
Definition: gcs_message.cc:124
uint64_t get_encode_payload_size() const
Definition: gcs_message.cc:128
const uchar * get_header() const
Definition: gcs_message.cc:116
bool m_owner
Definition: gcs_message.h:262
bool encode(uchar **buffer, uint64_t *buffer_len) const
Encodes the header and payload into an internal buffer.
Definition: gcs_message.cc:182
uchar * m_payload_slider
Definition: gcs_message.h:234
const uchar * get_payload() const
Definition: gcs_message.cc:120
Gcs_message_data()
Gcs_message_data implementation.
Definition: gcs_message.cc:38
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:142
uchar * m_header_slider
Definition: gcs_message.h:214
uchar * m_header
Definition: gcs_message.h:209
uchar * m_buffer
Definition: gcs_message.h:250
uint32_t m_header_capacity
Definition: gcs_message.h:224
void release_ownership()
Release the buffer's ownership which means that this object will not be responsible for deallocating ...
Definition: gcs_message.cc:180
uint64_t get_payload_length() const
Definition: gcs_message.cc:122
Gcs_message_data(Gcs_message_data const &)
uint64_t get_encode_header_size() const
Definition: gcs_message.cc:136
uint64_t m_payload_len
Definition: gcs_message.h:239
uint32_t m_header_len
Definition: gcs_message.h:219
Class that represents the data that is exchanged within a group.
Definition: gcs_message.h:356
const Gcs_member_identifier & get_origin() const
Definition: gcs_message.cc:343
Gcs_message(Gcs_message const &)
Gcs_message & operator=(Gcs_message const &)
virtual ~Gcs_message()
Definition: gcs_message.cc:337
const Gcs_group_identifier * get_destination() const
Definition: gcs_message.cc:348
Gcs_member_identifier * m_origin
Definition: gcs_message.h:412
Gcs_message_data & get_message_data() const
Definition: gcs_message.cc:353
Gcs_group_identifier * m_destination
Definition: gcs_message.h:413
Gcs_message_data * m_data
Definition: gcs_message.h:414
void init(const Gcs_member_identifier *origin, const Gcs_group_identifier *destination, Gcs_message_data *message_data)
Definition: gcs_message.cc:355
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:324
unsigned char uchar
Definition: my_inttypes.h:51
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:419