move serial code to src/devices/serial
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu, 22 Feb 2007 10:04:54 +0100
changeset 334 8075943fda5a
parent 333 22e355af817a
child 335 d8b5e567fc50
move serial code to src/devices/serial
SConstruct
src/devices/serial/channel.cc
src/devices/serial/channel.h
src/devices/serial/layer-connector.cc
src/devices/serial/layer-connector.h
src/devices/serial/propagator.h
src/devices/serial/serial-channel.cc
src/devices/serial/serial-channel.h
src/devices/serial/serial-net-device.cc
src/devices/serial/serial-net-device.h
src/devices/serial/serial-phy.cc
src/devices/serial/serial-phy.h
src/node/channel.cc
src/node/channel.h
src/node/layer-connector.cc
src/node/layer-connector.h
src/node/propagator.h
src/node/serial-channel.cc
src/node/serial-channel.h
src/node/serial-net-device.cc
src/node/serial-net-device.h
src/node/serial-phy.cc
src/node/serial-phy.h
--- a/SConstruct	Thu Feb 22 10:03:55 2007 +0100
+++ b/SConstruct	Thu Feb 22 10:04:54 2007 +0100
@@ -172,8 +172,6 @@
     'ipv4-address.cc',
     'internet-node.cc',
     'net-device.cc',
-    'serial-net-device.cc',
-    'serial-phy.cc',
     'mac-address.cc',
     'ipv4-header.cc',
     'udp-header.cc',
@@ -193,11 +191,8 @@
     'llc-snap-header.cc',
     'header-utils.cc',
     'net-device-list.cc',
-    'serial-channel.cc',
     'queue.cc',
     'drop-tail.cc',
-    'layer-connector.cc',
-    'channel.cc',
     ])
 node.add_headers ([
     'ipv4-header.h',
@@ -212,12 +207,8 @@
     'l3-demux.h',
     'ipv4-l4-demux.h',
     'net-device-list.h',
-    'serial-net-device.h',
-    'serial-phy.h',
     'header-utils.h',
     'protocol.h',
-    'demux.h',
-    'serial-channel.h',
     'queue.h',
     ])
 node.add_inst_headers ([
@@ -232,12 +223,8 @@
     'ipv4.h',
     'l3-protocol.h',
     'ipv4-route.h',
-    'serial-channel.h',
     'queue.h',
     'drop-tail.h',
-    'layer-connector.h',
-    'channel.h',
-    'serial-net-device.h',
     'llc-snap-header.h',
     'arp-header.h',
     'ipv4-header.h',
@@ -256,6 +243,26 @@
     'p2p-channel.h',
     ])
 
+serial = build.Ns3Module ('serial', 'src/devices/serial')
+ns3.add (serial)
+serial.add_deps (['node'])
+serial.add_sources ([
+    'serial-net-device.cc',
+    'serial-channel.cc',
+    'serial-phy.cc',
+    'layer-connector.cc',
+    'channel.cc',
+    ])
+serial.add_headers ([
+    'propagator.h',
+    ])
+serial.add_inst_headers ([
+    'serial-net-device.h',
+    'serial-channel.h',
+    'layer-connector.h',
+    'channel.h',
+    ])
+
 
 # utils
 run_tests = build.Ns3Module('run-tests', 'utils')
@@ -330,8 +337,7 @@
 sample_serial_net_device_if = build.Ns3Module ('sample-serial-net-device-if', 'samples')
 sample_serial_net_device_if.set_executable ()
 ns3.add (sample_serial_net_device_if)
-sample_serial_net_device_if.add_dep ('common')
-sample_serial_net_device_if.add_dep ('node')
+sample_serial_net_device_if.add_deps (['common', 'node', 'serial'])
 sample_serial_net_device_if.add_source ('main-serial-net-device-if.cc')
 
 sample_simple = build.Ns3Module('sample-simple', 'samples')
@@ -349,7 +355,7 @@
 sample_simple_tcl = build.Ns3Module('sample-simple.tcl', 'samples')
 sample_simple_tcl.set_executable()
 ns3.add(sample_simple_tcl)
-sample_simple_tcl.add_deps(['core', 'simulator', 'node'])
+sample_simple_tcl.add_deps(['core', 'simulator', 'node', 'serial'])
 sample_simple_tcl.add_source('ns-2/simple.tcl.cc')
 
 sample_channel = build.Ns3Module('sample-channel', 'samples')
@@ -358,6 +364,7 @@
 sample_channel.add_dep ('common')
 sample_channel.add_dep ('node')
 sample_channel.add_dep ('core')
+sample_channel.add_dep ('serial')
 sample_channel.add_source('main-channel.cc')
 
 ns3.generate_dependencies()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/serial/channel.cc	Thu Feb 22 10:04:54 2007 +0100
