DRCL J-Sim API

drcl.inet.transport
Class TCPPacket

java.lang.Object
  extended bydrcl.net.Packet
      extended bydrcl.inet.transport.TCPPacket
All Implemented Interfaces:
java.lang.Cloneable, Countable, ObjectCloneable, PacketWrapper

public class TCPPacket
extends Packet

This class defines the TCP packet header. Fields implemented in this class are SOURCE_port, DEST_port, SEQNo, ACKNo, AdvertisedWnd, ACK, SYN, FIN, SACK option, timestamp option. RFC requirements NOT implemented in this class are URG, PSH, RST, TCP checksum, Urgent pointer, and other options References:


Field Summary
static int FLAG_ACK
           
static int FLAG_FIN
           
static int FLAG_SACK
           
static int FLAG_SYN
           
static long MSS
          Size of maximum transmission unit, used to set/calculate packet count from sequence number.
 
Fields inherited from class drcl.net.Packet
body, headerSize, id, size
 
Constructor Summary
TCPPacket()
           
TCPPacket(int sport_, int dport_, long Seqno_, long AckNo_, int AdvWin_, boolean Ack_, boolean SYN_, boolean FIN_, double ts_, double ats_, boolean sack_, int sackLen_, int hsize_, int bsize_, java.lang.Object body_)
          Constructor for TCPPacket with SACK option.
TCPPacket(int sport_, int dport_, long Seqno_, long AckNo_, int AdvWin_, boolean Ack_, boolean SYN_, boolean FIN_, double ts_, double ats_, int hsize_, int bsize_, java.lang.Object body_)
          Constructor for TCPPacket without SACK option.
 
Method Summary
 java.lang.String _toString(java.lang.String separator_)
          Prints the packet header.
 java.lang.Object clone()
          Returns a clone of this object.
 long getAckNo()
           
 int getAdvWin()
           
 double getaTS()
           
 long getByteCount()
          Returns the byte count of this packet in the connection to which this packet belongs.
 int getDPort()
           
 long[] getLEblk()
           
 java.lang.String getName()
          Returns the name of this packet.
 int getPacketCount()
          Returns the count of this packet in the connection to which this packet belongs.
 java.lang.String getPacketType()
          Returns the type of packet.
 long[] getREblk()
           
 int getSACKLen()
           
 long getSeqNo()
           
 int getSPort()
           
 double getTS()
           
 boolean isACK()
           
 boolean isFIN()
           
 boolean isSACK()
           
 boolean isSYN()
           
 void setACK(boolean enabled_)
           
 void setaTS(double aTS_)
           
 void setFIN(boolean enabled_)
           
 void setLEblk(long[] LEblk_)
           
 void setREblk(long[] REblk_)
           
 void setSACK(boolean enabled_)
           
 void setSACKBlocks(long[] LEblk_, long[] REblk_)
           
 void setSACKLen(int len_)
           
 void setSeqNo(long seqno_)
           
 void setSYN(boolean enabled_)
           
 void setTS(double ts_)
           
 
Methods inherited from class drcl.net.Packet
equals, getBody, getHeaderSize, getNumberCount, getPacketSize, getSize, getSizeCount, getTimestamp, isByteCountSupported, isPacketCountSupported, isTimestampSupported, setBody, setBody, setHeaderSize, setPacketSize, setSize, setTimestamp, toString, toString, wraps
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MSS

public static long MSS
Size of maximum transmission unit, used to set/calculate packet count from sequence number.


FLAG_ACK

public static final int FLAG_ACK
See Also:
Constant Field Values

FLAG_SYN

public static final int FLAG_SYN
See Also:
Constant Field Values

FLAG_FIN

public static final int FLAG_FIN
See Also:
Constant Field Values

FLAG_SACK

public static final int FLAG_SACK
See Also:
Constant Field Values
Constructor Detail

TCPPacket

public TCPPacket()

TCPPacket

public TCPPacket(int sport_,
                 int dport_,
                 long Seqno_,
                 long AckNo_,
                 int AdvWin_,
                 boolean Ack_,
                 boolean SYN_,
                 boolean FIN_,
                 double ts_,
                 double ats_,
                 int hsize_,
                 int bsize_,
                 java.lang.Object body_)
