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

📄 ns-2.28-aodv-uu-0.9.1.patch

📁 aodv2003 在linux上的实现 很好
💻 PATCH
📖 第 1 页 / 共 2 页
字号:
diff -uprN ns-2.28.orig/common/packet.h ns-2.28/common/packet.h--- ns-2.28.orig/common/packet.h	2005-01-19 19:23:18.000000000 +0100+++ ns-2.28/common/packet.h	2005-05-20 15:44:18.059988224 +0200@@ -163,6 +163,11 @@ enum packet_t { 	// XCP packet 	PT_XCP, +#ifdef AODV_UU+        // AODV packets in AODV-UU+        PT_AODVUU,+#endif /* AODV_UU */+ 	// insert new packet types here 	PT_NTYPE // This MUST be the LAST one };@@ -252,6 +257,10 @@ public: 		 		// smac 		name_[PT_SMAC]="smac";+#ifdef AODV_UU+                // AODV packets in AODV-UU+                name_[PT_AODVUU] = "AODVUU";+#endif /* AODV_UU */  		name_[PT_XCP]="xcp"; diff -uprN ns-2.28.orig/mac/wireless-phy.h~ ns-2.28/mac/wireless-phy.h~--- ns-2.28.orig/mac/wireless-phy.h~	2005-01-26 22:58:52.000000000 +0100+++ ns-2.28/mac/wireless-phy.h~	1970-01-01 01:00:00.000000000 +0100@@ -1,135 +0,0 @@-/* -*-	Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*-  *- *- * 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 Computer Systems- *	Engineering Group at Lawrence Berkeley Laboratory.- * 4. Neither the name of the University nor of the Laboratory 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.- *- * $Header: /nfs/jade/vint/CVSROOT/ns-2/mac/wireless-phy.h,v 1.12 2003/11/19 00:41:44 haldar Exp $- *- * Ported from CMU/Monarch's code, nov'98 -Padma Haldar.- *- * wireless-phy.h- * -- a SharedMedia network interface- */--#ifndef ns_WirelessPhy_h-#define ns_WirelessPhy_h--#include "propagation.h"-#include "modulation.h"-#include "omni-antenna.h"-#include "phy.h"-#include "mobilenode.h"-#include "timer-handler.h"--class Phy;-class Propagation;-class WirelessPhy;--// For idle energy consumption -- Chalermek--class Idle_Timer : public TimerHandler {- public:-	Idle_Timer(WirelessPhy *a) : TimerHandler() { a_ = a; }- protected:-	virtual void expire(Event *e);-	WirelessPhy *a_;-};--class WirelessPhy : public Phy {-public:-	WirelessPhy();-	-	void sendDown(Packet *p);-	int sendUp(Packet *p);-	-	inline double getL() const {return L_;}-	inline double getLambda() const {return lambda_;}-	inline Node* node(void) const { return node_; }-	inline double getPtconsume() { return Pt_consume_; }--	double getDist(double Pr, double Pt, double Gt, double Gr, double hr,-		       double ht, double L, double lambda);-  -	virtual int command(int argc, const char*const* argv);-	virtual void dump(void) const;-	-	//void setnode (MobileNode *node) { node_ = node; }-	void node_on();-	void node_off();	--        /* -NEW- */-        inline double getAntennaZ() { return ant_->getZ(); }-        inline double getPt() { return Pt_; }-        inline double getRXThresh() { return RXThresh_; }-        inline double getCSThresh() { return CSThresh_; }-        inline double getFreq() { return freq_; }-        /* End -NEW- */--protected:-	double Pt_;		// transmitted signal power (W)-	double Pt_consume_;	// power consumption for transmission (W)-	double Pr_consume_;	// power consumption for reception (W)-	double P_idle_;         // idle power consumption (W)-	double last_send_time_;	// the last time the node sends somthing.-	double channel_idle_time_;	// channel idle time.-	double update_energy_time_;	// the last time we update energy.--	double freq_;           // frequency-	double lambda_;		// wavelength (m)-	double L_;		// system loss factor-  -	double RXThresh_;	// receive power threshold (W)-	double CSThresh_;	// carrier sense threshold (W)-	double CPThresh_;	// capture threshold (db)-  -	Antenna *ant_;-	Propagation *propagation_;	// Propagation Model-	Modulation *modulation_;	// Modulation Schem--	// Why phy has a node_ and this guy has it all over again??-//  	MobileNode* node_;         	// Mobile Node to which interface is attached .--	Idle_Timer idle_timer_;-	-	enum ChannelStatus { IDLE, RECV, SEND };-	int status_;-private:-	inline int initialized() {-		return (node_ && uptarget_ && downtarget_ && propagation_);-	}-	void UpdateIdleEnergy();-	// Convenience method-	EnergyModel* em() { return node()->energy_model(); }--	friend class Idle_Timer;-};--#endif /* !ns_WirelessPhy_h */diff -uprN ns-2.28.orig/Makefile.in ns-2.28/Makefile.in--- ns-2.28.orig/Makefile.in	2005-01-25 23:27:16.000000000 +0100+++ ns-2.28/Makefile.in	2005-05-20 15:45:40.156824444 +0200@@ -52,13 +52,22 @@ PERL	= @PERL@ # for diffusion #DIFF_INCLUDES = "./diffusion3/main ./diffusion3/lib ./diffusion3/nr ./diffusion3/ns" +# AODV-UU: Name of subdirectory with AODV-UU files,+# usually a symlink to the AODV-UU sources. If you change this,+# ~ns/trace/cmu-trace.cc must be updated as well.+AODV_UU_DIR = aodv-uu+AODV_UU_LIB = libaodv-uu.a+ CCOPT	= @V_CCOPT@ STATIC	= @V_STATIC@ LDFLAGS	= $(STATIC) LDOUT	= -o $(BLANK) -DEFINE	= -DTCP_DELAY_BIND_ALL -DNO_TK @V_DEFINE@ @V_DEFINES@ @DEFS@ -DNS_DIFFUSION -DSMAC_NO_SYNC -DCPP_NAMESPACE=@CPP_NAMESPACE@ -DUSE_SINGLE_ADDRESS_SPACE -Drng_test+# AODV-UU: Added "-DAODV_UU" and "-DNS_PORT" to enable AODV-UU+DEFINE	= -DTCP_DELAY_BIND_ALL -DNO_TK @V_DEFINE@ @V_DEFINES@ @DEFS@ -DNS_DIFFUSION -DSMAC_NO_SYNC -DCPP_NAMESPACE=@CPP_NAMESPACE@ -DUSE_SINGLE_ADDRESS_SPACE -Drng_test -DAODV_UU -DNS_PORT +# AODV-UU: Added -I for AODV-UU directory, to allow custom-generated+# endian.h to be found on systems which lack it. INCLUDES = \ 	-I. @V_INCLUDE_X11@ \ 	@V_INCLUDES@ \@@ -69,14 +78,17 @@ INCLUDES = \ 	-I./diffusion3/lib/nr -I./diffusion3/ns \ 	-I./diffusion3/filter_core -I./asim/ -I./qs \ 	-I./diffserv \-	-I./wpan+	-I./wpan \+	-I./$(AODV_UU_DIR) \   LIB	= \ 	@V_LIBS@ \ 	@V_LIB_X11@ \ 	@V_LIB@ \-	-lm @LIBS@+	-lm @LIBS@ \+	-L$(AODV_UU_DIR) \+	-laodv-uu \ #	-L@libdir@ \  CFLAGS	= $(CCOPT) $(DEFINE)@@ -358,11 +370,20 @@ BUILD_NSE = @build_nse@  all: $(NS) $(BUILD_NSE) all-recursive +# AODV-UU: Added phony targets for AODV-UU+.PHONY: aodv-uu-clean++$(AODV_UU_DIR)/$(AODV_UU_LIB):+	cd $(AODV_UU_DIR) && $(MAKE) $(AODV_UU_LIB) NS_DEFS='$(DEFINE)' OPTS='$(CCOPT)' NS_INC='$(subst -I.,-I$(shell pwd),$(INCLUDES))'++aodv-uu-clean:+	cd $(AODV_UU_DIR) && $(MAKE) clean  all-recursive: 	for i in $(SUBDIRS); do ( cd $$i; $(MAKE) all; ) done -$(NS): $(OBJ) common/tclAppInit.o Makefile+# AODV-UU: Added "aodv-uu" as first dependency+$(NS):  $(AODV_UU_DIR)/$(AODV_UU_LIB) $(OBJ) common/tclAppInit.o Makefile 	$(LINK) $(LDFLAGS) $(LDOUT)$@ \ 		common/tclAppInit.o $(OBJ) $(LIB) @@ -487,7 +508,7 @@ install-man: force install-recursive: force 	for i in $(SUBDIRS); do ( cd $$i; $(MAKE) install; ) done -clean:+clean: aodv-uu-clean dsruu-clean 	$(RM) $(CLEANFILES)  AUTOCONF_GEN = tcl/lib/ns-autoconf.tcldiff -uprN ns-2.28.orig/queue/priqueue.cc ns-2.28/queue/priqueue.cc--- ns-2.28.orig/queue/priqueue.cc	2005-01-25 23:38:47.000000000 +0100+++ ns-2.28/queue/priqueue.cc	2005-05-20 15:44:39.037880685 +0200@@ -92,7 +92,11 @@ PriQueue::recv(Packet *p, Handler *h)                 case PT_AODV:                         recvHighPriority(p, h);                         break;-+#ifdef AODV_UU+                case PT_AODVUU:+                        recvHighPriority(p, h);+                        break;+#endif /* AODV_UU */                 default:                         Queue::recv(p, h);                 }diff -uprN ns-2.28.orig/tcl/lib/ns-agent.tcl ns-2.28/tcl/lib/ns-agent.tcl--- ns-2.28.orig/tcl/lib/ns-agent.tcl	2005-01-19 19:23:37.000000000 +0100+++ ns-2.28/tcl/lib/ns-agent.tcl	2005-05-20 15:44:39.049878908 +0200@@ -192,3 +192,10 @@ Agent/AODV instproc init args { Agent/AODV set sport_   0 Agent/AODV set dport_   0 +# AODV-UU routing agent+Agent/AODVUU instproc init args {+    $self next $args+}++Agent/AODVUU set sport_   0+Agent/AODVUU set dport_   0diff -uprN ns-2.28.orig/tcl/lib/ns-default.tcl ns-2.28/tcl/lib/ns-default.tcl--- ns-2.28.orig/tcl/lib/ns-default.tcl	2005-01-19 19:23:37.000000000 +0100+++ ns-2.28/tcl/lib/ns-default.tcl	2005-05-20 15:44:39.050878760 +0200@@ -1343,3 +1343,19 @@ Queue set util_records_ 0 # Quick Start definitions end here  Delayer set debug_ false++# AODV-UU routing agent+Agent/AODVUU set unidir_hack_ 0+Agent/AODVUU set rreq_gratuitous_ 0+Agent/AODVUU set expanding_ring_search_ 1+Agent/AODVUU set local_repair_ 0+Agent/AODVUU set receive_n_hellos_ 0+Agent/AODVUU set hello_jittering_ 0+Agent/AODVUU set wait_on_reboot_ 0+Agent/AODVUU set debug_ 0+Agent/AODVUU set rt_log_interval_ 0+Agent/AODVUU set log_to_file_ 0+Agent/AODVUU set optimized_hellos_ 0+Agent/AODVUU set ratelimit_ 1+Agent/AODVUU set llfeedback_ 1+Agent/AODVUU set internet_gw_mode_ 0diff -uprN ns-2.28.orig/tcl/lib/ns-lib.tcl ns-2.28/tcl/lib/ns-lib.tcl--- ns-2.28.orig/tcl/lib/ns-lib.tcl	2005-01-24 21:03:43.000000000 +0100+++ ns-2.28/tcl/lib/ns-lib.tcl	2005-05-20 15:44:39.064876686 +0200@@ -597,9 +597,16 @@ Simulator instproc create-wireless-node  	    DSR { 		    $self at 0.0 "$node start-dsr" 	    }+	    DSRUU {+		    $self at 0.0 "$node start-dsr"+	    } 	    AODV { 		    set ragent [$self create-aodv-agent $node] 	    }+	    # AODV-UU routing agent+	    AODVUU {+		    $self at 0.0 "$node start-aodv"+	    } 	    TORA { 		    Simulator set IMEPFlag_ ON 		    set ragent [$self create-tora-agent $node]@@ -652,7 +659,7 @@ Simulator instproc create-wireless-node  	    $ifqType_ $ifqlen_ $phyType_ $antType_ $topoInstance_ \ 			$inerrProc_ $outerrProc_ $FECProc_ 	# Attach agent-	if {$routingAgent_ != "DSR"} {+	if {$routingAgent_ != "DSR" && $routingAgent_ != "DSRUU" && $routingAgent_ != "AODVUU"} { 		$node attach $ragent [Node set rtagent_port_] 	} 	if {$routingAgent_ == "DIFFUSION/RATE" ||@@ -672,7 +679,7 @@ Simulator instproc create-wireless-node  	# Bind routing agent and mip agent if existing basestation  	# address setting         if { [info exist wiredRouting_] && $wiredRouting_ == "ON" } {-		if { $routingAgent_ != "DSR" } {+		if { $routingAgent_ != "DSR" && $routingAgent_ != "DSRUU" && $routingAgent_ != "AODVUU"} { 			$node mip-call $ragent 		} 	}@@ -721,10 +728,14 @@ Simulator instproc create-wireless-node  Simulator instproc create-node-instance args { 	$self instvar routingAgent_ 	# DSR is a special case-	if {$routingAgent_ == "DSR"} {+	if {$routingAgent_ == "DSR" || $routingAgent_ == "DSRUU"} { 		set nodeclass [$self set-dsr-nodetype] 	} else {-		set nodeclass Node/MobileNode+		if { $routingAgent_ == "AODVUU"} {+			set nodeclass Node/MobileNode/AODVNode+		} else {+			set nodeclass Node/MobileNode+		}

⌨️ 快捷键说明

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