ns2.35中的IEEE802.11e模块移植

ns2.35中IEEE802.11e模块的移植指南
本文档详细介绍了如何将原本在ns2.88上的802.11e模块移植到ns2.35。主要涉及对3个.cc文件的修改,包括删除不兼容的头文件引用,并添加必要内容。已提供补丁详情,以帮助用户成功完成移植工作。

关于IEEE802.11e的内容就不多说了,直接开始移植工作。

之前的802.11e模块主要是在ns2.88上开发的,不能直接在ns2.35上使用,下面就给出移植的补丁。

根据我做的补丁对ns2.35进行修改,能够顺利运行,补丁内容如下:

diff -u -r ns-2.35-original/common/packet.h ns-2.35/common/packet.h
--- ns-2.35-original/common/packet.h	2010-05-10 06:28:41.000000000 +0800
+++ ns-2.35/common/packet.h	2013-08-09 10:21:44.493171279 +0800
@@ -69,6 +69,7 @@
 #define HDR_CDIFF(p)    (hdr_cdiff::access(p))  /* chalermak's diffusion*/
 //#define HDR_DIFF(p)     (hdr_diff::access(p))  /* SCADD's diffusion ported into ns */
 #define HDR_LMS(p)		(hdr_lms::access(p))
+#define HDR_MAC802_11E(p) ((hdr_mac802_11e *)hdr_mac::access(p))
 
 /* --------------------------------------------------------------------*/
 
diff -u -r ns-2.35-original/mac/wireless-phy.h ns-2.35/mac/wireless-phy.h
--- ns-2.35-original/mac/wireless-phy.h	2007-01-30 13:00:50.000000000 +0800
+++ ns-2.35/mac/wireless-phy.h	2013-08-09 10:19:48.184594542 +0800
@@ -127,7 +127,7 @@
 	// Why phy has a node_ and this guy has it all over again??
 //  	MobileNode* node_;         	// Mobile Node to which interface is attached .
 
- 	enum ChannelStatus { SLEEP, IDLE, RECV, SEND };	
+ 	enum ChannelStatus { SLEEP, IDLE, RECV, SEND, RECVING, SENDING};	
 	bool node_on_; // on-off status of this node
 	Sleep_Timer sleep_timer_;
 	int status_;
diff -u -r ns-2.35-original/Makefile.in ns-2.35/Makefile.in
--- ns-2.35-original/Makefile.in	2011-10-24 00:29:54.000000000 +0800
+++ ns-2.35/Makefile.in	2013-08-09 10:12:30.722425277 +0800
@@ -72,7 +72,7 @@
 	-I./diffusion3/lib/nr -I./diffusion3/ns \
 	-I./diffusion3/filter_core -I./asim/ -I./qs \
 	-I./diffserv -I./satellite \
-	-I./wpan
+	-I./wpan -I./mac/802_11e
 
 
 LIB	= \
@@ -333,6 +333,8 @@
 	wpan/p802_15_4sscs.o wpan/p802_15_4timer.o \
 	wpan/p802_15_4trace.o wpan/p802_15_4transac.o \
 	apps/pbc.o \
+        mac/802_11e/mac-802_11e.o mac/802_11e/priq.o \
+        mac/802_11e/d-tail.o mac/802_11e/mac-timers_802_11e.o \
 	@V_STLOBJ@
 
 
@@ -524,6 +526,7 @@
 	tcl/lib/ns-srcrt.tcl \
 	tcl/mcast/ns-lms.tcl \
 	tcl/lib/ns-qsnode.tcl \
+	mac/802_11e/priority.tcl \
 	@V_NS_TCL_LIB_STL@
 
 $(GEN_DIR)ns_tcl.cc: $(NS_TCL_LIB)
diff -u -r ns-2.35-original/tcl/lan/ns-mac.tcl ns-2.35/tcl/lan/ns-mac.tcl
--- ns-2.35-original/tcl/lan/ns-mac.tcl	2005-05-26 05:19:44.000000000 +0800
+++ ns-2.35/tcl/lan/ns-mac.tcl	2013-08-09 10:18:23.720175700 +0800
@@ -81,6 +81,24 @@
 	Mac/Multihop set hlen_ 16
 }
 
