⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 utils.tcl

📁 diff serve for ns-2, work for version 2.29
💻 TCL
字号:
# Copyright (C) 2001-2006  Sergio Andreozzi## This file is part of DiffServ4NS, a set of improvements to# the Network Simulator 2 for DiffServ simulations.## Project page: http://diffserv4ns.sourceforge.net/## DiffServ4NS is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.## DiffServ4NS is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with DiffServ4NS; if not, write to the Free Software# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA# GNU License: http://www.gnu.org/licenses/gpl.txt#  SourceId     : source agent index#  SinkId       : sink   agent index#  src          : source node#  dst          : destination node#  flowId       : flow Id used by LossMonitor to compute parameters as OWD and IPDV#  PacketSize   : UDP packet size  (in bytes)#  Rate         : #  Start        :#  Stop         :proc cbr_connection {SourceId SinkId src dst flowId PacketSize Rate start stop} {        global ns Sink_        set udp_($SourceId) [new Agent/UDP]        $udp_($SourceId)    set class_ $flowId        $ns attach-agent $src $udp_($SourceId)        set cbr_($SourceId) [new Application/Traffic/CBR]        $cbr_($SourceId)    attach-agent $udp_($SourceId)        $cbr_($SourceId)    set packet_size_ $PacketSize        $udp_($SourceId)    set packetSize_  $PacketSize        $cbr_($SourceId)    set rate_ $Rate        if {($flowId == 1)} {                set Sink_($SinkId) [new Agent/LossMonitor]                $Sink_($SinkId) set flowid_ $flowId        } else {                set Sink_($SinkId) [new Agent/Null]        }        $ns attach-agent $dst  $Sink_($SinkId)        $ns connect $udp_($SourceId) $Sink_($SinkId)        $ns at $start "$cbr_($SourceId) start"        $ns at $stop  "$cbr_($SourceId) stop"}proc telnet_connection {id src dst inter start} {    global ns    set tcp_($id) [new Agent/TCP]    $tcp_($id) set class_ 2#    $tcp_($id) set packetSize_ 1500    set sink_($id) [new Agent/TCPSink]    $ns attach-agent $src $tcp_($id)    $ns attach-agent $dst $sink_($id)    set telnet_($id) [new Application/Telnet]      $telnet_($id) attach-agent $tcp_($id)    $telnet_($id) set interval $inter    $ns connect $tcp_($id) $sink_($id)    $ns at $start "$telnet_($id) start"   }proc ftp_connection {id src dst start} {    global ns    set tcp_($id) [new Agent/TCP]    $tcp_($id) set class_ 2#    $tcp_($id) set packetSize_ 1500    $ns attach-agent $src $tcp_($id)    set ftp_($id) [new Application/FTP]    $ftp_($id) attach-agent $tcp_($id)    set sink_($id) [new Agent/TCPSink]    $ns attach-agent $dst $sink_($id)    $ns connect $tcp_($id) $sink_($id)    $ns at $start "$ftp_($id) start"    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -