src/node/node.cc
changeset 2600 6c389d0c717d
parent 2542 a9b88fdc09d6
child 2602 d9262bff6df2
equal deleted inserted replaced
2599:fcc1728eb669 2600:6c389d0c717d
    94 uint32_t 
    94 uint32_t 
    95 Node::AddDevice (Ptr<NetDevice> device)
    95 Node::AddDevice (Ptr<NetDevice> device)
    96 {
    96 {
    97   uint32_t index = m_devices.size ();
    97   uint32_t index = m_devices.size ();
    98   m_devices.push_back (device);
    98   m_devices.push_back (device);
       
    99   device->SetNode (this);
    99   device->SetIfIndex(index);
   100   device->SetIfIndex(index);
   100   device->SetReceiveCallback (MakeCallback (&Node::ReceiveFromDevice, this));
   101   device->SetReceiveCallback (MakeCallback (&Node::ReceiveFromDevice, this));
   101   NotifyDeviceAdded (device);
   102   NotifyDeviceAdded (device);
   102   return index;
   103   return index;
   103 }
   104 }
   115 uint32_t 
   116 uint32_t 
   116 Node::AddApplication (Ptr<Application> application)
   117 Node::AddApplication (Ptr<Application> application)
   117 {
   118 {
   118   uint32_t index = m_applications.size ();
   119   uint32_t index = m_applications.size ();
   119   m_applications.push_back (application);
   120   m_applications.push_back (application);
       
   121   application->SetNode (this);
   120   return index;
   122   return index;
   121 }
   123 }
   122 Ptr<Application> 
   124 Ptr<Application> 
   123 Node::GetApplication (uint32_t index) const
   125 Node::GetApplication (uint32_t index) const
   124 {
   126 {