Rice Pastry API

rice.pastry.wire.messaging.datagram
Class DatagramMessage

java.lang.Object
  |
  +--rice.pastry.wire.messaging.datagram.DatagramMessage
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AcknowledgementMessage, DatagramTransportMessage, PingMessage

public abstract class DatagramMessage
extends java.lang.Object
implements java.io.Serializable

Class which wraps all messages to be sent through the UDP-based pastry protocol. Adds on a "packet number" which should be repeated in the AcknowledgementMessage ack packet.

Version:
$Id: DatagramMessage.java,v 1.2 2002/09/09 01:19:48 amislove Exp $
Author:
Alan Mislove
See Also:
Serialized Form

Field Summary
protected  rice.pastry.NodeId destination
           
protected  int num
           
protected  rice.pastry.NodeId source
           
 
Constructor Summary
DatagramMessage(rice.pastry.NodeId source, rice.pastry.NodeId destination, int num)
          Builds a DatagramMessage given a packet number
 
Method Summary
 rice.pastry.wire.messaging.datagram.AcknowledgementMessage getAck(java.net.InetSocketAddress address)
          Returns the approriate 'ack' message for this datagram transport message.
 rice.pastry.NodeId getDestination()
          Returns the NodeId which is the destination
 int getNum()
          Returns the "packet number" of this transmission
 rice.pastry.NodeId getSource()
          Returns the NodeId from which this message came.
 void setNum(int num)
          Sets the "packet number" of this transmission
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

num

protected int num

source

protected rice.pastry.NodeId source

destination

protected rice.pastry.NodeId destination
Constructor Detail

DatagramMessage

public DatagramMessage(rice.pastry.NodeId source,
                       rice.pastry.NodeId destination,
                       int num)
Builds a DatagramMessage given a packet number

Parameters:
num - The "packet number"
Method Detail

getNum

public int getNum()
Returns the "packet number" of this transmission

Returns:
The packet number of this message.

setNum

public void setNum(int num)
Sets the "packet number" of this transmission

Parameters:
num - The packet number

getSource

public rice.pastry.NodeId getSource()
Returns the NodeId from which this message came.

Returns:
This message's source

getDestination

public rice.pastry.NodeId getDestination()
Returns the NodeId which is the destination

Returns:
This message's destination

getAck

public rice.pastry.wire.messaging.datagram.AcknowledgementMessage getAck(java.net.InetSocketAddress address)
Returns the approriate 'ack' message for this datagram transport message.

Parameters:
address - The address the ack will be sent to

toString

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

Rice Pastry API

Copyright © 2001 - Rice Pastry.


Imprint-Dataprotection