Merged nonotifier with main branch.
authortjkopena@cs.drexel.edu
Thu, 15 May 2008 07:47:17 -0400
changeset 3023 e690b0d1b625
parent 3022 c64c571c8e0c (current diff)
parent 3018 0ac9b895494d (diff)
child 3024 30ca8e7b5e89
Merged nonotifier with main branch.
examples/mixed-wireless.cc
--- a/examples/mixed-wireless.cc	Thu May 15 07:46:03 2008 -0400
+++ b/examples/mixed-wireless.cc	Thu May 15 07:47:17 2008 -0400
@@ -338,9 +338,9 @@
   CsmaHelper::EnableAsciiAll (ascii);
 
   // Let's do a pcap trace on the backbone devices
-  WifiHelper::EnablePcap ("mixed-wireless.pcap", backboneDevices); 
+  WifiHelper::EnablePcap ("mixed-wireless", backboneDevices); 
   // Let's additionally trace the application Sink, ifIndex 0
-  CsmaHelper::EnablePcap ("mixed-wireless.pcap", appSink->GetId (), 0);
+  CsmaHelper::EnablePcap ("mixed-wireless", appSink->GetId (), 0);
 
 #ifdef ENABLE_FOR_TRACING_EXAMPLE
   Config::Connect ("/NodeList/*/$MobilityModel/CourseChange",
--- a/src/node/node.cc	Thu May 15 07:46:03 2008 -0400
+++ b/src/node/node.cc	Thu May 15 07:47:17 2008 -0400
@@ -186,6 +186,11 @@
                          uint16_t protocol, const Address &from)
 {
   bool found = false;
+  // if there are (potentially) multiple handlers, we need to copy the
+  // packet before passing it to each handler, because handlers may
+  // modify it.
+  bool copyNeeded = (m_handlers.size () > 1);
+
   for (ProtocolHandlerList::iterator i = m_handlers.begin ();
        i != m_handlers.end (); i++)
     {
@@ -195,7 +200,7 @@
           if (i->protocol == 0 || 
               i->protocol == protocol)
             {
-              i->handler (device, packet, protocol, from);
+              i->handler (device, (copyNeeded ? packet->Copy () : packet), protocol, from);
               found = true;
             }
         }
--- a/src/node/packet-socket.cc	Thu May 15 07:46:03 2008 -0400
+++ b/src/node/packet-socket.cc	Thu May 15 07:47:17 2008 -0400
@@ -111,11 +111,11 @@
   Ptr<NetDevice> dev ;
   if (address.IsSingleDevice ())
     {
-      dev = 0;
+      dev = m_node->GetDevice (address.GetSingleDevice ());
     }
   else
     {
-      dev = m_node->GetDevice (address.GetSingleDevice ());
+      dev = 0;
     }
   m_node->RegisterProtocolHandler (MakeCallback (&PacketSocket::ForwardUp, this),
                                    address.GetProtocol (), dev);