src/devices/csma/csma-channel.cc
changeset 1867 16deaedc0380
parent 1792 bca29198a7dd
parent 1866 e7dbcc4df546
child 1870 67b3d2dea3d5
equal deleted inserted replaced
1803:4078e5efdfc6 1867:16deaedc0380
   203     }
   203     }
   204   return false;
   204   return false;
   205 }
   205 }
   206 
   206 
   207 bool
   207 bool
   208 CsmaChannel::TransmitStart(Packet& p, uint32_t srcId)
   208 CsmaChannel::TransmitStart(Ptr<Packet> p, uint32_t srcId)
   209 {
   209 {
   210   NS_LOG_FUNCTION;
   210   NS_LOG_FUNCTION;
   211   NS_LOG_PARAM ("(" << &p << ", " << srcId << ")");
   211   NS_LOG_PARAM ("(" << p << ", " << srcId << ")");
   212   NS_LOG_INFO ("UID is " << p.GetUid () << ")");
   212   NS_LOG_INFO ("UID is " << p->GetUid () << ")");
   213 
   213 
   214   if (m_state != IDLE)
   214   if (m_state != IDLE)
   215     {
   215     {
   216       NS_LOG_WARN ("state is not IDLE");
   216       NS_LOG_WARN ("state is not IDLE");
   217       return false;
   217       return false;
   238 
   238 
   239 bool
   239 bool
   240 CsmaChannel::TransmitEnd()
   240 CsmaChannel::TransmitEnd()
   241 {
   241 {
   242   NS_LOG_FUNCTION;
   242   NS_LOG_FUNCTION;
   243   NS_LOG_PARAM ("(" << &m_currentPkt << ", " << m_currentSrc << ")");
   243   NS_LOG_PARAM ("(" << m_currentPkt << ", " << m_currentSrc << ")");
   244   NS_LOG_INFO ("UID is " << m_currentPkt.GetUid () << ")");
   244   NS_LOG_INFO ("UID is " << m_currentPkt->GetUid () << ")");
   245 
   245 
   246   NS_ASSERT(m_state == TRANSMITTING);
   246   NS_ASSERT(m_state == TRANSMITTING);
   247   m_state = PROPAGATING;
   247   m_state = PROPAGATING;
   248 
   248 
   249   bool retVal = true;
   249   bool retVal = true;
   264 
   264 
   265 void
   265 void
   266 CsmaChannel::PropagationCompleteEvent()
   266 CsmaChannel::PropagationCompleteEvent()
   267 {
   267 {
   268   NS_LOG_FUNCTION;
   268   NS_LOG_FUNCTION;
   269   NS_LOG_PARAM ("(" << &m_currentPkt << ")");
   269   NS_LOG_PARAM ("(" << m_currentPkt << ")");
   270   NS_LOG_INFO ("UID is " << m_currentPkt.GetUid () << ")");
   270   NS_LOG_INFO ("UID is " << m_currentPkt->GetUid () << ")");
   271 
   271 
   272   NS_ASSERT(m_state == PROPAGATING);
   272   NS_ASSERT(m_state == PROPAGATING);
   273 
   273 
   274   NS_LOG_LOGIC ("Receive");
   274   NS_LOG_LOGIC ("Receive");
   275   
   275   
   276   std::vector<CsmaDeviceRec>::iterator it;
   276   std::vector<CsmaDeviceRec>::iterator it;
   277   for (it = m_deviceList.begin(); it < m_deviceList.end(); it++) 
   277   for (it = m_deviceList.begin(); it < m_deviceList.end(); it++) 
   278     {
   278     {
   279       if (it->IsActive())
   279       if (it->IsActive())
   280       {
   280       {
   281         it->devicePtr->Receive (m_currentPkt);
   281         it->devicePtr->Receive (m_currentPkt->Copy ());
   282       }
   282       }
   283     }
   283     }
   284   m_state = IDLE;
   284   m_state = IDLE;
   285 }
   285 }
   286 
   286