diff --git a/examples/simple-p2p.cc b/examples/simple-p2p.cc index c206bbf51..47edad9f4 100644 --- a/examples/simple-p2p.cc +++ b/examples/simple-p2p.cc @@ -100,10 +100,10 @@ int main (int argc, char *argv[]) // Here, we will explicitly create four nodes. In more sophisticated // topologies, we could configure a node factory. - Ptr n0 = MakeInternetNode (); - Ptr n1 = MakeInternetNode (); - Ptr n2 = MakeInternetNode (); - Ptr n3 = MakeInternetNode (); + Ptr n0 = MakeInternetNode (); + Ptr n1 = MakeInternetNode (); + Ptr n2 = MakeInternetNode (); + Ptr n3 = MakeInternetNode (); // We create the channels first without any IP addressing information Ptr channel0 = diff --git a/samples/main-simple.cc b/samples/main-simple.cc index 98beb4a56..eb35aee81 100644 --- a/samples/main-simple.cc +++ b/samples/main-simple.cc @@ -38,7 +38,7 @@ PrintTraffic (Ptr socket) void RunSimulation (void) { - Ptr a = MakeInternetNode (); + Ptr a = MakeInternetNode (); Ptr udp = a->QueryInterface (IUdp::iid); diff --git a/src/applications/onoff-application.cc b/src/applications/onoff-application.cc index 3994cdcb9..f3381fe5a 100644 --- a/src/applications/onoff-application.cc +++ b/src/applications/onoff-application.cc @@ -42,7 +42,7 @@ uint32_t OnOffApplication::g_defaultSize = 512; // Constructors - OnOffApplication::OnOffApplication(Ptr n, + OnOffApplication::OnOffApplication(Ptr n, const Ipv4Address rip, // Remote IP addr uint16_t rport, // Remote port const RandomVariable& ontime, @@ -67,7 +67,7 @@ uint32_t OnOffApplication::g_defaultSize = 512; { } -OnOffApplication::OnOffApplication(Ptr n, const OnOffApplication& c) +OnOffApplication::OnOffApplication(Ptr n, const OnOffApplication& c) : Application(n), m_socket(0), m_peerIP(c.m_peerIP), @@ -157,7 +157,7 @@ void OnOffApplication::StartApplication() // Called at time specified by Star if (!m_socket) { // Create the socket using the specified layer 4 protocol #ifdef NOTYET - m_socket = PeekNode()->GetKernel()->CreateGenericSocket(*m_l4Proto); + m_socket = PeekINode()->GetKernel()->CreateGenericSocket(*m_l4Proto); m_socket->Bind(); // Choose any available port local port m_socket->Connect(*m_peerIP, m_peerPort, MakeCallback(&OnOffApplication::ConnectionSucceeded, @@ -166,7 +166,7 @@ void OnOffApplication::StartApplication() // Called at time specified by Star this)); #endif - Ptr udp = GetNode ()->QueryInterface (IUdp::iid); + Ptr udp = GetINode ()->QueryInterface (IUdp::iid); m_socket = udp->CreateSocket (); m_socket->Connect (m_peerIP, m_peerPort); } diff --git a/src/applications/onoff-application.h b/src/applications/onoff-application.h index 661fa225e..8ee7d285a 100644 --- a/src/applications/onoff-application.h +++ b/src/applications/onoff-application.h @@ -41,7 +41,7 @@ class DataRate; class OnOffApplication : public Application { public: - OnOffApplication(Ptr n, + OnOffApplication(Ptr n, const Ipv4Address, // Peer IP address uint16_t, // Peer port const RandomVariable&, // Random variable for On time @@ -49,7 +49,7 @@ public: DataRate = g_defaultRate, // Data rate when on uint32_t = g_defaultSize); // Size of packets - OnOffApplication(Ptr n, const OnOffApplication&); // Copy constructor + OnOffApplication(Ptr n, const OnOffApplication&); // Copy constructor virtual ~OnOffApplication(); // Destructor virtual void StartApplication(); // Called at time specified by Start virtual void StopApplication(); // Called at time specified by Stop diff --git a/src/devices/p2p/p2p-net-device.cc b/src/devices/p2p/p2p-net-device.cc index 9542d951b..0733b7ded 100644 --- a/src/devices/p2p/p2p-net-device.cc +++ b/src/devices/p2p/p2p-net-device.cc @@ -32,7 +32,7 @@ NS_DEBUG_COMPONENT_DEFINE ("PointToPointNetDevice"); namespace ns3 { -PointToPointNetDevice::PointToPointNetDevice (Ptr node) +PointToPointNetDevice::PointToPointNetDevice (Ptr node) : NetDevice(node, MacAddress ("00:00:00:00:00:00")), m_txMachineState (READY), diff --git a/src/devices/p2p/p2p-net-device.h b/src/devices/p2p/p2p-net-device.h index 893080dce..f972d5c49 100644 --- a/src/devices/p2p/p2p-net-device.h +++ b/src/devices/p2p/p2p-net-device.h @@ -74,13 +74,13 @@ public: * Construct a PointToPointNetDevice * * This is the constructor for the PointToPointNetDevice. It takes as a - * parameter the Node to which this device is connected. Ownership of the - * Node pointer is not implied and the node must not be deleded. + * parameter the INode to which this device is connected. Ownership of the + * INode pointer is not implied and the node must not be deleded. * * @see PointToPointTopology::AddPointToPointLink () - * @param node the Node to which this device is connected. + * @param node the INode to which this device is connected. */ - PointToPointNetDevice (Ptr node); + PointToPointNetDevice (Ptr node); /** * Copy Construct a PointToPointNetDevice * diff --git a/src/devices/p2p/p2p-topology.cc b/src/devices/p2p/p2p-topology.cc index 7f9db4660..d547bf3c4 100644 --- a/src/devices/p2p/p2p-topology.cc +++ b/src/devices/p2p/p2p-topology.cc @@ -40,8 +40,8 @@ namespace ns3 { Ptr PointToPointTopology::AddPointToPointLink( - Ptr n1, - Ptr n2, + Ptr n1, + Ptr n2, const DataRate& bps, const Time& delay) { @@ -65,8 +65,8 @@ PointToPointTopology::AddPointToPointLink( void PointToPointTopology::AddIpv4Addresses( Ptr chan, - Ptr n1, const Ipv4Address& addr1, - Ptr n2, const Ipv4Address& addr2) + Ptr n1, const Ipv4Address& addr1, + Ptr n2, const Ipv4Address& addr2) { // Duplex link is assumed to be subnetted as a /30 @@ -79,13 +79,13 @@ PointToPointTopology::AddIpv4Addresses( Ptr nd1 = chan->GetDevice (0); Ptr nd2 = chan->GetDevice (1); // Make sure that nd1 belongs to n1 and nd2 to n2 - if ( (nd1->GetNode ()->GetId () == n2->GetId () ) && - (nd2->GetNode ()->GetId () == n1->GetId () ) ) + if ( (nd1->GetINode ()->GetId () == n2->GetId () ) && + (nd2->GetINode ()->GetId () == n1->GetId () ) ) { std::swap(nd1, nd2); } - NS_ASSERT (nd1->GetNode ()->GetId () == n1->GetId ()); - NS_ASSERT (nd2->GetNode ()->GetId () == n2->GetId ()); + NS_ASSERT (nd1->GetINode ()->GetId () == n1->GetId ()); + NS_ASSERT (nd2->GetINode ()->GetId () == n2->GetId ()); Ptr ip1 = n1->QueryInterface (IIpv4::iid); uint32_t index1 = ip1->AddInterface (nd1); @@ -105,38 +105,38 @@ PointToPointTopology::AddIpv4Addresses( void PointToPointTopology::AddIpv4Routes ( - Ptr n1, Ptr n2, Ptr chan) + Ptr n1, Ptr n2, Ptr chan) { // The PointToPoint channel is used to find the relevant NetDevices NS_ASSERT (chan->GetNDevices () == 2); Ptr nd1 = chan->GetDevice (0); Ptr nd2 = chan->GetDevice (1); - // Assert that n1 is the Node owning one of the two NetDevices + // Assert that n1 is the INode owning one of the two NetDevices // and make sure that nd1 corresponds to it - if (nd1->GetNode ()->GetId () == n1->GetId ()) + if (nd1->GetINode ()->GetId () == n1->GetId ()) { ; // Do nothing } - else if (nd2->GetNode ()->GetId () == n1->GetId ()) + else if (nd2->GetINode ()->GetId () == n1->GetId ()) { std::swap(nd1, nd2); } else { - NS_FATAL_ERROR("P2PTopo: Node does not contain an interface on Channel"); + NS_FATAL_ERROR("P2PTopo: INode does not contain an interface on Channel"); } - // Assert that n2 is the Node owning one of the two NetDevices + // Assert that n2 is the INode owning one of the two NetDevices // and make sure that nd2 corresponds to it - if (nd2->GetNode ()->GetId () != n2->GetId ()) + if (nd2->GetINode ()->GetId () != n2->GetId ()) { - NS_FATAL_ERROR("P2PTopo: Node does not contain an interface on Channel"); + NS_FATAL_ERROR("P2PTopo: INode does not contain an interface on Channel"); } // Assert that both are Ipv4 nodes - Ptr ip1 = nd1->GetNode ()->QueryInterface (IIpv4::iid); - Ptr ip2 = nd2->GetNode ()->QueryInterface (IIpv4::iid); + Ptr ip1 = nd1->GetINode ()->QueryInterface (IIpv4::iid); + Ptr ip2 = nd2->GetINode ()->QueryInterface (IIpv4::iid); NS_ASSERT(ip1 != 0 && ip2 != 0); // Get interface indexes for both nodes corresponding to the right channel diff --git a/src/devices/p2p/p2p-topology.h b/src/devices/p2p/p2p-topology.h index 1cb643d94..282cf7cd6 100644 --- a/src/devices/p2p/p2p-topology.h +++ b/src/devices/p2p/p2p-topology.h @@ -30,7 +30,7 @@ namespace ns3 { class PointToPointChannel; -class Node; +class INode; class IPAddr; class DataRate; class Queue; @@ -42,8 +42,8 @@ class Queue; class PointToPointTopology { public: /** - * \param n1 Node - * \param n2 Node + * \param n1 INode + * \param n2 INode * \param rate Maximum transmission link rate * \param delay one-way propagation delay * \return Pointer to the underlying PointToPointChannel @@ -53,13 +53,13 @@ public: * PointToPointChannel. */ static Ptr AddPointToPointLink( - Ptr n1, Ptr n2, const DataRate& dataRate, const Time& delay); + Ptr n1, Ptr n2, const DataRate& dataRate, const Time& delay); /** * \param chan PointToPointChannel to use - * \param n1 Node + * \param n1 INode * \param addr1 Ipv4 Address for n1 - * \param n2 Node + * \param n2 INode * \param addr2 Ipv4 Address for n2 * * Add Ipv4Addresses to the Ipv4 interfaces associated with the @@ -67,18 +67,18 @@ public: */ static void AddIpv4Addresses( Ptr chan, - Ptr n1, const Ipv4Address& addr1, - Ptr n2, const Ipv4Address& addr2); + Ptr n1, const Ipv4Address& addr1, + Ptr n2, const Ipv4Address& addr2); /** * \param channel PointToPointChannel to use - * \param n1 Node - * \param n2 Node + * \param n1 INode + * \param n2 INode * - * For the given PointToPointChannel, for each Node, add an + * For the given PointToPointChannel, for each INode, add an * IPv4 host route to the IPv4 address of the peer node. */ - static void AddIpv4Routes (Ptr n1, Ptr n2, Ptr channel); + static void AddIpv4Routes (Ptr n1, Ptr n2, Ptr channel); }; } // namespace ns3 diff --git a/src/internet-node/arp-ipv4-interface.cc b/src/internet-node/arp-ipv4-interface.cc index e11f0b51a..93423ec1d 100644 --- a/src/internet-node/arp-ipv4-interface.cc +++ b/src/internet-node/arp-ipv4-interface.cc @@ -31,7 +31,7 @@ namespace ns3 { -ArpIpv4Interface::ArpIpv4Interface (Ptr node, Ptr device) +ArpIpv4Interface::ArpIpv4Interface (Ptr node, Ptr device) : Ipv4Interface (device), m_node (node) {} diff --git a/src/internet-node/arp-ipv4-interface.h b/src/internet-node/arp-ipv4-interface.h index b1c0698f1..030d10e32 100644 --- a/src/internet-node/arp-ipv4-interface.h +++ b/src/internet-node/arp-ipv4-interface.h @@ -27,7 +27,7 @@ namespace ns3 { -class Node; +class INode; /** * \brief an Ipv4 Interface which uses ARP @@ -43,13 +43,13 @@ class ArpIpv4Interface : public Ipv4Interface NETDEVICE, ARP, }; - ArpIpv4Interface (Ptr node, Ptr device); + ArpIpv4Interface (Ptr node, Ptr device); virtual ~ArpIpv4Interface (); private: virtual void SendTo (Packet p, Ipv4Address dest); virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context); - Ptr m_node; + Ptr m_node; }; }//namespace ns3 diff --git a/src/internet-node/arp.cc b/src/internet-node/arp.cc index a18128cdb..37e64e783 100644 --- a/src/internet-node/arp.cc +++ b/src/internet-node/arp.cc @@ -36,7 +36,7 @@ namespace ns3 { const uint16_t Arp::PROT_NUMBER = 0x0806; -Arp::Arp (Ptr node) +Arp::Arp (Ptr node) : L3Protocol (PROT_NUMBER, 0/* XXX: correct version number ? */ ), m_node (node) {} diff --git a/src/internet-node/arp.h b/src/internet-node/arp.h index 0273d5e3b..49be7a3f7 100644 --- a/src/internet-node/arp.h +++ b/src/internet-node/arp.h @@ -31,7 +31,7 @@ namespace ns3 { class ArpCache; class NetDevice; -class Node; +class INode; class Packet; class TraceResolver; class TraceContext; @@ -41,7 +41,7 @@ class Arp : public L3Protocol public: static const uint16_t PROT_NUMBER; - Arp (Ptr node); + Arp (Ptr node); ~Arp (); virtual TraceResolver *CreateTraceResolver (TraceContext const &context); @@ -58,7 +58,7 @@ private: void SendArpRequest (ArpCache const *cache, Ipv4Address to); void SendArpReply (ArpCache const *cache, Ipv4Address toIp, MacAddress toMac); CacheList m_cacheList; - Ptr m_node; + Ptr m_node; }; }//namespace ns3 diff --git a/src/internet-node/ascii-trace.cc b/src/internet-node/ascii-trace.cc index e1c4181f5..fbd085dee 100644 --- a/src/internet-node/ascii-trace.cc +++ b/src/internet-node/ascii-trace.cc @@ -110,7 +110,7 @@ AsciiTrace::LogDevQueue (TraceContext const &context, Packet const &packet) m_os << Simulator::Now ().GetSeconds () << " "; NodeList::NodeIndex nodeIndex; context.Get (nodeIndex); - m_os << "node=" << NodeList::GetNode (nodeIndex)->GetId () << " "; + m_os << "node=" << NodeList::GetINode (nodeIndex)->GetId () << " "; Ipv4::InterfaceIndex interfaceIndex; context.Get (interfaceIndex); m_os << "interface=" << interfaceIndex << " "; @@ -124,7 +124,7 @@ AsciiTrace::LogDevRx (TraceContext const &context, Packet &p) m_os << "r " << Simulator::Now ().GetSeconds () << " "; NodeList::NodeIndex nodeIndex; context.Get (nodeIndex); - m_os << "node=" << NodeList::GetNode (nodeIndex)->GetId () << " "; + m_os << "node=" << NodeList::GetINode (nodeIndex)->GetId () << " "; Ipv4::InterfaceIndex interfaceIndex; context.Get (interfaceIndex); m_os << "interface=" << interfaceIndex << " "; diff --git a/src/internet-node/i-node-impl.cc b/src/internet-node/i-node-impl.cc index b5b81390e..41295175c 100644 --- a/src/internet-node/i-node-impl.cc +++ b/src/internet-node/i-node-impl.cc @@ -18,7 +18,7 @@ // // Author: George F. Riley // -// Implementation of the InternetNode class for ns3. +// Implementation of the INodeImpl class for ns3. // George F. Riley, Georgia Tech, Fall 2006 #include "ns3/composite-trace-resolver.h" @@ -38,21 +38,21 @@ namespace ns3 { -InternetNode::InternetNode() +INodeImpl::INodeImpl() { Construct (); } -InternetNode::InternetNode(uint32_t systemId) +INodeImpl::INodeImpl(uint32_t systemId) { Construct (); } -InternetNode::~InternetNode () +INodeImpl::~INodeImpl () {} void -InternetNode::Construct (void) +INodeImpl::Construct (void) { Ptr ipv4 = MakeNewObject (this); Ptr arp = MakeNewObject (this); @@ -79,37 +79,37 @@ InternetNode::Construct (void) } void -InternetNode::SetName (std::string name) +INodeImpl::SetName (std::string name) { m_name = name; } TraceResolver * -InternetNode::DoCreateTraceResolver (TraceContext const &context) +INodeImpl::DoCreateTraceResolver (TraceContext const &context) { CompositeTraceResolver *resolver = new CompositeTraceResolver (context); Ptr ipv4 = QueryInterface (IIpv4Private::iid); resolver->Add ("ipv4", MakeCallback (&IIpv4Private::CreateTraceResolver, PeekPointer (ipv4)), - InternetNode::IPV4); + INodeImpl::IPV4); return resolver; } void -InternetNode::DoDispose() +INodeImpl::DoDispose() { - Node::DoDispose (); + INode::DoDispose (); } void -InternetNode::DoAddDevice (Ptr device) const +INodeImpl::DoAddDevice (Ptr device) const { - device->SetReceiveCallback (MakeCallback (&InternetNode::ReceiveFromDevice, this)); + device->SetReceiveCallback (MakeCallback (&INodeImpl::ReceiveFromDevice, this)); } bool -InternetNode::ReceiveFromDevice (Ptr device, const Packet &p, uint16_t protocolNumber) const +INodeImpl::ReceiveFromDevice (Ptr device, const Packet &p, uint16_t protocolNumber) const { Ptr demux = QueryInterface (L3Demux::iid); Ptr target = demux->GetProtocol (protocolNumber); diff --git a/src/internet-node/i-node-impl.h b/src/internet-node/i-node-impl.h index 0784d872d..e61bc4c14 100644 --- a/src/internet-node/i-node-impl.h +++ b/src/internet-node/i-node-impl.h @@ -33,15 +33,15 @@ namespace ns3 { class Packet; -class InternetNode : public Node +class INodeImpl : public INode { public: enum TraceType { IPV4, }; - InternetNode(); - InternetNode(uint32_t systemId); - virtual ~InternetNode (); + INodeImpl(); + INodeImpl(uint32_t systemId); + virtual ~INodeImpl (); void SetName(std::string name); protected: diff --git a/src/internet-node/internet-node.cc b/src/internet-node/internet-node.cc index 70b79578a..5d73306ba 100644 --- a/src/internet-node/internet-node.cc +++ b/src/internet-node/internet-node.cc @@ -23,16 +23,16 @@ namespace ns3 { -Ptr +Ptr MakeInternetNode (void) { - return MakeNewObject (); + return MakeNewObject (); } -Ptr +Ptr MakeInternetNode (uint32_t systemId) { - return MakeNewObject (systemId); + return MakeNewObject (systemId); } } // namespace ns3 diff --git a/src/internet-node/internet-node.h b/src/internet-node/internet-node.h index b44cb89ba..991219d8c 100644 --- a/src/internet-node/internet-node.h +++ b/src/internet-node/internet-node.h @@ -26,9 +26,9 @@ namespace ns3 { -Ptr MakeInternetNode (void); +Ptr MakeInternetNode (void); -Ptr MakeInternetNode (uint32_t systemId); +Ptr MakeInternetNode (uint32_t systemId); } // namespace ns3 diff --git a/src/internet-node/ipv4-l4-demux.cc b/src/internet-node/ipv4-l4-demux.cc index c90e91c79..788924b0c 100644 --- a/src/internet-node/ipv4-l4-demux.cc +++ b/src/internet-node/ipv4-l4-demux.cc @@ -32,7 +32,7 @@ namespace ns3 { const InterfaceId Ipv4L4Demux::iid ("Ipv4L4Demux"); -Ipv4L4Demux::Ipv4L4Demux (Ptr node) +Ipv4L4Demux::Ipv4L4Demux (Ptr node) : Interface (Ipv4L4Demux::iid), m_node (node) {} diff --git a/src/internet-node/ipv4-l4-demux.h b/src/internet-node/ipv4-l4-demux.h index f6b199be9..c242814cb 100644 --- a/src/internet-node/ipv4-l4-demux.h +++ b/src/internet-node/ipv4-l4-demux.h @@ -32,7 +32,7 @@ namespace ns3 { class Ipv4L4Protocol; -class Node; +class INode; class TraceResolver; class TraceContext; @@ -44,7 +44,7 @@ class Ipv4L4Demux : public Interface public: static const InterfaceId iid; typedef int Ipv4L4ProtocolTraceType; - Ipv4L4Demux (Ptr node); + Ipv4L4Demux (Ptr node); virtual ~Ipv4L4Demux(); /** @@ -60,7 +60,7 @@ public: * \returns the L4Protocol effectively added. * * Invoke Copy on the input template to get a copy of the input - * protocol which can be used on the Node on which this L4 Demux + * protocol which can be used on the INode on which this L4 Demux * is running. The new L4Protocol is registered internally as * a working L4 Protocol and returned from this method. * The caller does not get ownership of the returned pointer. @@ -73,7 +73,7 @@ public: * * This method is typically called by lower layers * to forward packets up the stack to the right protocol. - * It is also called from InternetNode::GetUdp for example. + * It is also called from INodeImpl::GetUdp for example. */ Ptr GetProtocol(int protocolNumber); /** @@ -87,7 +87,7 @@ private: virtual void DoDispose (void); typedef std::list > L4List_t; L4List_t m_protocols; - Ptr m_node; + Ptr m_node; }; } //namespace ns3 diff --git a/src/internet-node/ipv4-loopback-interface.cc b/src/internet-node/ipv4-loopback-interface.cc index 195be2f8d..a58ee6fae 100644 --- a/src/internet-node/ipv4-loopback-interface.cc +++ b/src/internet-node/ipv4-loopback-interface.cc @@ -27,7 +27,7 @@ namespace ns3 { -Ipv4LoopbackInterface::Ipv4LoopbackInterface (Ptr node) +Ipv4LoopbackInterface::Ipv4LoopbackInterface (Ptr node) : Ipv4Interface (0), m_node (node) {} diff --git a/src/internet-node/ipv4-loopback-interface.h b/src/internet-node/ipv4-loopback-interface.h index cc7609b4a..4b89025dc 100644 --- a/src/internet-node/ipv4-loopback-interface.h +++ b/src/internet-node/ipv4-loopback-interface.h @@ -27,19 +27,19 @@ namespace ns3 { -class Node; +class INode; class Ipv4LoopbackInterface : public Ipv4Interface { public: - Ipv4LoopbackInterface (Ptr node); + Ipv4LoopbackInterface (Ptr node); virtual ~Ipv4LoopbackInterface (); private: virtual void SendTo (Packet p, Ipv4Address dest); virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context); - Ptr m_node; + Ptr m_node; }; }//namespace ns3 diff --git a/src/internet-node/ipv4.cc b/src/internet-node/ipv4.cc index 4c699fe5a..8a59bef90 100644 --- a/src/internet-node/ipv4.cc +++ b/src/internet-node/ipv4.cc @@ -43,7 +43,7 @@ namespace ns3 { const uint16_t Ipv4::PROT_NUMBER = 0x0800; -Ipv4::Ipv4(Ptr node) +Ipv4::Ipv4(Ptr node) : L3Protocol (PROT_NUMBER, 4), m_nInterfaces (0), m_defaultTtl (64), diff --git a/src/internet-node/ipv4.h b/src/internet-node/ipv4.h index 1b88f1863..a15b958cb 100644 --- a/src/internet-node/ipv4.h +++ b/src/internet-node/ipv4.h @@ -38,7 +38,7 @@ class Ipv4Interface; class Ipv4Address; class Ipv4Header; class Ipv4Route; -class Node; +class INode; class TraceResolver; class TraceContext; @@ -59,7 +59,7 @@ public: }; typedef ArrayTraceResolver::Index InterfaceIndex; - Ipv4(Ptr node); + Ipv4(Ptr node); virtual ~Ipv4 (); /** @@ -241,7 +241,7 @@ private: HostRoutes m_hostRoutes; NetworkRoutes m_networkRoutes; Ipv4Route *m_defaultRoute; - Ptr m_node; + Ptr m_node; CallbackTraceSource m_txTrace; CallbackTraceSource m_rxTrace; CallbackTraceSource m_dropTrace; diff --git a/src/internet-node/l3-demux.cc b/src/internet-node/l3-demux.cc index d3992f375..e2ce0756b 100644 --- a/src/internet-node/l3-demux.cc +++ b/src/internet-node/l3-demux.cc @@ -31,7 +31,7 @@ namespace ns3 { const InterfaceId L3Demux::iid ("L3Demux"); -L3Demux::L3Demux (Ptr node) +L3Demux::L3Demux (Ptr node) : Interface (L3Demux::iid), m_node (node) {} diff --git a/src/internet-node/l3-demux.h b/src/internet-node/l3-demux.h index 477a43e92..a4bfa78cc 100644 --- a/src/internet-node/l3-demux.h +++ b/src/internet-node/l3-demux.h @@ -34,7 +34,7 @@ namespace ns3 { class L3Protocol; -class Node; +class INode; class TraceResolver; class TraceContext; @@ -46,7 +46,7 @@ class L3Demux : public Interface public: static const InterfaceId iid; typedef int ProtocolTraceType; - L3Demux(Ptr node); + L3Demux(Ptr node); virtual ~L3Demux(); /** @@ -63,7 +63,7 @@ public: * \param protocol a template for the protocol to add to this L3 Demux. * * Invoke Copy on the input template to get a copy of the input - * protocol which can be used on the Node on which this L3 Demux + * protocol which can be used on the INode on which this L3 Demux * is running. The new L3Protocol is registered internally as * a working L3 Protocol and returned from this method. * The caller does not get ownership of the returned pointer. @@ -76,7 +76,7 @@ public: * * This method is typically called by lower layers * to forward packets up the stack to the right protocol. - * It is also called from InternetNode::GetIpv4 for example. + * It is also called from INodeImpl::GetIpv4 for example. */ Ptr GetProtocol (int protocolNumber); protected: @@ -84,7 +84,7 @@ protected: private: typedef std::map > L3Map_t; - Ptr m_node; + Ptr m_node; L3Map_t m_protocols; }; diff --git a/src/internet-node/pcap-trace.cc b/src/internet-node/pcap-trace.cc index a2d156544..99f4adf0c 100644 --- a/src/internet-node/pcap-trace.cc +++ b/src/internet-node/pcap-trace.cc @@ -84,7 +84,7 @@ PcapTrace::LogIp (TraceContext const &context, Packet const &p, uint32_t interfa { NodeList::NodeIndex nodeIndex; context.Get (nodeIndex); - uint32_t nodeId = NodeList::GetNode (nodeIndex)->GetId (); + uint32_t nodeId = NodeList::GetINode (nodeIndex)->GetId (); PcapWriter *writer = GetStream (nodeId, interfaceIndex); writer->WritePacket (p); } diff --git a/src/internet-node/udp-socket.cc b/src/internet-node/udp-socket.cc index 3195f9ef9..8c6c3dcfc 100644 --- a/src/internet-node/udp-socket.cc +++ b/src/internet-node/udp-socket.cc @@ -26,7 +26,7 @@ namespace ns3 { -UdpSocket::UdpSocket (Ptr node, Ptr udp) +UdpSocket::UdpSocket (Ptr node, Ptr udp) : m_endPoint (0), m_node (node), m_udp (udp), @@ -56,8 +56,8 @@ UdpSocket::~UdpSocket () m_udp = 0; } -Ptr -UdpSocket::GetNode (void) const +Ptr +UdpSocket::GetINode (void) const { return m_node; } diff --git a/src/internet-node/udp-socket.h b/src/internet-node/udp-socket.h index 9d2d5805e..37f65b652 100644 --- a/src/internet-node/udp-socket.h +++ b/src/internet-node/udp-socket.h @@ -29,7 +29,7 @@ namespace ns3 { class Ipv4EndPoint; -class Node; +class INode; class Packet; class Udp; @@ -39,11 +39,11 @@ public: /** * Create an unbound udp socket. */ - UdpSocket (Ptr node, Ptr udp); + UdpSocket (Ptr node, Ptr udp); virtual ~UdpSocket (); virtual enum SocketErrno GetErrno (void) const; - virtual Ptr GetNode (void) const; + virtual Ptr GetINode (void) const; virtual int Bind (void); virtual int Bind (Ipv4Address address); virtual int Bind (uint16_t port); @@ -82,7 +82,7 @@ private: ns3::Callback, uint32_t> dataSent); Ipv4EndPoint *m_endPoint; - Ptr m_node; + Ptr m_node; Ptr m_udp; Ipv4Address m_defaultAddress; uint16_t m_defaultPort; diff --git a/src/internet-node/udp.cc b/src/internet-node/udp.cc index d95152dc8..7b546044f 100644 --- a/src/internet-node/udp.cc +++ b/src/internet-node/udp.cc @@ -38,7 +38,7 @@ namespace ns3 { /* see http://www.iana.org/assignments/protocol-numbers */ const uint8_t Udp::PROT_NUMBER = 17; -Udp::Udp (Ptr node) +Udp::Udp (Ptr node) : Ipv4L4Protocol (PROT_NUMBER, 2), m_node (node), m_endPoints (new Ipv4EndPointDemux ()) diff --git a/src/internet-node/udp.h b/src/internet-node/udp.h index fdb707230..0328d3501 100644 --- a/src/internet-node/udp.h +++ b/src/internet-node/udp.h @@ -32,7 +32,7 @@ namespace ns3 { -class Node; +class INode; class TraceResolver; class TraceContext; class Socket; @@ -41,7 +41,7 @@ class Udp : public Ipv4L4Protocol { public: static const uint8_t PROT_NUMBER; - Udp (Ptr node); + Udp (Ptr node); virtual ~Udp (); virtual TraceResolver *CreateTraceResolver (TraceContext const &context); @@ -68,7 +68,7 @@ public: protected: virtual void DoDispose (void); private: - Ptr m_node; + Ptr m_node; Ipv4EndPointDemux *m_endPoints; }; diff --git a/src/node/application.cc b/src/node/application.cc index 985f8c513..ea5d90fcd 100644 --- a/src/node/application.cc +++ b/src/node/application.cc @@ -34,7 +34,7 @@ namespace ns3 { // Application Methods // \brief Application Constructor -Application::Application(Ptr n) +Application::Application(Ptr n) : m_node (n) { m_node->AddApplication (this); @@ -77,7 +77,7 @@ void Application::Stop(const RandomVariable& stopVar) delete v; } -Ptr Application::GetNode() const +Ptr Application::GetINode() const { return m_node; } diff --git a/src/node/application.h b/src/node/application.h index 4a1149323..fc19e214a 100644 --- a/src/node/application.h +++ b/src/node/application.h @@ -29,7 +29,7 @@ namespace ns3 { -class Node; +class INode; class RandomVariable; /** @@ -52,7 +52,7 @@ class RandomVariable; class Application : public Object { public: - Application(Ptr); + Application(Ptr); virtual ~Application(); /** @@ -98,9 +98,9 @@ public: void Stop(const RandomVariable& stopVariable); /** - * \returns the Node to which this Application object is attached. + * \returns the INode to which this Application object is attached. */ - Ptr GetNode() const; + Ptr GetINode() const; private: /** @@ -128,7 +128,7 @@ private: EventId m_startEvent; EventId m_stopEvent; - Ptr m_node; + Ptr m_node; }; } //namespace ns3 diff --git a/src/node/i-node.cc b/src/node/i-node.cc index 5eab3b1d0..023c749c3 100644 --- a/src/node/i-node.cc +++ b/src/node/i-node.cc @@ -19,7 +19,7 @@ // Author: George F. Riley // -// Implement the basic Node object for ns3. +// Implement the basic INode object for ns3. // George F. Riley, Georgia Tech, Fall 2006 #include "i-node.h" @@ -30,47 +30,47 @@ namespace ns3{ -const InterfaceId Node::iid ("Node"); +const InterfaceId INode::iid ("INode"); -Node::Node() - : Interface (Node::iid), +INode::INode() + : Interface (INode::iid), m_id(0), m_sid(0) { m_id = NodeList::Add (this); } -Node::Node(uint32_t sid) - : Interface (Node::iid), +INode::INode(uint32_t sid) + : Interface (INode::iid), m_id(0), m_sid(sid) { m_id = NodeList::Add (this); } -Node::~Node () +INode::~INode () {} TraceResolver * -Node::CreateTraceResolver (TraceContext const &context) +INode::CreateTraceResolver (TraceContext const &context) { return DoCreateTraceResolver (context); } uint32_t -Node::GetId (void) const +INode::GetId (void) const { return m_id; } uint32_t -Node::GetSystemId (void) const +INode::GetSystemId (void) const { return m_sid; } uint32_t -Node::AddDevice (Ptr device) +INode::AddDevice (Ptr device) { uint32_t index = m_devices.size (); m_devices.push_back (device); @@ -79,36 +79,36 @@ Node::AddDevice (Ptr device) return index; } Ptr -Node::GetDevice (uint32_t index) const +INode::GetDevice (uint32_t index) const { return m_devices[index]; } uint32_t -Node::GetNDevices (void) const +INode::GetNDevices (void) const { return m_devices.size (); } uint32_t -Node::AddApplication (Ptr application) +INode::AddApplication (Ptr application) { uint32_t index = m_applications.size (); m_applications.push_back (application); return index; } Ptr -Node::GetApplication (uint32_t index) const +INode::GetApplication (uint32_t index) const { return m_applications[index]; } uint32_t -Node::GetNApplications (void) const +INode::GetNApplications (void) const { return m_applications.size (); } -void Node::DoDispose() +void INode::DoDispose() { for (std::vector >::iterator i = m_devices.begin (); i != m_devices.end (); i++) diff --git a/src/node/i-node.h b/src/node/i-node.h index b96fa632f..66434dde2 100644 --- a/src/node/i-node.h +++ b/src/node/i-node.h @@ -19,7 +19,7 @@ // Author: George F. Riley // -// Define the basic Node object for ns3. +// Define the basic INode object for ns3. // George F. Riley, Georgia Tech, Fall 2006 #ifndef I_NODE_H @@ -37,35 +37,35 @@ class NetDevice; class Application; /** - * \brief A network Node. + * \brief A network INode. * * This class holds together: * - a list of NetDevice objects which represent the network interfaces - * of this node which are connected to other Node instances through + * of this node which are connected to other INode instances through * Channel instances. * - a list of Application objects which represent the userspace - * traffic generation applications which interact with the Node + * traffic generation applications which interact with the INode * through the Socket API. * - a node Id: a unique per-node identifier. * - a system Id: a unique Id used for parallel simulations. * - a trace resolver which can be used to connect user trace sinks * to the node's trace sources. * - * Every Node created is added to the NodeList automatically. + * Every INode created is added to the NodeList automatically. */ -class Node : public Interface +class INode : public Interface { public: static const InterfaceId iid; - virtual ~Node(); + virtual ~INode(); /** * \param context the trace context for the TraceResolver to create * \returns a newly-created TraceResolver. The caller takes * ownership of the returned pointer. * - * Request the Node to create a trace resolver. This method + * Request the INode to create a trace resolver. This method * could be used directly by a user who needs access to very low-level * trace configuration. */ @@ -74,7 +74,7 @@ public: /** * \returns the unique id of this node. * - * This unique id happens to be also the index of the Node into + * This unique id happens to be also the index of the INode into * the NodeList. */ uint32_t GetId (void) const; @@ -87,7 +87,7 @@ public: /** * \param device NetDevice to associate to this node. - * \returns the index of the NetDevice into the Node's list of + * \returns the index of the NetDevice into the INode's list of * NetDevice. * * Associate this device to this node. @@ -97,21 +97,21 @@ public: uint32_t AddDevice (Ptr device); /** * \param index the index of the requested NetDevice - * \returns the requested NetDevice associated to this Node. + * \returns the requested NetDevice associated to this INode. */ Ptr GetDevice (uint32_t index) const; /** * \returns the number of NetDevice instances associated - * to this Node. + * to this INode. */ uint32_t GetNDevices (void) const; /** * \param application Application to associate to this node. - * \returns the index of the Application within the Node's list + * \returns the index of the Application within the INode's list * of Application. * - * Associated this Application to this Node. This method is called + * Associated this Application to this INode. This method is called * automatically from Application::Application so the user * has little reasons to call this method directly. */ @@ -119,11 +119,11 @@ public: /** * \param index * \returns the application associated to this requested index - * within this Node. + * within this INode. */ Ptr GetApplication (uint32_t index) const; /** - * \returns the number of applications associated to this Node. + * \returns the number of applications associated to this INode. */ uint32_t GetNApplications (void) const; @@ -131,16 +131,16 @@ protected: /** * Must be invoked by subclasses only. */ - Node(); + INode(); /** * \param systemId a unique integer used for parallel simulations. * * Must be invoked by subclasses only. */ - Node(uint32_t systemId); + INode(uint32_t systemId); /** * The dispose method. Subclasses must override this method - * and must chain up to it by calling Node::DoDispose at the + * and must chain up to it by calling INode::DoDispose at the * end of their own DoDispose method. */ virtual void DoDispose (void); @@ -153,16 +153,16 @@ private: */ virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context) = 0; /** - * \param device the device added to this Node. + * \param device the device added to this INode. * - * This method is invoked whenever a user calls Node::AddDevice. + * This method is invoked whenever a user calls INode::AddDevice. * Subclasses are expected to call NetDevice::SetReceiveCallback * at this point to setup the node's receive function for * the NetDevice packets. */ virtual void DoAddDevice (Ptr device) const = 0; - uint32_t m_id; // Node id for this node + uint32_t m_id; // INode id for this node uint32_t m_sid; // System id for this node std::vector > m_devices; std::vector > m_applications; diff --git a/src/node/net-device.cc b/src/node/net-device.cc index cc4703ab6..776819f6a 100644 --- a/src/node/net-device.cc +++ b/src/node/net-device.cc @@ -32,7 +32,7 @@ namespace ns3 { const InterfaceId NetDevice::iid ("NetDevice"); -NetDevice::NetDevice(Ptr node, const MacAddress& addr) : +NetDevice::NetDevice(Ptr node, const MacAddress& addr) : Interface (NetDevice::iid), m_node (node), m_name(""), @@ -229,8 +229,8 @@ NetDevice::NotifyLinkDown (void) } } -Ptr -NetDevice::GetNode (void) const +Ptr +NetDevice::GetINode (void) const { return m_node; } diff --git a/src/node/net-device.h b/src/node/net-device.h index e85709f79..d18db7332 100644 --- a/src/node/net-device.h +++ b/src/node/net-device.h @@ -31,7 +31,7 @@ namespace ns3 { -class Node; +class INode; class TraceResolver; class TraceContext; class Channel; @@ -166,7 +166,7 @@ public: * base class to print the nodeid for example, it can invoke * this method. */ - Ptr GetNode (void) const; + Ptr GetINode (void) const; /** * \returns true if ARP is needed, false otherwise. @@ -187,7 +187,7 @@ public: * \param node base class node pointer of device's node * \param addr MAC address of this device. */ - NetDevice(Ptr node, const MacAddress& addr); + NetDevice(Ptr node, const MacAddress& addr); /** * Enable broadcast support. This method should be * called by subclasses from their constructor @@ -279,7 +279,7 @@ public: */ virtual Ptr DoGetChannel (void) const = 0; - Ptr m_node; + Ptr m_node; std::string m_name; uint16_t m_ifIndex; MacAddress m_address; diff --git a/src/node/node-list.cc b/src/node/node-list.cc index 0b9e0c9ae..712e6e7bb 100644 --- a/src/node/node-list.cc +++ b/src/node/node-list.cc @@ -49,26 +49,26 @@ public: NodeListPriv (); ~NodeListPriv (); - uint32_t Add (Ptr node); + uint32_t Add (Ptr node); NodeList::Iterator Begin (void); NodeList::Iterator End (void); TraceResolver *CreateTraceResolver (TraceContext const &context); - Node *PeekNode (uint32_t n); - Ptr GetNode (uint32_t n); - uint32_t GetNNodes (void); + INode *PeekINode (uint32_t n); + Ptr GetINode (uint32_t n); + uint32_t GetNINodes (void); private: - std::vector > m_nodes; + std::vector > m_nodes; }; NodeListPriv::NodeListPriv () {} NodeListPriv::~NodeListPriv () { - for (std::vector >::iterator i = m_nodes.begin (); + for (std::vector >::iterator i = m_nodes.begin (); i != m_nodes.end (); i++) { - Ptr node = *i; + Ptr node = *i; node->Dispose (); *i = 0; } @@ -77,7 +77,7 @@ NodeListPriv::~NodeListPriv () uint32_t -NodeListPriv::Add (Ptr node) +NodeListPriv::Add (Ptr node) { uint32_t index = m_nodes.size (); m_nodes.push_back (node); @@ -95,18 +95,18 @@ NodeListPriv::End (void) return m_nodes.end (); } uint32_t -NodeListPriv::GetNNodes (void) +NodeListPriv::GetNINodes (void) { return m_nodes.size (); } -Node * -NodeListPriv::PeekNode (uint32_t n) +INode * +NodeListPriv::PeekINode (uint32_t n) { return PeekPointer (m_nodes[n]); } -Ptr -NodeListPriv::GetNode (uint32_t n) +Ptr +NodeListPriv::GetINode (uint32_t n) { return m_nodes[n]; } @@ -115,11 +115,11 @@ NodeListPriv::GetNode (uint32_t n) TraceResolver * NodeListPriv::CreateTraceResolver (TraceContext const &context) { - ArrayTraceResolver *resolver = - new ArrayTraceResolver + ArrayTraceResolver *resolver = + new ArrayTraceResolver (context, - MakeCallback (&NodeListPriv::GetNNodes, this), - MakeCallback (&NodeListPriv::PeekNode, this)); + MakeCallback (&NodeListPriv::GetNINodes, this), + MakeCallback (&NodeListPriv::PeekINode, this)); return resolver; } @@ -133,7 +133,7 @@ NodeListPriv::CreateTraceResolver (TraceContext const &context) namespace ns3 { uint32_t -NodeList::Add (Ptr node) +NodeList::Add (Ptr node) { return SimulationSingleton::Get ()->Add (node); } @@ -152,10 +152,10 @@ NodeList::CreateTraceResolver (TraceContext const &context) { return SimulationSingleton::Get ()->CreateTraceResolver (context); } -Ptr -NodeList::GetNode (uint32_t n) +Ptr +NodeList::GetINode (uint32_t n) { - return SimulationSingleton::Get ()->GetNode (n); + return SimulationSingleton::Get ()->GetINode (n); } diff --git a/src/node/node-list.h b/src/node/node-list.h index 607a47d71..5f0d60c50 100644 --- a/src/node/node-list.h +++ b/src/node/node-list.h @@ -28,29 +28,29 @@ namespace ns3 { -class Node; +class INode; class TraceResolver; class TraceContext; /** * \brief the list of simulation nodes. * - * Every Node created is automatically added to this list. + * Every INode created is automatically added to this list. */ class NodeList { public: - typedef ArrayTraceResolver::Index NodeIndex; - typedef std::vector< Ptr >::iterator Iterator; + typedef ArrayTraceResolver::Index NodeIndex; + typedef std::vector< Ptr >::iterator Iterator; /** * \param node node to add * \returns index of node in list. * - * This method is called automatically from Node::Node so + * This method is called automatically from INode::INode so * the user has little reason to call it himself. */ - static uint32_t Add (Ptr node); + static uint32_t Add (Ptr node); /** * \returns a C++ iterator located at the beginning of this * list. @@ -71,9 +71,9 @@ public: /** * \param n index of requested node. - * \returns the Node associated to index n. + * \returns the INode associated to index n. */ - static Ptr GetNode (uint32_t n); + static Ptr GetINode (uint32_t n); }; }//namespace ns3 diff --git a/src/node/socket.h b/src/node/socket.h index aacafc8f1..ee710ca75 100644 --- a/src/node/socket.h +++ b/src/node/socket.h @@ -29,7 +29,7 @@ namespace ns3 { -class Node; +class INode; /** * \brief Define a Socket API based on the BSD Socket API. @@ -66,7 +66,7 @@ public: /** * \returns the node this socket is associated with. */ - virtual Ptr GetNode (void) const = 0; + virtual Ptr GetINode (void) const = 0; /** * Allocate a free port number and