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 STA_WIFI_MAC_H | 20 #ifndef STA_WIFI_MAC_H |
23 #define STA_WIFI_MAC_H | 21 #define STA_WIFI_MAC_H |
24 | 22 |
25 #include "regular-wifi-mac.h" | 23 #include "regular-wifi-mac.h" |
26 | 24 |
27 #include "ns3/event-id.h" | |
28 #include "ns3/packet.h" | |
29 #include "ns3/traced-callback.h" | |
30 | |
31 #include "supported-rates.h" | 25 #include "supported-rates.h" |
32 #include "amsdu-subframe-header.h" | |
33 | 26 |
34 namespace ns3 { | 27 namespace ns3 { |
35 | 28 |
36 class MgtAddBaRequestHeader; | 29 class MgtAddBaRequestHeader; |
37 | 30 |
38 class StaWifiMac : public RegularWifiMac | 31 class StaWifiMac : public RegularWifiMac |
39 { | 32 { |
40 public: | 33 public: |
41 static TypeId GetTypeId (void); | 34 static TypeId GetTypeId (void); |
42 | 35 |
43 StaWifiMac (); | 36 StaWifiMac (); |
44 virtual ~StaWifiMac (); | 37 virtual ~StaWifiMac (); |
45 | 38 |
46 /** | 39 /** \name Member Functions Inherited from RegularWifiMac */ |
47 * \param packet the packet to send. | 40 /*@{*/ |
48 * \param to the address to which the packet should be sent. | |
49 * | |
50 * The packet should be enqueued in a tx queue, and should be | |
51 * dequeued as soon as the channel access function determines that | |
52 * access is granted to this MAC. | |
53 */ | |
54 virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to); | 41 virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to); |
| 42 private: |
| 43 virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr); |
| 44 /*@}*/ |
55 | 45 |
| 46 public: |
56 /** | 47 /** |
57 * \param missed the number of beacons which must be missed | 48 * \param missed the number of beacons which must be missed |
58 * before a new association sequence is started. | 49 * before a new association sequence is started. |
59 */ | 50 */ |
60 void SetMaxMissedBeacons (uint32_t missed); | 51 void SetMaxMissedBeacons (uint32_t missed); |
61 /** | 52 /** |
62 * \param timeout | 53 * \param timeout |
63 * | 54 * |
64 * If no probe response is received within the specified | 55 * If no probe response is received within the specified |
65 * timeout, the station sends a new probe request. | 56 * timeout, the station sends a new probe request. |
(...skipping 16 matching lines...) Expand all Loading... |
82 enum MacState { | 73 enum MacState { |
83 ASSOCIATED, | 74 ASSOCIATED, |
84 WAIT_PROBE_RESP, | 75 WAIT_PROBE_RESP, |
85 WAIT_ASSOC_RESP, | 76 WAIT_ASSOC_RESP, |
86 BEACON_MISSED, | 77 BEACON_MISSED, |
87 REFUSED | 78 REFUSED |
88 }; | 79 }; |
89 | 80 |
90 void SetActiveProbing (bool enable); | 81 void SetActiveProbing (bool enable); |
91 bool GetActiveProbing (void) const; | 82 bool GetActiveProbing (void) const; |
92 virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr); | |
93 void SendProbeRequest (void); | 83 void SendProbeRequest (void); |
94 void SendAssociationRequest (void); | 84 void SendAssociationRequest (void); |
95 void TryToEnsureAssociated (void); | 85 void TryToEnsureAssociated (void); |
96 void AssocRequestTimeout (void); | 86 void AssocRequestTimeout (void); |
97 void ProbeRequestTimeout (void); | 87 void ProbeRequestTimeout (void); |
98 bool IsAssociated (void) const; | 88 bool IsAssociated (void) const; |
99 bool IsWaitAssocResp (void) const; | 89 bool IsWaitAssocResp (void) const; |
100 void MissedBeacons (void); | 90 void MissedBeacons (void); |
101 void RestartBeaconWatchdog (Time delay); | 91 void RestartBeaconWatchdog (Time delay); |
102 SupportedRates GetSupportedRates (void) const; | 92 SupportedRates GetSupportedRates (void) const; |
103 void SetState (enum MacState value); | 93 void SetState (enum MacState value); |
104 | 94 |
105 enum MacState m_state; | 95 enum MacState m_state; |
106 Time m_probeRequestTimeout; | 96 Time m_probeRequestTimeout; |
107 Time m_assocRequestTimeout; | 97 Time m_assocRequestTimeout; |
108 EventId m_probeRequestEvent; | 98 EventId m_probeRequestEvent; |
109 EventId m_assocRequestEvent; | 99 EventId m_assocRequestEvent; |
110 EventId m_beaconWatchdog; | 100 EventId m_beaconWatchdog; |
111 Time m_beaconWatchdogEnd; | 101 Time m_beaconWatchdogEnd; |
112 uint32_t m_maxMissedBeacons; | 102 uint32_t m_maxMissedBeacons; |
113 | 103 |
114 TracedCallback<Mac48Address> m_assocLogger; | 104 TracedCallback<Mac48Address> m_assocLogger; |
115 TracedCallback<Mac48Address> m_deAssocLogger; | 105 TracedCallback<Mac48Address> m_deAssocLogger; |
116 }; | 106 }; |
117 | 107 |
118 } // namespace ns3 | 108 } // namespace ns3 |
119 | 109 |
120 #endif /* STA_WIFI_MAC_H */ | 110 #endif /* STA_WIFI_MAC_H */ |
LEFT | RIGHT |