+if [TclObject is-class Mac/802_11e] {
+	Mac/802_11e set delay_ 64us
+	Mac/802_11e set ifs_ 16us
+	Mac/802_11e set slotTime_ 16us
+	Mac/802_11e set cwmin_ 16
+	Mac/802_11e set cwmax_ 1024
+	Mac/802_11e set rtxLimit_ 16
+	Mac/802_11e set bssId_ -1
+	Mac/802_11e set sifs_ 8us
+	Mac/802_11e set pifs_ 12us
+	Mac/802_11e set difs_ 16us
+	Mac/802_11e set rtxAckLimit_ 1
+	Mac/802_11e set rtxRtsLimit_ 3
+        Mac/802_11e set basicRate_ 1Mb  ;# set this to 0 if want to use bandwidth_ for 
+        Mac/802_11e set dataRate_ 1Mb   ;# both control and data pkts
+	Mac/802_11e set cfb_ 0 ;# disables CFB
+}
+
 # The MAC classifier (to demux incoming packets to the correct LL object)
 Mac instproc classify-macs {peerinfo} {
 	set peerlabel [lindex $peerinfo 0]
diff -u -r ns-2.35-original/tcl/lib/ns-default.tcl ns-2.35/tcl/lib/ns-default.tcl
--- ns-2.35-original/tcl/lib/ns-default.tcl	2010-07-04 06:45:45.000000000 +0800
+++ ns-2.35/tcl/lib/ns-default.tcl	2013-08-09 10:14:37.759055213 +0800
@@ -1590,3 +1590,19 @@
 
 Agent/MDART set macFailed_ true
 Agent/MDART set etxMetric_ true
+
+Queue/DTail set drop_front_ false
+Queue/DTail set summarystats_ false
+Queue/DTail set queue_in_bytes_ false
+Queue/DTail set mean_pktsize_ 500
+Queue/DTail/PriQ set Prefer_Routing_Protocols    1
+Queue/DTail/PriQ set Max_Levels   4 
+Queue/DTail/PriQ set Levels    4	
+Mac/802_11e set SlotTime_      0.000020    ;# 20us
+Mac/802_11e set SIFS_          0.000010    ;# 10us
+Mac/802_11e set PreambleLength_        144 ;# 144 bit
+Mac/802_11e set PLCPHeaderLength_      48  ;# 48 bits
+Mac/802_11e set PLCPDataRate_  1.0e6       ;# 1Mbps	       
+Mac/802_11e set RTSThreshold_  3000        ;# bytes
+Mac/802_11e set ShortRetryLimit_       7   ;# retransmittions
+Mac/802_11e set LongRetryLimit_        4   ;# retransmissions
diff -u -r ns-2.35-original/tcl/lib/ns-lib.tcl ns-2.35/tcl/lib/ns-lib.tcl
--- ns-2.35-original/tcl/lib/ns-lib.tcl	2010-05-10 06:28:41.000000000 +0800
+++ ns-2.35/tcl/lib/ns-lib.tcl	2013-08-09 10:13:38.762762677 +0800
@@ -194,6 +194,7 @@
 source ../mobility/dsdv.tcl
 source ../mobility/dsr.tcl
 source ../mobility/com.tcl
+source ../../mac/802_11e/priority.tcl
 
 source ../plm/plm.tcl
 source ../plm/plm-ns.tcl
diff -u -r ns-2.35-original/tcl/lib/ns-mobilenode.tcl ns-2.35/tcl/lib/ns-mobilenode.tcl
--- ns-2.35-original/tcl/lib/ns-mobilenode.tcl	2009-01-15 14:23:49.000000000 +0800
+++ ns-2.35/tcl/lib/ns-mobilenode.tcl	2013-08-09 10:10:50.577928693 +0800
@@ -452,6 +452,9 @@
 	#
 	$ifq target $mac
 	$ifq set limit_ $qlen
+	if {$qtype == "Queue/DTail/PriQ" } {
+		priority ifq
+        }
 	if {$imepflag != ""} {
 		set drpT [$self mobility-trace Drop "IFQ"]
 	} else {
@@ -493,12 +496,15 @@
 	}
 
 	set god_ [God instance]
-    if {$mactype == "Mac/802_11Ext"} {
+    	if {$mactype == "Mac/802_11Ext"} {
 		$mac nodes [$god_ num_nodes]
 	}
-    if {$mactype == "Mac/802_11"} {
+    	if {$mactype == "Mac/802_11"} {
 		$mac nodes [$god_ num_nodes]
 	}
+        if {$mactype == "Mac/802_11e"} {
+ 		$mac nodes [$god_ num_nodes]
+ 	}
 	#
 	# Network Interface
 	#

 

注意:由于我不知道如何上传压缩包(没找到地方上传),对于模块的修改在此说明一下。

修改的内容主要是3个.cc的文件,需要删去“#include "iostream.h"、“#include “stream.h””,并增加:

#include <iostream>
using namespace std;

 

参考文献
[1]IEEE802.11e for the ns-2 simulator.http://sourceforge.net/projects/ieee80211e-ns2/files/IEEE%20802.11e%20EDCA%20for%20ns2.28/

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值