OLD | NEW |
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 MakeTimeAccessor (&NqapWifiMac::GetBeaconInterval, | 53 MakeTimeAccessor (&NqapWifiMac::GetBeaconInterval, |
54 &NqapWifiMac::SetBeaconInterval), | 54 &NqapWifiMac::SetBeaconInterval), |
55 MakeTimeChecker ()) | 55 MakeTimeChecker ()) |
56 .AddAttribute ("BeaconGeneration", "Whether or not beacons are generated.", | 56 .AddAttribute ("BeaconGeneration", "Whether or not beacons are generated.", |
57 BooleanValue (true), | 57 BooleanValue (true), |
58 MakeBooleanAccessor (&NqapWifiMac::SetBeaconGeneration, | 58 MakeBooleanAccessor (&NqapWifiMac::SetBeaconGeneration, |
59 &NqapWifiMac::GetBeaconGeneration), | 59 &NqapWifiMac::GetBeaconGeneration), |
60 MakeBooleanChecker ()) | 60 MakeBooleanChecker ()) |
61 .AddAttribute ("DcaTxop", "The DcaTxop object", | 61 .AddAttribute ("DcaTxop", "The DcaTxop object", |
62 PointerValue (), | 62 PointerValue (), |
63 MakePointerAccessor (&NqapWifiMac::DoGetDcaTxop), | 63 MakePointerAccessor (&NqapWifiMac::GetDcaTxop, |
| 64 &NqapWifiMac::SetDcaTxop), |
64 MakePointerChecker<DcaTxop> ())· | 65 MakePointerChecker<DcaTxop> ())· |
65 ; | 66 ; |
66 return tid; | 67 return tid; |
67 } | 68 } |
68 | 69 |
69 NqapWifiMac::NqapWifiMac () | 70 NqapWifiMac::NqapWifiMac () |
70 { | 71 { |
71 NS_LOG_FUNCTION (this); | 72 NS_LOG_FUNCTION (this); |
72 m_rxMiddle = new MacRxMiddle (); | 73 m_rxMiddle = new MacRxMiddle (); |
73 m_rxMiddle->SetForwardCallback (MakeCallback (&NqapWifiMac::Receive, this)); | 74 m_rxMiddle->SetForwardCallback (MakeCallback (&NqapWifiMac::Receive, this)); |
74 | 75 |
75 m_low = CreateObject<MacLow> (); | 76 m_low = CreateObject<MacLow> (); |
76 m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle)); | 77 m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle)); |
77 | 78 |
78 m_dcfManager = new DcfManager (); | 79 m_dcfManager = new DcfManager (); |
79 m_dcfManager->SetupLowListener (m_low); | 80 m_dcfManager->SetupLowListener (m_low); |
80 | 81 |
81 m_dca = CreateObject<DcaTxop> (); | |
82 m_dca->SetLow (m_low); | |
83 m_dca->SetManager (m_dcfManager); | |
84 m_dca->SetTxOkCallback (MakeCallback (&NqapWifiMac::TxOk, this)); | |
85 m_dca->SetTxFailedCallback (MakeCallback (&NqapWifiMac::TxFailed, this)); | |
86 | |
87 m_beaconDca = CreateObject<DcaTxop> (); | 82 m_beaconDca = CreateObject<DcaTxop> (); |
88 m_beaconDca->SetAifsn(1); | 83 m_beaconDca->SetAifsn(1); |
89 m_beaconDca->SetMinCw(0); | 84 m_beaconDca->SetMinCw(0); |
90 m_beaconDca->SetMaxCw(0); | 85 m_beaconDca->SetMaxCw(0); |
91 m_beaconDca->SetLow (m_low); | 86 m_beaconDca->SetLow (m_low); |
92 m_beaconDca->SetManager (m_dcfManager); | 87 m_beaconDca->SetManager (m_dcfManager); |
93 } | 88 } |
94 NqapWifiMac::~NqapWifiMac () | 89 NqapWifiMac::~NqapWifiMac () |
95 { | 90 { |
96 NS_LOG_FUNCTION (this); | 91 NS_LOG_FUNCTION (this); |
97 } | 92 } |
98 | 93 |
99 void | 94 void |
100 NqapWifiMac::DoDispose (void) | 95 NqapWifiMac::DoDispose (void) |
101 { | 96 { |
102 NS_LOG_FUNCTION (this); | 97 NS_LOG_FUNCTION (this); |
103 delete m_rxMiddle; | 98 delete m_rxMiddle; |
104 delete m_dcfManager; | 99 delete m_dcfManager; |
105 m_rxMiddle = 0; | 100 m_rxMiddle = 0; |
106 m_low = 0; | 101 m_low = 0; |
107 m_dcfManager = 0; | 102 m_dcfManager = 0; |
108 m_phy = 0; | 103 m_phy = 0; |
109 m_dca = 0; | 104 m_dca = 0; |
110 m_beaconDca = 0; | 105 m_beaconDca = 0; |
| 106 m_stationManager = 0; |
111 m_beaconEvent.Cancel (); | 107 m_beaconEvent.Cancel (); |
112 WifiMac::DoDispose (); | 108 WifiMac::DoDispose (); |
113 } | 109 } |
114 | 110 |
115 void | 111 void |
116 NqapWifiMac::SetBeaconGeneration (bool enable) | 112 NqapWifiMac::SetBeaconGeneration (bool enable) |
117 { | 113 { |
118 NS_LOG_FUNCTION (this << enable); | 114 NS_LOG_FUNCTION (this << enable); |
119 if (enable) | 115 if (enable) |
120 { | 116 { |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 NqapWifiMac::ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Addr
ess to) | 289 NqapWifiMac::ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Addr
ess to) |
294 { | 290 { |
295 NS_LOG_FUNCTION (this << packet << from << to); | 291 NS_LOG_FUNCTION (this << packet << from << to); |
296 WifiMacHeader hdr; | 292 WifiMacHeader hdr; |
297 hdr.SetTypeData (); | 293 hdr.SetTypeData (); |
298 hdr.SetAddr1 (to); | 294 hdr.SetAddr1 (to); |
299 hdr.SetAddr2 (GetAddress ()); | 295 hdr.SetAddr2 (GetAddress ()); |
300 hdr.SetAddr3 (from); | 296 hdr.SetAddr3 (from); |
301 hdr.SetDsFrom (); | 297 hdr.SetDsFrom (); |
302 hdr.SetDsNotTo (); | 298 hdr.SetDsNotTo (); |
303 | 299 m_dca->Queue (packet, hdr); |
304 m_dca->Queue (packet, hdr); | |
305 } | 300 } |
306 void· | 301 void· |
307 NqapWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address fr
om) | 302 NqapWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address fr
om) |
308 { | 303 { |
309 NS_LOG_FUNCTION (this << packet << to << from); | 304 NS_LOG_FUNCTION (this << packet << to << from); |
310 ForwardDown (packet, from, to); | 305 ForwardDown (packet, from, to); |
311 } | 306 } |
312 void· | 307 void· |
313 NqapWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to) | 308 NqapWifiMac::Enqueue (Ptr<const Packet> packet, Mac48Address to) |
314 { | 309 { |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 else· | 553 else· |
559 { | 554 { |
560 /* damn, what could this be ? a control frame ? | 555 /* damn, what could this be ? a control frame ? |
561 * control frames should never reach the MacHigh so, | 556 * control frames should never reach the MacHigh so, |
562 * this is likely to be a bug. assert. | 557 * this is likely to be a bug. assert. |
563 */ | 558 */ |
564 NS_ASSERT (false); | 559 NS_ASSERT (false); |
565 }·· | 560 }·· |
566 } | 561 } |
567 Ptr<DcaTxop> | 562 Ptr<DcaTxop> |
568 NqapWifiMac::DoGetDcaTxop(void) const | 563 NqapWifiMac::GetDcaTxop(void) const |
569 { | 564 { |
570 return m_dca; | 565 return m_dca; |
571 } | 566 } |
572 | 567 |
| 568 void |
| 569 NqapWifiMac::SetDcaTxop (Ptr<DcaTxop> dcaTxop) |
| 570 { |
| 571 m_dca = dcaTxop; |
| 572 m_dca->SetLow (m_low); |
| 573 m_dca->SetManager (m_dcfManager); |
| 574 m_dca->SetTxOkCallback (MakeCallback (&NqapWifiMac::TxOk, this)); |
| 575 m_dca->SetTxFailedCallback (MakeCallback (&NqapWifiMac::TxFailed, this)); |
| 576 } |
| 577 |
573 } // namespace ns3 | 578 } // namespace ns3 |
OLD | NEW |