23 #include "ns3/assert.h" 
   24 #include "ns3/packet.h" 
   25 #include "ns3/simulator.h" 
   29 #include "ns3/double.h" 
   39 #undef NS_LOG_APPEND_CONTEXT 
   40 #define NS_LOG_APPEND_CONTEXT std::clog << "[mac=" << m_self << "] " 
   54   virtual void Print (std::ostream &os) 
const;
 
   56   void Set (
double snr);
 
   57   double Get (
void) 
const;
 
   67     .AddConstructor<SnrTag> ()
 
   68     .AddAttribute (
"Snr", 
"The snr of the last packet received",
 
   71                    MakeDoubleChecker<double> ())
 
   84   return sizeof (double);
 
   99   os << 
"Snr=" << 
m_snr;
 
  144     m_waitAck (ACK_NONE),
 
  146     m_overrideDurationId (
Seconds (0))
 
  280   << 
"send rts=" << params.
m_sendRts << 
", " 
  299       os << 
"basic-block-ack";
 
  302       os << 
"compressed-block-ack";
 
  305       os << 
"multi-tid-block-ack";
 
  353   : m_normalAckTimeoutEvent (),
 
  354     m_fastAckTimeoutEvent (),
 
  355     m_superFastAckTimeoutEvent (),
 
  356     m_fastAckFailedTimeoutEvent (),
 
  357     m_blockAckTimeoutEvent (),
 
  358     m_ctsTimeoutEvent (),
 
  409   bool oneRunning = 
false;
 
  651   NS_LOG_DEBUG (
"switching channel. Cancelling MAC pending events");
 
  706   else if (hdr.
IsCts ()
 
  717                                      rxSnr, txMode, tag.Get ());
 
  729   else if (hdr.
IsAck ()
 
  742                                       rxSnr, txMode, tag.Get ());
 
  796               if ((*it).second.first.IsImmediateBlockAck ())
 
  813               NS_LOG_DEBUG (
"There's not a valid agreement for this block ack request.");
 
  821   else if (hdr.
IsCtl ())
 
 1037   uint32_t dataSize = 
GetSize (packet, hdr);
 
 1081       if (hdr.
IsRts () && navUpdated)
 
 1093           Time navCounterResetCtsMissedDelay =
 
 1117       (*i)->NavReset (duration);
 
 1127       (*i)->NavStart (duration);
 
 1131   if (newNavEnd > oldNavEnd)
 
 1134       m_lastNavDuration = duration;
 
 1144       (*i)->AckTimeoutStart (duration);
 
 1152       (*i)->AckTimeoutReset ();
 
 1160       (*i)->CtsTimeoutStart (duration);
 
 1168       (*i)->CtsTimeoutReset ();
 
 1179                 ", size=" << packet->
GetSize () <<
 
 1180                 ", mode=" << txMode <<
 
 1472   duration -= txDuration;
 
 1475   duration = std::max (duration, newDuration);
 
 1545       uint16_t endSequence = ((*it).second.first.GetStartingSequence () + 2047) % 4096;
 
 1549       for (; i != (*it).second.second.end ()
 
 1554       (*it).second.second.insert (i, bufferedPacket);
 
 1559       (*j).second.UpdateWithMpdu (&hdr);
 
 1568                                  uint16_t startingSeq)
 
 1570   uint8_t tid = respHdr->
GetTid ();
 
 1585   std::list<BufferedPacket> buffer (0);
 
 1630       uint16_t endSequence = ((*it).second.first.GetStartingSequence () + 2047) % 4096;
 
 1632       uint16_t guard = (*it).second.second.begin ()->second.GetSequenceControl () & 0xfff0;
 
 1636       for (; i != (*it).second.second.end ()
 
 1639           if (guard == (*i).second.GetSequenceControl ())
 
 1641               if (!(*i).second.IsMoreFragments ())
 
 1651                   while (i != (*it).second.second.end () && ((guard >> 4) & 0x0fff) == (*i).second.GetSequenceNumber ())
 
 1655                   if (i != (*it).second.second.end ())
 
 1657                       guard = (*i).second.GetSequenceControl () & 0xfff0;
 
 1669               while (i != (*it).second.second.end () && ((guard >> 4) & 0x0fff) == (*i).second.GetSequenceNumber ())
 
 1673               if (i != (*it).second.second.end ())
 
 1675                   guard = (*i).second.GetSequenceControl () & 0xfff0;
 
 1680       (*it).second.second.erase ((*it).second.second.begin (), i);
 
 1690       uint16_t startingSeqCtrl = ((*it).second.first.GetStartingSequence () << 4) & 0xfff0;
 
 1691       uint16_t guard = startingSeqCtrl;
 
 1695       for (; i != (*it).second.second.end () && guard == (*i).second.GetSequenceControl (); i++)
 
 1697           if (!(*i).second.IsMoreFragments ())
 
 1699               while (lastComplete != i)
 
 1701                   m_rxCallback ((*lastComplete).first, &(*lastComplete).second);
 
 1704               m_rxCallback ((*lastComplete).first, &(*lastComplete).second);
 
 1707           guard = (*i).second.IsMoreFragments () ? (guard + 1) : ((guard + 16) & 0xfff0);
 
 1709       (*it).second.first.SetStartingSequence ((guard >> 4) & 0x0fff);
 
 1712       (*it).second.second.erase ((*it).second.second.begin (), lastComplete);
 
 1779   bool immediate = 
false;
 
 1788           immediate = (*it).second.first.IsImmediateBlockAck ();
 
 1799           (*i).second.FillBlockAckBitmap (&blockAck);
 
 1809           NS_LOG_DEBUG (
"there's not a valid block ack agreement with " << originator);