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) 2006, 2009 INRIA | 3 * Copyright (c) 2006, 2009 INRIA |
4 * Copyright (c) 2009 MIRKO BANCHI | |
5 * | 4 * |
6 * 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 |
7 * 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 |
8 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
9 * | 8 * |
10 * 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, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
14 * | 13 * |
15 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
16 * along with this program; if not, write to the Free Software | 15 * along with this program; if not, write to the Free Software |
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 * | 17 * |
19 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> | 18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
20 * Author: Mirko Banchi <mk.banchi@gmail.com> | |
21 */ | 19 */ |
22 #ifndef AP_WIFI_MAC_H | 20 #ifndef AP_WIFI_MAC_H |
23 #define AP_WIFI_MAC_H | 21 #define AP_WIFI_MAC_H |
24 | 22 |
25 #include "regular-wifi-mac.h" | 23 #include "regular-wifi-mac.h" |
26 | 24 |
27 #include "amsdu-subframe-header.h" | |
28 #include "supported-rates.h" | 25 #include "supported-rates.h" |
29 | 26 |
30 namespace ns3 { | 27 namespace ns3 { |
31 | 28 |
32 /** | 29 /** |
33 * \brief Wi-Fi AP state machine | 30 * \brief Wi-Fi AP state machine |
34 * | 31 * |
35 * Handle association, dis-association and authentication, | 32 * Handle association, dis-association and authentication, |
36 * of STAs within an infrastructure BSS. | 33 * of STAs within an infrastructure BSS. |
37 */ | 34 */ |
38 class ApWifiMac : public RegularWifiMac | 35 class ApWifiMac : public RegularWifiMac |
39 { | 36 { |
40 public: | 37 public: |
41 static TypeId GetTypeId (void); | 38 static TypeId GetTypeId (void); |
42 | 39 |
43 ApWifiMac (); | 40 ApWifiMac (); |
44 virtual ~ApWifiMac (); | 41 virtual ~ApWifiMac (); |
45 | 42 |
46 /** | 43 /** \name Member Functions Inherited from RegularWifiMac */ |
47 * \param stationManager the station manager attached to this MAC. | 44 /*@{*/ |
48 */ | |
49 virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> statio
nManager); | |
50 | |
51 /** | |
52 * \param linkUp the callback to invoke when the link becomes up. | |
53 */ | |
54 virtual void SetLinkUpCallback (Callback<void> linkUp); | 45 virtual void SetLinkUpCallback (Callback<void> linkUp); |
55 | |
56 /** | |
57 * \param packet the packet to send. | |
58 * \param to the address to which the packet should be sent. | |
59 * | |
60 * The packet should be enqueued in a tx queue, and should be | |
61 * dequeued as soon as the channel access function determines that | |
62 * access is granted to this MAC. | |
63 */ | |
64 virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to); | 46 virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to); |
65 | |
66 /** | |
67 * \param packet the packet to send. | |
68 * \param to the address to which the packet should be sent. | |
69 * \param from the address from which the packet should be sent. | |
70 * | |
71 * The packet should be enqueued in a tx queue, and should be | |
72 * dequeued as soon as the channel access function determines that | |
73 * access is granted to this MAC. The extra parameter "from" allows | |
74 * this device to operate in a bridged mode, forwarding received | |
75 * frames without altering the source address. | |
76 */ | |
77 virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address
from); | 47 virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address
from); |
78 virtual bool SupportsSendFrom (void) const; | 48 virtual bool SupportsSendFrom (void) const; |
| 49 virtual void SetAddress (Mac48Address address); |
| 50 private: |
| 51 virtual void DoDispose (void); |
| 52 virtual void DoStart (void); |
| 53 virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr); |
| 54 virtual void TxOk (const WifiMacHeader &hdr); |
| 55 virtual void TxFailed (const WifiMacHeader &hdr); |
| 56 virtual void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket, |
| 57 const WifiMacHeader *hdr); |
| 58 /*@}*/ |
79 | 59 |
80 /** | 60 public: |
81 * \param address the current address of this MAC layer. | |
82 */ | |
83 virtual void SetAddress (Mac48Address address); | |
84 /** | 61 /** |
85 * \param interval the interval between two beacon transmissions. | 62 * \param interval the interval between two beacon transmissions. |
86 */ | 63 */ |
87 void SetBeaconInterval (Time interval); | 64 void SetBeaconInterval (Time interval); |
88 /** | 65 /** |
89 * \returns the interval between two beacon transmissions. | 66 * \returns the interval between two beacon transmissions. |
90 */ | 67 */ |
91 Time GetBeaconInterval (void) const; | 68 Time GetBeaconInterval (void) const; |
92 /** | 69 /** |
93 * Start beacon transmission immediately. | 70 * Start beacon transmission immediately. |
94 */ | 71 */ |
95 void StartBeaconing (void); | 72 void StartBeaconing (void); |
96 | 73 |
97 private: | 74 private: |
98 virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr); | 75 /** |
99 virtual void TxOk (const WifiMacHeader &hdr); | 76 * Queue a packet for transmission to the specified device (which |
100 virtual void TxFailed (const WifiMacHeader &hdr); | 77 * must be an associated STA). If a QoS association is in effect, |
| 78 * then the packet is checked for a QoS tag which might specify the |
| 79 * UP/TID which is to be used. |
| 80 * |
| 81 * \param packet a pointer to the packet to be transmitted |
| 82 * \param from the MAC address of the device on the LAN which |
| 83 * originated this packet |
| 84 * \param to the MAC address of the device this packet is to be |
| 85 * sent to |
| 86 */ |
| 87 void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to
); |
101 | 88 |
102 /** | 89 /** |
103 * This method is called to de-aggregate an A-MSDU and forward the | 90 * Queue a packet for transmission to the specified device (which |
104 * constituent packets up the stack. We override the WifiMac version | 91 * must be an associated STA) with specified UP/TID if a QoS |
105 * here because, as an AP, we also need to think about redistributing | 92 * association is in effect. This method is used by the AP to |
106 * to other associated STAs. | 93 * preserve the UP/TID when forwarding packets between associated |
107 * | 94 * STAs. |
108 * \param aggregatedPacket the Packet containing the A-MSDU. | 95 * |
109 * \param hdr a pointer to the MAC header for \c aggregatedPacket. | 96 * \param packet a pointer to the packet to be transmitted |
110 */ | 97 * \param from the MAC address of the device on the LAN which |
111 virtual void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket, | 98 * originated this packet |
112 const WifiMacHeader *hdr); | 99 * \param to the MAC address of the device this packet is to be |
| 100 * sent to |
| 101 * \param tid the UP/TID to use for this packet |
| 102 */ |
| 103 void ForwardDown (Ptr<const Packet> packet, Mac48Address from, |
| 104 Mac48Address to, uint8_t tid); |
113 | 105 |
114 void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to
); | 106 /** |
115 void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to
, uint8_t tid); | 107 * Queue a Probe Response frame for transmission to the specified |
| 108 * device. This method is generally invoked in response to receipt |
| 109 * of a Probe Request. |
| 110 * |
| 111 * \param to the MAC address of the device to which the Probe |
| 112 * Response should be directed |
| 113 */ |
116 void SendProbeResp (Mac48Address to); | 114 void SendProbeResp (Mac48Address to); |
| 115 |
| 116 /** |
| 117 * Queue an Association Response for transmission to the specified |
| 118 * device, with a status code as specified by the parameter \c |
| 119 * success. |
| 120 * |
| 121 * \param to the MAC address of the device to which the Association |
| 122 * Response should be directed. |
| 123 * \param success \c true if the Status Code field in the Association |
| 124 * Response is to indicate success, else \c false. |
| 125 */ |
117 void SendAssocResp (Mac48Address to, bool success); | 126 void SendAssocResp (Mac48Address to, bool success); |
| 127 |
| 128 /** |
| 129 * Queue a Beacon frame for transmission. |
| 130 */ |
118 void SendOneBeacon (void); | 131 void SendOneBeacon (void); |
| 132 |
| 133 /** |
| 134 * \returns A SupportedRates object which can be serialised into a |
| 135 * Beacon, Probe Response, or other management frame as an |
| 136 * Information Element to indicate the supported rates and which of |
| 137 * those are basic rates. |
| 138 */ |
119 SupportedRates GetSupportedRates (void) const; | 139 SupportedRates GetSupportedRates (void) const; |
| 140 |
| 141 /** |
| 142 * Set accessor for the \c m_enableBeaconGeneration property which |
| 143 * controls whether or not this AP is transmitting Beacon |
| 144 * frames. This is exposed via the attribute subsystem as |
| 145 * "BeaconGeneration". |
| 146 * |
| 147 * \param enable \c true to enable beacon generation; \c false |
| 148 * otherwise. |
| 149 */ |
120 void SetBeaconGeneration (bool enable); | 150 void SetBeaconGeneration (bool enable); |
| 151 |
| 152 /** |
| 153 * Get accessor for the \c m_enableBeaconGeneration property which |
| 154 * controls whether or not this AP is transmitting Beacon |
| 155 * frames. This is exposed via the attribute subsystem as |
| 156 * "BeaconGeneration". |
| 157 * |
| 158 * \returns \c true to indicate that beacon generation is enabled; |
| 159 * \c false otherwise. |
| 160 */ |
121 bool GetBeaconGeneration (void) const; | 161 bool GetBeaconGeneration (void) const; |
122 virtual void DoDispose (void); | |
123 virtual void DoStart (void); | |
124 | 162 |
125 Ptr<DcaTxop> m_beaconDca; | |
126 Time m_beaconInterval; | 163 Time m_beaconInterval; |
127 bool m_enableBeaconGeneration; | 164 bool m_enableBeaconGeneration; |
128 EventId m_beaconEvent; | 165 EventId m_beaconEvent; |
129 }; | 166 }; |
130 | 167 |
131 } // namespace ns3 | 168 } // namespace ns3 |
132 | 169 |
133 #endif /* AP_WIFI_MAC_H */ | 170 #endif /* AP_WIFI_MAC_H */ |
LEFT | RIGHT |