Class that represents the data that is exchanged within a group.
It is sent by a member having the group as destination. It shall be received by all members that pertain to the group in that moment.
It is built using two major blocks: the header and the payload of the message. A user of Gcs_message can freely add data to the header and to the payload.
Each binding implementation might use these two fields at its own discretion but that data should be removed from the header/payload before its delivery to the client layer.
When the message is built, none of the data is passed unto it. One has to use the append_* methods in order to append data. Calling encode() at the end will provide a ready-to-send message.
On the receiver side, one shall use decode() in order to have the header and the payload restored in the original message fields.
A typical use case of sending a message is:
gcs_ctrl_interface_instance->get_local_information();
strlen(some_data));
This interface represents all the communication facilities that a binding implementation should provi...
Definition: gcs_communication_interface.h:90
virtual enum_gcs_error send_message(const Gcs_message &message_to_send)=0
Method used to broadcast a message to a group in which this interface pertains.
This interface represents all the control functionalities that a binding implementation must provide.
Definition: gcs_control_interface.h:111
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 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
Class that represents the data that is exchanged within a group.
Definition: gcs_message.h:357
Gcs_message_data & get_message_data() const
Definition: gcs_message.cc:352
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
A typical use case of receiving a message is:
{
my_Gcs_communication_event_listener(my_Message_delegator *delegator)
{
this->delegator= delegator;
}
{
delegator->process_gcs_message(message);
}
private:
my_Message_delegator *delegator;
}
This interface is implemented by those who wish to receive messages.
Definition: gcs_communication_event_listener.h:36