verinec.netsim.entities.packets
Class TCPPacket

java.lang.Object
  extended by desmoj.core.simulator.NamedObject
      extended by desmoj.core.simulator.ModelComponent
          extended by desmoj.core.simulator.Schedulable
              extended by desmoj.core.simulator.Entity
                  extended by verinec.netsim.entities.packets.Packet
                      extended by verinec.netsim.entities.packets.Leaf
                          extended by verinec.netsim.entities.packets.UDPPacket
                              extended by verinec.netsim.entities.packets.TCPPacket
All Implemented Interfaces:
Cloneable

public class TCPPacket
extends UDPPacket

A TCP Packet

Version:
$Revision:835 $
Author:
Dominik Jungo

Field Summary
private  int ack
          the acknowledgment number
private  boolean fin
          the finish flag.
private  boolean psh
          the push flag.
private  boolean rst
          the reset flag.
private  int seq
          the sequence number
private  boolean syn
          the synchronize flag.
private  boolean urg
          the urgent flag.
private  boolean validity
          validity simulates the checksum.
private  int windowsize
          the sender's remainig window size
 
Constructor Summary
TCPPacket(Model owner, IPAddress srcaddress, IPAddress dstaddress, int srcPort, int dstPort)
          Creates a new TCP Packet
 
Method Summary
 int getAck()
          gets the ack field
 String getProcessorName()
          gets the name of the processor that will process this packet
 int getSeq()
          gets the seq field
 int getWindowsize()
          gets the sender's remainig window size
 boolean isAck()
          test if the ackfied is set
 boolean isFin()
          gets the fin bit
 boolean isPsh()
          gets the psh bit
 boolean isRst()
          gets the rst bit
 boolean isSyn()
          tests if the syn field is set
 boolean isUrg()
          gets the urg bit
 boolean isValid()
          gets the packets validity (simulates checksum testing)
protected  Leaf selfClone()
           
 void setAck(int i)
          sets the ack bit
 void setFin(boolean b)
          sets the fin bit
 void setPsh(boolean b)
          sets the psh bit
 void setRst(boolean b)
          sets the rst bit
 void setSeq(int i)
          sets the seq bit
 void setSyn(boolean b)
          sets the syn bit
 void setUrg(boolean b)
          sets the urg bit
 void setValidity(boolean validity)
          sets the validity of this packet.
 void setWindowsize(int windowsize)
          sets the sender's remainig window size
 String toString()
          This returns a String representation of the Packet.
 
Methods inherited from class verinec.netsim.entities.packets.UDPPacket
byteArrayToPayload, createString, getDstPort, getSrcPort, payloadToByteArray, setDstPort, setSrcPort
 
Methods inherited from class verinec.netsim.entities.packets.Leaf
clone, getPayload, setPayload
 
Methods inherited from class verinec.netsim.entities.packets.Packet
getAge, getDstAddress, getPacketID, getSrcAddress, incrAge, setAge, setDstAddress, setPacketID, setSrcAddress
 
Methods inherited from class desmoj.core.simulator.Entity
getPriority, isEqual, isLarger, isLargerOrEqual, isNotEqual, isSimProcess, isSmaller, isSmallerOrEqual, numQueues, schedule, scheduleAfter, scheduleBefore, setPriority
 
Methods inherited from class desmoj.core.simulator.Schedulable
cancel, isCurrent, isScheduled, nextEntity, nextEvent, nextSchedulable, rename, reSchedule, scheduledAt
 
Methods inherited from class desmoj.core.simulator.ModelComponent
current, currentEntity, currentEvent, currentModel, currentSimProcess, currentTime, debugIsOn, debugOff, debugOn, epsilon, getModel, isExperimentCompatible, isModelCompatible, sendDebugNote, sendMessage, sendTraceNote, sendWarning, skipTraceNote, skipTraceNote, traceIsOn, traceOff, traceOn
 
Methods inherited from class desmoj.core.simulator.NamedObject
getName, getQuotedName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

urg

private boolean urg
the urgent flag. data will be treated immedately by application


psh

private boolean psh
the push flag. data will be treated immedately by application


rst

private boolean rst
the reset flag. breaks or refuses connection


fin

private boolean fin
the finish flag. indicator that no more data is sent, connection will be teared town


syn

private boolean syn
the synchronize flag. used for synchronisation of sequence numbers during connection set up


seq

private int seq
the sequence number


ack

private int ack
the acknowledgment number


windowsize

private int windowsize
the sender's remainig window size


validity

private boolean validity
validity simulates the checksum. either the packet fits (true) or not (false) to the ckecksum

Constructor Detail

TCPPacket

public TCPPacket(Model owner,
                 IPAddress srcaddress,
                 IPAddress dstaddress,
                 int srcPort,
                 int dstPort)
Creates a new TCP Packet

Parameters:
owner - a Model
srcaddress - source address of this packet
dstaddress - destination address of this packet
srcPort - source port
dstPort - destionation port
Method Detail

getProcessorName

public String getProcessorName()
Description copied from class: Packet
gets the name of the processor that will process this packet

Overrides:
getProcessorName in class UDPPacket
Returns:
the name of the processor that will process this packet
See Also:
UDPPacket.getProcessorName()

isAck

public boolean isAck()
test if the ackfied is set

Returns:
the ackbit

getAck

public int getAck()
gets the ack field

Returns:
the ack field

isFin

public boolean isFin()
gets the fin bit

Returns:
the fin bit

isPsh

public boolean isPsh()
gets the psh bit

Returns:
the psh bit

isRst

public boolean isRst()
gets the rst bit

Returns:
the rst bit

isSyn

public boolean isSyn()
tests if the syn field is set

Returns:
the syn field flag

getSeq

public int getSeq()
gets the seq field

Returns:
the seq field

isUrg

public boolean isUrg()
gets the urg bit

Returns:
the urg bit

setAck

public void setAck(int i)
sets the ack bit

Parameters:
i - a integer value for the ack field

setFin

public void setFin(boolean b)
sets the fin bit

Parameters:
b - a boolean value for the fin bit

setPsh

public void setPsh(boolean b)
sets the psh bit

Parameters:
b - a boolean value for the psh bit

setRst

public void setRst(boolean b)
sets the rst bit

Parameters:
b - a boolean value for the rst bit

setSeq

public void setSeq(int i)
sets the seq bit

Parameters:
i - a integer value for the seq field

setUrg

public void setUrg(boolean b)
sets the urg bit

Parameters:
b - a boolean value for the urg bit

setSyn

public void setSyn(boolean b)
sets the syn bit

Parameters:
b - a boolean value for the syn bit

toString

public String toString()
Description copied from class: Packet
This returns a String representation of the Packet.

Overrides:
toString in class UDPPacket
Returns:
the a String representation of the Packet
See Also:
Leaf.toString()

isValid

public boolean isValid()
gets the packets validity (simulates checksum testing)

Returns:
true if the checksum fits to the packet, false otherwise.

setValidity

public void setValidity(boolean validity)
sets the validity of this packet.

Parameters:
validity - the validity of this packet

getWindowsize

public int getWindowsize()
gets the sender's remainig window size

Returns:
the sender's remainig window size

setWindowsize

public void setWindowsize(int windowsize)
sets the sender's remainig window size

Parameters:
windowsize - the sender's remainig window size

selfClone

protected Leaf selfClone()
Overrides:
selfClone in class UDPPacket

Copyright © 2005 Verinec, DIUF