A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ap-wifi-mac.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2006, 2009 INRIA
4  * Copyright (c) 2009 MIRKO BANCHI
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Author: Mirko Banchi <mk.banchi@gmail.com>
21  */
22 #ifndef AP_WIFI_MAC_H
23 #define AP_WIFI_MAC_H
24 
25 #include "regular-wifi-mac.h"
26 #include "ht-capabilities.h"
27 #include "amsdu-subframe-header.h"
28 #include "supported-rates.h"
29 #include "ns3/random-variable-stream.h"
30 
31 namespace ns3 {
32 
40 class ApWifiMac : public RegularWifiMac
41 {
42 public:
43  static TypeId GetTypeId (void);
44 
45  ApWifiMac ();
46  virtual ~ApWifiMac ();
47 
51  virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager);
52 
56  virtual void SetLinkUpCallback (Callback<void> linkUp);
57 
66  virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to);
67 
79  virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
80  virtual bool SupportsSendFrom (void) const;
81 
85  virtual void SetAddress (Mac48Address address);
89  void SetBeaconInterval (Time interval);
93  Time GetBeaconInterval (void) const;
97  void StartBeaconing (void);
98 
107  int64_t AssignStreams (int64_t stream);
108 
109 private:
110  virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
119  virtual void TxOk (const WifiMacHeader &hdr);
128  virtual void TxFailed (const WifiMacHeader &hdr);
129 
139  virtual void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
140  const WifiMacHeader *hdr);
141 
150  void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to);
159  void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to, uint8_t tid);
166  void SendProbeResp (Mac48Address to);
174  void SendAssocResp (Mac48Address to, bool success);
178  void SendOneBeacon (void);
184  HtCapabilities GetHtCapabilities (void) const;
191  SupportedRates GetSupportedRates (void) const;
197  void SetBeaconGeneration (bool enable);
203  bool GetBeaconGeneration (void) const;
204  virtual void DoDispose (void);
205  virtual void DoInitialize (void);
206 
213 };
214 
215 } // namespace ns3
216 
217 #endif /* AP_WIFI_MAC_H */
virtual void DoInitialize(void)
This method is called only once by Object::Initialize.
Definition: ap-wifi-mac.cc:661
void SetBeaconInterval(Time interval)
Definition: ap-wifi-mac.cc:167
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:79
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:60
HtCapabilities GetHtCapabilities(void) const
Return the HT capability of the current AP.
Definition: ap-wifi-mac.cc:327
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Definition: ap-wifi-mac.cc:185
The Ht Capabilities Information ElementThis class knows how to serialise and deserialise the Ht Capab...
void SendAssocResp(Mac48Address to, bool success)
Forward an association response packet to the DCF.
Definition: ap-wifi-mac.cc:371
virtual bool SupportsSendFrom(void) const
Definition: ap-wifi-mac.cc:288
Ptr< DcaTxop > m_beaconDca
Dedicated DcaTxop for beacons.
Definition: ap-wifi-mac.h:207
The Supported Rates Information ElementThis class knows how to serialise and deserialise the Supporte...
bool m_enableBeaconGeneration
Flag if beacons are being generated.
Definition: ap-wifi-mac.h:209
virtual void Enqueue(Ptr< const Packet > packet, Mac48Address to)
Definition: ap-wifi-mac.cc:278
virtual void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > stationManager)
Definition: ap-wifi-mac.cc:147
base class for all MAC-level wifi objects.
static TypeId GetTypeId(void)
Definition: ap-wifi-mac.cc:48
void ForwardDown(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet down to DCF/EDCAF (enqueue the packet).
Definition: ap-wifi-mac.cc:193
EventId m_beaconEvent
Event to generate one beacon.
Definition: ap-wifi-mac.h:210
virtual void Receive(Ptr< Packet > packet, const WifiMacHeader *hdr)
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
Definition: ap-wifi-mac.cc:466
virtual void DeaggregateAmsduAndForward(Ptr< Packet > aggregatedPacket, const WifiMacHeader *hdr)
This method is called to de-aggregate an A-MSDU and forward the constituent packets up the stack...
Definition: ap-wifi-mac.cc:635
virtual void SetLinkUpCallback(Callback< void > linkUp)
Definition: ap-wifi-mac.cc:155
an EUI-48 address
Definition: mac48-address.h:41
bool GetBeaconGeneration(void) const
Return whether the AP is generating beacons.
Definition: ap-wifi-mac.cc:133
Wi-Fi AP state machineHandle association, dis-association and authentication, of STAs within an infra...
Definition: ap-wifi-mac.h:40
void SendProbeResp(Mac48Address to)
Forward a probe response packet to the DCF.
Definition: ap-wifi-mac.cc:341
SupportedRates GetSupportedRates(void) const
Return an instance of SupportedRates that contains all rates that we support including HT rates...
Definition: ap-wifi-mac.cc:295
virtual void TxFailed(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
Definition: ap-wifi-mac.cc:452
void SendOneBeacon(void)
Forward a beacon packet to the beacon special DCF.
Definition: ap-wifi-mac.cc:410
an identifier for simulation events.
Definition: event-id.h:46
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Definition: ap-wifi-mac.cc:98
virtual void SetAddress(Mac48Address address)
Definition: ap-wifi-mac.cc:108
Ptr< UniformRandomVariable > m_beaconJitter
UniformRandomVariable used to randomize the time of the first beacon.
Definition: ap-wifi-mac.h:211
Time m_beaconInterval
Interval between beacons.
Definition: ap-wifi-mac.h:208
virtual ~ApWifiMac()
Definition: ap-wifi-mac.cc:92
bool m_enableBeaconJitter
Flag if the first beacon should be generated at random time.
Definition: ap-wifi-mac.h:212
Time GetBeaconInterval(void) const
Definition: ap-wifi-mac.cc:140
tuple address
Definition: first.py:37
virtual void TxOk(const WifiMacHeader &hdr)
The packet we sent was successfully received by the receiver (i.e.
Definition: ap-wifi-mac.cc:438
a unique identifier for an interface.
Definition: type-id.h:49
void StartBeaconing(void)
Start beacon transmission immediately.
Definition: ap-wifi-mac.cc:178
Implements the IEEE 802.11 MAC header.
void SetBeaconGeneration(bool enable)
Enable or disable beacon generation of the AP.
Definition: ap-wifi-mac.cc:118