@@ -0,0 +1,81 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2007 University of Washington
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Craig Dowell <craigdo@ee.washingon.edu>
+ *
+ *	Thu Feb 15 14:50:46 PST 2007 craigdo: Created.
+ */
+
+#include "ns3/debug.h"
+#include "channel.h"
+
+NS_DEBUG_COMPONENT_DEFINE ("Channel");
+
+namespace ns3 {
+
+Channel::Channel ()
+{
+  NS_DEBUG("Channel::Channel ()");
+}
+
+Channel::~Channel ()
+{
+  NS_DEBUG("Channel::~Channel ()");
+}
+
+  bool
+Channel::DoConnectToUpper (LayerConnectorUpper &upper)
+{
+  NS_DEBUG("Channel::DoConnectToUpper (" << &upper << ")");
+  m_connectorList.push_back(&upper);
+
+  return true;
+}
+
+  bool
+Channel::LowerDoNotify (LayerConnectorUpper *upper)
+{
+  NS_DEBUG("Channel::LowerDoNotify ()");
+
+  Packet p;
+
+  NS_DEBUG("Channel::LowerDoNotify (): Starting pull");
+
+  upper->UpperPull(p);
+
+  NS_DEBUG("Channel::LowerDoNotify (): Got bits,  Propagate()");
+
+  return Propagate(p);
+}
+
+  bool
+Channel::Propagate (Packet &p)
+{
+  NS_DEBUG("Channel::Propagate (" << &p << ")");
+
+  for (ConnectorList::const_iterator i = m_connectorList.begin ();
+       i != m_connectorList.end (); 
+       i++)
+    {
+      (*i)->UpperSendUp (p);
+    }
+
+  return true;
+}
+
+} // namespace ns3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/serial/channel.h	Thu Feb 22 10:04:54 2007 +0100
@@ -0,0 +1,54 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2007 University of Washington
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Craig Dowell <craigdo@ee.washingon.edu>
+ *
+ *      Wed Feb 14 16:05:46 PST 2007 craigdo:  Created
+ */
+
+#include <list>
+#include "ns3/packet.h"
+#include "layer-connector.h"
+
+#ifndef CHANNEL_H
+#define CHANNEL_H
+
+namespace ns3 {
+
+class Channel : public LayerConnectorLower
+{
+public:
+  Channel ();
+  virtual ~Channel ();
+
+  // Called by the physical layer to cause bits to propagate along the channel
+  // The channel will call Receive on each of the phys.
+  bool Propagate (Packet &p);
+  bool DoConnectToUpper (LayerConnectorUpper &upper);
+  bool LowerDoNotify (LayerConnectorUpper *upper);
+
+protected:
+  typedef std::list<LayerConnectorUpper *> ConnectorList;
+  ConnectorList m_connectorList;
+
+private:
+};
+
+}; // namespace ns3
+
+#endif /* CHANNEL_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/serial/layer-connector.cc	Thu Feb 22 10:04:54 2007 +0100
@@ -0,0 +1,138 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2007 University of Washington
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Craig Dowell <craigdo@ee.washingon.edu>
+ *
+ *      Fri Feb 16 12:18:11 PST 2007 craigdo:  created
+ */
+
+#include "ns3/debug.h"
+#include "ns3/assert.h"
+#include "layer-connector.h"
+
+NS_DEBUG_COMPONENT_DEFINE ("LayerConnector");
+
+namespace ns3 {
+
+LayerConnectorUpper::LayerConnectorUpper ()
+{
+  NS_DEBUG("LayerConnectorUpper::LayerConnectorUpper ()");
+}
+
+LayerConnectorUpper::~LayerConnectorUpper ()
+{
+  NS_DEBUG("LayerConnectorUpper::~LayerConnectorUpper ()");
+}
+
+  bool
+LayerConnectorUpper::ConnectToLower (LayerConnectorLower &partner)
+{
+  NS_DEBUG("LayerConnectorUpper::ConnectToLower (" << &partner << ")");
+
+  return DoConnectToLower(partner);
+}
+
+  bool
+LayerConnectorUpper::DoConnectToLower (LayerConnectorLower &partner)
+{
+  NS_DEBUG("LayerConnectorUpper::DoConnectToLower (" << &partner << ")");
+
+  m_lowerPartner = &partner;
+  NS_ASSERT (m_lowerPartner);
+  return true;
+}
+
+  bool
+LayerConnectorUpper::UpperSendUp (Packet &p)
+{
+  NS_DEBUG("LayerConnectorUpper::UpperSendUp (" << &p << ")");
+
+  return UpperDoSendUp(p);
+}
+
+  bool
+LayerConnectorUpper::UpperPull (Packet &p)
+{
+  NS_DEBUG("LayerConnectorUpper::UpperPull (" << &p << ")");
+
+  return UpperDoPull(p);
+}
+
+  bool
+LayerConnectorUpper::UpperNotify ()
+{
+  NS_DEBUG("LayerConnectorUpper::UpperNotify ()");
+
+  NS_ASSERT (m_lowerPartner);
+  return m_lowerPartner->LowerNotify(this);
+}
+
+LayerConnectorLower::LayerConnectorLower ()
+{
+  NS_DEBUG("LayerConnectorLower::LayerConnectorLower ()");
+}
+
+LayerConnectorLower::~LayerConnectorLower ()
+{
+  NS_DEBUG("LayerConnectorLower::~LayerConnectorLower ()");
+}
+
+  bool
+LayerConnectorLower::ConnectToUpper (LayerConnectorUpper &partner)
+{
+  NS_DEBUG("LayerConnectorLower::ConnectToUpper (" << &partner << ")");
+
+  return DoConnectToUpper(partner);
+}
+
+  bool
+LayerConnectorLower::DoConnectToUpper (LayerConnectorUpper &partner)
+{
+  NS_DEBUG("LayerConnectorLower::DoConnectToUpper (" << &partner << ")");
+
+  m_upperPartner = &partner;
+  NS_ASSERT (m_upperPartner);
+  return true;
+}
+
+  bool
+LayerConnectorLower::LowerSendUp (Packet &p)
+{
+  NS_DEBUG("LayerConnectorLower::LowerSendUp (" << &p << ")");
+
+  NS_ASSERT (m_upperPartner);
+  return m_upperPartner->UpperSendUp(p);
+}
+
+  bool
+LayerConnectorLower::LowerPull (Packet &p)
+{
+  NS_DEBUG("LayerConnectorLower::LowerPull (" << &p << ")");
+
+  NS_ASSERT (m_upperPartner);
+  return m_upperPartner->UpperPull(p);
+}
+
+  bool
+LayerConnectorLower::LowerNotify (LayerConnectorUpper *upper)
+{
+  NS_DEBUG("LayerConnectorLower::LowerNotify ()");
+  return LowerDoNotify(upper);
+}
+
+} // namespace ns3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/serial/layer-connector.h	Thu Feb 22 10:04:54 2007 +0100
@@ -0,0 +1,97 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2007 University of Washington
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Craig Dowell <craigdo@ee.washingon.edu>
+ *
+ *      Wed Feb 14 16:05:46 PST 2007 craigdo:  created
+ */
+
+#include "ns3/packet.h"
+
+#ifndef LAYER_CONNECTOR_H
+#define LAYER_CONNECTOR_H
+
+namespace ns3 {
+
+class LayerConnectorLower;
+
+class LayerConnectorUpper {
+public:
+  LayerConnectorUpper ();
+  virtual ~LayerConnectorUpper ();
+
+  // called by the layer connector to introduce the lower interface to us here
+  bool ConnectToLower (LayerConnectorLower &lower);
+
+  // called by the lower layer to send a received packet on up the protocol
+  // stack to us here.
+  bool UpperSendUp (Packet &p);
+
+  // Call this function to tell a lower layer that there is data available
+  // here.  It is expected that the lower layer will call pull as soon as
+  // possible to get the data.
+  bool UpperNotify ();
+
+  // called by the lower layer to get available packet data that was implied
+  // by a previous Notify() call.
+  bool UpperPull(Packet &p);
+
+protected:
+  virtual bool DoConnectToLower (LayerConnectorLower &lower);
+  virtual bool UpperDoSendUp (Packet &p) = 0;
+  virtual bool UpperDoPull (Packet &p) = 0;
+
+  LayerConnectorLower *m_lowerPartner;
+
+private:
+};
+
+class LayerConnectorLower
+{
+public:
+  LayerConnectorLower ();
+  virtual ~LayerConnectorLower ();
+
+  // This function is called by the layer connector to introduce the upper
+  // layer interface to us here
+  bool ConnectToUpper (LayerConnectorUpper &upper);
+
+  // Notify is called by the upper layer connector to tell us that there
+  // is data available.  It is expected that we will call pull (below) as
+  // soon as possible to get the data.
+  bool LowerNotify (LayerConnectorUpper *upper);
+
+  // The lower connector calls this method to send a received packet on up 
+  // the protocol stack
+  bool LowerSendUp (Packet &p);
+
+  // Call this function to get available packet data from the upper connector
+  // that was implied by a previous Notify() call.
+  bool LowerPull(Packet &p);
+
+protected:
+  virtual bool DoConnectToUpper (LayerConnectorUpper &upper);
+  virtual bool LowerDoNotify (LayerConnectorUpper *upper) = 0;
+  LayerConnectorUpper *m_upperPartner;
+
+private:
+};
+
+}; // namespace ns3
+
+#endif /* LAYER_CONNECTOR_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/serial/propagator.h	Thu Feb 22 10:04:54 2007 +0100
@@ -0,0 +1,49 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2007 University of Washington
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Craig Dowell <craigdo@ee.washingon.edu>
+ *
+ *      Thu Feb 15 15:06:15 PST 2007 craigdo:  Created
+ */
+
+#ifndef PROPAGATOR_H
+#define PROPAGATOR_H
+
+#include "ns3/packet.h"
+
+namespace ns3 {
+
+class Propagator
+{
+public:
+  Propagator () : m_packet(0) {}
+  virtual ~Propagator () {}
+
+  void SetPacket (Packet &p) {DoSetPacket(p);}
+
+protected:
+  virtual void DoSetPacket (Packet &p) {m_packet = static_cast<Packet *>(&p);}
+
+  Packet *m_packet;
+private:
+};
+
+
+}; // namespace ns3
+
+#endif /* SERIAL_PHY_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/serial/serial-channel.cc	Thu Feb 22 10:04:54 2007 +0100
@@ -0,0 +1,45 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2007 University of Washington
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "serial-channel.h"
+#include "serial-net-device.h"
+#include "ns3/packet.h"
+
+namespace ns3 {
+
+void
+SerialChannel::Attach(SerialNetDevice* nd)
+{
+    nd->Attach(this);
+    m_devices.push_back (nd);
+}
+
+bool
+SerialChannel::Send(Packet& p, SerialNetDevice* caller)
+{
+    for (NetDevicesCI i = m_devices.begin (); i != m_devices.end (); i++) {
+        if (caller != (*i)) {
+            (*i)->Receive (p);
+            return true;
+        }
+    }
+    return false;
+}
+
+} // namespace ns3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/serial/serial-channel.h	Thu Feb 22 10:04:54 2007 +0100
@@ -0,0 +1,47 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2007 University of Washington
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+// The queue base class does not have any limit based on the number
+// of packets or number of bytes. It is, conceptually, infinite 
+// by default. Only subclasses define limitations.
+// The base class implements tracing and basic statistics calculations.
+
+#ifndef CHANNEL_SERIAL_H
+#define CHANNEL_SERIAL_H
+
+#include <list>
+#include "serial-net-device.h"
+#include "ns3/packet.h"
+
+namespace ns3 {
+
+// Simple SerialChannel class
+class SerialChannel {
+public:
+  bool Send(Packet& p, SerialNetDevice *caller);
+  void Attach (SerialNetDevice* nd);
+private:
+  typedef std::list<SerialNetDevice *> NetDevices;
+  typedef std::list<SerialNetDevice *>::const_iterator  NetDevicesCI;
+  NetDevices m_devices;
+};
+
+} // namespace ns3
+
+#endif /* CHANNEL_SERIAL__H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/serial/serial-net-device.cc	Thu Feb 22 10:04:54 2007 +0100
@@ -0,0 +1,144 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2005,2006 INRIA
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+
+#include <iostream>
+#include <cassert>
+#include "ns3/debug.h"
+#include "ns3/queue.h"
+#include "serial-net-device.h"
+#include "serial-channel.h"
+#include "serial-phy.h"
+
+NS_DEBUG_COMPONENT_DEFINE ("SerialNetDevice");
+
+namespace ns3 {
+
+
+SerialNetDevice::SerialNetDevice(Node* node, const MacAddress& addr) : 
+  NetDevice(node, addr)
+{
+  NS_DEBUG ("SerialNetDevice::SerialNetDevice (" << node << ", " << &addr << ")");
+
+  // BUGBUG FIXME
+  //
+  // You _must_ support broadcast to get any sort of packet from the ARP layer.
+  EnableBroadcast (MacAddress ("ff:ff:ff:ff:ff:ff"));
+  EnableMulticast();
+  EnablePointToPoint();
+  SetMtu(512); // bytes
+
+  m_phy = new SerialPhy(node, this);
+}
+
+SerialNetDevice::~SerialNetDevice()
+{
+  NS_DEBUG ("SerialNetDevice::~SerialNetDevice ()");
+}
+
+
+  bool
+SerialNetDevice::SendTo (Packet& p, const MacAddress& dest)
+{
+  NS_DEBUG ("SerialNetDevice::SendTo (" << &p << ", " << &dest << ")");
+
+  assert (IsLinkUp ());
+
+#ifdef NOTYET
+    struct NetDevicePacketDestAddress tag;
+    tag.address = address;
+    p.AddTag (tag);
+#endif
+    if (m_queue->Enque(p) )
+      {
+        NotifyDataAvailable ();
+        return true;
+      }
+    return false;
+}
+
+  bool
+SerialNetDevice::Attach (SerialChannel* ch)
+{
+  NS_DEBUG ("SerialNetDevice::Attach (" << &ch << ")");
+
+  m_channel = ch;
+  /* 
+   * For now, this device is up whenever a channel is attached to it.
+   * In fact, it should become up only when the second device
+   * is attached to the channel. So, there should be a way for
+   * a SerialChannel to notify both of its attached devices
+   * that the channel is 'complete', hence that the devices are
+   * up, hence that they can call NotifyLinkUp. 
+   */
+  NotifyLinkUp ();
+  return true;
+}
+
+void
+SerialNetDevice::AddQueue (Queue* q)
+{
+  NS_DEBUG ("SerialNetDevice::AddQueue (" << q << ")");
+
+  m_queue = q;
+}
+
+void
+SerialNetDevice::Receive (Packet& p)
+{
+  // ignore return value for now.
+  NS_DEBUG ("SerialNetDevice::Receive (" << &p << ")");
+
+  // Dispatch this to SerialPhy::Receive
+  m_phy->Receive (p);
+}
+
+void
+SerialNetDevice::NotifyDataAvailable(void)
+{
+  NS_DEBUG ("SerialNetDevice::NotifyDataAvailable ()");
+
+  Packet p;
+  bool found = GetQueue ()->Deque (p);
+  if (found)
+    {
+#ifdef NOTYET
+      struct NetDevicePacketDestAddress tag;
+      p.PeekTag (tag);
+      // send packet to address tag.address
+#endif
+      NS_DEBUG ("SerialNetDevice::NotifyDataAvailable (): Dequeued");
+      m_channel->Send(p, this);
+    }
+}
+
+Queue* 
+SerialNetDevice::GetQueue(void) const 
+{ 
+    return m_queue;
+}
+
+SerialChannel* 
+SerialNetDevice::GetChannel(void) const 
+{ 
+    return m_channel;
+}
+
+} // namespace ns3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/serial/serial-net-device.h	Thu Feb 22 10:04:54 2007 +0100
@@ -0,0 +1,72 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2007 University of Washington
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Craig Dowell <craigdo@ee.washington.edu>
+ */
+
+#ifndef SERIAL_NET_DEVICE_H
+#define SERIAL_NET_DEVICE_H
+
+#include <string.h>
+#include "ns3/mac-address.h"
+#include "ns3/internet-node.h"
+#include "ns3/net-device.h"
+#include "ns3/callback.h"
+#include "ns3/packet.h"
+
+namespace ns3 {
+
+class SerialChannel;
+class SerialPhy;
+class Queue;
+
+class SerialNetDevice : public NetDevice {
+friend class SerialPhy;
+public:
+  SerialNetDevice(Node* node, const MacAddress& addr);
+  virtual ~SerialNetDevice();
+
+private:
+  // Don't let the compiler slip in copy and assignment construction
+  SerialNetDevice(const SerialNetDevice&);
+  SerialNetDevice&operator=(const SerialNetDevice&);
+
+public:
+  bool Attach(SerialChannel* ch);
+  void AddQueue(Queue *);
+  // called by ChannelSerial
+  void Receive (Packet& p);
+
+protected:
+  Queue* GetQueue(void) const; 
+  SerialChannel* GetChannel(void) const;
+
+private:
+  virtual void NotifyDataAvailable (void);
+  virtual bool SendTo (Packet& p, const MacAddress& dest);
+
+  SerialPhy* m_phy;
+  SerialChannel* m_channel;
+  Queue* m_queue;
+
+};
+
+}; // namespace ns3
+
+#endif // SERIAL_NET_DEVICE_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/serial/serial-phy.cc	Thu Feb 22 10:04:54 2007 +0100
@@ -0,0 +1,70 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2005,2006 INRIA
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+
+#include "ns3/debug.h"
+#include "ns3/queue.h"
+#include "serial-phy.h"
+#include "serial-net-device.h"
+#include "serial-channel.h"
+
+NS_DEBUG_COMPONENT_DEFINE ("SerialPhy");
+
+namespace ns3 {
+
+SerialPhy::SerialPhy(Node* node, SerialNetDevice* netdevice) :
+  m_node(node), m_netdevice(netdevice)
+{
+  NS_DEBUG ("SerialPhy::SerialPhy (" << node << ", " << netdevice << ")");
+}
+
+SerialPhy::~SerialPhy()
+{
+  NS_DEBUG ("SerialPhy::~SerialPhy ()");
+}
+
+void
+SerialPhy::NotifyDataAvailable(void)
+{
+  NS_DEBUG ("SerialPhy::NotifyDataAvailable ()");
+
+  Packet p;
+  bool found = m_netdevice->GetQueue ()->Deque (p);
+  if (found)
+    {
+#ifdef NOTYET
+      struct NetDevicePacketDestAddress tag;
+      p.PeekTag (tag);
+      // send packet to address tag.address
+#endif
+      NS_DEBUG ("SerialPhy::NotifyDataAvailable (): Dequeued");
+      m_netdevice->GetChannel()->Send(p, m_netdevice);
+    }
+}
+
+void
+SerialPhy::Receive (Packet& p)
+{
+  NS_DEBUG ("SerialPhy::Receive (" << &p << ")");
+
+  m_netdevice->ForwardUp (p);
+}
+
+} // namespace ns3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/serial/serial-phy.h	Thu Feb 22 10:04:54 2007 +0100
@@ -0,0 +1,46 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2007 University of Washington
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: Craig Dowell <craigdo@ee.washington.edu>
+ */
+
+#ifndef SERIAL_PHY_H
+#define SERIAL_PHY_H
+
+#include <string.h>
+#include "ns3/internet-node.h"
+#include "ns3/packet.h"
+#include "serial-net-device.h"
+
+namespace ns3 {
+
+class SerialPhy {
+public:
+  SerialPhy(Node* node, SerialNetDevice* netdevice);
+  virtual ~SerialPhy();
+  virtual void NotifyDataAvailable (void);
+  void Receive (Packet& p);
+
+private:
+  Node* m_node;
+  SerialNetDevice* m_netdevice;
+};
+
+} // namespace ns3
+
+#endif // SERIAL_PHY_H
--- a/src/node/channel.cc	Thu Feb 22 10:03:55 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 University of Washington
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Craig Dowell <craigdo@ee.washingon.edu>
- *
- *	Thu Feb 15 14:50:46 PST 2007 craigdo: Created.
- */
-
-#include "ns3/debug.h"
-#include "channel.h"
-
-NS_DEBUG_COMPONENT_DEFINE ("Channel");
-
-namespace ns3 {
-
-Channel::Channel ()
-{
-  NS_DEBUG("Channel::Channel ()");
-}
-
-Channel::~Channel ()
-{
-  NS_DEBUG("Channel::~Channel ()");
-}
-
-  bool
-Channel::DoConnectToUpper (LayerConnectorUpper &upper)
-{
-  NS_DEBUG("Channel::DoConnectToUpper (" << &upper << ")");
-  m_connectorList.push_back(&upper);
-
-  return true;
-}
-
-  bool
-Channel::LowerDoNotify (LayerConnectorUpper *upper)
-{
-  NS_DEBUG("Channel::LowerDoNotify ()");
-
-  Packet p;
-
-  NS_DEBUG("Channel::LowerDoNotify (): Starting pull");
-
-  upper->UpperPull(p);
-
-  NS_DEBUG("Channel::LowerDoNotify (): Got bits,  Propagate()");
-
-  return Propagate(p);
-}
-
-  bool
-Channel::Propagate (Packet &p)
-{
-  NS_DEBUG("Channel::Propagate (" << &p << ")");
-
-  for (ConnectorList::const_iterator i = m_connectorList.begin ();
-       i != m_connectorList.end (); 
-       i++)
-    {
-      (*i)->UpperSendUp (p);
-    }
-
-  return true;
-}
-
-} // namespace ns3
--- a/src/node/channel.h	Thu Feb 22 10:03:55 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 University of Washington
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Craig Dowell <craigdo@ee.washingon.edu>
- *
- *      Wed Feb 14 16:05:46 PST 2007 craigdo:  Created
- */
-
-#include <list>
-#include "ns3/packet.h"
-#include "layer-connector.h"
-
-#ifndef CHANNEL_H
-#define CHANNEL_H
-
-namespace ns3 {
-
-class Channel : public LayerConnectorLower
-{
-public:
-  Channel ();
-  virtual ~Channel ();
-
-  // Called by the physical layer to cause bits to propagate along the channel
-  // The channel will call Receive on each of the phys.
-  bool Propagate (Packet &p);
-  bool DoConnectToUpper (LayerConnectorUpper &upper);
-  bool LowerDoNotify (LayerConnectorUpper *upper);
-
-protected:
-  typedef std::list<LayerConnectorUpper *> ConnectorList;
-  ConnectorList m_connectorList;
-
-private:
-};
-
-}; // namespace ns3
-
-#endif /* CHANNEL_H */
--- a/src/node/layer-connector.cc	Thu Feb 22 10:03:55 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 University of Washington
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Craig Dowell <craigdo@ee.washingon.edu>
- *
- *      Fri Feb 16 12:18:11 PST 2007 craigdo:  created
- */
-
-#include "ns3/debug.h"
-#include "ns3/assert.h"
-#include "layer-connector.h"
-
-NS_DEBUG_COMPONENT_DEFINE ("LayerConnector");
-
-namespace ns3 {
-
-LayerConnectorUpper::LayerConnectorUpper ()
-{
-  NS_DEBUG("LayerConnectorUpper::LayerConnectorUpper ()");
-}
-
-LayerConnectorUpper::~LayerConnectorUpper ()
-{
-  NS_DEBUG("LayerConnectorUpper::~LayerConnectorUpper ()");
-}
-
-  bool
-LayerConnectorUpper::ConnectToLower (LayerConnectorLower &partner)
-{
-  NS_DEBUG("LayerConnectorUpper::ConnectToLower (" << &partner << ")");
-
-  return DoConnectToLower(partner);
-}
-
-  bool
-LayerConnectorUpper::DoConnectToLower (LayerConnectorLower &partner)
-{
-  NS_DEBUG("LayerConnectorUpper::DoConnectToLower (" << &partner << ")");
-
-  m_lowerPartner = &partner;
-  NS_ASSERT (m_lowerPartner);
-  return true;
-}
-
-  bool
-LayerConnectorUpper::UpperSendUp (Packet &p)
-{
-  NS_DEBUG("LayerConnectorUpper::UpperSendUp (" << &p << ")");
-
-  return UpperDoSendUp(p);
-}
-
-  bool
-LayerConnectorUpper::UpperPull (Packet &p)
-{
-  NS_DEBUG("LayerConnectorUpper::UpperPull (" << &p << ")");
-
-  return UpperDoPull(p);
-}
-
-  bool
-LayerConnectorUpper::UpperNotify ()
-{
-  NS_DEBUG("LayerConnectorUpper::UpperNotify ()");
-
-  NS_ASSERT (m_lowerPartner);
-  return m_lowerPartner->LowerNotify(this);
-}
-
-LayerConnectorLower::LayerConnectorLower ()
-{
-  NS_DEBUG("LayerConnectorLower::LayerConnectorLower ()");
-}
-
-LayerConnectorLower::~LayerConnectorLower ()
-{
-  NS_DEBUG("LayerConnectorLower::~LayerConnectorLower ()");
-}
-
-  bool
-LayerConnectorLower::ConnectToUpper (LayerConnectorUpper &partner)
-{
-  NS_DEBUG("LayerConnectorLower::ConnectToUpper (" << &partner << ")");
-
-  return DoConnectToUpper(partner);
-}
-
-  bool
-LayerConnectorLower::DoConnectToUpper (LayerConnectorUpper &partner)
-{
-  NS_DEBUG("LayerConnectorLower::DoConnectToUpper (" << &partner << ")");
-
-  m_upperPartner = &partner;
-  NS_ASSERT (m_upperPartner);
-  return true;
-}
-
-  bool
-LayerConnectorLower::LowerSendUp (Packet &p)
-{
-  NS_DEBUG("LayerConnectorLower::LowerSendUp (" << &p << ")");
-
-  NS_ASSERT (m_upperPartner);
-  return m_upperPartner->UpperSendUp(p);
-}
-
-  bool
-LayerConnectorLower::LowerPull (Packet &p)
-{
-  NS_DEBUG("LayerConnectorLower::LowerPull (" << &p << ")");
-
-  NS_ASSERT (m_upperPartner);
-  return m_upperPartner->UpperPull(p);
-}
-
-  bool
-LayerConnectorLower::LowerNotify (LayerConnectorUpper *upper)
-{
-  NS_DEBUG("LayerConnectorLower::LowerNotify ()");
-  return LowerDoNotify(upper);
-}
-
-} // namespace ns3
--- a/src/node/layer-connector.h	Thu Feb 22 10:03:55 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 University of Washington
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Craig Dowell <craigdo@ee.washingon.edu>
- *
- *      Wed Feb 14 16:05:46 PST 2007 craigdo:  created
- */
-
-#include "ns3/packet.h"
-
-#ifndef LAYER_CONNECTOR_H
-#define LAYER_CONNECTOR_H
-
-namespace ns3 {
-
-class LayerConnectorLower;
-
-class LayerConnectorUpper {
-public:
-  LayerConnectorUpper ();
-  virtual ~LayerConnectorUpper ();
-
-  // called by the layer connector to introduce the lower interface to us here
-  bool ConnectToLower (LayerConnectorLower &lower);
-
-  // called by the lower layer to send a received packet on up the protocol
-  // stack to us here.
-  bool UpperSendUp (Packet &p);
-
-  // Call this function to tell a lower layer that there is data available
-  // here.  It is expected that the lower layer will call pull as soon as
-  // possible to get the data.
-  bool UpperNotify ();
-
-  // called by the lower layer to get available packet data that was implied
-  // by a previous Notify() call.
-  bool UpperPull(Packet &p);
-
-protected:
-  virtual bool DoConnectToLower (LayerConnectorLower &lower);
-  virtual bool UpperDoSendUp (Packet &p) = 0;
-  virtual bool UpperDoPull (Packet &p) = 0;
-
-  LayerConnectorLower *m_lowerPartner;
-
-private:
-};
-
-class LayerConnectorLower
-{
-public:
-  LayerConnectorLower ();
-  virtual ~LayerConnectorLower ();
-
-  // This function is called by the layer connector to introduce the upper
-  // layer interface to us here
-  bool ConnectToUpper (LayerConnectorUpper &upper);
-
-  // Notify is called by the upper layer connector to tell us that there
-  // is data available.  It is expected that we will call pull (below) as
-  // soon as possible to get the data.
-  bool LowerNotify (LayerConnectorUpper *upper);
-
-  // The lower connector calls this method to send a received packet on up 
-  // the protocol stack
-  bool LowerSendUp (Packet &p);
-
-  // Call this function to get available packet data from the upper connector
-  // that was implied by a previous Notify() call.
-  bool LowerPull(Packet &p);
-
-protected:
-  virtual bool DoConnectToUpper (LayerConnectorUpper &upper);
-  virtual bool LowerDoNotify (LayerConnectorUpper *upper) = 0;
-  LayerConnectorUpper *m_upperPartner;
-
-private:
-};
-
-}; // namespace ns3
-
-#endif /* LAYER_CONNECTOR_H */
--- a/src/node/propagator.h	Thu Feb 22 10:03:55 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 University of Washington
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Craig Dowell <craigdo@ee.washingon.edu>
- *
- *      Thu Feb 15 15:06:15 PST 2007 craigdo:  Created
- */
-
-#ifndef PROPAGATOR_H
-#define PROPAGATOR_H
-
-#include "ns3/packet.h"
-
-namespace ns3 {
-
-class Propagator
-{
-public:
-  Propagator () : m_packet(0) {}
-  virtual ~Propagator () {}
-
-  void SetPacket (Packet &p) {DoSetPacket(p);}
-
-protected:
-  virtual void DoSetPacket (Packet &p) {m_packet = static_cast<Packet *>(&p);}
-
-  Packet *m_packet;
-private:
-};
-
-
-}; // namespace ns3
-
-#endif /* SERIAL_PHY_H */
--- a/src/node/serial-channel.cc	Thu Feb 22 10:03:55 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 University of Washington
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "serial-channel.h"
-#include "serial-net-device.h"
-#include "ns3/packet.h"
-
-namespace ns3 {
-
-void
-SerialChannel::Attach(SerialNetDevice* nd)
-{
-    nd->Attach(this);
-    m_devices.push_back (nd);
-}
-
-bool
-SerialChannel::Send(Packet& p, SerialNetDevice* caller)
-{
-    for (NetDevicesCI i = m_devices.begin (); i != m_devices.end (); i++) {
-        if (caller != (*i)) {
-            (*i)->Receive (p);
-            return true;
-        }
-    }
-    return false;
-}
-
-} // namespace ns3
--- a/src/node/serial-channel.h	Thu Feb 22 10:03:55 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 University of Washington
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-// The queue base class does not have any limit based on the number
-// of packets or number of bytes. It is, conceptually, infinite 
-// by default. Only subclasses define limitations.
-// The base class implements tracing and basic statistics calculations.
-
-#ifndef CHANNEL_SERIAL_H
-#define CHANNEL_SERIAL_H
-
-#include <list>
-#include "serial-net-device.h"
-#include "ns3/packet.h"
-
-namespace ns3 {
-
-// Simple SerialChannel class
-class SerialChannel {
-public:
-  bool Send(Packet& p, SerialNetDevice *caller);
-  void Attach (SerialNetDevice* nd);
-private:
-  typedef std::list<SerialNetDevice *> NetDevices;
-  typedef std::list<SerialNetDevice *>::const_iterator  NetDevicesCI;
-  NetDevices m_devices;
-};
-
-} // namespace ns3
-
-#endif /* CHANNEL_SERIAL__H */
--- a/src/node/serial-net-device.cc	Thu Feb 22 10:03:55 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2005,2006 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-
-#include <iostream>
-#include <cassert>
-#include "ns3/debug.h"
-#include "protocol.h"
-#include "demux.h"
-#include "queue.h"
-#include "serial-net-device.h"
-#include "serial-channel.h"
-#include "serial-phy.h"
-
-NS_DEBUG_COMPONENT_DEFINE ("SerialNetDevice");
-
-namespace ns3 {
-
-
-SerialNetDevice::SerialNetDevice(Node* node, const MacAddress& addr) : 
-  NetDevice(node, addr)
-{
-  NS_DEBUG ("SerialNetDevice::SerialNetDevice (" << node << ", " << &addr << ")");
-
-  // BUGBUG FIXME
-  //
-  // You _must_ support broadcast to get any sort of packet from the ARP layer.
-  EnableBroadcast (MacAddress ("ff:ff:ff:ff:ff:ff"));
-  EnableMulticast();
-  EnablePointToPoint();
-  SetMtu(512); // bytes
-
-  m_phy = new SerialPhy(node, this);
-}
-
-SerialNetDevice::~SerialNetDevice()
-{
-  NS_DEBUG ("SerialNetDevice::~SerialNetDevice ()");
-}
-
-
-  bool
-SerialNetDevice::SendTo (Packet& p, const MacAddress& dest)
-{
-  NS_DEBUG ("SerialNetDevice::SendTo (" << &p << ", " << &dest << ")");
-
-  assert (IsLinkUp ());
-
-#ifdef NOTYET
-    struct NetDevicePacketDestAddress tag;
-    tag.address = address;
-    p.AddTag (tag);
-#endif
-    if (m_queue->Enque(p) )
-      {
-        NotifyDataAvailable ();
-        return true;
-      }
-    return false;
-}
-
-  bool
-SerialNetDevice::Attach (SerialChannel* ch)
-{
-  NS_DEBUG ("SerialNetDevice::Attach (" << &ch << ")");
-
-  m_channel = ch;
-  /* 
-   * For now, this device is up whenever a channel is attached to it.
-   * In fact, it should become up only when the second device
-   * is attached to the channel. So, there should be a way for
-   * a SerialChannel to notify both of its attached devices
-   * that the channel is 'complete', hence that the devices are
-   * up, hence that they can call NotifyLinkUp. 
-   */
-  NotifyLinkUp ();
-  return true;
-}
-
-void
-SerialNetDevice::AddQueue (Queue* q)
-{
-  NS_DEBUG ("SerialNetDevice::AddQueue (" << q << ")");
-
-  m_queue = q;
-}
-
-void
-SerialNetDevice::Receive (Packet& p)
-{
-  // ignore return value for now.
-  NS_DEBUG ("SerialNetDevice::Receive (" << &p << ")");
-
-  // Dispatch this to SerialPhy::Receive
-  m_phy->Receive (p);
-}
-
-void
-SerialNetDevice::NotifyDataAvailable(void)
-{
-  NS_DEBUG ("SerialNetDevice::NotifyDataAvailable ()");
-
-  Packet p;
-  bool found = GetQueue ()->Deque (p);
-  if (found)
-    {
-#ifdef NOTYET
-      struct NetDevicePacketDestAddress tag;
-      p.PeekTag (tag);
-      // send packet to address tag.address
-#endif
-      NS_DEBUG ("SerialNetDevice::NotifyDataAvailable (): Dequeued");
-      m_channel->Send(p, this);
-    }
-}
-
-Queue* 
-SerialNetDevice::GetQueue(void) const 
-{ 
-    return m_queue;
-}
-
-SerialChannel* 
-SerialNetDevice::GetChannel(void) const 
-{ 
-    return m_channel;
-}
-
-} // namespace ns3
--- a/src/node/serial-net-device.h	Thu Feb 22 10:03:55 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 University of Washington
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Craig Dowell <craigdo@ee.washington.edu>
- */
-
-#ifndef SERIAL_NET_DEVICE_H
-#define SERIAL_NET_DEVICE_H
-
-#include <string.h>
-#include "mac-address.h"
-#include "internet-node.h"
-#include "net-device.h"
-#include "ns3/callback.h"
-#include "ns3/packet.h"
-
-namespace ns3 {
-
-class SerialChannel;
-class SerialPhy;
-class Queue;
-
-class SerialNetDevice : public NetDevice {
-friend class SerialPhy;
-public:
-  SerialNetDevice(Node* node, const MacAddress& addr);
-  virtual ~SerialNetDevice();
-
-private:
-  // Don't let the compiler slip in copy and assignment construction
-  SerialNetDevice(const SerialNetDevice&);
-  SerialNetDevice&operator=(const SerialNetDevice&);
-
-public:
-  bool Attach(SerialChannel* ch);
-  void AddQueue(Queue *);
-  // called by ChannelSerial
-  void Receive (Packet& p);
-
-protected:
-  Queue* GetQueue(void) const; 
-  SerialChannel* GetChannel(void) const;
-
-private:
-  virtual void NotifyDataAvailable (void);
-  virtual bool SendTo (Packet& p, const MacAddress& dest);
-
-  SerialPhy* m_phy;
-  SerialChannel* m_channel;
-  Queue* m_queue;
-
-};
-
-}; // namespace ns3
-
-#endif // SERIAL_NET_DEVICE_H
-
--- a/src/node/serial-phy.cc	Thu Feb 22 10:03:55 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2005,2006 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-
-#include "ns3/debug.h"
-#include "serial-phy.h"
-#include "serial-net-device.h"
-#include "serial-channel.h"
-#include "queue.h"
-
-NS_DEBUG_COMPONENT_DEFINE ("SerialPhy");
-
-namespace ns3 {
-
-SerialPhy::SerialPhy(Node* node, SerialNetDevice* netdevice) :
-  m_node(node), m_netdevice(netdevice)
-{
-  NS_DEBUG ("SerialPhy::SerialPhy (" << node << ", " << netdevice << ")");
-}
-
-SerialPhy::~SerialPhy()
-{
-  NS_DEBUG ("SerialPhy::~SerialPhy ()");
-}
-
-void
-SerialPhy::NotifyDataAvailable(void)
-{
-  NS_DEBUG ("SerialPhy::NotifyDataAvailable ()");
-
-  Packet p;
-  bool found = m_netdevice->GetQueue ()->Deque (p);
-  if (found)
-    {
-#ifdef NOTYET
-      struct NetDevicePacketDestAddress tag;
-      p.PeekTag (tag);
-      // send packet to address tag.address
-#endif
-      NS_DEBUG ("SerialPhy::NotifyDataAvailable (): Dequeued");
-      m_netdevice->GetChannel()->Send(p, m_netdevice);
-    }
-}
-
-void
-SerialPhy::Receive (Packet& p)
-{
-  NS_DEBUG ("SerialPhy::Receive (" << &p << ")");
-
-  m_netdevice->ForwardUp (p);
-}
-
-} // namespace ns3
--- a/src/node/serial-phy.h	Thu Feb 22 10:03:55 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 University of Washington
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Craig Dowell <craigdo@ee.washington.edu>
- */
-
-#ifndef SERIAL_PHY_H
-#define SERIAL_PHY_H
-
-#include <string.h>
-#include "internet-node.h"
-#include "serial-net-device.h"
-#include "ns3/packet.h"
-
-namespace ns3 {
-
-class SerialPhy {
-public:
-  SerialPhy(Node* node, SerialNetDevice* netdevice);
-  virtual ~SerialPhy();
-  virtual void NotifyDataAvailable (void);
-  void Receive (Packet& p);
-
-private:
-  Node* m_node;
-  SerialNetDevice* m_netdevice;
-};
-
-} // namespace ns3
-
-#endif // SERIAL_PHY_H