network
Class XMLPacket

java.lang.Object
  extended bynetwork.Packet
      extended bynetwork.XMLPacket
All Implemented Interfaces:
java.io.Serializable

public class XMLPacket
extends Packet

A Packet with an XML payload.

Author:
cooperse, hoele
See Also:
Serialized Form

Field Summary
static java.lang.String EVERYONE
          The address indicating everyone
 
Fields inherited from class network.Packet
IP, IP_REQUEST, NUM_TYPES, XML
 
Constructor Summary
XMLPacket(byte[] xml, java.lang.String from, java.lang.String to, long id)
           
 
Method Summary
 void decrementTTL()
          Decrements the timeToLive of the packet.
 java.lang.String getFrom()
           
 long getId()
           
 byte[] getSignature()
          Get the signature
 java.lang.String getTo()
           
 int getTTL()
           
 byte[] getXML()
           
 boolean isTTLZero()
           
 void setSignature(byte[] sig)
          Sets the signature of the message
 void setTTL(int ttl)
          Sets the TTL to the given value
 
Methods inherited from class network.Packet
getType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EVERYONE

public static final java.lang.String EVERYONE
The address indicating everyone

See Also:
Constant Field Values
Constructor Detail

XMLPacket

public XMLPacket(byte[] xml,
                 java.lang.String from,
                 java.lang.String to,
                 long id)
Parameters:
xml - The XML payload
from - The virtual address of the sender.
to - The virtual address of the recipient.
Method Detail

getXML

public byte[] getXML()
Returns:
The XML payload

getFrom

public java.lang.String getFrom()
Returns:
Returns the from.

getTo

public java.lang.String getTo()
Returns:
Returns the to.

decrementTTL

public void decrementTTL()
Decrements the timeToLive of the packet.


isTTLZero

public boolean isTTLZero()
Returns:
Returns a boolean indicating whether the time-to-live of the packet has reached zero.

getTTL

public int getTTL()
Returns:
Returns the current value of the time-to-live

setTTL

public void setTTL(int ttl)
Sets the TTL to the given value

Parameters:
ttl - The int for the TTL to set

getSignature

public byte[] getSignature()
Get the signature

Returns:
The byte[] of the signature

setSignature

public void setSignature(byte[] sig)
Sets the signature of the message

Parameters:
sig - The signature (signed message digest)

getId

public long getId()
Returns:
Returns the id.