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

📄 umts.patch

📁 对ns2软件进行UMTS扩展
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
+	LL_HANDOVER		= 0x1001,+	LL_RELEASE_REQ	= 0x1010,+	LL_RELEASE_REPLY	= 0x1011 };  struct hdr_ll {-	LLFrameType lltype_;		// link-layer frame type+	LLFrameType lltype_;	// link-layer frame type 	int seqno_;			// sequence number 	int ackno_;			// acknowledgement number 	int bopno_;			// begin of packet seqno 	int eopno_;			// end of packet seqno 	int psize_;			// size of packet 	double sendtime_;		// time the packet is sent+	int paging_ok_;		// for paging procedure+	double tx_rate_;		// transmission rate of the data flow  	static int offset_; 	inline int& offset() { return offset_; }@@ -73,6 +122,7 @@ 	inline int& eopno() { return eopno_; } 	inline int& psize() { return psize_; } 	inline double& sendtime() { return sendtime_; }+	inline double& tx_rate() { return tx_rate_; } };  @@ -89,7 +139,13 @@  	virtual void sendUp(Packet* p); 	virtual void sendDown(Packet* p);-	++	// P.M. & P.B. modifications+	virtual void switch_on(void) {}+	virtual void update_flow(int acked, int fraged, int flowid) {}+	virtual void configure_flow(int flow, const char*const& type , double rate) {}++ 	inline int seqno() { return seqno_; } 	inline int ackno() { return ackno_; } 	inline int macDA() { return macDA_; }@@ -97,24 +153,23 @@         inline NsObject* downtarget() { return downtarget_; }         inline NsObject* uptarget() { return uptarget_; }  	inline ARPTable *arp_table() { return arptable_; }-	+ protected: 	int command(int argc, const char*const* argv);-	+ 	int seqno_;			// link-layer sequence number 	int ackno_;			// ACK received so far 	int macDA_;			// destination MAC address-	-        Queue* ifq_;			// interface queue++	  Queue* ifq_;			// interface queue 	Mac*   mac_;		        // MAC object         LanRouter* lanrouter_;          // for lookups of the next hop 	ARPTable*  arptable_;           // ARP table object 	VARPTable* varp_;               // Virtual ARP object-	-	NsObject* downtarget_;		// for outgoing packet ++	NsObject* downtarget_;		// for outgoing packet 	NsObject* uptarget_;		// for incoming packet-        -	+ };  #endifdiff -ur mac/mac.cc ns-umts-extensions/code/mac.cc--- mac/mac.cc	2001-06-05 23:49:43.000000000 +0000+++ ns-umts-extensions/code/mac.cc	2003-06-01 20:10:45.000000000 +0000@@ -1,4 +1,35 @@ /* -*-	Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */++/* Modified and extended by Pablo Martin and Paula Ballester,+ * Strathclyde University, Glasgow.+ * June, 2003.+*/++/* Copyright (c) 2003 Strathclyde University of Glasgow, Scotland.+ * 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 and binary code must contain+ * the above copyright notice, this list of conditions and the following+ * disclaimer.+ *+ * 2. All advertising materials mentioning features or use of this software+ * must display the following acknowledgement:+ * This product includes software developed at Strathclyde University of+ * Glasgow, Scotland.+ *+ * 3. The name of the University may not be used to endorse or promote+ * products derived from this software without specific prior written+ * permission.+ * STRATHCLYDE UNIVERSITY OF GLASGOW, MAKES NO REPRESENTATIONS+ * CONCERNING EITHER THE MERCHANTABILITY OF THIS SOFTWARE OR THE+ * SUITABILITY OF THIS SOFTWARE FOR ANY PARTICULAR PURPOSE.  The software+ * is provided "as is" without express or implied warranty of any kind.+*/+ /*  * Copyright (c) 1997 Regents of the University of California.  * All rights reserved.@@ -92,13 +123,16 @@ 	bind_bw("bandwidth_", &bandwidth_); 	bind_time("delay_", &delay_); 	bind_bool("abstract_", &abstract_);+	+	// P.M. & P.B. modifications+	tti_=0.01; }  int Mac::command(int argc, const char*const* argv) { 	if(argc == 2) { 		Tcl& tcl = Tcl::instance();-		+ 		if(strcmp(argv[1], "id") == 0) { 			tcl.resultf("%d", addr()); 			return TCL_OK;@@ -106,7 +140,7 @@ 			tcl.resultf("%s", channel_->name()); 			return (TCL_OK); 		}-		+ 	} else if (argc == 3) { 		TclObject *obj; 		if( (obj = TclObject::lookup(argv[2])) == 0) {diff -ur mac/mac.h ns-umts-extensions/code/mac.h--- mac/mac.h	2000-12-20 10:11:36.000000000 +0000+++ ns-umts-extensions/code/mac.h	2003-06-01 20:10:45.000000000 +0000@@ -1,4 +1,35 @@ /* -*-	Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */++/* Modified and extended by Pablo Martin and Paula Ballester,+ * Strathclyde University, Glasgow.+ * June, 2003.+*/++/* Copyright (c) 2003 Strathclyde University of Glasgow, Scotland.+ * 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 and binary code must contain+ * the above copyright notice, this list of conditions and the following+ * disclaimer.+ *+ * 2. All advertising materials mentioning features or use of this software+ * must display the following acknowledgement:+ * This product includes software developed at Strathclyde University of+ * Glasgow, Scotland.+ *+ * 3. The name of the University may not be used to endorse or promote+ * products derived from this software without specific prior written+ * permission.+ * STRATHCLYDE UNIVERSITY OF GLASGOW, MAKES NO REPRESENTATIONS+ * CONCERNING EITHER THE MERCHANTABILITY OF THIS SOFTWARE OR THE+ * SUITABILITY OF THIS SOFTWARE FOR ANY PARTICULAR PURPOSE.  The software+ * is provided "as is" without express or implied warranty of any kind.+*/+ /*  * Copyright (c) 1997 Regents of the University of California.  * All rights reserved.@@ -146,7 +177,8 @@ 	// it must not alter or free the pkt.  If you want to frob it, copy it. }; -+class Mac;+class LL; class MacHandlerResume : public Handler { public: 	MacHandlerResume(Mac* m) : mac_(m) {}@@ -177,7 +209,7 @@  	virtual void resume(Packet* p = 0); 	virtual void installTap(Tap *t) { tap_ = t; }-	+ 	inline double txtime(int bytes) { 		return (8. * bytes / bandwidth_); 	}@@ -186,11 +218,17 @@ 			     (HDR_CMN(p))->size()) / bandwidth_; 	} 	inline double bandwidth() const { return bandwidth_; }-	+ 	inline int addr() { return index_; } 	inline MacState state() { return state_; } 	inline MacState state(int m) { return state_ = (MacState) m; }-	++	// P.M. & P.B. modifications+      inline double& tti() { return tti_;}+	virtual void dl_interference(unsigned long error) {printf("error, dl\n");}+	virtual void ul_interference(int addr[], unsigned long error[]) {printf("error, ul\n");}+	virtual void remove(int addr) {printf("error, remove\n");}+         //mac methods to set dst, src and hdt_type in pkt hdrs. 	// note: -1 is the broadcast mac addr. 	virtual inline int hdr_dst(char* hdr, int dst = -2) {@@ -220,16 +258,16 @@  protected: 	int command(int argc, const char*const* argv);-	virtual int initialized() { -		return (netif_ && uptarget_ && downtarget_); +	virtual int initialized() {+		return (netif_ && uptarget_ && downtarget_); 	}-	int index_;		// MAC address+	int index_;			// MAC address 	double bandwidth_;      // channel bitrate 	double delay_;		// MAC overhead-	int abstract_;         //   MAC support for abstract LAN -        +	int abstract_;         	// MAC support for abstract LAN+ 	Phy *netif_;            // network interface-        Tap *tap_;              // tap agent+        Tap *tap_;            // tap agent 	LL *ll_;             	// LL this MAC is connected to 	Channel *channel_;	// channel this MAC is connected to @@ -238,6 +276,9 @@ 	MacHandlerSend hSend_;	// handle delay send due to busy channel 	Event intr_; +	// P.M. & P.B. modifications+	double tti_;+ 	/* 	 * Internal MAC State 	 */diff -ur mac/phy.cc ns-umts-extensions/code/phy.cc--- mac/phy.cc	1999-10-14 22:19:28.000000000 +0000+++ ns-umts-extensions/code/phy.cc	2003-06-01 20:10:45.000000000 +0000@@ -1,4 +1,35 @@ /* -*-	Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */++/* Modified and extended by Pablo Martin and Paula Ballester,+ * Strathclyde University, Glasgow.+ * June, 2003.+*/++/* Copyright (c) 2003 Strathclyde University of Glasgow, Scotland.+ * 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 and binary code must contain+ * the above copyright notice, this list of conditions and the following+ * disclaimer.+ *+ * 2. All advertising materials mentioning features or use of this software+ * must display the following acknowledgement:+ * This product includes software developed at Strathclyde University of+ * Glasgow, Scotland.+ *+ * 3. The name of the University may not be used to endorse or promote+ * products derived from this software without specific prior written+ * permission.+ * STRATHCLYDE UNIVERSITY OF GLASGOW, MAKES NO REPRESENTATIONS+ * CONCERNING EITHER THE MERCHANTABILITY OF THIS SOFTWARE OR THE+ * SUITABILITY OF THIS SOFTWARE FOR ANY PARTICULAR PURPOSE.  The software+ * is provided "as is" without express or implied warranty of any kind.+*/+ /*  * Copyright (c) 1997 Regents of the University of California.  * All rights reserved.@@ -105,9 +136,9 @@ void Phy::recv(Packet* p, Handler*) {-	struct hdr_cmn *hdr = HDR_CMN(p);	+	struct hdr_cmn *hdr = HDR_CMN(p); 	//struct hdr_sr *hsr = HDR_SR(p);-	+ 	/* 	 * Handle outgoing packets 	 */@@ -128,6 +159,13 @@ 			 * contributes to the Noise floor and hence 			 * may affect the reception of other packets. 			 */++			/// P.M. & P.B. modifications+			// we do not discard packets, only mark them+			hdr->error() = 1;+			uptarget_->recv(p, (Handler*) 0);+			return;+ 			Packet::free(p); 			return; 		} else {diff -ur mac/wireless-phy.cc ns-umts-extensions/code/wireless-phy.cc--- mac/wireless-phy.cc	2002-05-30 00:10:15.000000000 +0000+++ ns-umts-extensions/code/wireless-phy.cc	2003-06-01 20:10:45.000000000 +0000@@ -1,5 +1,36 @@-/* -*-	Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- +/* -*-	Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*-*/++/* Modified and extended by Pablo Martin and Paula Ballester,+ * Strathclyde University, Glasgow.+ * June, 2003.+*/++/* Copyright (c) 2003 Strathclyde University of Glasgow, Scotland.+ * 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 and binary code must contain+ * the above copyright notice, this list of conditions and the following+ * disclaimer.+ *+ * 2. All advertising materials mentioning features or use of this software+ * must display the following acknowledgement:+ * This product includes software developed at Strathclyde University of+ * Glasgow, Scotland.+ *+ * 3. The name of the University may not be used to endorse or promote+ * products derived from this software without specific prior written+ * permission.+ * STRATHCLYDE UNIVERSITY OF GLASGOW, MAKES NO REPRESENTATIONS+ * CONCERNING EITHER THE MERCHANTABILITY OF THIS SOFTWARE OR THE+ * SUITABILITY OF THIS SOFTWARE FOR ANY PARTICULAR PURPOSE.  The software+ * is provided "as is" without express or implied warranty of any kind.+*/++/*  * Copyright (c) 1996 Regents of the University of California.  * All rights reserved.  *@@ -53,6 +84,9 @@ #include <agent.h> #include <trace.h> +// P.M. & P.B. modifications+#include "phy-umts.h"+ #include "diffusion/diff_header.h"  #define max(a,b) (((a)<(b))?(b):(a))@@ -98,7 +132,7 @@ 	bind("Pt_", &Pt_); 	bind("freq_", &freq_); 	bind("L_", &L_);-	+ 	lambda_ = SPEED_OF_LIGHT / freq_;  	node_ = 0;@@ -122,25 +156,25 @@ 	channel_idle_time_ = NOW; 	update_energy_time_ = NOW; 	last_send_time_ = NOW;-	+ 	idle_timer_.resched(1.0); }  int WirelessPhy::command(int argc, const char*const* argv) {-	TclObject *obj; +	TclObject *obj;  	if (argc==2) { 		if (strcasecmp(argv[1], "NodeOn") == 0) {-			if (em() == NULL) +			if (em() == NULL) 				return TCL_OK; 			if (NOW > update_energy_time_) { 				update_energy_time_ = NOW; 			} 			return TCL_OK; 		} else if (strcasecmp(argv[1], "NodeOff") == 0) {-			if (em() == NULL) +			if (em() == NULL) 				return TCL_OK; 			if (NOW > update_energy_time_) { 				em()->DecrIdleEnergy(NOW-update_energy_time_,@@ -160,7 +194,7 @@ 			P_idle_ = atof(argv[2]); 			return TCL_OK; 		} else if( (obj = TclObject::lookup(argv[2])) == 0) {-			fprintf(stderr,"WirelessPhy: %s lookup of %s failed\n", +			fprintf(stderr,"WirelessPhy: %s lookup of %s failed\n", 				argv[1], argv[2]); 			return TCL_ERROR; 		} else if (strcmp(argv[1], "propagation") == 0) {@@ -178,16 +212,16 @@ 	} 	return Phy::command(argc,argv); }- -void ++void WirelessPhy::sendDown(Packet *p) { 	/* 	 * Sanity Check 	 */ 	assert(initialized());-	-	if (em()) ++	if (em()) 		if ((em()->node_on() != true) || (em()->sleep())) { 			Packet::free(p); 			return;@@ -205,14 +239,14 @@

⌨️ 快捷键说明

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