From bca528b89ac62cc93cbcbd9fcee63886c3c6acfe Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Sat, 12 May 2007 15:36:41 -0700 Subject: [PATCH] Remove unused code --- examples/simple-p2p.cc | 3 +- src/devices/p2p/p2p-topology.cc | 110 -------------------------------- src/devices/p2p/p2p-topology.h | 17 ----- 3 files changed, 2 insertions(+), 128 deletions(-) diff --git a/examples/simple-p2p.cc b/examples/simple-p2p.cc index bc44cd0f0..3d44e314e 100644 --- a/examples/simple-p2p.cc +++ b/examples/simple-p2p.cc @@ -205,7 +205,8 @@ int main (int argc, char *argv[]) // Also configure some tcpdump traces; each interface will be traced // The output files will be named simple-p2p.pcap-- - // and can be read by the "tcpdump -r" command + // and can be read by the "tcpdump -r" command (use "-tt" option to + // display timestamps correctly) PcapTrace pcaptrace ("simple-p2p.pcap"); pcaptrace.TraceAllIp (); diff --git a/src/devices/p2p/p2p-topology.cc b/src/devices/p2p/p2p-topology.cc index 84b02528b..f748b87a3 100644 --- a/src/devices/p2p/p2p-topology.cc +++ b/src/devices/p2p/p2p-topology.cc @@ -178,115 +178,5 @@ PointToPointTopology::AddIpv4Routes ( } - -#ifdef NOTYET - -// Get the net device connecting node n1 to n2. For topologies where -// there are possibly multiple devices connecting n1 and n2 (for example -// wireless with two devices on different channels) this will return -// the first one found. -PointToPointNetDevice* PointToPointTopology::GetNetDevice(Node* n1, Node* n2) -{ - // First get the NetDeviceList capability from node 1 - NetDeviceList* ndl1 = n1->GetNetDeviceList(); - if (!ndl1) return 0; // No devices, return nil - // Get the list of devices - const NetDeviceList::NetDevices_t& dlist = ndl1->GetAll(); - for (NetDeviceList::NetDevices_t::const_iterator i = dlist.Begin(); - i != dlist.End(); ++i) - { // Check each device - NetDevice* nd = *i; // next device - Channel* c = nd->GetChannel(); - if (!c) continue; // No channel - if (c->NodeIsPeer(n2)) return nd; // found it - } - return 0; // None found -} - -// Get the channel connecting node n1 to node n2 -PointToPointChannel* PointToPointTopology::GetChannel( - Node* n1, - Node* n2 -) -{ - NetDevice* nd = GetNetDevice(n1, n2); - if (!nd) return 0; // No net device, so no channel - return nd->GetChannel(); -} - -Queue* PointToPointTopology::GetQueue(Node* n1, Node* n2) -{ - NetDevice* nd = GetNetDevice(n1, n2); - if (!nd) return 0; // No net device, so in queue - return nd->GetQueue(); -} - -Queue* PointToPointTopology::SetQueue(Node* n1, Node* n2, const Queue& q) -{ - NetDevice* nd = GetNetDevice(n1, n2); - if (!nd) return 0; // No net device, can't set queue - // Add the specified queue to the netdevice - return nd->SetQueue(q); -} - -#endif - -#ifdef GFR -P2PChannel* Topology::AddDuplexLink(Node* n1, const IPAddr& ip1, - Node* n2, const IPAddr& ip2, - const Rate& rate, const Time& delay) -{ - // First get the NetDeviceList capability from each node - NetDeviceList* ndl1 = n1->GetNetDeviceList(); - NetDeviceList* ndl2 = n2->GetNetDeviceList(); - if (!ndl1 || !ndl2) return nil; // Both ends must have NetDeviceList - // Get the net devices - P2PNetDevice* nd1 = ndl1->Add(P2PNetDevice(n1, rate, nil)); - P2PNetDevice* nd2 = ndl2->Add(P2PNetDevice(n1, rate, nd1->GetChannel())); - // Not implemented yet. Add appropriate layer 2 protocol for - // the net devices. - // Get the L3 proto for node 1 and configure it with this device - L3Demux* l3demux1 = n1->GetL3Demux(); - L3Protocol* l3proto1 = nil; - // If the node 1 l3 demux exists, find the coresponding l3 protocol - if (l3demux1) l3proto1 = l3demux1->Lookup(ip1.L3Proto()); - // If the l3 protocol exists, configure this net device. Use a mask - // of all ones, since there is only one device on the remote end - // of this link - if (l3proto1) l3proto1->AddNetDevice(nd1, ip1, ip1.GetMask(ip1.Size()*8)); - // Same for node 2 - L3Demux* l3demux2 = n2->GetL3Demux(); - L3Protocol* l3proto2 = nil; - // If the node 2 l3 demux exists, find the coresponding l3 protocol - if (l3demux2) l3proto2 = l3demux2->Lookup(ip2.L3Proto()); - if (l3proto2) l3proto2->AddNetDevice(nd2, ip2, ip2.GetMask(ip2.Size()*8)); - return dynamic_cast(nd1->GetChannel()); // Always succeeds -} - -// Get the channel connecting node n1 to node n2 -Channel* Topology::GetChannel(Node* n1, Node* n2) -{ - NetDevice* nd = GetNetDevice(n1, n2); - if (!nd) return 0; // No net device, so no channel - return nd->GetChannel(); -} - -Queue* Topology::GetQueue(Node* n1, Node* n2) -{ - NetDevice* nd = GetNetDevice(n1, n2); - if (!nd) return 0; // No net device, so in queue - return nd->GetQueue(); -} - -Queue* Topology::SetQueue(Node* n1, Node* n2, const Queue& q) -{ - NetDevice* nd = GetNetDevice(n1, n2); - if (!nd) return 0; // No net device, can't set queue - // Add the specified queue to the netdevice - return nd->SetQueue(q); -} - -#endif - } // namespace ns3 diff --git a/src/devices/p2p/p2p-topology.h b/src/devices/p2p/p2p-topology.h index 1a1ed9870..2f5e4c75b 100644 --- a/src/devices/p2p/p2p-topology.h +++ b/src/devices/p2p/p2p-topology.h @@ -78,23 +78,6 @@ public: * IPv4 host route to the IPv4 address of the peer node. */ static void AddIpv4Routes (Node*, Node*, const PointToPointChannel*); - - /** - * Get the connecting node n1 to node n2 - */ - static PointToPointChannel* GetChannel(Node*, Node*); - /** - * Get the NetDevice connecting node n1 to n2 - */ - static PointToPointNetDevice* GetNetDevice(Node*, Node*); - /** - * Get the queue associated with a link between two nodes - */ - static Queue* GetQueue(Node*, Node*); - /** - * Set the queue associated with a link between two nodes - */ - static Queue* SetQueue(Node*, Node*, const Queue&); }; } // namespace ns3