src/devices/wifi/wifi-net-device.cc
changeset 2159 20f882e85b4a
parent 2151 7c63780653f2
child 2164 6e347fdbfa4a
equal deleted inserted replaced
2158:1bae76be026d 2159:20f882e85b4a
   297   m_channel = channel;
   297   m_channel = channel;
   298   m_phy->SetChannel (channel);
   298   m_phy->SetChannel (channel);
   299   NotifyConnected ();
   299   NotifyConnected ();
   300 }
   300 }
   301 bool
   301 bool
   302 WifiNetDevice::SendTo (const Packet &packet, const Address &to, uint16_t protocolNumber)
   302 WifiNetDevice::SendTo (Ptr<Packet> packet, const Address &to, uint16_t protocolNumber)
   303 {
   303 {
   304   NS_ASSERT (Mac48Address::IsMatchingType (to));
   304   NS_ASSERT (Mac48Address::IsMatchingType (to));
   305 
   305 
   306   Mac48Address realTo = Mac48Address::ConvertFrom (to);
   306   Mac48Address realTo = Mac48Address::ConvertFrom (to);
   307 
       
   308   Packet p = packet;
       
   309 
   307 
   310   LlcSnapHeader llc;
   308   LlcSnapHeader llc;
   311   llc.SetType (protocolNumber);
   309   llc.SetType (protocolNumber);
   312   p.AddHeader (llc);
   310   packet->AddHeader (llc);
   313 
   311 
   314   m_txLogger (p, realTo);
   312   m_txLogger (packet, realTo);
   315 
   313 
   316   return DoSendTo (p, realTo);
   314   return DoSendTo (packet, realTo);
   317 }
   315 }
   318 void 
   316 void 
   319 WifiNetDevice::DoForwardUp (Packet packet, const Mac48Address &from)
   317 WifiNetDevice::DoForwardUp (Ptr<Packet> packet, const Mac48Address &from)
   320 {
   318 {
   321   m_rxLogger (packet, from);
   319   m_rxLogger (packet, from);
   322 
   320 
   323   LlcSnapHeader llc;
   321   LlcSnapHeader llc;
   324   packet.RemoveHeader (llc);
   322   packet->RemoveHeader (llc);
   325   NetDevice::ForwardUp (packet, llc.GetType (), from);
   323   NetDevice::ForwardUp (packet, llc.GetType (), from);
   326 }
   324 }
   327 Mac48Address 
   325 Mac48Address 
   328 WifiNetDevice::GetSelfAddress (void) const
   326 WifiNetDevice::GetSelfAddress (void) const
   329 {
   327 {
   413 {
   411 {
   414   // XXX restart adhoc network join.
   412   // XXX restart adhoc network join.
   415   m_ssid = ssid;
   413   m_ssid = ssid;
   416 }
   414 }
   417 bool
   415 bool
   418 AdhocWifiNetDevice::DoSendTo (const Packet &packet, Mac48Address const &to)
   416 AdhocWifiNetDevice::DoSendTo (Ptr<const Packet> packet, Mac48Address const &to)
   419 {
   417 {
   420   m_high->Enqueue (packet, to);
   418   m_high->Enqueue (packet, to);
   421   return true;
   419   return true;
   422 }
   420 }
   423 void
   421 void
   490 {
   488 {
   491   m_ssid = ssid;
   489   m_ssid = ssid;
   492   m_high->StartActiveAssociation ();
   490   m_high->StartActiveAssociation ();
   493 }
   491 }
   494 bool
   492 bool
   495 NqstaWifiNetDevice::DoSendTo (const Packet &packet, Mac48Address const &to)
   493 NqstaWifiNetDevice::DoSendTo (Ptr<const Packet> packet, Mac48Address const &to)
   496 {
   494 {
   497   m_high->Queue (packet, to);
   495   m_high->Queue (packet, to);
   498   return true;
   496   return true;
   499 }
   497 }
   500 void
   498 void
   597 NqapWifiNetDevice::StartBeaconing (void)
   595 NqapWifiNetDevice::StartBeaconing (void)
   598 {
   596 {
   599   m_high->StartBeaconing ();
   597   m_high->StartBeaconing ();
   600 }
   598 }
   601 bool
   599 bool
   602 NqapWifiNetDevice::DoSendTo (const Packet &packet, Mac48Address const & to)
   600 NqapWifiNetDevice::DoSendTo (Ptr<const Packet> packet, Mac48Address const & to)
   603 {
   601 {
   604   m_high->Queue (packet, to);
   602   m_high->Queue (packet, to);
   605   return true;
   603   return true;
   606 }
   604 }
   607 void
   605 void