Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2005,2006 INRIA | 3 * Copyright (c) 2005,2006 INRIA |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 11 matching lines...) Expand all Loading... | |
22 #include "wifi-phy.h" | 22 #include "wifi-phy.h" |
23 #include "wifi-remote-station-manager.h" | 23 #include "wifi-remote-station-manager.h" |
24 #include "wifi-channel.h" | 24 #include "wifi-channel.h" |
25 #include "ns3/llc-snap-header.h" | 25 #include "ns3/llc-snap-header.h" |
26 #include "ns3/packet.h" | 26 #include "ns3/packet.h" |
27 #include "ns3/uinteger.h" | 27 #include "ns3/uinteger.h" |
28 #include "ns3/pointer.h" | 28 #include "ns3/pointer.h" |
29 #include "ns3/node.h" | 29 #include "ns3/node.h" |
30 #include "ns3/trace-source-accessor.h" | 30 #include "ns3/trace-source-accessor.h" |
31 #include "ns3/log.h" | 31 #include "ns3/log.h" |
32 #include "ns3/wifi-mac-header.h" | |
32 | 33 |
33 NS_LOG_COMPONENT_DEFINE ("WifiNetDevice"); | 34 NS_LOG_COMPONENT_DEFINE ("WifiNetDevice"); |
34 | 35 |
35 namespace ns3 { | 36 namespace ns3 { |
36 | 37 |
37 NS_OBJECT_ENSURE_REGISTERED (WifiNetDevice); | 38 NS_OBJECT_ENSURE_REGISTERED (WifiNetDevice); |
38 | 39 |
39 TypeId | 40 TypeId |
40 WifiNetDevice::GetTypeId (void) | 41 WifiNetDevice::GetTypeId (void) |
41 { | 42 { |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
287 void | 288 void |
288 WifiNetDevice::ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to ) | 289 WifiNetDevice::ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to ) |
289 { | 290 { |
290 LlcSnapHeader llc; | 291 LlcSnapHeader llc; |
291 if (!m_monitor) | 292 if (!m_monitor) |
292 { | 293 { |
293 packet->RemoveHeader (llc); | 294 packet->RemoveHeader (llc); |
294 } | 295 } |
295 else | 296 else |
296 { | 297 { |
297 packet->Copy ()->RemoveHeader (llc); | 298 Ptr<Packet> pCopy = packet->Copy (); |
Nicola Baldo
2011/07/15 15:33:28
Can you explain this?
ashwin.narayan89
2011/07/18 08:33:30
Code has been modified. If not in monitor mode, th
| |
299 RadiotapHeader rtHeader; | |
300 WifiMacHeader wmHeader; | |
301 pCopy->RemoveHeader (rtHeader); | |
302 pCopy->RemoveHeader (wmHeader); | |
303 pCopy->RemoveHeader (llc); | |
298 } | 304 } |
299 enum NetDevice::PacketType type; | 305 enum NetDevice::PacketType type; |
300 if (to.IsBroadcast ()) | 306 if (to.IsBroadcast ()) |
301 { | 307 { |
302 type = NetDevice::PACKET_BROADCAST; | 308 type = NetDevice::PACKET_BROADCAST; |
303 } | 309 } |
304 else if (to.IsGroup ()) | 310 else if (to.IsGroup ()) |
305 { | 311 { |
306 type = NetDevice::PACKET_MULTICAST; | 312 type = NetDevice::PACKET_MULTICAST; |
307 } | 313 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
362 void | 368 void |
363 WifiNetDevice::SetPromiscReceiveCallback (PromiscReceiveCallback cb) | 369 WifiNetDevice::SetPromiscReceiveCallback (PromiscReceiveCallback cb) |
364 { | 370 { |
365 m_promiscRx = cb; | 371 m_promiscRx = cb; |
366 m_mac->SetPromisc (); | 372 m_mac->SetPromisc (); |
367 } | 373 } |
368 | 374 |
369 void | 375 void |
370 WifiNetDevice::SetMonitorMode () | 376 WifiNetDevice::SetMonitorMode () |
371 { | 377 { |
372 m_monitor = true; | 378 m_monitor = true; // Must be set only if WifiNetDevice has a MonitorWifiMac un derneath |
379 } | |
380 | |
381 bool | |
382 WifiNetDevice::IsMonitorMode (void) const | |
383 { | |
384 return m_monitor; | |
373 } | 385 } |
374 | 386 |
375 bool | 387 bool |
376 WifiNetDevice::SupportsSendFrom (void) const | 388 WifiNetDevice::SupportsSendFrom (void) const |
377 { | 389 { |
378 return m_mac->SupportsSendFrom (); | 390 return m_mac->SupportsSendFrom (); |
379 } | 391 } |
380 | 392 |
381 } // namespace ns3 | 393 } // namespace ns3 |
382 | 394 |
LEFT | RIGHT |