|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--hypercast.OL_Message
This class implements the I_OverlayMessage interface and defines the messages exchanged between socket adapters of overlay sockets. It is used by applications to send data. It is also used to send overlay messages for monitoring and control objectives. This class is not used in exchanging protocol messages via node adapters. An overlay message has the following format: ---------------------------- ------------- | Overlay | Extension | ... | Extension | |message header| | | | ---------------------------- ------------- Here, the format of overlay message header is: (Overlay Message Length and LA Size are in units of bytes) ------------------------------------------------------------- |Version| DMode |Traffic Class| Flow Label | | 4 bits| 4 bits| 8 bits | 16 bits | ------------------------------------------------------------- | Overlay Message Length | Hop Limit | | 16 bits | 16 bits | -------------------------------------------------------------------- |Extension Type | LA Size | Source Logical Address / | 8 bits | 8 bits | variable / --------------------------------------------------------------------------- / Previous Hop Logical Address / Destination Logical Address / / variable length / (only if DMode is Unicast, variable) / --------------------------------------------------------------------------- Each extension has the following format: (in bytes) ---------------------------------------------------------------------- | Next Ext. Type | Extension Length | Extension Specific Information | | 8 bits | 16 bits | > 0 bytes | ---------------------------------------------------------------------- The extension types are defined in class Extension. @see Extension 1. There is only one extension with type Payload (RAW_DATA). It carries the application payload. It does not have to be the last extension. 2. In an overlay message, each extension, except the Payload extension, contains plain text information. (TODO: I'm not certain that this is true) 3. In general, there is no assumption on the order of extensions.
Field Summary | |
static byte |
DELIVERY_MODE_FLOOD
|
static byte |
DELIVERY_MODE_INVALID
|
static byte |
DELIVERY_MODE_MULTICAST
|
static byte |
DELIVERY_MODE_UNICAST
|
Fields inherited from interface hypercast.I_OverlayMessage |
DELDUPS, E2EACK, H2HACK, INCAST, INORDER, NAMING, NOSERVICE, SYNC |
Constructor Summary | |
OL_Message(hypercast.OL_Message orig_msg)
Create an OL_Message by cloning another OL_Message instance. |
|
OL_Message(short hopLimit,
hypercast.I_LogicalAddress sourceAddress)
Create an empty OL_Message with specified hopLimit and source logical address. |
|
OL_Message(short hopLimit,
hypercast.I_LogicalAddress sourceAddress,
hypercast.KeyVault kv)
Create an empty OL_Message with specified hopLimit, source logical address and key vault. |
Method Summary | |
void |
addExtension(hypercast.Extension extension)
Add a extension to the Overlay application message. |
short |
decrementHopLimit()
Decrements the hop limit by one and returns the decremented value. |
byte |
getDeliveryMode()
Returns the delivery mode of the message |
hypercast.I_LogicalAddress |
getDestinationAddress()
Gets the destination logical address in this message |
java.util.Vector |
getExtension()
Gets the extension store (vector) in this message |
hypercast.Extension |
getExtension(int index)
Gets the extension at specified position in the extension store (vector) of this message. |
hypercast.Extension |
getFirstExtensionByType(byte type)
Returns the first extension with specified extension type. |
byte |
getFlowLabel()
Accesses the flow label. |
short |
getHopLimit()
Returns the maximum number of hops that this message may take in the network. |
byte[] |
getMessageID()
Deprecated. use getMessageIdentifier |
byte[] |
getMessageIdentifier()
Returns the message identifier carried by this message. |
byte[] |
getPayload()
Returns the plaintext application payload. |
int |
getPayloadLength()
Returns the length of application payload. |
hypercast.I_LogicalAddress |
getPrevhopAddress()
Deprecated. name has changed from Prevhop Address to Previous Hop Address, use getPreviousHopAddress |
hypercast.I_LogicalAddress |
getPreviousHopAddress()
Gets the previous hop logical address in this message |
hypercast.I_LogicalAddress |
getRoutingAddress()
Deprecated. name has changed: Routing Address to Destination Address, use getDestinationAddress |
long |
getSequenceNumber()
Returns the sequence number carried by this message. |
short |
getServiceIdentifier()
Returns the service number carried by this message. |
short |
getServiceNumber()
Deprecated. use getServiceIdentifier |
int |
getSize()
|
hypercast.I_LogicalAddress |
getSourceAddress()
|
hypercast.I_LogicalAddress |
getSrcAddress()
Deprecated. name has changed from Src Address to Source Address, use getSourceAddress |
byte[] |
getStreamID()
Gets the stream ID of the message. |
int |
getStreamIdentifier()
Returns the stream identifier carried by this message. |
byte |
getTrafficClass()
Returns the traffice class of the message |
byte |
getVersion()
Returns the version of the message. |
static boolean |
isValidDeliveryMode(byte mode)
Validates the value of a delivery mode. |
static hypercast.OL_Message |
restoreMessage(byte[] recvbuff,
int[] validBytesStart,
int validBytesEnd,
hypercast.I_Node node,
hypercast.KeyVault kv)
Restore an OL_Message from an byte array. |
void |
setDeliveryMode(byte deliveryMode)
Sets the delivery mode in this message |
void |
setDestinationAddress(hypercast.I_LogicalAddress destinationAddress)
Sets the destination address in this message |
void |
setExtension(int index,
hypercast.Extension e)
Sets the extension at specified position in the extension store (vector) of this message. |
void |
setFirstExtensionByType(int type,
hypercast.Extension ee)
Sets the first extension with specified extension type. |
void |
setHopLimit(short hopLimit)
Sets the hop limit of this message. |
void |
setKeyVault(hypercast.KeyVault kv)
Sets key vault instance in this message. |
void |
setMsgIdentifier(int msgID)
Sets the message identifier in this message if the message is an enhanced service message. |
void |
setPayload(byte[] newPayload)
Sets the payload. |
void |
setPrevhopAddress(hypercast.I_LogicalAddress previousHopAddress)
Deprecated. name has changed from Prevhop Address to Previous Hop Address, use setPreviousHopAddress |
void |
setPreviousHopAddress(hypercast.I_LogicalAddress previousHopAddress)
Sets the previous hop address in this message |
void |
setRoutingAddress(hypercast.I_LogicalAddress destinationAddress)
Deprecated. name has changed: Routing Address to Destination Address, use setDestinationAddress |
void |
setSequenceNumber(long sequenceNum)
Sets the sequence number in this message if the message is an stream-oriented message. |
void |
setServiceIdentifier(short serviceID)
Sets the service number in the enhanced service message. |
void |
setSourceAddress(hypercast.I_LogicalAddress sourceAddress)
Sets the logical address in this message |
void |
setSrcAddress(hypercast.I_LogicalAddress rtaddress)
Deprecated. name has changed from Src Address to Source Address, use setSourceAddress |
void |
setStreamIdentifier(int streamID)
Sets the stream identifier in this message if the message is an enhanced service message. |
void |
setTrafficClass(byte trafficClass)
Sets the traffic class of the message. |
byte[] |
toByteArray()
Convert this message into a byte array. |
java.lang.String |
toString()
Converts the overaly message object to String representation. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final byte DELIVERY_MODE_INVALID
public static final byte DELIVERY_MODE_MULTICAST
public static final byte DELIVERY_MODE_FLOOD
public static final byte DELIVERY_MODE_UNICAST
Constructor Detail |
public OL_Message(short hopLimit, hypercast.I_LogicalAddress sourceAddress)
hopLimit
- Maximum number of hops that message will be allowed to have in networksourceAddress
- Logical address that will be used as the source of the messagepublic OL_Message(hypercast.OL_Message orig_msg)
public OL_Message(short hopLimit, hypercast.I_LogicalAddress sourceAddress, hypercast.KeyVault kv)
hopLimit
- Maximum number of hops that message will be allowed to have in networksourceAddress
- Logical address that will be used as the source of the messagekv
- an KeyVault instance for security computationMethod Detail |
public static hypercast.OL_Message restoreMessage(byte[] recvbuff, int[] validBytesStart, int validBytesEnd, hypercast.I_Node node, hypercast.KeyVault kv)
recvbuff
- the byte array buffervalidBytesStart
- start of valid section of the array,
this variable is essentially a pointer to an int, the caller of
this method expects that the value will be updated to reflect
the bytes of the buffer consumed by this method, i.e. on return
the value of this variable should be set to the next valid byte
after the message that has been restored.validBytesEnd
- end of valid section of the array (actually, 1 beyond last valid byte.)node
- an I_Node object which is used to get LogicalAddress sizekv
- an KeyVault instance for security computation
throw
- IllegalArgumentException for invalid version and deliveryModepublic byte[] toByteArray()
toByteArray
in interface I_Message
java.lang.IllegalStateException
- if souce address or destination address are nullpublic static boolean isValidDeliveryMode(byte mode)
public int getSize()
public short getHopLimit()
I_OverlayMessage
getHopLimit
in interface I_OverlayMessage
public short decrementHopLimit()
if (msg.decrementHopLimit() != 0)
. Do not
use greater than or less than in comparisons, e.g. if (msg.decrementHopLimit() > 0)
.
The latter comparison will fail when the hop limit is large because a large hop limit is represented as a negative Java short.
HyperCastWarningRuntimeException
- if the current hop limit is zeropublic void setHopLimit(short hopLimit)
setHopLimit
in interface I_OverlayMessage
public int getPayloadLength()
getPayloadLength
in interface I_OverlayMessage
public byte[] getPayload()
getPayload
in interface I_OverlayMessage
public void setPayload(byte[] newPayload)
public byte getVersion()
public byte getDeliveryMode()
public void setDeliveryMode(byte deliveryMode)
deliveryMode
- delivery mode
throw
- IllegalArgumentException for invalid delivery modepublic byte getTrafficClass()
getTrafficClass
in interface I_OverlayMessage
public void setTrafficClass(byte trafficClass)
setTrafficClass
in interface I_OverlayMessage
public byte[] getMessageID()
getMessageID
in interface I_OverlayMessage
public short getServiceNumber()
getServiceNumber
in interface I_OverlayMessage
public short getServiceIdentifier()
getServiceIdentifier
in interface I_OverlayMessage
HyperCastWarningRuntimeException
- if the message is not an enhanced service message.public void setServiceIdentifier(short serviceID)
setServiceIdentifier
in interface I_OverlayMessage
serviceID
- service identifier
HyperCastWarningRuntimeException
- if the message is not an enhanced service message ,
or setting new service identifier will change the message type.public byte[] getStreamID()
I_OverlayMessage
getStreamID
in interface I_OverlayMessage
public int getStreamIdentifier()
getStreamIdentifier
in interface I_OverlayMessage
HyperCastWarningRuntimeException
- if the message is not a stream oriented message.public void setStreamIdentifier(int streamID)
setStreamIdentifier
in interface I_OverlayMessage
streamID
- stream identifier in byte array format
HyperCastWarningRuntimeException
- if the message is not a stream oriented message.public long getSequenceNumber()
getSequenceNumber
in interface I_OverlayMessage
HyperCastWarningRuntimeException
- if the message is not a stream oriented message.public void setSequenceNumber(long sequenceNum)
setSequenceNumber
in interface I_OverlayMessage
sequenceNum
- the sequence number
HyperCastWarningRuntimeException
- if the message is not a stream oriented message.public byte[] getMessageIdentifier()
getMessageIdentifier
in interface I_OverlayMessage
HyperCastWarningRuntimeException
- if the message is not a messagestroe oriented message.public void setMsgIdentifier(int msgID)
setMsgIdentifier
in interface I_OverlayMessage
msgID
- the message identifier
HyperCastWarningRuntimeException
- if the message is not a messagestroe oriented message.public void addExtension(hypercast.Extension extension)
extension
- the extension to be added into extension vector.
throw
- IllegalArgumentException if the type of the extension is not supported.public hypercast.Extension getFirstExtensionByType(byte type)
public void setFirstExtensionByType(int type, hypercast.Extension ee)
public java.util.Vector getExtension()
public hypercast.Extension getExtension(int index)
public void setExtension(int index, hypercast.Extension e)
public byte getFlowLabel()
public hypercast.I_LogicalAddress getSrcAddress()
getSrcAddress
in interface I_OverlayMessage
public hypercast.I_LogicalAddress getSourceAddress()
getSourceAddress
in interface I_OverlayMessage
public void setSrcAddress(hypercast.I_LogicalAddress rtaddress)
public void setSourceAddress(hypercast.I_LogicalAddress sourceAddress)
public hypercast.I_LogicalAddress getRoutingAddress()
public hypercast.I_LogicalAddress getDestinationAddress()
public void setRoutingAddress(hypercast.I_LogicalAddress destinationAddress)
public void setDestinationAddress(hypercast.I_LogicalAddress destinationAddress)
public hypercast.I_LogicalAddress getPrevhopAddress()
public hypercast.I_LogicalAddress getPreviousHopAddress()
public void setPrevhopAddress(hypercast.I_LogicalAddress previousHopAddress)
public void setPreviousHopAddress(hypercast.I_LogicalAddress previousHopAddress)
public void setKeyVault(hypercast.KeyVault kv)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |