[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about mac




Hi,

You need to apply the attached patch to use just Mac. Let me know if you have 
any problems. BTW, these changes should also be reflected in today/tomorrow's 
snapshot.

Satish





> Hi all,
> 
> I have a question concerning mac for wireless simulations. I believe
> currently, only mac-802.11 can be used for wireless channel. I have tried
> to replace mac-802.11 with just mac but it did not run properly. 
> 
> Has anyone tried running Marc Greiss's wireless tutorial using basic mac
> instead of mac-802.11? 
> 
> Thanks.
> 
> 
> 

Index: mac.h
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/mac.h,v
retrieving revision 1.30
diff -u -r1.30 mac.h
--- mac.h	1999/09/29 18:45:22	1.30
+++ mac.h	1999/11/20 02:00:29
@@ -107,7 +107,7 @@
 	int macSA_;		// source MAC address
 	int macDA_;		// destination MAC address
 	u_int16_t hdr_type_;     // mac_hdr type
-	
+
 	double txtime_;		// transmission time
 	double sstime_;		// slot start time
 
@@ -211,6 +211,12 @@
 
 private:
 	//virtual void discard(Packet *p, const char* why = 0) {};
+	
+        void mac_log(Packet *p) {
+                logtarget_->recv(p, (Handler*) 0);
+        }
+        
+        NsObject*       logtarget_;
 
 protected:
 	int command(int argc, const char*const* argv);
Index: mac.cc
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/mac.cc,v
retrieving revision 1.35
diff -u -r1.35 mac.cc
--- mac.cc	1999/10/14 22:19:26	1.35
+++ mac.cc	1999/11/20 02:00:29
@@ -43,7 +43,7 @@
 
 #include <channel.h>
 #include <mac.h>
-
+#include <address.h>
 
 int hdr_mac::offset_;
 
@@ -132,6 +132,12 @@
 			netif_ = (Phy*) obj;
 			return TCL_OK;
 		}
+		else if (strcmp(argv[1], "log-target") == 0) {
+                        logtarget_ = (NsObject*) obj;
+                        if(logtarget_ == 0)
+                                return TCL_ERROR;
+                        return TCL_OK;
+                }
 		// else if (strcmp(argv[1], "up-target") == 0) {
 		// uptarget_ = (NsObject*) obj;
 		// return TCL_OK;
@@ -172,7 +178,7 @@
 {
 	char* mh = (char*)p->access(hdr_mac::offset_);
 	int dst = this->hdr_dst(mh);
-	
+
 	state(MAC_IDLE);
 	if (((u_int32_t)dst != MAC_BROADCAST) && (dst != index_)) {
 		drop(p);
Index: tcl/lib/ns-mobilenode.tcl
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/tcl/lib/ns-mobilenode.tcl,v
retrieving revision 1.27
diff -u -r1.27 ns-mobilenode.tcl
--- ns-mobilenode.tcl	1999/11/05 05:29:01	1.27
+++ ns-mobilenode.tcl	1999/11/20 02:00:29
@@ -506,6 +506,7 @@
 	# Initialize ARP table only once.
 	#
 	if { $arptable_ == "" } {
+
             set arptable_ [new ARPTable $self $mac]
             # FOR backward compatibility sake, hack only
 	    
@@ -566,7 +567,9 @@
 	$mac down-target $netif
 	#$mac nodes $opt(nn)
 	set god_ [God instance]
-	$mac nodes [$god_ num_nodes]
+        if {$mactype == "Mac/802_11"} {
+		$mac nodes [$god_ num_nodes]
+	}
 
 	#
 	# Network Interface