hypercast.HC
Class HC_Message

java.lang.Object
  |
  +--hypercast.HC.HC_Message
All Implemented Interfaces:
I_Message

public final class HC_Message
extends java.lang.Object
implements I_Message

This class encapsulates a HC protocol message.


Field Summary
static byte Beacon
          Hypercast protocol message type (used to beacon all)
static byte Kill
          Hypercast protocol message type (used to kill a node)
static byte Leave
          Hypercast protocol message type (used to leave the hypercube)
static byte Ping
          Hypercast protocol message type (used to ping neighbor periodically)
 byte Proto_num
           
 byte Proto_sub
           
static byte PROTONUM_HC30
          Protocol Number value in Protocol field for HC3.0 protocol message
 
Constructor Summary
HC_Message(byte[] data, int offset, hypercast.I_UnicastAdapter adapter)
          Constructs a HC_Message with a byte array and an I_UnicastAdapter
HC_Message(byte proto_sub, byte type, int gh, hypercast.I_PhysicalAddress srcp, hypercast.HC.HC_LogicalAddress srcl, hypercast.I_PhysicalAddress desp, hypercast.HC.HC_LogicalAddress desl, hypercast.HC.HC_LogicalAddress hrootl, int hrootsn, byte[] data, hypercast.I_UnicastAdapter adapter)
          New Constructor of HC_Message.
HC_Message(byte type, int gh, hypercast.I_PhysicalAddress srcp, hypercast.HC.HC_LogicalAddress srcl, hypercast.I_PhysicalAddress desp, hypercast.HC.HC_LogicalAddress desl, hypercast.HC.HC_LogicalAddress hrootl, int hrootsn, byte[] data, hypercast.I_UnicastAdapter adapter)
          Constructs a HC_Message with all the components
 
Method Summary
 hypercast.HC.HC_LogicalAddress getDestLA()
          Returns the destination logical address of the message
 hypercast.I_PhysicalAddress getDestPA()
          Returns the destination physical address of the message
 hypercast.HC.HC_LogicalAddress getHRootLA()
          Returns the HRoot logical address of the message
 int getHRootSeqNum()
          Returns the HRoot sequence number of the message
 int getOverlayHash()
          Returns the overlayHash of this message.
 hypercast.HC.HC_LogicalAddress getSrcLA()
          Returns the source logical address of the message
 hypercast.I_PhysicalAddress getSrcPA()
          Returns the source physical address of the message
 int getType()
          Returns the type of the message
static hypercast.HC.HC_Message restoreMessage(byte[] recvbuff, int[] validBytesStart, int validBytesEnd, hypercast.I_UnicastAdapter adapter, int thisOverlaysHash)
          Reconstruct HC message from byte array.
 byte[] toByteArray()
          Converts message to byte array
 java.lang.String toString()
          Converts the message object to String
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

Ping

public static final byte Ping
Hypercast protocol message type (used to ping neighbor periodically)

See Also:
Constant Field Values

Kill

public static final byte Kill
Hypercast protocol message type (used to kill a node)

See Also:
Constant Field Values

Beacon

public static final byte Beacon
Hypercast protocol message type (used to beacon all)

See Also:
Constant Field Values

Leave

public static final byte Leave
Hypercast protocol message type (used to leave the hypercube)

See Also:
Constant Field Values

PROTONUM_HC30

public static final byte PROTONUM_HC30
Protocol Number value in Protocol field for HC3.0 protocol message

See Also:
Constant Field Values

Proto_num

public byte Proto_num

Proto_sub

public byte Proto_sub
Constructor Detail

HC_Message

public HC_Message(byte[] data,
                  int offset,
                  hypercast.I_UnicastAdapter adapter)
Constructs a HC_Message with a byte array and an I_UnicastAdapter

The following is the byte format followed
Byte 0 : Type
Bytes 1-4 : overlayHash
Bytes 5-10 : SrcPA
Bytes 11-14: SrcLA
BYtes 15-20: DestPA
Bytes 21-24: DestLA
Bytes 25-28: HRootLA
Bytes 29-32: HRootSeqNum

Parameters:
data - an input byte array
adapter - an I_UnicastAdapter object
Throws:
if - the packet has an invalid type

HC_Message

public HC_Message(byte type,
                  int gh,
                  hypercast.I_PhysicalAddress srcp,
                  hypercast.HC.HC_LogicalAddress srcl,
                  hypercast.I_PhysicalAddress desp,
                  hypercast.HC.HC_LogicalAddress desl,
                  hypercast.HC.HC_LogicalAddress hrootl,
                  int hrootsn,
                  byte[] data,
                  hypercast.I_UnicastAdapter adapter)
Constructs a HC_Message with all the components

Parameters:
type - the type
srcp - source PhysicalAddress object
srcl - source LogicalAddress object
desp - destination PhysicalAddress object
desl - destination LogicalAddress object
hrootl - HRoot LogicalAddress object
hrootsn - HRoot sequence number
data - payload data array
Throws:
if - the packet has an invalid type

HC_Message

public HC_Message(byte proto_sub,
                  byte type,
                  int gh,
                  hypercast.I_PhysicalAddress srcp,
                  hypercast.HC.HC_LogicalAddress srcl,
                  hypercast.I_PhysicalAddress desp,
                  hypercast.HC.HC_LogicalAddress desl,
                  hypercast.HC.HC_LogicalAddress hrootl,
                  int hrootsn,
                  byte[] data,
                  hypercast.I_UnicastAdapter adapter)
New Constructor of HC_Message.

Method Detail

restoreMessage

public static hypercast.HC.HC_Message restoreMessage(byte[] recvbuff,
                                                     int[] validBytesStart,
                                                     int validBytesEnd,
                                                     hypercast.I_UnicastAdapter adapter,
                                                     int thisOverlaysHash)
Reconstruct HC message from byte array.


toByteArray

public byte[] toByteArray()
Converts message to byte array

Specified by:
toByteArray in interface I_Message
Returns:
a byte array which represents a packet which can be sent out to the network

getType

public int getType()
Returns the type of the message

Returns:
Type of this message

getOverlayHash

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


getDestPA

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

Returns:
the destication I_PhysicalAddress object

getSrcLA

public hypercast.HC.HC_LogicalAddress getSrcLA()
Returns the source logical address of the message

Returns:
the source HC_LogicalAddress object

getDestLA

public hypercast.HC.HC_LogicalAddress getDestLA()
Returns the destination logical address of the message

Returns:
the destination HC_LogicalAddress object

getHRootLA

public hypercast.HC.HC_LogicalAddress getHRootLA()
Returns the HRoot logical address of the message

Returns:
the HRoot HC_LogicalAddress object

getHRootSeqNum

public int getHRootSeqNum()
Returns the HRoot sequence number of the message

Returns:
the HRoot sequence number

getSrcPA

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

Returns:
the source I_PhysicalAddress object

toString

public java.lang.String toString()
Converts the message object to String

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the HC_Message object