Difference between revisions of "NSOC2011ClickMac"

From Nsnam
Jump to: navigation, search
(Approach)
(Approach)
Line 6: Line 6:
  
 
== Approach ==
 
== Approach ==
'''Overview'''
+
'''Overview''' <br>
GSoC 2010 saw the integration of the Click Modular Router with ns-3. The implementation, however, is limited only to layer 3 or in other words, Click's use is confined only to all of ns-3's network device types. This project deals with making Click's Wifi MAC specific elements compatible with ns-3-click.  
+
GSoC 2010 saw the integration of the Click Modular Router with ns-3. The implementation, however, is limited only to layer 3 or in other words, Click's use is confined only to all of ns-3's network device types. This project deals with making Click's Wifi MAC specific elements compatible with ns-3-click.
  
 
----
 
----
  
'''Details'''  
+
'''Details''' <br>
<br>
+
 
A major step in the project would be the implementation of full radiotap headers support. The radiotap header cannot simply be added in YansWifiPhy as this would create issues with the current implementations of MacLow and MacRxMiddle. The current NS-3 Click integration is limited to L3 and leaves ns-3 to handle L2. The radiotap header would probably best be added on the receiver path as close to NetDevice as possible. The implementation would require a redesign in the method of packet forwarding with the radiotap pertinent data. The radiotap header could be created in MacLow and the necessary modifications must be made for sending the header upwards.
 
A major step in the project would be the implementation of full radiotap headers support. The radiotap header cannot simply be added in YansWifiPhy as this would create issues with the current implementations of MacLow and MacRxMiddle. The current NS-3 Click integration is limited to L3 and leaves ns-3 to handle L2. The radiotap header would probably best be added on the receiver path as close to NetDevice as possible. The implementation would require a redesign in the method of packet forwarding with the radiotap pertinent data. The radiotap header could be created in MacLow and the necessary modifications must be made for sending the header upwards.
 +
 +
----
 +
 +
'''Creation of Radiotap Header''' <br>
 +
The Radiotap Header can be created in MacLow::ReceiveOk(Ptr<Packet> packet, double rxSnr, WifiMode txMode, WifiPreamble preamble).
 +
 +
        RadiotapHeader radiotaphdr;
 +
        uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;
 +
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == preamble);
 +
        radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());
 +
 +
        if (isShortPreamble)
 +
          {
 +
            frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;
 +
          }
 +
 +
        radiotaphdr.SetFrameFlags (frameFlags);
 +
        radiotaphdr.SetRate (rate);
 +
 +
        if (channelFreqMhz < 2500)
 +
          {
 +
            radiotaphdr.SetChannelFrequencyAndFlags (channelFreqMhz,
 +
              RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);
 +
          }
 +
        else
 +
          {
 +
            radiotaphdr.SetChannelFrequencyAndFlags (channelFreqMhz,
 +
              RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);
 +
          }
 +
 +
        double signalDbm = RatioToDb (m_sendAckEvent->GetRxPowerW ()) + 30;
 +
        double noiseDbm = RatioToDb(m_sendAckEvent->GetRxPowerW() / rxSnr) - GetRxNoiseFigure() + 30 ;
 +
 +
 +
        radiotaphdr.SetAntennaSignalPower (signalDbm);
 +
        radiotaphdr.SetAntennaNoisePower (noiseDbm);
 +
 +
channelFreqMhz can be determined using YansWifiPhy::GetChannelFrequencyMhz() while rate can be obtained from tx.GetDataRate().
 +
 +
In MacLow::Receive(), the rxpacket segment of the code should be modified so that m_rxCallback (packet, &hdr) includes the Radiotap Header. The signature as well as the invocations of the callback must also be modified.
 +
 +
void
 +
MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,RadiotapHeader> callback)
 +
{
 +
  m_rxCallback = callback;
 +
}

Revision as of 11:29, 23 May 2011

Click-MAC Extensions for ns-3-click

  • Student: Ashwin Narayan
  • Mentors: Ruben Merz and Lalith Suresh
  • Abstract: This project deals with the MAC extensions for ns-3 click. The current integration of the Click Modular Router with ns-3 is confined to only ns-3’s network device types and doesn’t yet permit the use of Click’s Wifi MAC specific elements. This project aims to enable the same by implementing Radiotap support, and a Monitor Wifi Mac High interface.

Approach

Overview
GSoC 2010 saw the integration of the Click Modular Router with ns-3. The implementation, however, is limited only to layer 3 or in other words, Click's use is confined only to all of ns-3's network device types. This project deals with making Click's Wifi MAC specific elements compatible with ns-3-click.


Details
A major step in the project would be the implementation of full radiotap headers support. The radiotap header cannot simply be added in YansWifiPhy as this would create issues with the current implementations of MacLow and MacRxMiddle. The current NS-3 Click integration is limited to L3 and leaves ns-3 to handle L2. The radiotap header would probably best be added on the receiver path as close to NetDevice as possible. The implementation would require a redesign in the method of packet forwarding with the radiotap pertinent data. The radiotap header could be created in MacLow and the necessary modifications must be made for sending the header upwards.


Creation of Radiotap Header
The Radiotap Header can be created in MacLow::ReceiveOk(Ptr<Packet> packet, double rxSnr, WifiMode txMode, WifiPreamble preamble).

       RadiotapHeader radiotaphdr;
       uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;

bool isShortPreamble = (WIFI_PREAMBLE_SHORT == preamble);

       radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());
       if (isShortPreamble)
         {
           frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;
         }
       radiotaphdr.SetFrameFlags (frameFlags);
       radiotaphdr.SetRate (rate);
       if (channelFreqMhz < 2500)
         {
           radiotaphdr.SetChannelFrequencyAndFlags (channelFreqMhz,
             RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);
         }
       else
         {
           radiotaphdr.SetChannelFrequencyAndFlags (channelFreqMhz,
             RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);
         }
       double signalDbm = RatioToDb (m_sendAckEvent->GetRxPowerW ()) + 30;
       double noiseDbm = RatioToDb(m_sendAckEvent->GetRxPowerW() / rxSnr) - GetRxNoiseFigure() + 30 ;


       radiotaphdr.SetAntennaSignalPower (signalDbm);
       radiotaphdr.SetAntennaNoisePower (noiseDbm);

channelFreqMhz can be determined using YansWifiPhy::GetChannelFrequencyMhz() while rate can be obtained from tx.GetDataRate().

In MacLow::Receive(), the rxpacket segment of the code should be modified so that m_rxCallback (packet, &hdr) includes the Radiotap Header. The signature as well as the invocations of the callback must also be modified.

void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,RadiotapHeader> callback) { m_rxCallback = callback; }