hypercast.DT
Class DT_Message

java.lang.Object
  |
  +--hypercast.DT.DT_Message
All Implemented Interfaces:
I_Message

public class DT_Message
extends java.lang.Object
implements I_Message

This class defines a DT protocol message, which contains a type (byte), a Overlay hash(int) and 4 AddressPairs. The Src and Dst AddressPairs can not both be null. Its format in byte array is as following: ------------------------------------------------------------ | Protocol | Length | Type | Overlay ID hash | | 8 bits | 16 bits | 8 bits | 32 bits | ---------------------------------------------------------------------------- | Src | Dst | ADDR1 | ADDR2 | | 112 bits | 112 bits | 112 bits | 112 bits | ----------------------------------------------------------------------------


Field Summary
static byte Beacon
          A message type used with Multicasting
static byte Goodbye
          A message type
static byte HelloNeighbor
          A message type
static byte HelloNotNeighbor
          A message type
static byte IAmHere
          A message type used with Buddies
static byte IAmLeader
          A message type used to broadcast leader address pair
static byte NewNode
          A message type
static byte NodePing
          A message type
static byte NodePong
          A message type
static byte PROTONUM_DT30
          Protocol Number value in the Protocol field of a DT3.0 protocol message
static byte ServerReply
          A message type
static byte ServerRequest
          A message type
static byte TestMessage
          A test type
 
Constructor Summary
DT_Message(byte[] A, hypercast.I_UnicastAdapter adapter)
          Creates a message from a byte array.
DT_Message(byte proto_sub, int T, int gh, hypercast.DT.DT_AddressPair Src_arg, hypercast.DT.DT_AddressPair Dst_arg, hypercast.DT.DT_AddressPair CW_arg, hypercast.DT.DT_AddressPair CCW_arg)
          Constructor of DT_Message.
DT_Message(hypercast.DT.DT_Message A)
          Constructor.
 
Method Summary
 hypercast.DT.DT_AddressPair getCCW()
          Returns the address pair of CCW neighbor with respect to the source of the message.
 hypercast.DT.DT_LogicalAddress getCCWLA()
          Returns the logical address of CCW neighbor with respect to the source of the message.
 hypercast.I_PhysicalAddress getCCWPA()
          Returns the physical address of CCW neighbor with respect to the source of the message.
 hypercast.DT.DT_AddressPair getCW()
          Returns the address pair of CW neighbor with respect to the source of the message.
 hypercast.DT.DT_LogicalAddress getCWLA()
          Returns the logical address of CW neighbor with respect to the source of the message.
 hypercast.I_PhysicalAddress getCWPA()
          Returns the physical address of CW neighbor with respect to the source of the message.
 hypercast.DT.DT_AddressPair getDst()
          Returns the address pair of the destination of the message.
 hypercast.DT.DT_LogicalAddress getDstLA()
          Returns the logical address of the destination of the message.
 hypercast.I_PhysicalAddress getDstPA()
          Returns the physical address of the destination of the message.
 java.lang.String getLabel()
          Returns the name of the message according to its type.
 hypercast.DT.DT_AddressPair getLeader()
          the same as getCW
 hypercast.DT.DT_LogicalAddress getLeaderLA()
          Returns the logical address of CW neighbor with respect to the source of the message.
 hypercast.I_PhysicalAddress getLeaderPA()
          Returns the physical address of CW neighbor with respect to the source of the message.
 int getOverlayHash()
          Returns the overlayHash of this message.
 hypercast.DT.DT_AddressPair getSrc()
          Returns the address pair of the source of the message.
 hypercast.DT.DT_LogicalAddress getSrcLA()
          Returns the logical address of the source of the message.
 hypercast.I_PhysicalAddress getSrcPA()
          Returns the physical address of the source of the message.
static hypercast.DT.DT_Message restoreMessage(byte[] A, int[] beginValidBytes, int endValidBytes, hypercast.I_UnicastAdapter adapter, int thisOverlayHash)
          Creates a message, if possible, from a byte array.
 byte[] toByteArray()
          Converts the message into a byte array for transmission.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HelloNeighbor

public static final byte HelloNeighbor
A message type

See Also:
Constant Field Values

HelloNotNeighbor

public static final byte HelloNotNeighbor
A message type

See Also:
Constant Field Values

Goodbye

public static final byte Goodbye
A message type

See Also:
Constant Field Values

ServerRequest

public static final byte ServerRequest
A message type

