https://www.nsnam.org/mediawiki/api.php?action=feedcontributions&user=Ashwin&feedformat=atomNsnam - User contributions [en]2024-03-29T10:44:05ZUser contributionsMediaWiki 1.24.1https://www.nsnam.org/mediawiki/index.php?title=NSOC2011AcceptedProjects&diff=6195NSOC2011AcceptedProjects2011-09-01T14:29:55Z<p>Ashwin: /* Click-MAC Extensions for ns-3-click */</p>
<hr />
<div>{{TOC}}<br />
<br />
<blockquote><br />
<br />
* [[GS02011StudentGuide |ns-3 GSoC/NSoC Student guide]]<br />
* [[GS02011StudentApplicationTemplate |NSoC Student application template]]<br />
* [[NSOC2011 |NSoC 2011 page]]<br />
* [[GSOC2011Projects |NSoC 2011 Ideas page]] | [[NSOC2011AcceptedProjects |NSoC 2011 Accepted Projects]]<br />
* [[GSOC2010Projects |GSoC 2010 Ideas page]] | [[GSOC2010AcceptedProjects |GSoC 2010 Accepted Projects]]<br />
* [[GSOC2009Projects |GSoC 2009 Ideas page]] | [[GSOC2009AcceptedProjects |GSoC 2009 Accepted Projects]]<br />
* [[GSOC2010OAReport |GSoC Organization Administrator guide]]<br />
* ''Get in contact with the ns-3 team'': [http://mailman.isi.edu/mailman/listinfo/ns-developers ns-developers mailing list] | ''IRC'' #ns-3 on freenode.net<br />
</blockquote><br />
<p>&nbsp;<br />
<br />
= Program Schedule =<br />
<br />
* May 23rd: Begin project.<br />
* July 11th - July 15th: Mid Term Code Review + feedback.<br />
* August 15th - August 19th: End Term Code Review + feedback.<br />
<br />
= Accepted Projects =<br />
<br />
This page links to more information on the projects accepted for ns-3's Summer of Code effort for 2011.<br />
<br />
== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* '''[[NSOC2011ClickMac | Project wiki]]'''<br />
* 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.<br />
* '''Midterm code review:''' http://codereview.appspot.com/4685048/<br />
* '''Final code review:''' http://codereview.appspot.com/4890044<br />
<br />
== LTE-RRC Extensions ==<br />
<br />
* Student: [mailto:pankaj303er@gmail.com Pankaj Gupta]<br />
* Mentors: [mailto:g.piro@poliba.it Giuseppe Piro] and [mailto:f.capozzi@poliba.it Francesco Capozzi]<br />
* '''[[LTE_RRC_Extension | Project wiki]]'''<br />
* Abstract: Current RRC entity in the present LTE module of ns-3 has the handling of user plane. Handling of control messages is not present. This proposal aims to enhance and develop the RRC state machine in ns-3 LTE for control plane handling in UE and eNodeB.<br />
* '''Midterm code review:''' http://codereview.appspot.com/4811043/<br />
* '''Later code review:'''http://codereview.appspot.com/4830049/<br />
<br />
== IPv6 Global Routing ==<br />
<br />
* Student: [mailto:atishayjain25@gmail.com Atishay Jain]<br />
* Mentors: [mailto:tomh@tomh.org Tom Henderson] and [mailto:watrous@uw.edu Mitch Watrous]<br />
* '''[[Global_Routing_for_Ipv6 | Project wiki]]'''<br />
* Abstract: This project proposes to implement global routing in ipv6 for ns-3. It involves extending the existing global routing protocol in ipv4. In global routing in ipv4 only OSPF has been used. The project would extend the existing ipv4-global-routing to ipv6 implementing, Open Shortest Path First. Implementation of ipv6 nix-vector support is also proposed if time permits.<br />
* '''Midterm code review:'''http://codereview.appspot.com/4812043/<br />
<br />
[[Category:GSoC]]</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011AcceptedProjects&diff=6194NSOC2011AcceptedProjects2011-09-01T14:29:14Z<p>Ashwin: /* Click-MAC Extensions for ns-3-click */</p>
<hr />
<div>{{TOC}}<br />
<br />
<blockquote><br />
<br />
* [[GS02011StudentGuide |ns-3 GSoC/NSoC Student guide]]<br />
* [[GS02011StudentApplicationTemplate |NSoC Student application template]]<br />
* [[NSOC2011 |NSoC 2011 page]]<br />
* [[GSOC2011Projects |NSoC 2011 Ideas page]] | [[NSOC2011AcceptedProjects |NSoC 2011 Accepted Projects]]<br />
* [[GSOC2010Projects |GSoC 2010 Ideas page]] | [[GSOC2010AcceptedProjects |GSoC 2010 Accepted Projects]]<br />
* [[GSOC2009Projects |GSoC 2009 Ideas page]] | [[GSOC2009AcceptedProjects |GSoC 2009 Accepted Projects]]<br />
* [[GSOC2010OAReport |GSoC Organization Administrator guide]]<br />
* ''Get in contact with the ns-3 team'': [http://mailman.isi.edu/mailman/listinfo/ns-developers ns-developers mailing list] | ''IRC'' #ns-3 on freenode.net<br />
</blockquote><br />
<p>&nbsp;<br />
<br />
= Program Schedule =<br />
<br />
* May 23rd: Begin project.<br />
* July 11th - July 15th: Mid Term Code Review + feedback.<br />
* August 15th - August 19th: End Term Code Review + feedback.<br />
<br />
= Accepted Projects =<br />
<br />
This page links to more information on the projects accepted for ns-3's Summer of Code effort for 2011.<br />
<br />
== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* '''[[NSOC2011ClickMac | Project wiki]]'''<br />
* 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.<br />
* '''Midterm code review:''' http://codereview.appspot.com/4685048/<br />
<br />
== LTE-RRC Extensions ==<br />
<br />
* Student: [mailto:pankaj303er@gmail.com Pankaj Gupta]<br />
* Mentors: [mailto:g.piro@poliba.it Giuseppe Piro] and [mailto:f.capozzi@poliba.it Francesco Capozzi]<br />
* '''[[LTE_RRC_Extension | Project wiki]]'''<br />
* Abstract: Current RRC entity in the present LTE module of ns-3 has the handling of user plane. Handling of control messages is not present. This proposal aims to enhance and develop the RRC state machine in ns-3 LTE for control plane handling in UE and eNodeB.<br />
* '''Midterm code review:''' http://codereview.appspot.com/4811043/<br />
* '''Later code review:'''http://codereview.appspot.com/4830049/<br />
<br />
== IPv6 Global Routing ==<br />
<br />
* Student: [mailto:atishayjain25@gmail.com Atishay Jain]<br />
* Mentors: [mailto:tomh@tomh.org Tom Henderson] and [mailto:watrous@uw.edu Mitch Watrous]<br />
* '''[[Global_Routing_for_Ipv6 | Project wiki]]'''<br />
* Abstract: This project proposes to implement global routing in ipv6 for ns-3. It involves extending the existing global routing protocol in ipv4. In global routing in ipv4 only OSPF has been used. The project would extend the existing ipv4-global-routing to ipv6 implementing, Open Shortest Path First. Implementation of ipv6 nix-vector support is also proposed if time permits.<br />
* '''Midterm code review:'''http://codereview.appspot.com/4812043/<br />
<br />
[[Category:GSoC]]</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5955NSOC2011ClickMac2011-08-15T13:31:26Z<p>Ashwin: /* Progress */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<br />
A major step in the project would be the implementation of full radiotap headers support. <br />
<br />
For the RX side, 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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
For the TX side, the radiotap information can be extracted from the packet and fed to the per-packet tx-vector parameters.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t rate = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
Ptr<Packet> p = packet->Copy ();<br />
RadiotapHeader header;<br />
header.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_FCS_INCLUDED;<br />
if (isShortPreamble)<br />
{<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;<br />
}<br />
header.SetFrameFlags (frameFlags);<br />
header.SetRate (rate);<br />
uint16_t channelFlags = 0;<br />
switch (rate)<br />
{<br />
case 2: // 1Mbps<br />
case 4: // 2Mbps<br />
case 10: // 5Mbps<br />
case 22: // 11Mbps<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;<br />
break;<br />
default:<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;<br />
break;<br />
}<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ;<br />
}<br />
else<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ;<br />
}<br />
header.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (), channelFlags);<br />
header.SetAntennaSignalPower (signalDbm);<br />
header.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType (), header);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
...<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
YansWifiPhyHelper::PcapSniffRxEvent () has been modified to remove the redundancies in setting the radiotap parameters because of the above modifications in YansWifiPhy::EndReceive ().<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
Changes were made in the existing radiotap header implementation to accommodate the TX parameters in the header. For monitor mode support, the changes required would be using a dummy address and protocol in the NetDevice->Send () arguments in Ipv4L3ClickRoutingProtocol::SendDown () and then modifications in MonitorWifiMac::Enqueue () that include the removal of the wifi-mac and radiotap headers. The radiotap information stripped would then be used to set the per-packet tx-vector parameters. The packet with the stripped headers is sent to the dca_queue.<br />
<br />
MonitorWifiMac::SetTxParametersFromRadiotapHeader() sets the tx-vector relevant parameters in WifiRemoteStationManager before the packet is sent to the dca_queue. The per-packet nature of the tx-vector parameters is preserved owing to the implementation of the HighLatencyTxVectorTag in WifiRemoteStationManager.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type. The latter has a single host Click configuration for wifi. The node broadcasts ARP requests if it wants to find a destination address and it responds to ARP requests made to it. A click script is used to set radiotap tx parameters (tx power, RTS and data retries).<br />
<br />
Rate control was made possible by means of SetTXRate() and different transmission powers were assigned to alternative packets using the RoundRobinSwitch element and assigning two different tx power levels to alternative ARP packets.<br />
<br />
*Note:<br />
Since the test script above can be used for both RX and TX, this script would alone be sufficient to test the monitor mode support for ns-3's Wifi model.<br />
<br />
== Future Work ==<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Implementation of Tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for RX Monitor Mode support<br />
* July 10 - July 17 : Mid-term review + feedback<br />
* July 18 - July 27 : Tx-vector implementation for radiotap header support<br />
* July 27 - Aug 5 : Test script for TX Monitor Mode support<br />
* Aug 6 - Aug 8 : Addition of comments<br />
* Aug 9 - Aug 12 : Testing and fixing holes<br />
* Aug 13 - Aug 14 : Cleaning up<br />
* Aug 15 : Submitted code for review</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5954NSOC2011ClickMac2011-08-15T13:31:00Z<p>Ashwin: /* Progress */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<br />
A major step in the project would be the implementation of full radiotap headers support. <br />
<br />
For the RX side, 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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
For the TX side, the radiotap information can be extracted from the packet and fed to the per-packet tx-vector parameters.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t rate = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
Ptr<Packet> p = packet->Copy ();<br />
RadiotapHeader header;<br />
header.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_FCS_INCLUDED;<br />
if (isShortPreamble)<br />
{<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;<br />
}<br />
header.SetFrameFlags (frameFlags);<br />
header.SetRate (rate);<br />
uint16_t channelFlags = 0;<br />
switch (rate)<br />
{<br />
case 2: // 1Mbps<br />
case 4: // 2Mbps<br />
case 10: // 5Mbps<br />
case 22: // 11Mbps<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;<br />
break;<br />
default:<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;<br />
break;<br />
}<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ;<br />
}<br />
else<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ;<br />
}<br />
header.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (), channelFlags);<br />
header.SetAntennaSignalPower (signalDbm);<br />
header.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType (), header);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
...<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
YansWifiPhyHelper::PcapSniffRxEvent () has been modified to remove the redundancies in setting the radiotap parameters because of the above modifications in YansWifiPhy::EndReceive ().<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
Changes were made in the existing radiotap header implementation to accommodate the TX parameters in the header. For monitor mode support, the changes required would be using a dummy address and protocol in the NetDevice->Send () arguments in Ipv4L3ClickRoutingProtocol::SendDown () and then modifications in MonitorWifiMac::Enqueue () that include the removal of the wifi-mac and radiotap headers. The radiotap information stripped would then be used to set the per-packet tx-vector parameters. The packet with the stripped headers is sent to the dca_queue.<br />
<br />
MonitorWifiMac::SetTxParametersFromRadiotapHeader() sets the tx-vector relevant parameters in WifiRemoteStationManager before the packet is sent to the dca_queue. The per-packet nature of the tx-vector parameters is preserved owing to the implementation of the HighLatencyTxVectorTag in WifiRemoteStationManager.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type. The latter has a single host Click configuration for wifi. The node broadcasts ARP requests if it wants to find a destination address and it responds to ARP requests made to it. A click script is used to set radiotap tx parameters (tx power, RTS and data retries).<br />
<br />
Rate control was made possible by means of SetTXRate() and different transmission powers were assigned to alternative packets using the RoundRobinSwitch element and assigning two different tx power levels to alternative ARP packets.<br />
<br />
*Note:<br />
Since the test script above can be used for both RX and TX, this script would alone be sufficient to test the monitor mode support for ns-3's Wifi model.<br />
<br />
== Future Work ==<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Implementation of Tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for RX Monitor Mode support and further testing<br />
* July 10 - July 17 : Mid-term review + feedback<br />
* July 18 - July 27 : Tx-vector implementation for radiotap header support<br />
* July 27 - Aug 5 : Test script for TX Monitor Mode support and further testing<br />
* Aug 6 - Aug 8 : Addition of comments<br />
* Aug 9 - Aug 12 : Testing and fixing holes<br />
* Aug 13 - Aug 14 : Cleaning up<br />
* Aug 15 : Submitted code for review</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5947NSOC2011ClickMac2011-08-10T06:52:36Z<p>Ashwin: /* Test Script */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<br />
A major step in the project would be the implementation of full radiotap headers support. <br />
<br />
For the RX side, 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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
For the TX side, the radiotap information can be extracted from the packet and fed to the per-packet tx-vector parameters.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t rate = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
Ptr<Packet> p = packet->Copy ();<br />
RadiotapHeader header;<br />
header.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_FCS_INCLUDED;<br />
if (isShortPreamble)<br />
{<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;<br />
}<br />
header.SetFrameFlags (frameFlags);<br />
header.SetRate (rate);<br />
uint16_t channelFlags = 0;<br />
switch (rate)<br />
{<br />
case 2: // 1Mbps<br />
case 4: // 2Mbps<br />
case 10: // 5Mbps<br />
case 22: // 11Mbps<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;<br />
break;<br />
default:<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;<br />
break;<br />
}<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ;<br />
}<br />
else<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ;<br />
}<br />
header.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (), channelFlags);<br />
header.SetAntennaSignalPower (signalDbm);<br />
header.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType (), header);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
...<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
YansWifiPhyHelper::PcapSniffRxEvent () has been modified to remove the redundancies in setting the radiotap parameters because of the above modifications in YansWifiPhy::EndReceive ().<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
Changes were made in the existing radiotap header implementation to accommodate the TX parameters in the header. For monitor mode support, the changes required would be using a dummy address and protocol in the NetDevice->Send () arguments in Ipv4L3ClickRoutingProtocol::SendDown () and then modifications in MonitorWifiMac::Enqueue () that include the removal of the wifi-mac and radiotap headers. The radiotap information stripped would then be used to set the per-packet tx-vector parameters. The packet with the stripped headers is sent to the dca_queue.<br />
<br />
MonitorWifiMac::SetTxParametersFromRadiotapHeader() sets the tx-vector relevant parameters in WifiRemoteStationManager before the packet is sent to the dca_queue. The per-packet nature of the tx-vector parameters is preserved owing to the implementation of the HighLatencyTxVectorTag in WifiRemoteStationManager.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type. The latter has a single host Click configuration for wifi. The node broadcasts ARP requests if it wants to find a destination address and it responds to ARP requests made to it. A click script is used to set radiotap tx parameters (tx power, RTS and data retries).<br />
<br />
Rate control was made possible by means of SetTXRate() and different transmission powers were assigned to alternative packets using the RoundRobinSwitch element and assigning two different tx power levels to alternative ARP packets.<br />
<br />
*Note:<br />
Since the test script above can be used for both RX and TX, this script would alone be sufficient to test the monitor mode support for ns-3's Wifi model.<br />
<br />
== Future Work ==<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Implementation of Tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for RX Monitor Mode support and further testing<br />
* July 10 - July 17 : Mid-term review + feedback<br />
* July 18 - July 27 : Tx-vector implementation for radiotap header support<br />
* July 27 - Aug 5 : Test script for TX Monitor Mode support and further testing<br />
* Aug 6 - Present : Addition of comments and cleaning up of code</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5946NSOC2011ClickMac2011-08-10T06:51:28Z<p>Ashwin: /* Test Script */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<br />
A major step in the project would be the implementation of full radiotap headers support. <br />
<br />
For the RX side, 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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
For the TX side, the radiotap information can be extracted from the packet and fed to the per-packet tx-vector parameters.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t rate = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
Ptr<Packet> p = packet->Copy ();<br />
RadiotapHeader header;<br />
header.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_FCS_INCLUDED;<br />
if (isShortPreamble)<br />
{<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;<br />
}<br />
header.SetFrameFlags (frameFlags);<br />
header.SetRate (rate);<br />
uint16_t channelFlags = 0;<br />
switch (rate)<br />
{<br />
case 2: // 1Mbps<br />
case 4: // 2Mbps<br />
case 10: // 5Mbps<br />
case 22: // 11Mbps<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;<br />
break;<br />
default:<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;<br />
break;<br />
}<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ;<br />
}<br />
else<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ;<br />
}<br />
header.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (), channelFlags);<br />
header.SetAntennaSignalPower (signalDbm);<br />
header.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType (), header);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
...<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
YansWifiPhyHelper::PcapSniffRxEvent () has been modified to remove the redundancies in setting the radiotap parameters because of the above modifications in YansWifiPhy::EndReceive ().<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
Changes were made in the existing radiotap header implementation to accommodate the TX parameters in the header. For monitor mode support, the changes required would be using a dummy address and protocol in the NetDevice->Send () arguments in Ipv4L3ClickRoutingProtocol::SendDown () and then modifications in MonitorWifiMac::Enqueue () that include the removal of the wifi-mac and radiotap headers. The radiotap information stripped would then be used to set the per-packet tx-vector parameters. The packet with the stripped headers is sent to the dca_queue.<br />
<br />
MonitorWifiMac::SetTxParametersFromRadiotapHeader() sets the tx-vector relevant parameters in WifiRemoteStationManager before the packet is sent to the dca_queue. The per-packet nature of the tx-vector parameters is preserved owing to the implementation of the HighLatencyTxVectorTag in WifiRemoteStationManager.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type. The latter has a single host Click configuration for wifi. The node broadcasts ARP requests if it wants to find a destination address and it responds to ARP requests made to it. A click script is used to set radiotap tx parameters (tx power, RTS and data retries).<br />
<br />
Rate control was made possible by means of SetTXRate() and different transmission powers were assigned to alternative packets using the RoundRobinSwitch element and assigning two different tx power levels to alternative ARP packets.<br />
<br />
*Note*:<br />
Since the test script above can be used for both RX and TX, this script would alone be sufficient to test the monitor mode support for ns-3's Wifi model.<br />
<br />
== Future Work ==<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Implementation of Tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for RX Monitor Mode support and further testing<br />
* July 10 - July 17 : Mid-term review + feedback<br />
* July 18 - July 27 : Tx-vector implementation for radiotap header support<br />
* July 27 - Aug 5 : Test script for TX Monitor Mode support and further testing<br />
* Aug 6 - Present : Addition of comments and cleaning up of code</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5945NSOC2011ClickMac2011-08-10T06:50:00Z<p>Ashwin: /* Progress */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<br />
A major step in the project would be the implementation of full radiotap headers support. <br />
<br />
For the RX side, 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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
For the TX side, the radiotap information can be extracted from the packet and fed to the per-packet tx-vector parameters.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t rate = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
Ptr<Packet> p = packet->Copy ();<br />
RadiotapHeader header;<br />
header.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_FCS_INCLUDED;<br />
if (isShortPreamble)<br />
{<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;<br />
}<br />
header.SetFrameFlags (frameFlags);<br />
header.SetRate (rate);<br />
uint16_t channelFlags = 0;<br />
switch (rate)<br />
{<br />
case 2: // 1Mbps<br />
case 4: // 2Mbps<br />
case 10: // 5Mbps<br />
case 22: // 11Mbps<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;<br />
break;<br />
default:<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;<br />
break;<br />
}<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ;<br />
}<br />
else<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ;<br />
}<br />
header.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (), channelFlags);<br />
header.SetAntennaSignalPower (signalDbm);<br />
header.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType (), header);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
...<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
YansWifiPhyHelper::PcapSniffRxEvent () has been modified to remove the redundancies in setting the radiotap parameters because of the above modifications in YansWifiPhy::EndReceive ().<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
Changes were made in the existing radiotap header implementation to accommodate the TX parameters in the header. For monitor mode support, the changes required would be using a dummy address and protocol in the NetDevice->Send () arguments in Ipv4L3ClickRoutingProtocol::SendDown () and then modifications in MonitorWifiMac::Enqueue () that include the removal of the wifi-mac and radiotap headers. The radiotap information stripped would then be used to set the per-packet tx-vector parameters. The packet with the stripped headers is sent to the dca_queue.<br />
<br />
MonitorWifiMac::SetTxParametersFromRadiotapHeader() sets the tx-vector relevant parameters in WifiRemoteStationManager before the packet is sent to the dca_queue. The per-packet nature of the tx-vector parameters is preserved owing to the implementation of the HighLatencyTxVectorTag in WifiRemoteStationManager.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type. The latter has a single host Click configuration for wifi. The node broadcasts ARP requests if it wants to find a destination address and it responds to ARP requests made to it. A click script is used to set radiotap tx parameters (tx power, RTS and data retries).<br />
<br />
Rate control was made possible by means of SetTXRate() and different transmission powers were assigned to alternative packets using the RoundRobinSwitch element and assigning two different tx power levels to alternative ARP packets.<br />
<br />
== Future Work ==<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Implementation of Tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for RX Monitor Mode support and further testing<br />
* July 10 - July 17 : Mid-term review + feedback<br />
* July 18 - July 27 : Tx-vector implementation for radiotap header support<br />
* July 27 - Aug 5 : Test script for TX Monitor Mode support and further testing<br />
* Aug 6 - Present : Addition of comments and cleaning up of code</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5940NSOC2011ClickMac2011-08-07T16:15:20Z<p>Ashwin: /* Test Script */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<br />
A major step in the project would be the implementation of full radiotap headers support. <br />
<br />
For the RX side, 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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
For the TX side, the radiotap information can be extracted from the packet and fed to the per-packet tx-vector parameters.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t rate = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
Ptr<Packet> p = packet->Copy ();<br />
RadiotapHeader header;<br />
header.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_FCS_INCLUDED;<br />
if (isShortPreamble)<br />
{<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;<br />
}<br />
header.SetFrameFlags (frameFlags);<br />
header.SetRate (rate);<br />
uint16_t channelFlags = 0;<br />
switch (rate)<br />
{<br />
case 2: // 1Mbps<br />
case 4: // 2Mbps<br />
case 10: // 5Mbps<br />
case 22: // 11Mbps<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;<br />
break;<br />
default:<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;<br />
break;<br />
}<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ;<br />
}<br />
else<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ;<br />
}<br />
header.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (), channelFlags);<br />
header.SetAntennaSignalPower (signalDbm);<br />
header.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType (), header);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
...<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
YansWifiPhyHelper::PcapSniffRxEvent () has been modified to remove the redundancies in setting the radiotap parameters because of the above modifications in YansWifiPhy::EndReceive ().<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
Changes were made in the existing radiotap header implementation to accommodate the TX parameters in the header. For monitor mode support, the changes required would be using a dummy address and protocol in the NetDevice->Send () arguments in Ipv4L3ClickRoutingProtocol::SendDown () and then modifications in MonitorWifiMac::Enqueue () that include the removal of the wifi-mac and radiotap headers. The radiotap information stripped would then be used to set the per-packet tx-vector parameters. The packet with the stripped headers is sent to the dca_queue.<br />
<br />
MonitorWifiMac::SetTxParametersFromRadiotapHeader() sets the tx-vector relevant parameters in WifiRemoteStationManager before the packet is sent to the dca_queue. The per-packet nature of the tx-vector parameters is preserved owing to the implementation of the HighLatencyTxVectorTag in WifiRemoteStationManager.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type. The latter has a single host Click configuration for wifi. The node broadcasts ARP requests if it wants to find a destination address and it responds to ARP requests made to it. A click script is used to set radiotap tx parameters (tx power, RTS and data retries).<br />
<br />
Rate control was made possible by means of SetTXRate() and different transmission powers were assigned to alternative packets using the RoundRobinSwitch element and assigning two different tx power levels to alternative ARP packets.<br />
<br />
== Future Work ==<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Implementation of Tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for RX Monitor Mode support and further testing<br />
* July 10 - July 17 : Mid-term review + feedback<br />
* July 18 - July 27 : Tx-vector implementation for radiotap header support<br />
* July 27 - Aug 5 : Test script for TX Monitor Mode support and further testing</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5939NSOC2011ClickMac2011-08-07T05:24:17Z<p>Ashwin: /* Transmission side */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<br />
A major step in the project would be the implementation of full radiotap headers support. <br />
<br />
For the RX side, 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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
For the TX side, the radiotap information can be extracted from the packet and fed to the per-packet tx-vector parameters.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t rate = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
Ptr<Packet> p = packet->Copy ();<br />
RadiotapHeader header;<br />
header.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_FCS_INCLUDED;<br />
if (isShortPreamble)<br />
{<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;<br />
}<br />
header.SetFrameFlags (frameFlags);<br />
header.SetRate (rate);<br />
uint16_t channelFlags = 0;<br />
switch (rate)<br />
{<br />
case 2: // 1Mbps<br />
case 4: // 2Mbps<br />
case 10: // 5Mbps<br />
case 22: // 11Mbps<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;<br />
break;<br />
default:<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;<br />
break;<br />
}<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ;<br />
}<br />
else<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ;<br />
}<br />
header.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (), channelFlags);<br />
header.SetAntennaSignalPower (signalDbm);<br />
header.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType (), header);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
...<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
YansWifiPhyHelper::PcapSniffRxEvent () has been modified to remove the redundancies in setting the radiotap parameters because of the above modifications in YansWifiPhy::EndReceive ().<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
Changes were made in the existing radiotap header implementation to accommodate the TX parameters in the header. For monitor mode support, the changes required would be using a dummy address and protocol in the NetDevice->Send () arguments in Ipv4L3ClickRoutingProtocol::SendDown () and then modifications in MonitorWifiMac::Enqueue () that include the removal of the wifi-mac and radiotap headers. The radiotap information stripped would then be used to set the per-packet tx-vector parameters. The packet with the stripped headers is sent to the dca_queue.<br />
<br />
MonitorWifiMac::SetTxParametersFromRadiotapHeader() sets the tx-vector relevant parameters in WifiRemoteStationManager before the packet is sent to the dca_queue. The per-packet nature of the tx-vector parameters is preserved owing to the implementation of the HighLatencyTxVectorTag in WifiRemoteStationManager.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type. The latter has a single host Click configuration for wifi. The node broadcasts ARP requests if it wants to find a destination address and it responds to ARP requests made to it. A click script is used to set radiotap tx parameters (tx power, RTS and data retries).<br />
<br />
== Future Work ==<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Implementation of Tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for RX Monitor Mode support and further testing<br />
* July 10 - July 17 : Mid-term review + feedback<br />
* July 18 - July 27 : Tx-vector implementation for radiotap header support<br />
* July 27 - Aug 5 : Test script for TX Monitor Mode support and further testing</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5938NSOC2011ClickMac2011-08-07T05:18:18Z<p>Ashwin: /* Transmission side */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<br />
A major step in the project would be the implementation of full radiotap headers support. <br />
<br />
For the RX side, 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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
For the TX side, the radiotap information can be extracted from the packet and fed to the per-packet tx-vector parameters.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t rate = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
Ptr<Packet> p = packet->Copy ();<br />
RadiotapHeader header;<br />
header.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_FCS_INCLUDED;<br />
if (isShortPreamble)<br />
{<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;<br />
}<br />
header.SetFrameFlags (frameFlags);<br />
header.SetRate (rate);<br />
uint16_t channelFlags = 0;<br />
switch (rate)<br />
{<br />
case 2: // 1Mbps<br />
case 4: // 2Mbps<br />
case 10: // 5Mbps<br />
case 22: // 11Mbps<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;<br />
break;<br />
default:<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;<br />
break;<br />
}<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ;<br />
}<br />
else<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ;<br />
}<br />
header.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (), channelFlags);<br />
header.SetAntennaSignalPower (signalDbm);<br />
header.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType (), header);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
...<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
YansWifiPhyHelper::PcapSniffRxEvent () has been modified to remove the redundancies in setting the radiotap parameters because of the above modifications in YansWifiPhy::EndReceive ().<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
For monitor mode support, the changes required would be using a dummy address and protocol in the NetDevice->Send () arguments in Ipv4L3ClickRoutingProtocol::SendDown () and then modifications in MonitorWifiMac::Enqueue () that include the removal of the wifi-mac and radiotap headers. The radiotap information stripped would then be used to set the per-packet tx-vector parameters. The packet with the stripped headers is sent to the dca_queue.<br />
<br />
MonitorWifiMac::SetTxParametersFromRadiotapHeader() sets the tx-vector relevant parameters in WifiRemoteStationManager before the packet is sent to the dca_queue. The per-packet nature of the tx-vector parameters is preserved owing to the implementation of the HighLatencyTxVectorTag in WifiRemoteStationManager.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type. The latter has a single host Click configuration for wifi. The node broadcasts ARP requests if it wants to find a destination address and it responds to ARP requests made to it. A click script is used to set radiotap tx parameters (tx power, RTS and data retries).<br />
<br />
== Future Work ==<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Implementation of Tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for RX Monitor Mode support and further testing<br />
* July 10 - July 17 : Mid-term review + feedback<br />
* July 18 - July 27 : Tx-vector implementation for radiotap header support<br />
* July 27 - Aug 5 : Test script for TX Monitor Mode support and further testing</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5937NSOC2011ClickMac2011-08-07T05:17:51Z<p>Ashwin: /* Test Script */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<br />
A major step in the project would be the implementation of full radiotap headers support. <br />
<br />
For the RX side, 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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
For the TX side, the radiotap information can be extracted from the packet and fed to the per-packet tx-vector parameters.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t rate = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
Ptr<Packet> p = packet->Copy ();<br />
RadiotapHeader header;<br />
header.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_FCS_INCLUDED;<br />
if (isShortPreamble)<br />
{<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;<br />
}<br />
header.SetFrameFlags (frameFlags);<br />
header.SetRate (rate);<br />
uint16_t channelFlags = 0;<br />
switch (rate)<br />
{<br />
case 2: // 1Mbps<br />
case 4: // 2Mbps<br />
case 10: // 5Mbps<br />
case 22: // 11Mbps<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;<br />
break;<br />
default:<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;<br />
break;<br />
}<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ;<br />
}<br />
else<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ;<br />
}<br />
header.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (), channelFlags);<br />
header.SetAntennaSignalPower (signalDbm);<br />
header.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType (), header);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
...<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
YansWifiPhyHelper::PcapSniffRxEvent () has been modified to remove the redundancies in setting the radiotap parameters because of the above modifications in YansWifiPhy::EndReceive ().<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
For monitor mode support, the changes required would be using a dummy address and protocol in the NetDevice->Send () arguments in Ipv4L3ClickRoutingProtocol::SendDown () and then modifications in MonitorWifiMac::Enqueue () that include the removal of the wifi-mac and radiotap headers. The radiotap information stripped would then be used to set the per-packet tx-vector parameters. The packet with the stripped headers is sent to the dca_queue.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type. The latter has a single host Click configuration for wifi. The node broadcasts ARP requests if it wants to find a destination address and it responds to ARP requests made to it. A click script is used to set radiotap tx parameters (tx power, RTS and data retries).<br />
<br />
== Future Work ==<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Implementation of Tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for RX Monitor Mode support and further testing<br />
* July 10 - July 17 : Mid-term review + feedback<br />
* July 18 - July 27 : Tx-vector implementation for radiotap header support<br />
* July 27 - Aug 5 : Test script for TX Monitor Mode support and further testing</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5936NSOC2011ClickMac2011-08-06T11:24:28Z<p>Ashwin: /* RadiotapHeader support */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<br />
A major step in the project would be the implementation of full radiotap headers support. <br />
<br />
For the RX side, 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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
For the TX side, the radiotap information can be extracted from the packet and fed to the per-packet tx-vector parameters.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t rate = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
Ptr<Packet> p = packet->Copy ();<br />
RadiotapHeader header;<br />
header.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_FCS_INCLUDED;<br />
if (isShortPreamble)<br />
{<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;<br />
}<br />
header.SetFrameFlags (frameFlags);<br />
header.SetRate (rate);<br />
uint16_t channelFlags = 0;<br />
switch (rate)<br />
{<br />
case 2: // 1Mbps<br />
case 4: // 2Mbps<br />
case 10: // 5Mbps<br />
case 22: // 11Mbps<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;<br />
break;<br />
default:<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;<br />
break;<br />
}<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ;<br />
}<br />
else<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ;<br />
}<br />
header.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (), channelFlags);<br />
header.SetAntennaSignalPower (signalDbm);<br />
header.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType (), header);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
...<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
YansWifiPhyHelper::PcapSniffRxEvent () has been modified to remove the redundancies in setting the radiotap parameters because of the above modifications in YansWifiPhy::EndReceive ().<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
For monitor mode support, the changes required would be using a dummy address and protocol in the NetDevice->Send () arguments in Ipv4L3ClickRoutingProtocol::SendDown () and then modifications in MonitorWifiMac::Enqueue () that include the removal of the wifi-mac and radiotap headers. The radiotap information stripped would then be used to set the per-packet tx-vector parameters. The packet with the stripped headers is sent to the dca_queue.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type. The latter has a single host Click configuration for wifi. The node broadcasts ARP requests if it wants to find a destination address and it responds to ARP requests made to it. A click script is used to set radiotap tx parameters (tx power, RTS and data retries). MonitorWifiMac::SetTxParametersFromRadiotapHeader() sets the tx-vector relevant parameters in WifiRemoteStationManager before the packet is sent to the dca_queue. The per-packet nature of the tx-vector parameters is preserved owing to the implementation of the HighLatencyTxVectorTag in WifiRemoteStationManager.<br />
<br />
== Future Work ==<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Implementation of Tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for RX Monitor Mode support and further testing<br />
* July 10 - July 17 : Mid-term review + feedback<br />
* July 18 - July 27 : Tx-vector implementation for radiotap header support<br />
* July 27 - Aug 5 : Test script for TX Monitor Mode support and further testing</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5935NSOC2011ClickMac2011-08-06T11:22:50Z<p>Ashwin: /* Creation of Radiotap Header */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t rate = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
Ptr<Packet> p = packet->Copy ();<br />
RadiotapHeader header;<br />
header.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_FCS_INCLUDED;<br />
if (isShortPreamble)<br />
{<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;<br />
}<br />
header.SetFrameFlags (frameFlags);<br />
header.SetRate (rate);<br />
uint16_t channelFlags = 0;<br />
switch (rate)<br />
{<br />
case 2: // 1Mbps<br />
case 4: // 2Mbps<br />
case 10: // 5Mbps<br />
case 22: // 11Mbps<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;<br />
break;<br />
default:<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;<br />
break;<br />
}<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ;<br />
}<br />
else<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ;<br />
}<br />
header.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (), channelFlags);<br />
header.SetAntennaSignalPower (signalDbm);<br />
header.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType (), header);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
...<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
YansWifiPhyHelper::PcapSniffRxEvent () has been modified to remove the redundancies in setting the radiotap parameters because of the above modifications in YansWifiPhy::EndReceive ().<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
For monitor mode support, the changes required would be using a dummy address and protocol in the NetDevice->Send () arguments in Ipv4L3ClickRoutingProtocol::SendDown () and then modifications in MonitorWifiMac::Enqueue () that include the removal of the wifi-mac and radiotap headers. The radiotap information stripped would then be used to set the per-packet tx-vector parameters. The packet with the stripped headers is sent to the dca_queue.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type. The latter has a single host Click configuration for wifi. The node broadcasts ARP requests if it wants to find a destination address and it responds to ARP requests made to it. A click script is used to set radiotap tx parameters (tx power, RTS and data retries). MonitorWifiMac::SetTxParametersFromRadiotapHeader() sets the tx-vector relevant parameters in WifiRemoteStationManager before the packet is sent to the dca_queue. The per-packet nature of the tx-vector parameters is preserved owing to the implementation of the HighLatencyTxVectorTag in WifiRemoteStationManager.<br />
<br />
== Future Work ==<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Implementation of Tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for RX Monitor Mode support and further testing<br />
* July 10 - July 17 : Mid-term review + feedback<br />
* July 18 - July 27 : Tx-vector implementation for radiotap header support<br />
* July 27 - Aug 5 : Test script for TX Monitor Mode support and further testing</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5934NSOC2011ClickMac2011-08-06T11:21:42Z<p>Ashwin: /* PCAP Traces */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t rate = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
Ptr<Packet> p = packet->Copy ();<br />
RadiotapHeader header;<br />
header.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_FCS_INCLUDED;<br />
<br />
if (isShortPreamble)<br />
{<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;<br />
}<br />
<br />
header.SetFrameFlags (frameFlags);<br />
header.SetRate (rate);<br />
<br />
uint16_t channelFlags = 0;<br />
switch (rate)<br />
{<br />
case 2: // 1Mbps<br />
case 4: // 2Mbps<br />
case 10: // 5Mbps<br />
case 22: // 11Mbps<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;<br />
break;<br />
<br />
default:<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;<br />
break;<br />
}<br />
<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ;<br />
}<br />
else<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ;<br />
}<br />
<br />
header.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (), channelFlags);<br />
<br />
header.SetAntennaSignalPower (signalDbm);<br />
header.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType (), header);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
...<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
YansWifiPhyHelper::PcapSniffRxEvent () has been modified to remove the redundancies in setting the radiotap parameters because of the above modifications in YansWifiPhy::EndReceive ().<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
For monitor mode support, the changes required would be using a dummy address and protocol in the NetDevice->Send () arguments in Ipv4L3ClickRoutingProtocol::SendDown () and then modifications in MonitorWifiMac::Enqueue () that include the removal of the wifi-mac and radiotap headers. The radiotap information stripped would then be used to set the per-packet tx-vector parameters. The packet with the stripped headers is sent to the dca_queue.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type. The latter has a single host Click configuration for wifi. The node broadcasts ARP requests if it wants to find a destination address and it responds to ARP requests made to it. A click script is used to set radiotap tx parameters (tx power, RTS and data retries). MonitorWifiMac::SetTxParametersFromRadiotapHeader() sets the tx-vector relevant parameters in WifiRemoteStationManager before the packet is sent to the dca_queue. The per-packet nature of the tx-vector parameters is preserved owing to the implementation of the HighLatencyTxVectorTag in WifiRemoteStationManager.<br />
<br />
== Future Work ==<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Implementation of Tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for RX Monitor Mode support and further testing<br />
* July 10 - July 17 : Mid-term review + feedback<br />
* July 18 - July 27 : Tx-vector implementation for radiotap header support<br />
* July 27 - Aug 5 : Test script for TX Monitor Mode support and further testing</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5933NSOC2011ClickMac2011-08-06T11:17:45Z<p>Ashwin: /* Creation of Radiotap Header */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t rate = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
Ptr<Packet> p = packet->Copy ();<br />
RadiotapHeader header;<br />
header.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_FCS_INCLUDED;<br />
<br />
if (isShortPreamble)<br />
{<br />
frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE;<br />
}<br />
<br />
header.SetFrameFlags (frameFlags);<br />
header.SetRate (rate);<br />
<br />
uint16_t channelFlags = 0;<br />
switch (rate)<br />
{<br />
case 2: // 1Mbps<br />
case 4: // 2Mbps<br />
case 10: // 5Mbps<br />
case 22: // 11Mbps<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;<br />
break;<br />
<br />
default:<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;<br />
break;<br />
}<br />
<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ;<br />
}<br />
else<br />
{<br />
channelFlags |= RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ;<br />
}<br />
<br />
header.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (), channelFlags);<br />
<br />
header.SetAntennaSignalPower (signalDbm);<br />
header.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType (), header);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
For monitor mode support, the changes required would be using a dummy address and protocol in the NetDevice->Send () arguments in Ipv4L3ClickRoutingProtocol::SendDown () and then modifications in MonitorWifiMac::Enqueue () that include the removal of the wifi-mac and radiotap headers. The radiotap information stripped would then be used to set the per-packet tx-vector parameters. The packet with the stripped headers is sent to the dca_queue.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type. The latter has a single host Click configuration for wifi. The node broadcasts ARP requests if it wants to find a destination address and it responds to ARP requests made to it. A click script is used to set radiotap tx parameters (tx power, RTS and data retries). MonitorWifiMac::SetTxParametersFromRadiotapHeader() sets the tx-vector relevant parameters in WifiRemoteStationManager before the packet is sent to the dca_queue. The per-packet nature of the tx-vector parameters is preserved owing to the implementation of the HighLatencyTxVectorTag in WifiRemoteStationManager.<br />
<br />
== Future Work ==<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Implementation of Tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for RX Monitor Mode support and further testing<br />
* July 10 - July 17 : Mid-term review + feedback<br />
* July 18 - July 27 : Tx-vector implementation for radiotap header support<br />
* July 27 - Aug 5 : Test script for TX Monitor Mode support and further testing</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5932NSOC2011ClickMac2011-08-06T11:12:35Z<p>Ashwin: /* Progress */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
For monitor mode support, the changes required would be using a dummy address and protocol in the NetDevice->Send () arguments in Ipv4L3ClickRoutingProtocol::SendDown () and then modifications in MonitorWifiMac::Enqueue () that include the removal of the wifi-mac and radiotap headers. The radiotap information stripped would then be used to set the per-packet tx-vector parameters. The packet with the stripped headers is sent to the dca_queue.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type. The latter has a single host Click configuration for wifi. The node broadcasts ARP requests if it wants to find a destination address and it responds to ARP requests made to it. A click script is used to set radiotap tx parameters (tx power, RTS and data retries). MonitorWifiMac::SetTxParametersFromRadiotapHeader() sets the tx-vector relevant parameters in WifiRemoteStationManager before the packet is sent to the dca_queue. The per-packet nature of the tx-vector parameters is preserved owing to the implementation of the HighLatencyTxVectorTag in WifiRemoteStationManager.<br />
<br />
== Future Work ==<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Implementation of Tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for RX Monitor Mode support and further testing<br />
* July 10 - July 17 : Mid-term review + feedback<br />
* July 18 - July 27 : Tx-vector implementation for radiotap header support<br />
* July 27 - Aug 5 : Test script for TX Monitor Mode support and further testing</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5931NSOC2011ClickMac2011-08-06T11:10:36Z<p>Ashwin: /* Progress */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
For monitor mode support, the changes required would be using a dummy address and protocol in the NetDevice->Send () arguments in Ipv4L3ClickRoutingProtocol::SendDown () and then modifications in MonitorWifiMac::Enqueue () that include the removal of the wifi-mac and radiotap headers. The radiotap information stripped would then be used to set the per-packet tx-vector parameters. The packet with the stripped headers is sent to the dca_queue.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type. The latter has a single host Click configuration for wifi. The node broadcasts ARP requests if it wants to find a destination address and it responds to ARP requests made to it. A click script is used to set radiotap tx parameters (tx power, RTS and data retries). MonitorWifiMac::SetTxParametersFromRadiotapHeader() sets the tx-vector relevant parameters in WifiRemoteStationManager before the packet is sent to the dca_queue. The per-packet nature of the tx-vector parameters is preserved owing to the implementation of the HighLatencyTxVectorTag in WifiRemoteStationManager.<br />
<br />
== Future Work ==<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Implementation of Tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for RX Monitor Mode support and further testing<br />
* July 10 - July 17 : Mid-term review + feedback<br />
* July 18 - July 27 : Tx-vector implementation for radiotap header support<br />
* July 27 - Aug 5 : Test script for TX Monitor Mode support and further testing</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5930NSOC2011ClickMac2011-08-06T11:09:22Z<p>Ashwin: /* Transmission side */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
For monitor mode support, the changes required would be using a dummy address and protocol in the NetDevice->Send () arguments in Ipv4L3ClickRoutingProtocol::SendDown () and then modifications in MonitorWifiMac::Enqueue () that include the removal of the wifi-mac and radiotap headers. The radiotap information stripped would then be used to set the per-packet tx-vector parameters. The packet with the stripped headers is sent to the dca_queue.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type. The latter has a single host Click configuration for wifi. The node broadcasts ARP requests if it wants to find a destination address and it responds to ARP requests made to it. A click script is used to set radiotap tx parameters (tx power, RTS and data retries). MonitorWifiMac::SetTxParametersFromRadiotapHeader() sets the tx-vector relevant parameters in WifiRemoteStationManager before the packet is sent to the dca_queue. The per-packet nature of the tx-vector parameters is preserved owing to the implementation of the HighLatencyTxVectorTag in WifiRemoteStationManager.<br />
<br />
== Future Work ==<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Implementation of Tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for RX Monitor Mode support and further testing<br />
* July 10 - July 17 : Mid-term review + feedback<br />
* July 18 - July 27 : Tx-vector implementation for radiotap header support<br />
* July 27 - Present : Test script for TX Monitor Mode support and further testing</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5929NSOC2011ClickMac2011-08-06T11:08:06Z<p>Ashwin: /* Transmission side */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
For monitor mode support, the changes required would be using a dummy address and protocol in the NetDevice->Send() arguments in Ipv4L3ClickRoutingProtocol::SendDown() and then modifications in MonitorWifiMac::Enqueue() that include the removal of the wifi-mac and radiotap headers. The radiotap information stripped would then be used to set the per-packet tx-vector parameters. The packet with the stripped headers is sent to the dca_queue.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type. The latter has a single host Click configuration for wifi. The node broadcasts ARP requests if it wants to find a destination address and it responds to ARP requests made to it. A click script is used to set radiotap tx parameters (tx power, RTS and data retries). MonitorWifiMac::SetTxParametersFromRadiotapHeader() sets the tx-vector relevant parameters in WifiRemoteStationManager before the packet is sent to the dca_queue. The per-packet nature of the tx-vector parameters is preserved owing to the implementation of the HighLatencyTxVectorTag in WifiRemoteStationManager.<br />
<br />
== Future Work ==<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Implementation of Tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for RX Monitor Mode support and further testing<br />
* July 10 - July 17 : Mid-term review + feedback<br />
* July 18 - July 27 : Tx-vector implementation for radiotap header support<br />
* July 27 - Present : Test script for TX Monitor Mode support and further testing</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5928NSOC2011ClickMac2011-08-06T11:06:17Z<p>Ashwin: /* Transmission side */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
For monitor mode support, the changes required would be using a dummy address and protocol in the NetDevice->Send() arguments in Ipv4L3ClickRoutingProtocol::SendDown() and then modifications in MonitorWifiMac::Enqueue() that include the removal of the wifi-mac and radiotap headers. The radiotap information stripped would then be used to set the per-packet tx-vector parameters.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type. The latter has a single host Click configuration for wifi. The node broadcasts ARP requests if it wants to find a destination address and it responds to ARP requests made to it. A click script is used to set radiotap tx parameters (tx power, RTS and data retries). MonitorWifiMac::SetTxParametersFromRadiotapHeader() sets the tx-vector relevant parameters in WifiRemoteStationManager before the packet is sent to the dca_queue. The per-packet nature of the tx-vector parameters is preserved owing to the implementation of the HighLatencyTxVectorTag in WifiRemoteStationManager.<br />
<br />
== Future Work ==<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Implementation of Tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for RX Monitor Mode support and further testing<br />
* July 10 - July 17 : Mid-term review + feedback<br />
* July 18 - July 27 : Tx-vector implementation for radiotap header support<br />
* July 27 - Present : Test script for TX Monitor Mode support and further testing</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5927NSOC2011ClickMac2011-08-06T11:02:53Z<p>Ashwin: /* Test Script */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
For monitor mode support, the changes required would be stripping off the WifiMac headers from Ipv4L3ClickRoutingProtocol::SendDown() and then modifications in MonitorWifiMac::Enqueue() that include the removal of the radiotap header. Then, the radiotap information stripped would be used to set the per-packet tx-vector parameters.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type. The latter has a single host Click configuration for wifi. The node broadcasts ARP requests if it wants to find a destination address and it responds to ARP requests made to it. A click script is used to set radiotap tx parameters (tx power, RTS and data retries). MonitorWifiMac::SetTxParametersFromRadiotapHeader() sets the tx-vector relevant parameters in WifiRemoteStationManager before the packet is sent to the dca_queue. The per-packet nature of the tx-vector parameters is preserved owing to the implementation of the HighLatencyTxVectorTag in WifiRemoteStationManager.<br />
<br />
== Future Work ==<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Implementation of Tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for RX Monitor Mode support and further testing<br />
* July 10 - July 17 : Mid-term review + feedback<br />
* July 18 - July 27 : Tx-vector implementation for radiotap header support<br />
* July 27 - Present : Test script for TX Monitor Mode support and further testing</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5926NSOC2011ClickMac2011-08-05T13:49:31Z<p>Ashwin: /* Deliverables */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
For monitor mode support, the changes required would be stripping off the WifiMac headers from Ipv4L3ClickRoutingProtocol::SendDown() and then modifications in MonitorWifiMac::Enqueue() that include the removal of the radiotap header. Then, the radiotap information stripped would be used to set the per-packet tx-vector parameters.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type.<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Implementation of Tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for RX Monitor Mode support and further testing<br />
* July 10 - July 17 : Mid-term review + feedback<br />
* July 18 - July 27 : Tx-vector implementation for radiotap header support<br />
* July 27 - Present : Test script for TX Monitor Mode support and further testing</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5925NSOC2011ClickMac2011-08-05T13:48:27Z<p>Ashwin: /* Progress */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
For monitor mode support, the changes required would be stripping off the WifiMac headers from Ipv4L3ClickRoutingProtocol::SendDown() and then modifications in MonitorWifiMac::Enqueue() that include the removal of the radiotap header. Then, the radiotap information stripped would be used to set the per-packet tx-vector parameters.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type.<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for RX Monitor Mode support and further testing<br />
* July 10 - July 17 : Mid-term review + feedback<br />
* July 18 - July 27 : Tx-vector implementation for radiotap header support<br />
* July 27 - Present : Test script for TX Monitor Mode support and further testing</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5924NSOC2011ClickMac2011-08-05T13:45:34Z<p>Ashwin: /* Transmission side */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
For monitor mode support, the changes required would be stripping off the WifiMac headers from Ipv4L3ClickRoutingProtocol::SendDown() and then modifications in MonitorWifiMac::Enqueue() that include the removal of the radiotap header. Then, the radiotap information stripped would be used to set the per-packet tx-vector parameters.<br />
<br />
== Test Script ==<br />
A click-based script was created for the purpose of testing the TX side of monitor mode support. For this, two nodes were used, one of AdhocWifiMac type and the other of MonitorWifiMac type.<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5923NSOC2011ClickMac2011-08-05T13:35:59Z<p>Ashwin: /* MonitorWifiMac */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
== RX Side ==<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac/MidTermReport&diff=5915NSOC2011ClickMac/MidTermReport2011-07-29T14:43:54Z<p>Ashwin: /* Progress */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click :: Mid-term Report ==<br />
<br />
== Approach ==<br />
The approach has been described in detail on the wiki link: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac]<br />
<br />
== Progress ==<br />
''' Radiotap Support for ns-3's Wifi model '''<br />
* Radiotap header support was created at YansWifiPhy::EndReceive() with the necessary modifications to send the headers up the stack through MacLow and MacRxMiddle. The PCAP tracing was refactored to contain the radiotap information. Further modifications were made for the headers to be sent higher up the stack.<br />
<br />
''' A MonitorWifiMac abstraction '''<br />
* The work included the creation of a MonitorWifiMac abstraction that would essentially be a copy of the non-QoS part of RegularWifiMac, an implementation that would work independently of the type of station. Provision of a Monitor Mode was made with the required modifications in WifiNetDevice. The packet reception was then tested at MonitorWifiMac::Receive(), where the radiotap header would be added to the packet. <br />
<br />
''' Test script for Monitor Mode '''<br />
* A test script was developed similar to the existing wifi-simple-adhoc-grid example for the purpose of testing the Monitor Mode and the correct working of the MonitorWifiMac class. For this purpose, a lone monitor node was chosen to be in the midst of a grid of AdhocWifiMac nodes capable of communicating with each other. The monitor node would be capable of receiving all the packets. The script is Click-based and prints information about the received packets within Click.<br />
<br />
To summarize, this work includes the the Rx side of Monitor Mode and Radiotap support for ns-3's Wifi model.<br />
<br />
Future work: Tx-vector modifications</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5899NSOC2011ClickMac2011-07-22T04:14:02Z<p>Ashwin: /* RadiotapHeader support */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5898NSOC2011ClickMac2011-07-22T04:09:16Z<p>Ashwin: /* RadiotapHeader support */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
|<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <--<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5897NSOC2011ClickMac2011-07-22T04:08:48Z<p>Ashwin: /* RadiotapHeader support */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
|<br />
WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information) <---<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5896NSOC2011ClickMac2011-07-22T04:05:09Z<p>Ashwin: /* RadiotapHeader support */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice<br />
--> WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information)<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5895NSOC2011ClickMac2011-07-22T04:04:01Z<p>Ashwin: /* RadiotapHeader support */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice --> WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information)<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5894NSOC2011ClickMac2011-07-22T04:00:04Z<p>Ashwin: /* RadiotapHeader support */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy (Creation of Radiotap Header) --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice --> WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information)<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5893NSOC2011ClickMac2011-07-22T03:59:30Z<p>Ashwin: /* RadiotapHeader support */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy --> MacLow --> MacRxMiddle --> RegularWifiMac --> NetDevice --> WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information)<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5892NSOC2011ClickMac2011-07-22T03:58:17Z<p>Ashwin: /* RadiotapHeader support */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
<nowiki>YansWifiPhy<br />
|<br />
| (Creation of Radiotap Header)<br />
V<br />
MacLow<br />
|<br />
|<br />
V<br />
MacRxMiddle<br />
|<br />
|<br />
V<br />
RegularWifiMac<br />
|<br />
|<br />
V<br />
NetDevice --> WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information)<br />
</nowiki><br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5891NSOC2011ClickMac2011-07-22T03:57:31Z<p>Ashwin: /* RadiotapHeader support */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
YansWifiPhy<br />
|<br />
| (Creation of Radiotap Header)<br />
V<br />
MacLow<br />
|<br />
|<br />
V<br />
MacRxMiddle<br />
|<br />
|<br />
V<br />
RegularWifiMac<br />
|<br />
|<br />
V<br />
NetDevice --> WifiNetDevice (if in monitor mode, remove LLC header from packet, else just extract LLC information)<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5890NSOC2011ClickMac2011-07-22T03:29:23Z<p>Ashwin: /* Plan */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Adding Radiotap Information to the implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5889NSOC2011ClickMac2011-07-20T06:02:49Z<p>Ashwin: /* Details */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== RadiotapHeader support ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5888NSOC2011ClickMac2011-07-20T06:02:15Z<p>Ashwin: /* Click-MAC Extensions for ns-3-click */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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, provide RadiotapHeader support for ns-3's Wifi model and a Monitor Wifi Mac interface to support a Monitor Mode within ns-3.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== Details ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac/MidTermReport&diff=5887NSOC2011ClickMac/MidTermReport2011-07-20T06:00:46Z<p>Ashwin: /* Progress */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click :: Mid-term Report ==<br />
<br />
== Approach ==<br />
The approach has been described in detail on the wiki link: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac]<br />
<br />
== Progress ==<br />
''' Radiotap Support for ns-3's Wifi model '''<br />
* Radiotap header support was created at YansWifiPhy::EndReceive() with the necessary modifications to send the headers up the stack through MacLow and MacRxMiddle. The PCAP tracing was refactored to contain the radiotap information. Further modifications were made for the headers to be sent higher up the stack.<br />
<br />
''' A MonitorWifiMac abstraction '''<br />
* The work included the creation of a MonitorWifiMac abstraction that would essentially be a copy of the non-QoS part of RegularWifiMac, an implementation that would work independently of the type of station. Provision of a Monitor Mode was made with the required modifications in WifiNetDevice. The packet reception was then tested at MonitorWifiMac::Receive(), where the radiotap header would be added to the packet. <br />
<br />
''' Test script for Monitor Mode '''<br />
* A test script was developed similar to the existing wifi-simple-adhoc-grid example for the purpose of testing the Monitor Mode and the correct working of the MonitorWifiMac class. For this purpose, a lone monitor node was chosen to be in the midst of a grid of AdhocWifiMac nodes capable of communicating with each other. The monitor node would be capable of receiving all the packets. The script has been Click-based to print information about the received packets within Click.<br />
<br />
To summarize, this work includes the the Rx side of Monitor Mode and Radiotap support for ns-3's Wifi model.<br />
<br />
Future work: Tx-vector modifications</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac/MidTermReport&diff=5886NSOC2011ClickMac/MidTermReport2011-07-20T05:59:43Z<p>Ashwin: /* Progress */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click :: Mid-term Report ==<br />
<br />
== Approach ==<br />
The approach has been described in detail on the wiki link: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac]<br />
<br />
== Progress ==<br />
''' Radiotap Support for ns-3's Wifi model '''<br />
* Radiotap header support was created at YansWifiPhy::EndReceive() with the necessary modifications to send the headers up the stack through MacLow and MacRxMiddle. A certain amount of Pcap refactoring was done to permit the traces to contain the radiotap information. Further modifications were made for the headers to be sent higher up the stack.<br />
<br />
''' A MonitorWifiMac abstraction '''<br />
* The work included the creation of a MonitorWifiMac abstraction that would essentially be a copy of the non-QoS part of RegularWifiMac, an implementation that would work independently of the type of station. Provision of a Monitor Mode was made with the required modifications in WifiNetDevice. The packet reception was then tested at MonitorWifiMac::Receive(), where the radiotap header would be added to the packet. <br />
<br />
''' Test script for Monitor Mode '''<br />
* A test script was developed similar to the existing wifi-simple-adhoc-grid example for the purpose of testing the Monitor Mode and the correct working of the MonitorWifiMac class. For this purpose, a lone monitor node was chosen to be in the midst of a grid of AdhocWifiMac nodes capable of communicating with each other. The monitor node would be capable of receiving all the packets. The script has been Click-based to print information about the received packets within Click.<br />
<br />
To summarize, this work includes the the Rx side of Monitor Mode and Radiotap support for ns-3's Wifi model.<br />
<br />
Future work: Tx-vector modifications</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5885NSOC2011ClickMac2011-07-20T05:57:37Z<p>Ashwin: /* Creation of Radiotap Header */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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 interface.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== Details ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
I'm also investigating to see if the removal of WifiMode is possible.<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5884NSOC2011ClickMac2011-07-20T05:54:44Z<p>Ashwin: /* Creation of Radiotap Header */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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 interface.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== Details ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save the expense of a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5883NSOC2011ClickMac2011-07-20T05:54:20Z<p>Ashwin: /* Creation of Radiotap Header */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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 interface.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== Details ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,const RadiotapHeader *> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
The callback uses RadiotapHeader of type const RadiotapHeader * to save a copy.<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5882NSOC2011ClickMac2011-07-20T05:50:22Z<p>Ashwin: /* MonitorWifiMac */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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 interface.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== Details ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,RadiotapHeader> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5881NSOC2011ClickMac2011-07-20T05:50:02Z<p>Ashwin: /* MonitorWifiMac */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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 interface.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== Details ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,RadiotapHeader> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
'''Rx side'''<br />
----<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5880NSOC2011ClickMac2011-07-20T05:49:33Z<p>Ashwin: /* MonitorWifiMac */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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 interface.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== Details ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,RadiotapHeader> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
'''Rx side'''<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5879NSOC2011ClickMac2011-07-20T05:48:48Z<p>Ashwin: /* Creation of Radiotap Header */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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 interface.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== Details ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, event->GetPayloadMode (), radiotaphdr);<br />
<br />
The radiotap header can be added as arguments as shown above for MacLow::ReceiveOk(). I'm attempting to reduce the redundancy in using such a set of parameters. Since we're passing the radiotap header, I've eliminated the need for a variable storing SNR and the need for WifiPreamble. This information is available within the radiotap header content. <br />
<br />
double rxSnr;<br />
enum WifiPreamble preamble;<br />
Ptr<YansWifiPhy> yanswifiphy = new YansWifiPhy ();<br />
double RxPowerW;<br />
RxPowerW = DbToRatio (radiotaphdr.GetAntennaSignalPower () - 30);<br />
rxSnr = RxPowerW / (DbToRatio (radiotaphdr.GetAntennaNoisePower () + yanswifiphy->GetRxNoiseFigure () - 30));<br />
preamble = (radiotaphdr.GetFrameFlags () == 0x02) ? WIFI_PREAMBLE_SHORT:WIFI_PREAMBLE_LONG;<br />
<br />
Due to these changes, the necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,RadiotapHeader> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
* Rx side<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5878NSOC2011ClickMac2011-07-20T05:42:36Z<p>Ashwin: /* Modifications for sending up the stack */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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 interface.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== Details ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType ());<br />
<br />
The radiotap headers can be added as arguments to the above for MacLow::ReceiveOk(). Adding the radiotap headers in the arguments of the above would result in redundancies. The necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,RadiotapHeader> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
* Rx side<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5877NSOC2011ClickMac2011-07-20T05:42:02Z<p>Ashwin: /* PCAP Refactoring */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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 interface.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== Details ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType ());<br />
<br />
The radiotap headers can be added as arguments to the above for MacLow::ReceiveOk(). Adding the radiotap headers in the arguments of the above would result in redundancies. The necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,RadiotapHeader> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
== PCAP Traces ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, RadiotapHeader radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
* Rx side<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwinhttps://www.nsnam.org/mediawiki/index.php?title=NSOC2011ClickMac&diff=5876NSOC2011ClickMac2011-07-20T05:41:21Z<p>Ashwin: /* Modifications for sending up the stack */</p>
<hr />
<div>== Click-MAC Extensions for ns-3-click ==<br />
<br />
* Student: [mailto:anarayan@cs.rutgers.edu Ashwin Narayan]<br />
* Mentors: [mailto:ruben@net.t-labs.tu-berlin.de Ruben Merz] and [mailto:suresh.lalith@gmail.com Lalith Suresh]<br />
* 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 interface.<br />
<br />
Mid-term report: [http://www.nsnam.org/wiki/index.php/NSOC2011ClickMac/MidTermReport]<br />
<br />
== Details ==<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 YansWifiPhy and the necessary modifications must be made for sending the header upwards.<br />
<br />
== Creation of Radiotap Header ==<br />
The Radiotap Header can be created in YansWifiPhy::EndReceive().<br />
<br />
uint32_t dataRate500KbpsUnits = event->GetPayloadMode ().GetDataRate () / 500000;<br />
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());<br />
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;<br />
double noiseDbm = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;<br />
uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;<br />
RadiotapHeader radiotaphdr;<br />
radiotaphdr.SetTsft (Simulator::Now ().GetMicroSeconds ());<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
radiotaphdr.SetFrameFlags (frameFlags);<br />
radiotaphdr.SetRate (dataRate500KbpsUnits);<br />
if (GetChannelFrequencyMhz () < 2500)<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_2GHZ | RadiotapHeader::CHANNEL_FLAG_CCK);<br />
}<br />
else<br />
{<br />
radiotaphdr.SetChannelFrequencyAndFlags (GetChannelFrequencyMhz (),<br />
RadiotapHeader::CHANNEL_FLAG_SPECTRUM_5GHZ | RadiotapHeader::CHANNEL_FLAG_OFDM);<br />
}<br />
radiotaphdr.SetAntennaSignalPower (signalDbm);<br />
radiotaphdr.SetAntennaNoisePower (noiseDbm);<br />
<br />
The necessary modifications must be made in MacLow and MacRxMiddle to send the RadiotapHeaders up the stack. <br />
<br />
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType ());<br />
<br />
The radiotap headers can be added as arguments to the above for MacLow::ReceiveOk(). Adding the radiotap headers in the arguments of the above would result in redundancies. The necessary modifications must be made in MacLow::ReceiveOk() accordingly along with the callbacks and then in MacRxMiddle::Receive() accordingly. <br />
<br />
In MacLow::ReceiveOk(), 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.<br />
<br />
void MacLow::SetRxCallback (Callback<void,Ptr<Packet>,const WifiMacHeader *,RadiotapHeader> callback)<br />
{ m_rxCallback = callback;<br />
}<br />
<br />
== PCAP Refactoring ==<br />
<br />
Ptr<Packet> p = packet->Copy ();<br />
p->AddHeader (radiotaphdr);<br />
<br />
The Radiotap Header can be added to the copy of the packet and then the following could be used:<br />
<br />
NotifyPromiscSniffRx (p, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);<br />
<br />
== Modifications for sending up the stack ==<br />
While the Radiotap Header is created in MacLow, it must be sent up the stack till MacHigh where it can be added to the packet for Click use.<br />
<br />
RegularWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, RadiotapHeader radiotaphdr)<br />
<br />
Accordingly, the callbacks and arguments have been modified to permit the same.<br />
<br />
== MonitorWifiMac ==<br />
MonitorWifiMac can inherit directly from WifiMac and we could copy only the non-QoS part from RegularMacWifi. Thus, the MonitorWifiMac implementation doesn't need to know the type of station being implemented in the Click graph.<br />
<br />
* Rx side<br />
To test the reception of a Radiotap Header at Receive (), I attempted to remove the radiotap header. However, this resulted in premature termination while running the test programs (nsclick-simple-lan and nsclick-raw-wlan). The problem appears to be with RadiotapHeader::Deserialize () where an error occurs due the m_length and bytesRead being inconsistent. The LLC header at WifiNetDevice::Receive () needs to be preserved. For this purpose, I created a copy of the packet at Receive () and then removed the header with the LLC header from the copy. The LLC parameters necessary for the rest of Receive () can be used from this copy.<br />
<br />
For Monitor Mode testing, a flag was created at WifiNetDevice::ForwardUp (), which when set (through WifiNetDevice::SetMonitorMode ()) would remove the LLC header from the packet. If not, the packet would simply travel up as it is. The packet reception was tested at MonitorWifiMac where at Receive (), the radiotap header being sent up the stack would be added to the packet. This packet would then be sent up the stack through ForwardUp (). <br />
<br />
There is no need for a Monitor Mode flag in MacLow, unlike our initial assumptions. In MacLow::ReceiveOk, there's no need to do any bypassing for Monitor Mode. In MonitorWifiMac, the Monitor Mode functionality can be enabled using m_low->SetPromisc ().<br />
<br />
==Test script==<br />
A test script was developed for testing Monitor Mode. The grid would consist of several AdhocWifiMac nodes capable of talking to each other and a lone MonitorWifiMac node, which receives all these packets. The example is Click-based and prints the information about the received packets from within Click.<br />
<br />
== Transmission side ==<br />
As far as TX part is concerned, there’s a need to use a tx-vector that allows per-packet tx parameters so as to allow for the transmission parameters obtained from the radiotap headers to be used for transmission. The implementation introduces per-packet tx parameters through WifiStationRemoteManager by adding the appropriate menthods for the different parameters and for Data, Rts, Cts, Ack. <br />
<br />
There would be changes required in IPv4L3ClickRouting would be stripping off headers (the radiotap headers must be stripped as high in the stack as possible) to extract required information and pushing them using SendDown () where we can pass the required click information through netdev->Send (). I might need to strip off a WifiMacHeader at Ipv4L3ClickProtocol::SendDown () to extract Mac address information before sending out the packet through the NetDevice.<br />
<br />
RadiotapHeader radiotaphdr;<br />
r->RemoveHeader(radiotaphdr);<br />
...<br />
netdev->Send(p, radiotaphdr.GetInfo(), protocol);<br />
<br />
As part of future work, following the click-mac integration, there’s the possible implementation of tx-queue feedback.<br />
<br />
== Deliverables ==<br />
Considering the time period for the program, the following would be the list of deliverables:<br />
* Implementation of full-radiotap header support<br />
* Implementation a MonitorWifiMac abstraction<br />
* Modification of tx-vector to support radiotap information<br />
<br />
== Plan ==<br />
* May 23 - June 11 : Creation of radiotap headers in YansWifiPhy and testing the same<br />
* June 12 - June 26 : Implementing MonitorWifiMac abstraction<br />
* June 27 - July 1 : Testing<br />
* July 1 - July 10 : Refactoring PCAP output: moving wifi PCAP sniff trace sources to MacLow,<br />
* July 11 - July 15 : Mid-term code review + feedback<br />
* July 16 - July 21 : Rest of the refactoring of the PCAP output<br />
* July 22 - July 24 : Testing<br />
* July 25 - August 7 : Implementation of tx-vector<br />
* August 8 - August 11 : Integration and testing<br />
* August 12 - August 14 : Documentation<br />
* August 15 - August 19 : End-term code review + feedback<br />
<br />
== Progress ==<br />
* May 15 - May 22 : Revisions to original proposal before beginning of the Coding Phase<br />
* May 23 - June 3 : Created Radiotap headers in YansWifiPhy and tested output using examples<br />
* June 3 - June 10 : Creation of MonitorWifiMac (copy of non-QoS RegularWifiMac)<br />
* June 10 - July 3 : MonitorWifiMac abstraction ready for rx<br />
* July 4 - July 10 : Test script for Monitor Mode and further testing<br />
* July 10 - Present : Mid-term review + feedback<br />
<br />
Currently working on the Tx-vector aspect</div>Ashwin