ROBinHeader

Overview

The ROBinHeader class represents headers of Binary messages.

The headers of binary messages hold information about the message version, the message type and message ID as well as information on whether is it compressed.

The headers have the following format:

Bytes 0-3: Basic RO signature, currently "RO10" Byte 4: Subversion, currently 7 Byte 5: Compression (01 - compressed or 00 - not compressed) Byte 6: MessageType Bytes 7-9: Reserved for future use Bytes 10-11 User data (Word) Bytes 12-27 Message ID (GUID) == 28 Bytes total

Sample of the ROBinHeader data:

52 4F 31 30 37 00 01 00 00 00 00 00 18 81 48 0F 0D BE 46 0D 9A F7 5A 65 83 29 7A 88

As you can see above, this is the usual binary message "RO107", which is not compressed and whose message type is Exception Message.

In most cases there is no need to work with this class directly, unless you want to change the message header format, in which case you need to assure that other participants of the communication process can read it properly.

Location

 

clientID  retain

GUID value that represents the ID of the client who owns that message. Taken the from ROMessage.ClientID property.

@property (retain) ROGuid *clientID

compressed  assign

Shows if the message is compressed or not. See the ROBinMessage.useCompression property for more details.

@property (assign) BOOL compressed

init

Initializes a new message header with the proper binary signature.

- (id) init

initWithNewClientID

Initializes a new message header with the proper binary signature and a new ClientID.

- (id) initWithNewClientID

length

This read-only property returns the length of the header (always 28).

@property (readonly) int length

messageType  assign

Represents the message type, which can be one of the following: * Message * Exception * Event * Poll * Poll Response * Query Service Info

@property (assign) enum ROMessageType messageType

readFromNSData:

Initializes a new message header from the given bytes buffer.

- (int) readFromNSData:(NSData *)aData

Parameters:

  • aData: Bytes buffer from which the message header should be read

writeToNSData:

Writes the message header content into the given bytes buffer.

- (void) writeToNSData:(NSMutableData *)aData

Parameters:

  • aData: Bytes buffer to which the header data should be written. It should already be initialized.

 

clientID  retain

GUID value that represents the ID of the client who owns that message. Taken the from ROMessage.ClientID property.

@property (retain) ROGuid *clientID

compressed  assign

Shows if the message is compressed or not. See the ROBinMessage.useCompression property for more details.

@property (assign) BOOL compressed

length

This read-only property returns the length of the header (always 28).

@property (readonly) int length

messageType  assign

Represents the message type, which can be one of the following: * Message * Exception * Event * Poll * Poll Response * Query Service Info

@property (assign) enum ROMessageType messageType

 

init

Initializes a new message header with the proper binary signature.

- (id) init

initWithNewClientID

Initializes a new message header with the proper binary signature and a new ClientID.

- (id) initWithNewClientID

readFromNSData:

Initializes a new message header from the given bytes buffer.

- (int) readFromNSData:(NSData *)aData

Parameters:

  • aData: Bytes buffer from which the message header should be read

writeToNSData:

Writes the message header content into the given bytes buffer.

- (void) writeToNSData:(NSMutableData *)aData

Parameters:

  • aData: Bytes buffer to which the header data should be written. It should already be initialized.