See Also:
Constant Field Values

ServerReply

public static final byte ServerReply
A message type

See Also:
Constant Field Values

NewNode

public static final byte NewNode
A message type

See Also:
Constant Field Values

NodePing

public static final byte NodePing
A message type

See Also:
Constant Field Values

NodePong

public static final byte NodePong
A message type

See Also:
Constant Field Values

IAmHere

public static final byte IAmHere
A message type used with Buddies

See Also:
Constant Field Values

IAmLeader

public static final byte IAmLeader
A message type used to broadcast leader address pair

See Also:
Constant Field Values

Beacon

public static final byte Beacon
A message type used with Multicasting

See Also:
Constant Field Values

TestMessage

public static final byte TestMessage
A test type

See Also:
Constant Field Values

PROTONUM_DT30

public static final byte PROTONUM_DT30
Protocol Number value in the Protocol field of a DT3.0 protocol message

See Also:
Constant Field Values
Constructor Detail

DT_Message

public DT_Message(hypercast.DT.DT_Message A)
Constructor. It constructs a DT_Message instance by copying another DT_Message instance.


DT_Message

public DT_Message(byte proto_sub,
                  int T,
                  int gh,
                  hypercast.DT.DT_AddressPair Src_arg,
                  hypercast.DT.DT_AddressPair Dst_arg,
                  hypercast.DT.DT_AddressPair CW_arg,
                  hypercast.DT.DT_AddressPair CCW_arg)
Constructor of DT_Message. For LeaderIs messages, the Leader's AddressPair should go in the place of CW.


DT_Message

public DT_Message(byte[] A,
                  hypercast.I_UnicastAdapter adapter)
Creates a message from a byte array.

Parameters:
adapter - used to create new PhysicalAddress from the byte array.
Method Detail

restoreMessage

public static hypercast.DT.DT_Message restoreMessage(byte[] A,
                                                     int[] beginValidBytes,
                                                     int endValidBytes,
                                                     hypercast.I_UnicastAdapter adapter,
                                                     int thisOverlayHash)
Creates a message, if possible, from a byte array. If a message is read, the value of beginValidBytes is incremented to the index of the first byte not in the message.

Parameters:
adapter - used to create new PhysicalAddress from the byte array.

toByteArray

public byte[] toByteArray()
Converts the message into a byte array for transmission.

Specified by:
toByteArray in interface I_Message

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getLabel

public java.lang.String getLabel()
Returns the name of the message according to its type.


getOverlayHash

public int getOverlayHash()
Returns the overlayHash of this message.


getSrcPA

public hypercast.I_PhysicalAddress getSrcPA()
Returns the physical address of the source of the message.


getDstPA

public hypercast.I_PhysicalAddress getDstPA()
Returns the physical address of the destination of the message.


getCCWPA

public hypercast.I_PhysicalAddress getCCWPA()
Returns the physical address of CCW neighbor with respect to the source of the message.


getCWPA

public hypercast.I_PhysicalAddress getCWPA()
Returns the physical address of CW neighbor with respect to the source of the message.


getLeaderPA

public hypercast.I_PhysicalAddress getLeaderPA()
Returns the physical address of CW neighbor with respect to the source of the message.


getSrcLA

public hypercast.DT.DT_LogicalAddress getSrcLA()
Returns the logical address of the source of the message.


getDstLA

public hypercast.DT.DT_LogicalAddress getDstLA()
Returns the logical address of the destination of the message.


getCCWLA

public hypercast.DT.DT_LogicalAddress getCCWLA()
Returns the logical address of CCW neighbor with respect to the source of the message.


getCWLA

public hypercast.DT.DT_LogicalAddress getCWLA()
Returns the logical address of CW neighbor with respect to the source of the message.


getLeaderLA

public hypercast.DT.DT_LogicalAddress getLeaderLA()
Returns the logical address of CW neighbor with respect to the source of the message.


getSrc

public hypercast.DT.DT_AddressPair getSrc()
Returns the address pair of the source of the message.


getDst

public hypercast.DT.DT_AddressPair getDst()
Returns the address pair of the destination of the message.


getCCW

public hypercast.DT.DT_AddressPair getCCW()
Returns the address pair of CCW neighbor with respect to the source of the message.


getCW

public hypercast.DT.DT_AddressPair getCW()
Returns the address pair of CW neighbor with respect to the source of the message.


getLeader

public hypercast.DT.DT_AddressPair getLeader()
the same as getCW