com.limegroup.gnutella.routing
Class ResetTableMessage

java.lang.Object
  extended bycom.limegroup.gnutella.messages.Message
      extended bycom.limegroup.gnutella.routing.RouteTableMessage
          extended bycom.limegroup.gnutella.routing.ResetTableMessage
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable

public class ResetTableMessage
extends RouteTableMessage

The RESET route table update message.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.limegroup.gnutella.routing.RouteTableMessage
PATCH_VARIANT, RESET_VARIANT
 
Fields inherited from class com.limegroup.gnutella.messages.Message
F_PING, F_PING_REPLY, F_PUSH, F_QUERY, F_QUERY_REPLY, F_ROUTE_TABLE_UPDATE, F_VENDOR_MESSAGE, F_VENDOR_MESSAGE_STABLE, N_MULTICAST, N_TCP, N_UDP, N_UNKNOWN, RECORD_STATS, SOFT_MAX
 
Constructor Summary
protected ResetTableMessage(byte[] guid, byte ttl, byte hops, byte[] payload)
          Creates a new ResetTableMessage with data read from the network.
  ResetTableMessage(int tableSize, byte infinity)
          Creates a new ResetTableMessage from scratch, with TTL 1.
 
Method Summary
 byte getInfinity()
          Returns the smallest value in the route table for infinity, i.e., one more than the max TTL.
 int getTableSize()
          Returns the new size of the route table.
 void recordDrop()
          Records the dropping of this message in statistics.
 java.lang.String toString()
           
protected  void writePayloadData(java.io.OutputStream out)
           
 
Methods inherited from class com.limegroup.gnutella.routing.RouteTableMessage
getVariant, read, stripExtendedPayload, writePayload
 
Methods inherited from class com.limegroup.gnutella.messages.Message
compareTo, getCreationTime, getFunc, getGUID, getHops, getLength, getNetwork, getPriority, getTotalLength, getTTL, hop, isMulticast, isTCP, isUDP, isUnknownNetwork, makeGuid, read, read, read, read, read, readNullTerminatedBytes, repOk, setGUID, setHops, setPriority, setTTL, updateLength, write, writeGemExtension, writeGemExtension, writeGemExtensions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ResetTableMessage

public ResetTableMessage(int tableSize,
                         byte infinity)
Creates a new ResetTableMessage from scratch, with TTL 1. The receiver should initialize its routing table to a tableSize array with values of infinity. Throws IllegalArgumentException if either value is less than 1.

Parameters:
tableSize - the size of the table
infinity - the smallest value in the route table for infinity, i.e., one more than the max TTL
See Also:
RouteTableMessage

ResetTableMessage

protected ResetTableMessage(byte[] guid,
                            byte ttl,
                            byte hops,
                            byte[] payload)
                     throws BadPacketException
Creates a new ResetTableMessage with data read from the network. The payload argument is the complete payload of the message. The first byte is guaranteed to be RESET_VARIANT.

Throws:
BadPacketException - the remaining values in payload are not well-formed, e.g., because it's the wrong length.
Method Detail

writePayloadData

protected void writePayloadData(java.io.OutputStream out)
                         throws java.io.IOException
Specified by:
writePayloadData in class RouteTableMessage
Throws:
java.io.IOException

getInfinity

public byte getInfinity()
Returns the smallest value in the route table for infinity, i.e., one more than the max TTL.


getTableSize

public int getTableSize()
Returns the new size of the route table.


recordDrop

public void recordDrop()
Description copied from class: Message
Records the dropping of this message in statistics.

Specified by:
recordDrop in class Message

toString

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