IMessage

Detailed Description

class IMessage : public RED::IREDObject

This interface gives access to REDnet message content.

@related class RNET::System

A message contains information sent between peers. It is made of a header followed by optional data.

Users can check the type of a message by calling RNET::MESSAGE_TYPE on it.

Public Functions

SET_CID(CID_class_RNETIMessage)
virtual RNET::MessageType GetType() const = 0
Returns:the type of the message.
virtual int GetSourceID() const = 0
Returns:the ID (Peer’s ID) of the source of the message.
virtual void GetData(char *&oBuffer, int &oSize) const = 0

Gets the message data.

The message data doesn’t include the header and can be NULL.

Message can encode received data, dispatcher or peer requests or network error. Use RNET::IMessage::Type to know what the message category is.

Parameters:
  • oBuffer – returned pointer to the message data.
  • oSize – size of the data pointed by oBuffer in bytes.
virtual int Size() const = 0
Returns:the size of the message (including the header) in bytes.