test-suite-ecn-ack.tcl
来自「一款用来进行网络模拟的软件」· TCL 代码 · 共 667 行 · 第 1/2 页
TCL
667 行
Class Test/ecn_ack_fulltcp -superclass TestSuiteTest/ecn_ack_fulltcp instproc init {} { $self instvar net_ test_ Queue/RED set setbit_ true set net_ net2-lossy Agent/TCP set bugFix_ true set test_ ecn_ack_fulltcp $self next}Test/ecn_ack_fulltcp instproc run {} { global quiet wrap wrap1 $self instvar ns_ $self setTopo set wrap $wrap1 $self ecnsetup FullTcpSack1 $self drop_pkt 20000 $ns_ run}######################################################################## SYN/ACK Packets ######################################################################### No SYN packets dropped or marked.Class Test/synack -superclass TestSuiteTest/synack instproc init {} { $self instvar net_ test_ guide_ set net_ net2-lossy set test_ synack_ set guide_ "No SYN packets dropped or marked." Agent/TCPSink set ecn_syn_ false $self next pktTraceFile}Test/synack instproc run {} { global quiet $self instvar ns_ guide_ node_ guide_ testName_ puts "Guide: $guide_" Agent/TCP set ecn_ 1 Agent/TCP set window_ 8 $self setTopo # Set up forward TCP connection set tcp1 [$ns_ create-connection TCP $node_(s1) TCPSink $node_(s4) 0] $tcp1 set window_ 8 set ftp1 [$tcp1 attach-app FTP] $ns_ at 0.00 "$ftp1 produce 20" $self drop_pkt 1000 $self tcpDump $tcp1 5.0 $ns_ at 10.0 "$self cleanupAll $testName_" $ns_ run}# Full TCP, no SYN packets dropped or marked.Class Test/synack_fulltcp -superclass TestSuiteTest/synack_fulltcp instproc init {} { $self instvar net_ test_ guide_ set net_ net2-lossy set test_ synack_fulltcp_ set guide_ "Full TCP, no SYN packets dropped or marked." Agent/TCPSink set ecn_syn_ false $self next pktTraceFile}Test/synack_fulltcp instproc run {} { global quiet wrap wrap1 $self instvar ns_ guide_ node_ guide_ testName_ puts "Guide: $guide_" Agent/TCP set ecn_ 1 Agent/TCP set window_ 8 $self setTopo # Set up forward TCP connection set wrap $wrap1 set tcp1 [new Agent/TCP/FullTcp/Sack] set sink [new Agent/TCP/FullTcp/Sack] $ns_ attach-agent $node_(s1) $tcp1 $ns_ attach-agent $node_(s4) $sink $tcp1 set fid_ 0 $sink set fid_ 0 $ns_ connect $tcp1 $sink $sink listen ; # will figure out who its peer is set ftp1 [$tcp1 attach-app FTP] $ns_ at 0.00 "$ftp1 produce 5" set ftp2 [$sink attach-app FTP] $ns_ at 0.03 "$ftp2 produce 20" $self drop_pkt 1000 $self tcpDump $tcp1 5.0 $ns_ at 10.0 "$self cleanupAll $testName_" $ns_ run}# SYN packet dropped.Class Test/synack0 -superclass TestSuiteTest/synack0 instproc init {} { $self instvar net_ test_ guide_ set net_ net2-lossy set test_ synack0_ set guide_ "SYN packet dropped." Agent/TCPSink set ecn_syn_ false $self next pktTraceFile}Test/synack0 instproc run {} { global quiet $self instvar ns_ guide_ node_ guide_ testName_ puts "Guide: $guide_" Agent/TCP set ecn_ 1 Agent/TCP set window_ 8 $self setTopo # Set up forward TCP connection set tcp1 [$ns_ create-connection TCP $node_(s1) TCPSink $node_(s4) 0] $tcp1 set window_ 8 set ftp1 [$tcp1 attach-app FTP] $ns_ at 0.00 "$ftp1 produce 20" $self drop_pkt 1 $self tcpDump $tcp1 5.0 $ns_ at 10.0 "$self cleanupAll $testName_" $ns_ run}# SYN packet dropped, old parameters for RTO.Class Test/synack0A -superclass TestSuiteTest/synack0A instproc init {} { $self instvar net_ test_ guide_ set net_ net2-lossy set test_ synack0A_ set guide_ "SYN packet dropped, old parameters for RTO." Agent/TCPSink set ecn_syn_ false Agent/TCP set rtxcur_init_ 6.0 Agent/TCP set updated_rttvar_ false Test/synack0A instproc run {} [Test/synack0 info instbody run ] $self next pktTraceFile}# SYN/ACK packet dropped.Class Test/synack1 -superclass TestSuiteTest/synack1 instproc init {} { $self instvar net_ test_ guide_ set net_ net2A-lossy set test_ synack1_ set guide_ "SYN/ACK packet dropped." Agent/TCPSink set ecn_syn_ false $self next pktTraceFile}Test/synack1 instproc run {} { global quiet $self instvar ns_ guide_ node_ guide_ testName_ puts "Guide: $guide_" Agent/TCP set ecn_ 1 $self setTopo # Set up forward TCP connection set tcp1 [$ns_ create-connection TCP $node_(s1) TCPSink $node_(s4) 0] $tcp1 set window_ 8 set ftp1 [$tcp1 attach-app FTP] $ns_ at 0.00 "$ftp1 produce 20" $self drop_pkt 1 $self tcpDump $tcp1 5.0 $ns_ at 5.0 "$self cleanupAll $testName_" $ns_ run}# SYN/ACK packet dropped, FullTCPClass Test/synack1_fulltcp -superclass TestSuiteTest/synack1_fulltcp instproc init {} { $self instvar net_ test_ guide_ set net_ net2A-lossy set test_ synack1_fulltcp_ set guide_ "SYN/ACK packet dropped, FullTCP." Agent/TCPSink set ecn_syn_ false $self next pktTraceFile}Test/synack1_fulltcp instproc run {} { global quiet wrap wrap1 $self instvar ns_ guide_ node_ guide_ testName_ puts "Guide: $guide_" Agent/TCP set ecn_ 1 Agent/TCP set window_ 8 $self setTopo # Set up forward TCP connection set wrap $wrap1 set tcp1 [new Agent/TCP/FullTcp/Sack] set sink [new Agent/TCP/FullTcp/Sack] $ns_ attach-agent $node_(s1) $tcp1 $ns_ attach-agent $node_(s4) $sink $tcp1 set fid_ 0 $sink set fid_ 0 $ns_ connect $tcp1 $sink $sink listen ; # will figure out who its peer is set ftp1 [$tcp1 attach-app FTP] $ns_ at 0.00 "$ftp1 produce 5" set ftp2 [$sink attach-app FTP] $ns_ at 0.03 "$ftp2 produce 20" $self drop_pkt 1 $self tcpDump $tcp1 5.0 $ns_ at 5.0 "$self cleanupAll $testName_" $ns_ run}# SYN/ACK packet marked.Class Test/synack2 -superclass TestSuiteTest/synack2 instproc init {} { $self instvar net_ test_ guide_ set net_ net2A-lossy set test_ synack2_ set guide_ "SYN/ACK packet marked." Agent/TCPSink set ecn_syn_ true $self next pktTraceFile}Test/synack2 instproc run {} { global quiet $self instvar ns_ guide_ node_ guide_ testName_ puts "Guide: $guide_" Agent/TCP set ecn_ 1 Agent/TCP set window_ 8 $self setTopo # Set up forward TCP connection set tcp1 [$ns_ create-connection TCP $node_(s1) TCPSink $node_(s4) 0] $tcp1 set window_ 8 set ftp1 [$tcp1 attach-app FTP] $ns_ at 0.00 "$ftp1 produce 20" $self mark_pkt 1 # $self mark_pkt 10 $self tcpDump $tcp1 5.0 $ns_ at 2.0 "$self cleanupAll $testName_" $ns_ run}Class Test/synack2_fulltcp -superclass TestSuiteTest/synack2_fulltcp instproc init {} { $self instvar net_ test_ guide_ set net_ net2A-lossy set test_ synack2_fulltcp_ set guide_ "SYN/ACK packet marked, FullTCP." Agent/TCPSink set ecn_syn_ true Agent/TCP/FullTcp set ecn_syn_ true $self next pktTraceFile}Test/synack2_fulltcp instproc run {} { global quiet wrap wrap1 $self instvar ns_ guide_ node_ guide_ testName_ puts "Guide: $guide_" Agent/TCP set ecn_ 1 $self setTopo # Set up forward TCP connection set wrap $wrap1 set tcp1 [new Agent/TCP/FullTcp/Sack] set sink [new Agent/TCP/FullTcp/Sack] $ns_ attach-agent $node_(s1) $tcp1 $ns_ attach-agent $node_(s4) $sink $tcp1 set fid_ 0 $sink set fid_ 0 $ns_ connect $tcp1 $sink $sink listen ; # will figure out who its peer is set ftp1 [$tcp1 attach-app FTP] $ns_ at 0.00 "$ftp1 produce 5" set ftp2 [$sink attach-app FTP] $ns_ at 0.03 "$ftp2 produce 20" $self mark_pkt 1 # $self mark_pkt 10 $self tcpDump $tcp1 5.0 $ns_ at 2.0 "$self cleanupAll $testName_" $ns_ run}Class Test/synack2a_fulltcp -superclass TestSuiteTest/synack2a_fulltcp instproc init {} { $self instvar net_ test_ guide_ set net_ net2A-lossy set test_ synack2a_fulltcp_ set guide_ "SYN/ACK packet marked, FullTCP, wait." Agent/TCPSink set ecn_syn_ true Agent/TCP/FullTcp set ecn_syn_ true Agent/TCP/FullTcp set ecn_syn_wait_ true $self next pktTraceFile}Test/synack2a_fulltcp instproc run {} { global quiet wrap wrap1 $self instvar ns_ guide_ node_ guide_ testName_ puts "Guide: $guide_" Agent/TCP set ecn_ 1 $self setTopo # Set up forward TCP connection set wrap $wrap1 set tcp1 [new Agent/TCP/FullTcp/Sack] set sink [new Agent/TCP/FullTcp/Sack] $ns_ attach-agent $node_(s1) $tcp1 $ns_ attach-agent $node_(s4) $sink $tcp1 set fid_ 0 $sink set fid_ 0 $ns_ connect $tcp1 $sink $sink listen ; # will figure out who its peer is set ftp1 [$tcp1 attach-app FTP] $ns_ at 0.00 "$ftp1 produce 5" set ftp2 [$sink attach-app FTP] $ns_ at 0.03 "$ftp2 produce 20" $self mark_pkt 1 # $self mark_pkt 10 $self tcpDump $tcp1 5.0 $ns_ at 2.0 "$self cleanupAll $testName_" $ns_ run}# time 0: SYN packet sent by A# time 0.027277: SYN/ACK packet sent by B# time 0.032309: SYN/ACK packet marked# time 0.054555: ACK packet sent by A# time 0.054555: two request data packets sent by A# time 0.08558: ACK packets sent from B# time 0.112858: three data packets sent by A# time 0.146923: ACK packets sent by B# time 0.231832: data packets sent by BTestSuite runTest# E: Congestion Experienced in IP header.# N: ECN-Capable-Transport (ECT) in IP header.# C: ECN-Echo in TCP header.# A: Congestion Window Reduced (CWR) in TCP header.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?