View | Details | Raw Unified | Return to bug 1722
Collapse All | Expand All

(-)a/src/wifi/helper/wifi-helper.cc (+8 lines)
 Lines 26-31    Link Here 
26
#include "ns3/dca-txop.h"
26
#include "ns3/dca-txop.h"
27
#include "ns3/edca-txop-n.h"
27
#include "ns3/edca-txop-n.h"
28
#include "ns3/minstrel-wifi-manager.h"
28
#include "ns3/minstrel-wifi-manager.h"
29
#include "ns3/ap-wifi-mac.h"
29
#include "ns3/wifi-phy.h"
30
#include "ns3/wifi-phy.h"
30
#include "ns3/wifi-remote-station-manager.h"
31
#include "ns3/wifi-remote-station-manager.h"
31
#include "ns3/wifi-channel.h"
32
#include "ns3/wifi-channel.h"
 Lines 215-220    Link Here 
215
              rmac->GetAttribute ("BK_EdcaTxopN", ptr);
216
              rmac->GetAttribute ("BK_EdcaTxopN", ptr);
216
              Ptr<EdcaTxopN> bk_edcaTxopN = ptr.Get<EdcaTxopN> ();
217
              Ptr<EdcaTxopN> bk_edcaTxopN = ptr.Get<EdcaTxopN> ();
217
              currentStream += bk_edcaTxopN->AssignStreams (currentStream);
218
              currentStream += bk_edcaTxopN->AssignStreams (currentStream);
219
220
              // if an AP, handle any beacon jitter
221
              Ptr<ApWifiMac> apmac = DynamicCast<ApWifiMac> (rmac);
222
              if (apmac)
223
                {
224
                  currentStream += apmac->AssignStreams (currentStream);
225
                }
218
            }
226
            }
219
        }
227
        }
220
    }
228
    }
(-)a/src/wifi/model/ap-wifi-mac.cc (-1 / +27 lines)
 Lines 55-60    Link Here 
55
                   MakeTimeAccessor (&ApWifiMac::GetBeaconInterval,
55
                   MakeTimeAccessor (&ApWifiMac::GetBeaconInterval,
56
                                     &ApWifiMac::SetBeaconInterval),
56
                                     &ApWifiMac::SetBeaconInterval),
57
                   MakeTimeChecker ())
57
                   MakeTimeChecker ())
58
    .AddAttribute ("BeaconJitter", "A uniform random variable to cause the initial beacon starting time (after simulation time 0) to be distributed between 0 and the BeaconInterval.",
59
                   StringValue ("ns3::UniformRandomVariable"),
60
                   MakePointerAccessor (&ApWifiMac::m_beaconJitter),
61
                   MakePointerChecker<UniformRandomVariable> ())
62
    .AddAttribute ("EnableBeaconJitter", "If beacons are enabled, whether to jitter the initial send event.",
63
                   BooleanValue (false),
64
                   MakeBooleanAccessor (&ApWifiMac::m_enableBeaconJitter),
65
                   MakeBooleanChecker ())
58
    .AddAttribute ("BeaconGeneration", "Whether or not beacons are generated.",
66
    .AddAttribute ("BeaconGeneration", "Whether or not beacons are generated.",
59
                   BooleanValue (true),
67
                   BooleanValue (true),
60
                   MakeBooleanAccessor (&ApWifiMac::SetBeaconGeneration,
68
                   MakeBooleanAccessor (&ApWifiMac::SetBeaconGeneration,
 Lines 172-177    Link Here 
172
  SendOneBeacon ();
180
  SendOneBeacon ();
173
}
181
}
174
182
183
int64_t
184
ApWifiMac::AssignStreams (int64_t stream)
185
{
186
  NS_LOG_FUNCTION (this << stream);
187
  m_beaconJitter->SetStream (stream);
188
  return 1;
189
}
190
175
void
191
void
176
ApWifiMac::ForwardDown (Ptr<const Packet> packet, Mac48Address from,
192
ApWifiMac::ForwardDown (Ptr<const Packet> packet, Mac48Address from,
177
                        Mac48Address to)
193
                        Mac48Address to)
 Lines 648-654    Link Here 
648
  m_beaconEvent.Cancel ();
664
  m_beaconEvent.Cancel ();
649
  if (m_enableBeaconGeneration)
665
  if (m_enableBeaconGeneration)
650
    {
666
    {
651
      m_beaconEvent = Simulator::ScheduleNow (&ApWifiMac::SendOneBeacon, this);
667
      if (m_enableBeaconJitter)
668
        {
669
          int64_t jitter = m_beaconJitter->GetValue (0, m_beaconInterval.GetMicroSeconds ());
670
          NS_LOG_DEBUG ("Scheduling initial beacon for access point " << GetAddress() << " at time " << jitter << " microseconds");
671
          m_beaconEvent = Simulator::Schedule (MicroSeconds (jitter), &ApWifiMac::SendOneBeacon, this);
672
        }
673
      else
674
        {
675
          NS_LOG_DEBUG ("Scheduling initial beacon for access point " << GetAddress() << " at time 0");
676
          m_beaconEvent = Simulator::ScheduleNow (&ApWifiMac::SendOneBeacon, this);
677
        }
652
    }
678
    }
653
  RegularWifiMac::DoInitialize ();
679
  RegularWifiMac::DoInitialize ();
654
}
680
}
(-)a/src/wifi/model/ap-wifi-mac.h (+13 lines)
 Lines 26-31    Link Here 
