--- a/src/node/internet-node.cc Mon Apr 30 10:07:53 2007 +0200
+++ b/src/node/internet-node.cc Mon Apr 30 10:16:04 2007 +0200
@@ -153,5 +153,11 @@
return static_cast<Arp*> (m_l3Demux->Lookup (Arp::PROT_NUMBER));
}
+void
+InternetNode::DoAddDevice (NetDevice *device) const
+{
+ //XXX
+}
+
}//namespace ns3
--- a/src/node/internet-node.h Mon Apr 30 10:07:53 2007 +0200
+++ b/src/node/internet-node.h Mon Apr 30 10:16:04 2007 +0200
@@ -57,6 +57,7 @@
void SetName(std::string name);
private:
+ virtual void DoAddDevice (NetDevice *device) const;
// Capabilities
NetDeviceList* m_netDevices;
ApplicationList* m_applicationList;
--- a/src/node/node.cc Mon Apr 30 10:07:53 2007 +0200
+++ b/src/node/node.cc Mon Apr 30 10:16:04 2007 +0200
@@ -68,6 +68,25 @@
m_sid = s;
}
+uint32_t
+Node::AddDevice (NetDevice *device)
+{
+ uint32_t index = m_devices.size ();
+ m_devices.push_back (device);
+ DoAddDevice (device);
+ return index;
+}
+NetDevice *
+Node::GetDevice (uint32_t index) const
+{
+ return m_devices[index];
+}
+uint32_t
+Node::GetNDevices (void) const
+{
+ return m_devices.size ();
+}
+
// Node stack creation and management routines.
Node* Node::Create()
{
--- a/src/node/node.h Mon Apr 30 10:07:53 2007 +0200
+++ b/src/node/node.h Mon Apr 30 10:16:04 2007 +0200
@@ -100,6 +100,7 @@
class TraceContext;
class TraceResolver;
+class NetDevice;
class Node {
friend class NodeList;
@@ -119,6 +120,13 @@
uint32_t GetSystemId (void) const;
void SetSystemId(uint32_t s);
+ uint32_t AddDevice (NetDevice *device);
+ NetDevice *GetDevice (uint32_t index) const;
+ uint32_t GetNDevices (void) const;
+
+private:
+ virtual void DoAddDevice (NetDevice *device) const = 0;
+
#ifdef REMOVE_FOR_NOW
// Define a protected delete operator. This will prevent users
// from attempting to delete Node objects. The deletion of
@@ -181,6 +189,7 @@
private:
uint32_t m_id; // Node id for this node
uint32_t m_sid; // System id for this node
+ std::vector<NetDevice *> m_devices;
};
} //namespace ns3