|
J-Sim v1.2.1-p7 API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectdrcl.DrclObj
drcl.comp.Component
drcl.net.Module
drcl.inet.Protocol
drcl.inet.transport.TCP
This component implements the single-session sender TCP. Only one TCP session is handled in this component. Open and close of the connection is not implemented, nor is the 3-way handshaking.
Several variants of TCP are implemented: Tahoe, Reno, New-Reno ([Fall96])
and Vegas ([Brakmo95]).
Each can be used with the SACK option. Currently only New-Reno takes advantage
of the SACK blocks in an ACK.
To specify the implementation, use setImplementation(String)
with "Tahoe", "Reno", "New-Reno" or "Vegas" as argument.
To enable SACK, use setSackEnabled(boolean).
The initial sequence number is set as 0, instead of a random value suggestted in [TCPILL2]
For Tahoe and Reno, the RTT and RXT timer base estimation is based on
[TCPILL2]. The sending time of a segment is recorded as ts_
in the TCP header (similar to the timestamp option in the real TCP header)
and returned by the corresponding acknowledgment packet.
ts_ is set to -1 if the segment is
a retransmitted one, so no RTT estimation is performed
for retransmitted segments. The algorithm is described in [RFC793] and
[TCPILL1].
SampleRTT = current time - ts_;
SmoothedRTT[new] = 7/8*SmoothedRTT[old] + 1/8*SampleRTT;
Delta = |SampleRTT - SmoothedRTT[old]|;
RTTVariance[new] = 3/4*RTTVariance[old] + 1/4*Delta;
and the retransmission timer base is
RTO[new] = SmoothedRTT[new] + 4*RTTVariance[new].
The exception is that for the first acknowledgment received:
SampleRTT = current time - ts_;
SmoothedRTT[new] = SampleRTT;
RTTVariance[new] = SampleRTT/2;
and the retransmission timer base is
RTO[new] = SmoothedRTT[new] + 4*RTTVariance[new].
Additional usage infomation:
setMaxburstEnabled(boolean).
This option restricts the maximum number of bytes that can be sent in
response to a single ACK to be one segment during Reno-style fast recovery,
and two segments otherwise. This is based on [RFC2018] and is different
from similar setting in [Fall96].
For Vegas, only two segments restriction applies since Vegas does not have
fast recovery.
setTTL(int).
setMSS(int).
setTick(double).
References:
TCPPacket,
TCPSink,
Serialized Form| Nested Class Summary | |
static class |
TCP.VegasVariables
Stores variables for implementing TCP-VEGAS. |
| Nested classes inherited from class drcl.comp.Component |
Component.Locks |
| Field Summary | |
protected Port |
ackPort
Port to export the acknowledged sequence number of each packet received. |
protected int |
AWND
Receiver window size. |
static int |
AWND_DEFAULT
Default advertisement window size (unit of MSS bytes). |
protected int |
backoff
Current RXT timer backoff value. |
protected int |
burst
# of bytes that have been sent in response to last ACK. |
protected long |
bytesRetx
# of bytes retransmitted. |
protected double |
cur_rtt
Most recent RTT value. |
protected int |
CWND
Congestion window size. |
protected Port |
cwndPort
Port to export the congestion window changed event. |
static int |
DEBUG_ACK
|
static int |
DEBUG_DUPACK
|
static java.lang.String[] |
DEBUG_LEVELS
|
static int |
DEBUG_RTT
|
static int |
DEBUG_SACK
|
static int |
DEBUG_SAMPLE
|
static int |
DEBUG_SEND
|
static int |
DEBUG_TIMEOUT
|
static int |
DEBUG_VEGAS
|
protected long |
dt_max
Maximum seqence number of data in the buffer, = snd_una + sbuffer.size(). |
protected int |
dup_ack
Number of duplicated ACKs received. |
protected java.lang.String |
implementation
|
static int |
INIT_SS_THRESHOLD
Initial slow-start threshold (unit of MSS bytes). |
protected long |
last_seq
|
protected boolean |
maxburst
True if maxburst restriction is enabled. |
protected int |
MAXCWND
Maximum congestion window size. |
static int |
MAXCWND_DEFAULT
Default maximum congestion window size (unit of MSS bytes). |
protected double |
maxrto
Maximum value of a RXT timeout. |
protected int |
MSS
MSS Maximum segmentation size. |
static boolean |
NS_COMPATIBLE
Sets to true to make TCP ns compatible |
protected long |
numack
# of effective acks received. |
static int |
NUMDUPACKS
Number of duplicate ACKs to trigger fast RXT as specified in [RFC2581] (for Reno, Tahoe). |
protected int |
numTimeouts
# of coarse-grained timeouts. |
protected LongSpace |
recvBuffer
(Reconstructed) Sequence numbers that the receiver has received. |
protected int |
rttvar_bits
Exponent of weight for updating t_rttvar. |
protected int |
rttvar_exp
Exponent of multiple for t_rtxcur. |
protected int |
rttvar_init
Initial value of RTT Variation (shifted by rttvar_bits) |
protected Port |
rttvarPort
Port to export the RTTVAR event. |
protected double |
rtxcur_init
Initial value of base RXT timer. |
protected boolean |
SACK
True if SACK option is enabled. |
protected CircularBuffer |
sbuffer
Sending buffer. |
protected Port |
seqNoPort
Port to export the [first] sequence number of each packet sent. |
protected long |
snd_max
Maximum seqence number that has been sent. |
protected long |
snd_nxt
Sequence number to send next. |
protected long |
snd_nxt_marked
snd_nxt marked for NEW-RENO and SACK. |
protected long |
snd_nxt_recorded
during Reno-style fast recovery. |
protected long |
snd_una
Smallest sequence number that has not yet been acknowledged. |
protected int |
srtt_bits
Exponent of weight for updating t_srtt. |
protected int |
srtt_init
Initial value of smoothed RTT (shifted by srtt_bits) |
protected Port |
srttPort
Port to export the SRTT event. |
protected Port |
sstPort
Port to export the slow start threshold changed event. |
int |
state
FSM State of this TCP component. |
protected int |
sthld
Congestion avoidance threshold. |
protected double |
t_grain
TCP tick for all the rtt variables. |
protected int |
t_rttvar
RTT Variation (shifted by rttvar_bits) |
protected double |
t_rtxcur
Current RXT timeout value. |
protected int |
t_srtt
Smoothed RTT (shifted by srtt_bits) |
protected int |
TTL
TTL field to IP. |
protected TCP.VegasVariables |
vegas
|
| Fields inherited from class drcl.net.Module |
address, downPort, PortGroup_DOWN, PortGroup_UP, timerPort, upPort |
| Fields inherited from interface drcl.inet.transport.TCPConstants |
ACK_EVENT, ACK_PORT_ID, CLOSE_WAIT, CLOSED, CLOSING, CWND_EVENT, CWND_PORT_ID, DEFAULT_PID, DELAY_ACK, ESTABLISHED, ESTABLISHED_FIN, ESTABLISHED_OVER, FIN_WAIT_1, FIN_WAIT_2, LAST_ACK, LISTEN, LISTEN1, LISTEN2, NEW_RENO, PRE_CLOSED, PRE_LAST_ACK, PRE_SYN_SENT, RECEIVE, RENO, RTT_EVT, RTTVAR_EVENT, RTTVAR_PORT_ID, RXT_EVT, SEND, SEQNO_EVENT, SEQNO_PORT_ID, SEQNO_RCV_EVENT, SEQNO_RCV_PORT_ID, SEQNO_SENT_EVENT, SEQNO_SENT_PORT_ID, SRTT_EVENT, SRTT_PORT_ID, SST_EVENT, SST_PORT_ID, STATES, SYN_RCVD, SYN_SENT, TAHOE, TIME_WAIT, TIMEOUT_TYPES, VEGAS |
| Constructor Summary | |
TCP()
|
|
TCP(java.lang.String id_)
|
|
| Method Summary | |
protected void |
_start()
Used to output initial states events. |
protected void |
ack_syn_fin(boolean ack_,
boolean syn_,
boolean fin_)
|
java.lang.String |
configInfo()
|
void |
configureRTT(double tick_,
double srtt_init_,
double rttvar_init_,
double basertt_init_,
double maxrto_)
Configures RTT parameters. |
protected void |
dataArriveAtDownPort(java.lang.Object data_,
Port downPort_)
The handler invoked when a packet arrives at a "down" port. |
protected void |
dataArriveAtUpPort(java.lang.Object data_,
Port upPort_)
The handler invoked when a packet arrives at an "up" port. |
void |
duplicate(java.lang.Object source_)
Duplicates the content of source_, including ID, name, child components and connections among them, to this component. |
protected int |
getAckNo()
|
protected int |
getAvailableRcvBuffer()
|
double |
getBASERTT_INIT()
Returns the initial value of baseRTT (in second). |
java.lang.String[] |
getDebugLevelNames()
Returns the names of defined debug levels; subclasses should override this method if debug levels are defined. |
java.lang.String |
getImplementation()
|
long |
getLocalAddr()
Returns the local address. |
int |
getLocalPort()
Returns the local port. |
int |
getMAXCWND()
|
double |
getMAXRTO()
Returns the maximum retr timeout (in second). |
int |
getMSS()
|
java.lang.String |
getName()
Returns the (informational) name of the component. |
long |
getNumBytesRetransmitted()
Returns # of bytes retransmitted. |
int |
getNumTimeouts()
Returns # of coarse-grained timeouts. |
long |
getPeer()
Returns the peer address. |
int |
getRemotePort()
Returns the peer port. |
double |
getRTTVAR_INIT()
Returns the initial value of rttvar (in second). |
protected int |
getSendingBuffer()
|
protected int |
getSeqNo()
|
double |
getSRTT_INIT()
Returns the initial value of srtt (in second). |
int |
getState()
|
double |
getTick()
|
int |
getTTL()
|
java.lang.String |
info()
Returns information regarding this component. |
boolean |
isMaxburstEnabled()
|
boolean |
isSackEnabled()
|
protected void |
option_process(TCPPacket pkt_,
long seq_)
Processing TCP header options. |
protected void |
recv(TCPPacket pkt_)
Handles a packet arriving at the down port. |
void |
reset()
Resets the component for being used anew. |
protected void |
resetRXTTimer(double now_)
Resets the retransmission timer. |
protected void |
rtt_init()
Initialize variables for the retransmit timer as in [TCPILL2]. |
protected void |
rtt_update(double now_,
double ts_)
Update RTT estimations and recalculate RXT timer base. |
protected double |
rxt_timer(int t_backoff_)
Returns the RXT timeout value by multiplying base value and back off value. |
protected long |
seq_max()
Returns the maximum sequence number that can be sent. |
void |
setBASERTT_INIT(double v_)
Sets the initial value of baseRTT (in second). |
void |
setImplementation(java.lang.String impl_)
|
void |
setMaxburstEnabled(boolean maxburst_)
|
void |
setMAXCWND(int max_)
|
void |
setMAXRTO(double v_)
Sets the maximum retr timeout (in second). |
void |
setMSS(int mss)
Sets the maximum segment size. |
void |
setPeer(long peer_)
|
void |
setRTTVAR_INIT(double v_)
Sets the initial value of rttvar (in second). |
void |
setSackEnabled(boolean sack_)
|
void |
setSRTT_INIT(double v_)
Sets the initial value of srtt (in second). |
void |
setTick(double tick_)
Sets the clock tick for RTT estimation. |
void |
setTTL(int ttl)
|
protected void |
snd_maxpck(java.lang.String debugMsg_)
Sends as many packets as allowed by the current window. |
protected void |
snd_packet(long seqno_,
int size_)
Sends one packet with specified starting sequence number and packet size. |
protected int |
snd_wnd()
Returns the size of usable window, which is the smaller value of congestion window and window size advertized by peer. |
protected void |
tcp_init()
Initializes this TCP component. |
protected void |
timeout(java.lang.Object evt_)
The handler invoked when a timeout event occurs. |
protected void |
timer_backoff()
Backs off the RXT timer backoff. |
protected void |
win_decrease(boolean timeout_)
Updates congestion window and sending window variables when three duplicate acks are received. |
protected void |
win_increase()
Updates congestion window and sending window variables. |
protected void |
win_init()
Initializes sliding window variables. |
| Methods inherited from class drcl.net.Module |
cancelTimeout, deliver, getAddress, process, removeDefaultDownPort, removeDefaultUpPort, removeTimerPort, setAddress, setTimeout, setTimeoutAt |
| Methods inherited from class drcl.DrclObj |
clone |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static boolean NS_COMPATIBLE
public static int AWND_DEFAULT
public static int MAXCWND_DEFAULT
public static int INIT_SS_THRESHOLD
public static int NUMDUPACKS
public static final java.lang.String[] DEBUG_LEVELS
public static final int DEBUG_ACK
public static final int DEBUG_DUPACK
public static final int DEBUG_SEND
public static final int DEBUG_TIMEOUT
public static final int DEBUG_RTT
public static final int DEBUG_SACK
public static final int DEBUG_SAMPLE
public static final int DEBUG_VEGAS
protected Port cwndPort
protected Port sstPort
protected Port srttPort
protected Port rttvarPort
protected Port seqNoPort
protected Port ackPort
protected int srtt_init
srtt_bits)
protected int rttvar_init
rttvar_bits)
protected double rtxcur_init
protected double t_grain
protected transient int t_srtt
srtt_bits)
protected transient int t_rttvar
rttvar_bits)
protected transient double t_rtxcur
protected transient int backoff
protected int srtt_bits
t_srtt.
protected int rttvar_bits
t_rttvar.
protected int rttvar_exp
t_rtxcur.
protected double maxrto
protected transient double cur_rtt
protected transient TCP.VegasVariables vegas
protected int TTL
protected int MSS
protected java.lang.String implementation
protected transient int CWND
protected int MAXCWND
protected transient int AWND
protected transient int sthld
protected transient long snd_una
protected transient long snd_nxt
protected transient long snd_nxt_recorded
protected transient long snd_nxt_marked
snd_nxt marked for NEW-RENO and SACK.
protected transient long snd_max
protected transient long dt_max
protected transient int dup_ack
protected transient long numack
protected transient CircularBuffer sbuffer
protected transient long bytesRetx
protected transient int numTimeouts
protected transient int burst
protected transient long last_seq
protected boolean SACK
protected boolean maxburst
protected transient LongSpace recvBuffer
public transient int state
| Constructor Detail |
public TCP()
public TCP(java.lang.String id_)
| Method Detail |
public java.lang.String[] getDebugLevelNames()
Component
getDebugLevelNames in class Componentpublic java.lang.String getName()
Component
getName in class Componentpublic void reset()
Component
reset in class Componentpublic void duplicate(java.lang.Object source_)
Component
duplicate in interface ObjectDuplicableduplicate in class Protocolprotected void _start()
_start in class Componentpublic int getState()
public void setPeer(long peer_)
public long getPeer()
drcl.inet.transport.Connection
getPeer in interface drcl.inet.transport.Connectionpublic void setTTL(int ttl)
public int getTTL()
public void setMSS(int mss)
public int getMSS()
public void setMAXCWND(int max_)
public int getMAXCWND()
public void setTick(double tick_)
public double getTick()
public void setSRTT_INIT(double v_)
public double getSRTT_INIT()
public void setRTTVAR_INIT(double v_)
public double getRTTVAR_INIT()
public void setBASERTT_INIT(double v_)
public double getBASERTT_INIT()
public void setMAXRTO(double v_)
public double getMAXRTO()
public long getNumBytesRetransmitted()
public int getNumTimeouts()
public void configureRTT(double tick_,
double srtt_init_,
double rttvar_init_,
double basertt_init_,
double maxrto_)
tick_ - time unit for RTT variables.srtt_init_ - initial value of srtt.rttvar_init_ - initial value of rttvar.basertt_init_ - initial value of baseRTT.maxrto_ - maximum retrx timeout.public void setImplementation(java.lang.String impl_)
public java.lang.String getImplementation()
public void setSackEnabled(boolean sack_)
public boolean isSackEnabled()
public void setMaxburstEnabled(boolean maxburst_)
public boolean isMaxburstEnabled()
protected void tcp_init()
protected void rtt_init()
protected void rtt_update(double now_,
double ts_)
ts_ - the sending time of the acknowledged packet.protected double rxt_timer(int t_backoff_)
protected void win_init()
protected int snd_wnd()
protected long seq_max()
protected void dataArriveAtUpPort(java.lang.Object data_,
Port upPort_)
Module
dataArriveAtUpPort in class Module
protected void dataArriveAtDownPort(java.lang.Object data_,
Port downPort_)
Module
dataArriveAtDownPort in class Moduleprotected void recv(TCPPacket pkt_)
protected void option_process(TCPPacket pkt_,
long seq_)
protected void win_increase()
protected void win_decrease(boolean timeout_)
protected void timer_backoff()
protected void timeout(java.lang.Object evt_)
Module
timeout in class ModuleModule.setTimeout(Object, double),
Module.setTimeoutAt(Object, double)protected void snd_maxpck(java.lang.String debugMsg_)
protected void snd_packet(long seqno_,
int size_)
protected void resetRXTTimer(double now_)
protected void ack_syn_fin(boolean ack_,
boolean syn_,
boolean fin_)
public int getLocalPort()
drcl.inet.transport.Connection
getLocalPort in interface drcl.inet.transport.Connectionpublic int getRemotePort()
drcl.inet.transport.Connection
getRemotePort in interface drcl.inet.transport.Connectionpublic long getLocalAddr()
drcl.inet.transport.Connection
getLocalAddr in interface drcl.inet.transport.Connectionprotected int getSeqNo()
protected int getAckNo()
protected int getAvailableRcvBuffer()
protected int getSendingBuffer()
public java.lang.String info()
Component
info in class Componentpublic java.lang.String configInfo()
|
J-Sim v1.2.1-p7 API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||