|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindtree.techworks.insight.remoteprotocol.spi.PacketHeader
public class PacketHeader
This is the common Header for all DataPackets. The format of the Packet Header is as follows
0 8 16 24 32 | . . . . . . . | . . . . . . . | . . . . . . . | . . . . . . . | +---------------+---------------+-------------------------------+ | IDENTIFIER | VERSION | PHL | MESSAGE TYPE | +---------------+---------------+-------------------------------+ | FLAGS | 0xFF | HEADER CHECKSUM | +-------------------------------+-------------------------------+ | SOURCE IDENTIFIER | MESSAGE SEQUENCE | +-------------------------------+-------------------------------+ | DATA LENGTH | +---------------------------------------------------------------+ | DATA AND PADDING (Multiples of 8 bits) | < < > > | | +---------------------------------------------------------------+ | . . . . . . . | . . . . . . . | . . . . . . . | . . . . . . . | 0 8 16 24 32 IDENTIFIER: A constant (01001001 / 0x49) identifying that the packet is an Insight packet. (The number is the ASCII for 'I') VERSION: The version of the packet. Currently 0x01 PHL: Packet Header Length. Basically identifies the start of the data content MESSAGE TYPE: The identifier for the message. Currently the following will be used: 0x01 Startup The content in the Data field will contain the format specified. 0x02 Log Data The content will be data from the log event. 0x03 Shutdown The content will be empty. FLAGS: Currently Unused HEADER CHECKSUM: The checksum of the header with the checksum fields set to 0xFF. SOURCE IDENTIFIER: This will uniquely identify a source for a message. This field will be generated by the source (sender) and Insight will cache it on receipt of the first message from the source. All messages from the same source will be associated. MESSAGE SEQUENCE: The sequence number of the message. Ideally the Startup message will have the sequence number 0x00, and it will roll over after 0xFF. DATA LENGTH: Number of bytes in the data part.
For details on the different supported message types, see the static fields
in the
MessageType
class.
The format of the data content for the different message types are:
StartupMessageDataContent
DataPacket
,
Serialized FormField Summary | |
---|---|
static byte |
INSIGHT_PACKET_IDENTIFIER
The identifier for an Insight Packet. |
static byte |
PACKET_HEADER_LENGTH
The packet header length for this version. |
Constructor Summary | |
---|---|
PacketHeader()
Creates an instance of the packet header |
|
PacketHeader(byte[] packetData)
Creates an instance of the header from the byte array passed in. |
Method Summary | |
---|---|
int |
getDataLength()
Returns the dataLength |
byte |
getFlags()
Returns the flags |
short |
getHeaderChecksum()
Returns the headerChecksum |
short |
getMessageSequence()
Returns the messageSequence |
MessageType |
getMessageType()
Returns the messageType |
byte[] |
getPacketHeaderAsByteArray()
Gets the packet Header as a byte array |
byte |
getPacketHeaderLength()
Returns the packetHeaderLength |
short |
getSourceIdentifier()
Returns the sourceIdentifier |
byte |
getVersion()
Returns the version |
void |
recalculateHeader(PacketDataContent content)
Recalculates the Header for this packet using the PacketDataContent field passed in. |
void |
setDataLength(int dataLength)
Sets the dataLength |
void |
setFlags(byte flags)
Sets the flags |
void |
setMessageSequence(short messageSequence)
Sets the messageSequence |
void |
setMessageType(MessageType messageType)
Sets the messageType |
void |
setSourceIdentifier(short sourceIdentifier)
Sets the sourceIdentifier |
void |
setVersion(byte version)
Sets the version |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte INSIGHT_PACKET_IDENTIFIER
I
public static final byte PACKET_HEADER_LENGTH
Constructor Detail |
---|
public PacketHeader()
public PacketHeader(byte[] packetData) throws RemoteProtocolException
packetData
- The byte array representing the header
RemoteProtocolException
- If the header is not well formatted.Method Detail |
---|
public int getDataLength()
public void setDataLength(int dataLength)
dataLength
- The dataLength to set.public byte getFlags()
public void setFlags(byte flags)
flags
- The flags to set.public short getMessageSequence()
public void setMessageSequence(short messageSequence)
messageSequence
- The messageSequence to set.public MessageType getMessageType()
public void setMessageType(MessageType messageType)
messageType
- The messageType to set.public short getSourceIdentifier()
public void setSourceIdentifier(short sourceIdentifier)
sourceIdentifier
- The sourceIdentifier to set.public byte getVersion()
public void setVersion(byte version)
version
- The version to set.public short getHeaderChecksum()
public byte getPacketHeaderLength()
public byte[] getPacketHeaderAsByteArray()
byte
array containing the data from the header.public void recalculateHeader(PacketDataContent content)
DATA LENGTH
field. However changing
this field changes the HEADER CHECKSUM
, hence this method
changes the checksum too. In later versions of the
DataPacket
if variable length headers are allowed, then
the PHL
field would also be set in this method.
content
- The data content accompanying this packet header
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |