Class Packet

java.lang.Object
  |
  +--Packet
Direct Known Subclasses:
RoutingInfoPacket

public class Packet
extends java.lang.Object

A Packet is a packet in the network.


Field Summary
static java.lang.String BROADCAST
          Packet.BROADCAST is the type for broadcast packets.
static java.lang.String DATA
          Packet.DATA is the type for data packets.
static java.lang.String ROUTING_INFO
          Packet.ROUTING_INFO is the type for routing information packets.
static java.lang.String ROUTING_REQUEST
          Packet.ROUTING_REQUEST is the type for routing request packets.
 
Constructor Summary
Packet(java.lang.String typ, java.lang.String src, java.lang.String dest)
          new Packet(typ, src, dest) returns a Packet with type typ.
 
Method Summary
 java.lang.String getDestination()
          pkt.getDestination() returns the name of the destination router of pkt.
 int getSerialNumber()
          pkt.getSerialNumber() returns the serial number of pkt.
 java.lang.String getSource()
          pkt.getSource() returns the name of the source router of pkt.
 java.lang.String getType()
          pkt.getType() returns the type of pkt.
 java.lang.String toString()
          pkt.toString() returns a string describing pkt.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DATA

public static java.lang.String DATA
Packet.DATA is the type for data packets.


ROUTING_INFO

public static java.lang.String ROUTING_INFO
Packet.ROUTING_INFO is the type for routing information packets.


ROUTING_REQUEST

public static java.lang.String ROUTING_REQUEST
Packet.ROUTING_REQUEST is the type for routing request packets.


BROADCAST

public static java.lang.String BROADCAST
Packet.BROADCAST is the type for broadcast packets.

Constructor Detail

Packet

public Packet(java.lang.String typ,
              java.lang.String src,
              java.lang.String dest)
new Packet(typ, src, dest) returns a Packet with type typ. Its source router is named src. Its destination router is named dest.

Method Detail

getSerialNumber

public int getSerialNumber()
pkt.getSerialNumber() returns the serial number of pkt.


getType

public java.lang.String getType()
pkt.getType() returns the type of pkt.


getSource

public java.lang.String getSource()
pkt.getSource() returns the name of the source router of pkt.


getDestination

public java.lang.String getDestination()
pkt.getDestination() returns the name of the destination router of pkt.


toString

public java.lang.String toString()
pkt.toString() returns a string describing pkt.

Overrides:
toString in class java.lang.Object