--- a/src/devices/p2p-gfr/p2p-channel.cc Fri May 11 10:37:01 2007 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-// -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*-
-//
-// Copyright (c) 2006 Georgia Tech Research Corporation
-// 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: George F. Riley<riley@ece.gatech.edu>
-//
-
-// Implementation of simple point-to-point channel
-// George F. Riley, Georgia Tech, Spring 2007
-
-#include "ns3/simulator.h"
-#include "ns3/packet.h"
-#include "ns3/node.h"
-#include "p2p-channel.h"
-#include "p2p-net-device.h"
-
-namespace ns3 {
-
-P2PChannel::P2PChannel(const Time& delay, double maxRate)
- : m_nd1(0), m_nd2(0),
- m_delay (delay),
- m_maxRate (maxRate)
-{
-}
-
-P2PChannel::~P2PChannel ()
-{}
-
-// Channels create compatible net devices
-P2PNetDevice* P2PChannel::CreateNetDevice(Node *node, MacAddress address)
-{
- // Create a new point-to-point network device
- P2PNetDevice* nd = new P2PNetDevice(node, address);
- nd->Connect (this);
- // Add to list of peers
- if (!m_nd1) m_nd1 = nd;
- else m_nd2 = nd;
- return nd;
-}
-
-void P2PChannel::RemoveNetDevice(NetDevice* nd)
-{
- if (nd == m_nd1) m_nd1 = 0;
- if (nd == m_nd2) m_nd2 = 0;
- // Now if all removed, remove the channel as well
- if (!m_nd1 && !m_nd2)
- {
- delete this;
- }
-}
-
-void P2PChannel::Send(P2PNetDevice *device, Packet& p, double rate)
-{ // Schedule a receive event at receiver
- // First calculate time in future
- double maxRate;
- if (rate < m_maxRate)
- {
- maxRate = rate;
- }
- else
- {
- maxRate = m_maxRate;
- }
- Time txTime = Seconds (p.GetSize() * 8 / maxRate);
- Time rxTime = m_delay + txTime;
- P2PNetDevice *to, *from;
- if (device == m_nd1)
- {
- from = m_nd1;
- to = m_nd2;
- }
- else
- {
- from = m_nd2;
- to = m_nd1;
- }
- // Schedule the receive event at receiver
- Simulator::Schedule(rxTime, &P2PNetDevice::Receive, to, p);
- // Schedule the link free event
- Simulator::Schedule(txTime, &P2PNetDevice::TxComplete, from);
-
-}
-
-}//namespace ns3
--- a/src/devices/p2p-gfr/p2p-channel.h Fri May 11 10:37:01 2007 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-// -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*-
-//
-// Copyright (c) 2006 Georgia Tech Research Corporation
-// 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: George F. Riley<riley@ece.gatech.edu>
-//
-
-// Definition of a simple point-to-point channel
-// George F. Riley, Georgia Tech, Spring 2007
-
-#ifndef P2P_CHANNEL_H
-#define P2P_CHANNEL_H
-
-#include "ns3/nstime.h"
-#include "ns3/mac-address.h"
-
-namespace ns3 {
-
-class P2PNetDevice;
-class NetDevice;
-class Node;
-class Packet;
-
-class P2PChannel {
-public:
- P2PChannel(const Time& delay, double maxRate /* bits/s */);
- ~P2PChannel();
-
- P2PNetDevice* CreateNetDevice(Node *node, MacAddress address);
- void RemoveNetDevice (NetDevice *device);
- void Send (P2PNetDevice *device, Packet&p, double rate /* bits/s */);
-private:
- // The two endpoints of this channel
- P2PNetDevice* m_nd1;
- P2PNetDevice* m_nd2;
- Time m_delay;
- double m_maxRate;
-};
-
-}//namespace ns3
-
-#endif
--- a/src/devices/p2p-gfr/p2p-net-device.cc Fri May 11 10:37:01 2007 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-// -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*-
-//
-// Copyright (c) 2006 Georgia Tech Research Corporation
-// 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: George F. Riley<riley@ece.gatech.edu>
-//
-
-// Implementation of a point-to-point network device
-// George F. Riley, Georgia Tech, Spring 2007
-
-#include "ns3/empty-trace-resolver.h"
-#include "p2p-net-device.h"
-#include "p2p-channel.h"
-
-namespace ns3 {
-
-P2PNetDevice::P2PNetDevice (Node *node, MacAddress const &addr)
- : NetDevice (node, addr),
- m_rate (1000000)
-{
- SetMtu (2300);
- EnableBroadcast (MacAddress ("ff:ff:ff:ff:ff:ff"));
-}
-
-P2PNetDevice::~P2PNetDevice()
-{ // Inform channel that we are destroyed
- m_channel->RemoveNetDevice(this);
-}
-
-void
-P2PNetDevice::SetRate (double rate)
-{
- m_rate = rate;
-}
-
-void
-P2PNetDevice::Connect (P2PChannel *channel)
-{
- m_channel = channel;
- NotifyLinkUp ();
-}
-
-bool
-P2PNetDevice::SendTo (Packet& p, const MacAddress&)
-{
- m_channel->Send (this, p, m_rate);
- return true;
-}
-
-TraceResolver *
-P2PNetDevice::DoCreateTraceResolver (TraceContext const &context)
-{
- return new EmptyTraceResolver (context);
-}
-
-void
-P2PNetDevice::Receive(Packet p)
-{
- ForwardUp (p);
-}
-
-void
-P2PNetDevice::TxComplete (void)
-{}
-
-}//namespace ns3
--- a/src/devices/p2p-gfr/p2p-net-device.h Fri May 11 10:37:01 2007 -0400
+++ /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) 2006 Georgia Tech Research Corporation
-// 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: George F. Riley<riley@ece.gatech.edu>
-//
-
-// Definition for a Point-to-Point network device
-// George F. Riley, Georgia Tech, Spring 2007
-
-#ifndef P2P_NET_DEVICE_H
-#define P2P_NET_DEVICE_H
-
-#include "ns3/net-device.h"
-
-namespace ns3 {
-
-class P2PChannel;
-
-class P2PNetDevice : public NetDevice {
-public:
- P2PNetDevice(Node *node, MacAddress const &addr);
- virtual ~P2PNetDevice();
-
- void SetRate (double rate);
- void Connect (P2PChannel *channel);
- void Receive(Packet p);
- void TxComplete (void);
- private:
- virtual bool SendTo (Packet& p, const MacAddress& dest);
- virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context);
-
- double m_rate;
- P2PChannel *m_channel;
-};
-
-}//namespace ns3
-
-#endif /* P2P_NET_DEVICE_H */
-
--- a/src/devices/p2p-gfr/wscript Fri May 11 10:37:01 2007 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-
-
-def build(bld):
- p2p = bld.create_obj('cpp', 'objects')
- p2p.name = 'ns3-p2p-gfr'
- p2p.source = [
- 'p2p-net-device.cc',
- 'p2p-channel.cc',
- 'p2p-topology.cc',
- 'p2p-phy.cc',
- 'layer-connector.cc',
- ]
- headers = bld.create_obj('ns3header')
- headers.name = 'ns3-p2p-gfr-headers'
- headers.source = [
- 'p2p-net-device.h',
- 'p2p-channel.h',
- 'p2p-topology.h',
- 'p2p-phy.h',
- 'layer-connector.h',
- ]
-