26
#include "ht-capabilities.h"
26
#include "ht-capabilities.h"
27
#include "amsdu-subframe-header.h"
27
#include "amsdu-subframe-header.h"
28
#include "supported-rates.h"
28
#include "supported-rates.h"
29
#include "ns3/random-variable-stream.h"
29
30
30
namespace ns3 {
31
namespace ns3 {
31
32
 Lines 95-100    Link Here 
95
   */
96
   */
96
  void StartBeaconing (void);
97
  void StartBeaconing (void);
97
98
99
 /**
100
  * Assign a fixed random variable stream number to the random variables
101
  * used by this model.  Return the number of streams (possibly zero) that
102
  * have been assigned.
103
  *
104
  * \param stream first stream index to use
105
  * \return the number of stream indices assigned by this model
106
  */
107
  int64_t AssignStreams (int64_t stream);
108
98
private:
109
private:
99
  virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
110
  virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
100
  virtual void TxOk (const WifiMacHeader &hdr);
111
  virtual void TxOk (const WifiMacHeader &hdr);
 Lines 128-133    Link Here 
128
  Time m_beaconInterval;
139
  Time m_beaconInterval;
129
  bool m_enableBeaconGeneration;
140
  bool m_enableBeaconGeneration;
130
  EventId m_beaconEvent;
141
  EventId m_beaconEvent;
142
  Ptr<UniformRandomVariable> m_beaconJitter;
143
  bool m_enableBeaconJitter;
131
};
144
};
132
145
133
} // namespace ns3
146
} // namespace ns3
(-)a/src/wifi/test/wifi-test.cc (+6 lines)
 Lines 39-44    Link Here 
39
#include "ns3/pointer.h"
39
#include "ns3/pointer.h"
40
#include "ns3/rng-seed-manager.h"
40
#include "ns3/rng-seed-manager.h"
41
#include "ns3/edca-txop-n.h"
41
#include "ns3/edca-txop-n.h"
42
#include "ns3/config.h"
43
#include "ns3/boolean.h"
42
44
43
namespace ns3 {
45
namespace ns3 {
44
46
 Lines 416-421    Link Here 
416
  RngSeedManager::SetSeed (1);
418
  RngSeedManager::SetSeed (1);
417
  RngSeedManager::SetRun (17);
419
  RngSeedManager::SetRun (17);
418
420
421
  // Disable the initial jitter of AP beacons (test case was written before
422
  // beacon jitter was added)
423
  Config::SetDefault ("ns3::ApWifiMac::EnableBeaconJitter", BooleanValue (false));
424
419
  Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> ();
425
  Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> ();
420
  Ptr<PropagationDelayModel> propDelay = m_propDelay.Create<PropagationDelayModel> ();
426
  Ptr<PropagationDelayModel> propDelay = m_propDelay.Create<PropagationDelayModel> ();
421
  Ptr<PropagationLossModel> propLoss = CreateObject<RandomPropagationLossModel> ();
427
  Ptr<PropagationLossModel> propLoss = CreateObject<RandomPropagationLossModel> ();

Return to bug 1722