Constructor for TCPPacket without SACK option.

Parameters:
Seqno_ - Sequence number of data
AckNo_ - Acknowledge sequence number
AdvWin_ - Advertised window
Ack_ - flag ACK
SYN_ - flag SYN
FIN_ - flag FIN
ts_ - Timestamp
ats_ - Ackknowledge Timestamp
hsize_ - header size, calculated by caller
bsize_ - body size
body_ - body

TCPPacket

public TCPPacket(int sport_,
                 int dport_,
                 long Seqno_,
                 long AckNo_,
                 int AdvWin_,
                 boolean Ack_,
                 boolean SYN_,
                 boolean FIN_,
                 double ts_,
                 double ats_,
                 boolean sack_,
                 int sackLen_,
                 int hsize_,
                 int bsize_,
                 java.lang.Object body_)
Constructor for TCPPacket with SACK option.

Parameters:
Seqno_ - Sequence number of data
AckNo_ - Acknowledge sequence number
AdvWin_ - Advertised window
Ack_ - flag ACK
SYN_ - flag SYN
FIN_ - flag FIN
ts_ - Timestamp
ats_ - Ackknowledge Timestamp
sack_ - flag SACK
sackLen_ - # of SACK blocks
hsize_ - header size, calculated by caller
bsize_ - body size
body_ - body
Method Detail

getName

public java.lang.String getName()
Description copied from class: Packet
Returns the name of this packet.

Specified by:
getName in class Packet

getPacketCount

public int getPacketCount()
Description copied from class: Packet
Returns the count of this packet in the connection to which this packet belongs. By default, it delegates the call to the encapsulated packet, and throws a PacketException if the encapsulated object is not a packet.

Overrides:
getPacketCount in class Packet

getByteCount

public long getByteCount()
Description copied from class: Packet
Returns the byte count of this packet in the connection to which this packet belongs. By default, it delegates the call to the encapsulated packet, and throws a PacketException if the encapsulated object is not a packet. This method approximates the byte count with the byte count obtained from the encapsulated packet plus the header size times the packet count.

Overrides:
getByteCount in class Packet

getDPort

public int getDPort()

getSPort

public int getSPort()

getTS

public double getTS()

setTS

public void setTS(double ts_)

getaTS

public double getaTS()

setaTS

public void setaTS(double aTS_)

setSeqNo

public void setSeqNo(long seqno_)

getSeqNo

public long getSeqNo()

getAckNo

public long getAckNo()

getAdvWin

public int getAdvWin()

setACK

public void setACK(boolean enabled_)

isACK

public boolean isACK()

setSYN

public void setSYN(boolean enabled_)

isSYN

public boolean isSYN()

setFIN

public void setFIN(boolean enabled_)

isFIN

public boolean isFIN()

setSACK

public void setSACK(boolean enabled_)

isSACK

public boolean isSACK()

getSACKLen

public int getSACKLen()

setSACKLen

public void setSACKLen(int len_)

getLEblk

public long[] getLEblk()

setLEblk

public void setLEblk(long[] LEblk_)

getREblk

public long[] getREblk()

setREblk

public void setREblk(long[] REblk_)

setSACKBlocks

public void setSACKBlocks(long[] LEblk_,
                          long[] REblk_)

clone

public java.lang.Object clone()
Description copied from interface: ObjectCloneable
Returns a clone of this object.

Specified by:
clone in interface ObjectCloneable
Specified by:
clone in class Packet

getPacketType

public java.lang.String getPacketType()
Description copied from class: Packet
Returns the type of packet. By default, it delegates the call to the encapsulated packet, and returns Packet.getName() otherwise.

Overrides:
getPacketType in class Packet

_toString

public java.lang.String _toString(java.lang.String separator_)
Description copied from class: Packet
Prints the packet header.

Overrides:
_toString in class Packet

DRCL J-Sim API

Copyright © 1998-2003 Distributed Real-time Computing Lab (DRCL). All Rights Reserved.     ~ To J-Sim Home ~