Sunday, June 5, 2005

CORBA header

The CORBA messages are carried over TCP. Inside, each message consist of message header and message data.

The structure of message header is :

char[4] magic;
octet[2] GIOP_version;
octet flags;
octet message_type;
unsigned long message_size;

First 4 octets contain "GIOP", then followed with 2 octets of GIOP version (high byte is for Major version, low byte is for minor version).

flags (in GIOP 1.1, 1.2, and 1.3) is an 8-bit octet. The least significant bit indicates the byte ordering used in subsequent elements of the message (including message_size). A value of FALSE (0) indicates big-endian byte ordering, and TRUE (1) indicates little-endian byte ordering. The byte order for fragment messages must match the byte order of the initial message that the fragment extends.

The second least significant bit indicates whether or not more framents follow. A value of FALSE (0) indicates this message is the last fragment, and TRUE (1) indicates more fragments follow this message. The most significant 6 bits are reserved. These 6 bits must have value 0 for GIOP version 1.1, 1.2, and 1.3.

message_type indicates the type of the message; these correspond to enum values of type MsgType.

message_size contains the number of octets in the message following the message header, encoded using the byte order specified in the byte order bit (the least significant bit) in the flags field (or using the byte_order field in GIOP 1.0). It refers to the size of the message body, not including the 12-byte message header. This count includes any alignment gaps and must match the size of the actual request parameters (plus any final padding bytes that may follow the parameters to have a fragment message terminate on an 8-byte boundary).


MsgType definition:

enum MsgType_1_1 {
Request,
Reply,
CancelRequest,
LocateRequest,
LocateReply,
CloseConnection,
MessageError,
Fragment // GIOP 1.1 addition
};

So, message_type may containt 0 for "Request", octet 1 (00000001) for Reply an so on.

No comments:

Post a Comment