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

📄 ns-mac.tcl

📁 CBRP协议(移动adhoc中基于分簇的路由协议)ns2下的源码
💻 TCL
字号:
## Copyright (c) 1997 Regents of the University of California.# All rights reserved.# # Redistribution and use in source and binary forms, with or without# modification, are permitted provided that the following conditions# are met:# 1. Redistributions of source code must retain the above copyright#    notice, this list of conditions and the following disclaimer.# 2. Redistributions in binary form must reproduce the above copyright#    notice, this list of conditions and the following disclaimer in the#    documentation and/or other materials provided with the distribution.# 3. All advertising materials mentioning features or use of this software#    must display the following acknowledgement:# 	This product includes software developed by the Daedalus Research#       Group at the University of California, Berkeley.# 4. Neither the name of the University nor of the research group#    may be used to endorse or promote products derived from this software #    without specific prior written permission.## THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF# SUCH DAMAGE.## Contributed by the Daedalus Research Group, http://daedalus.cs.berkeley.edu##default channel propagation delay (for a LAN)Channel set delay_ 4us#default bandwidth settingMac set bandwidth_ 1.5MbMac set hlen_ 0Mac set label_ 0# WaveLAN settings (also inherited by Csma/Ca, which is what WaveLAN is)Mac/Csma set bandwidth_ 2MbMac/Csma set hlen_ 20Mac/Csma set delay_ 64usMac/Csma set ifs_ 16usMac/Csma set slotTime_ 16usMac/Csma set cwmin_ 16Mac/Csma set cwmax_ 1024Mac/Csma set rtxLimit_ 16# 10 Mbps Ethernet settingsMac/Csma/Cd set bandwidth_ 10MbMac/Csma/Cd set ifs_ 52usMac/Csma/Cd set slotTime_ 52usMac/Csma/Cd set cwmin_ 1# IEEE 802.11 MAC settingsif [TclObject is-class Mac/802_11] {Mac/802_11 set hlen_ 20Mac/802_11 set delay_ 64usMac/802_11 set ifs_ 16usMac/802_11 set slotTime_ 16usMac/802_11 set cwmin_ 16Mac/802_11 set cwmax_ 1024Mac/802_11 set rtxLimit_ 16Mac/802_11 set bssid_ -1Mac/802_11 set sifs_ 8usMac/802_11 set pifs_ 12usMac/802_11 set difs_ 16usMac/802_11 set rtxAckLimit_ 1Mac/802_11 set rtxRtsLimit_ 3}# Multihop wireless MAC modeled after Metricom's Ricochetif [TclObject is-class Mac/Multihop] {Mac/Multihop set bandwidth_ 100KbMac/Multihop set delay_ 10msMac/Multihop set tx_rx_ 11.125msMac/Multihop set rx_tx_ 13.25msMac/Multihop set rx_rx_ 10.5625Mac/Multihop set backoffBase_ 20msMac/Multihop set hlen_ 16}# The MAC classifier (to demux incoming packets to the correct LL object)Mac instproc classify-macs {peerinfo} {	set peerlabel [lindex $peerinfo 0]	set peerll [lindex $peerinfo 1]	$self instvar mclass_	set mclass_ [new Classifier/Mac]	$mclass_ install $peerlabel $peerll	$self target $mclass_}# XXX this belongs in ns-node.tcl# Hook up the MACs together at a given NodeNode instproc addmac {mac} { 	$self instvar machead_ mactail_	if ![info exists mactail_] {		set mactail_ [set machead_ $mac]		$mac maclist $mactail_	} else {		$mactail_ maclist $mac		$mac maclist $machead_		set mactail_ $mac	}}

⌨️ 快捷键说明

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