author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Mon, 17 Dec 2007 13:41:51 +0100 | |
changeset 2285 | 7c716f6fc4de |
parent 2159 | 20f882e85b4a |
child 2350 | 0b54480c4fd1 |
permissions | -rw-r--r-- |
1948 | 1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
3 |
* Copyright (c) 2005,2006 INRIA |
|
4 |
* |
|
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 |
|
7 |
* published by the Free Software Foundation; |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 |
* |
|
18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
|
19 |
*/ |
|
20 |
#ifndef MAC_HIGH_NQSTA_H |
|
21 |
#define MAC_HIGH_NQSTA_H |
|
22 |
||
23 |
#include <stdint.h> |
|
24 |
||
25 |
#include "ns3/mac48-address.h" |
|
26 |
#include "ns3/callback.h" |
|
27 |
#include "ns3/event-id.h" |
|
28 |
#include "ns3/packet.h" |
|
29 |
#include "ns3/nstime.h" |
|
30 |
||
31 |
#include "supported-rates.h" |
|
32 |
||
33 |
namespace ns3 { |
|
34 |
||
35 |
class WifiMacHeader; |
|
36 |
class WifiNetDevice; |
|
37 |
class DcaTxop; |
|
2009
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
38 |
class WifiPhy; |
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
39 |
class MacStations; |
1948 | 40 |
|
2285 | 41 |
/** |
42 |
* \brief a non-QoS STA state machine |
|
43 |
* |
|
44 |
* This state machine handles association, disassociation, |
|
45 |
* authentication and beacon monitoring. It does not perform |
|
46 |
* channel scanning. |
|
47 |
* If the station detects a certain number of missed beacons |
|
48 |
* while associated, it automatically attempts a new association |
|
49 |
* sequence. |
|
50 |
*/ |
|
1948 | 51 |
class MacHighNqsta { |
52 |
public: |
|
2159
20f882e85b4a
port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2054
diff
changeset
|
53 |
typedef Callback<void, Ptr<Packet>, const Mac48Address &> ForwardCallback; |
1948 | 54 |
typedef Callback<void> AssociatedCallback; |
55 |
typedef Callback<void> DisAssociatedCallback; |
|
56 |
||
57 |
MacHighNqsta (); |
|
58 |
~MacHighNqsta (); |
|
59 |
||
60 |
void SetDcaTxop (DcaTxop *dca); |
|
1964
041240a915f8
build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1952
diff
changeset
|
61 |
void SetDevice (WifiNetDevice *device); |
1948 | 62 |
void SetForwardCallback (ForwardCallback callback); |
63 |
void SetAssociatedCallback (AssociatedCallback callback); |
|
64 |
void SetDisAssociatedCallback (DisAssociatedCallback callback); |
|
2054
ba8e810bae4c
derive WifiPhy from Object and manage it with a Ptr<>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2009
diff
changeset
|
65 |
void SetPhy (Ptr<WifiPhy> phy); |
2009
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
66 |
void SetStations (MacStations *stations); |
1948 | 67 |
|
2285 | 68 |
/** |
69 |
* \param missed the number of beacons which must be missed |
|
70 |
* before a new association sequence is started. |
|
71 |
*/ |
|
1948 | 72 |
void SetMaxMissedBeacons (uint32_t missed); |
2285 | 73 |
/** |
74 |
* \param timeout |
|
75 |
* |
|
76 |
* If no probe response is received within the specified |
|
77 |
* timeout, the station sends a new probe request. |
|
78 |
*/ |
|
1948 | 79 |
void SetProbeRequestTimeout (Time timeout); |
2285 | 80 |
/** |
81 |
* \param timeout |
|
82 |
* |
|
83 |
* If no association response is received within the specified |
|
84 |
* timeout, the station sends a new association request. |
|
85 |
*/ |
|
1948 | 86 |
void SetAssocRequestTimeout (Time timeout); |
87 |
||
88 |
Mac48Address GetBssid (void) const; |
|
89 |
||
2285 | 90 |
/** |
91 |
* Start an active association sequence immediately. |
|
92 |
*/ |
|
1948 | 93 |
void StartActiveAssociation (void); |
94 |
||
2159
20f882e85b4a
port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2054
diff
changeset
|
95 |
void Queue (Ptr<const Packet> packet, Mac48Address to); |
1948 | 96 |
|
2159
20f882e85b4a
port to Ptr<Packet> branch
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2054
diff
changeset
|
97 |
void Receive (Ptr<Packet> packet, WifiMacHeader const *hdr); |
1948 | 98 |
private: |
99 |
void SetBssid (Mac48Address bssid); |
|
100 |
Mac48Address GetBroadcastBssid (void); |
|
101 |
void SendProbeRequest (void); |
|
2009
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
102 |
void SendAssociationRequest (void); |
1948 | 103 |
void TryToEnsureAssociated (void); |
104 |
void AssocRequestTimeout (void); |
|
105 |
void ProbeRequestTimeout (void); |
|
106 |
bool IsAssociated (void); |
|
107 |
void MissedBeacons (void); |
|
1952
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1948
diff
changeset
|
108 |
void RestartBeaconWatchdog (Time delay); |
2009
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
109 |
SupportedRates GetSupportedRates (void) const; |
1948 | 110 |
enum { |
111 |
ASSOCIATED, |
|
112 |
WAIT_PROBE_RESP, |
|
113 |
WAIT_ASSOC_RESP, |
|
114 |
BEACON_MISSED, |
|
115 |
REFUSED |
|
116 |
} m_state; |
|
117 |
Time m_probeRequestTimeout; |
|
118 |
Time m_assocRequestTimeout; |
|
119 |
EventId m_probeRequestEvent; |
|
120 |
EventId m_assocRequestEvent; |
|
1964
041240a915f8
build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1952
diff
changeset
|
121 |
WifiNetDevice *m_device; |
1948 | 122 |
ForwardCallback m_forward; |
123 |
AssociatedCallback m_associatedCallback; |
|
124 |
DisAssociatedCallback m_disAssociatedCallback; |
|
125 |
DcaTxop *m_dca; |
|
1952
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1948
diff
changeset
|
126 |
EventId m_beaconWatchdog; |
2ad2630756e3
do not use the Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1948
diff
changeset
|
127 |
Time m_beaconWatchdogEnd; |
1948 | 128 |
Mac48Address m_bssid; |
129 |
uint32_t m_maxMissedBeacons; |
|
2054
ba8e810bae4c
derive WifiPhy from Object and manage it with a Ptr<>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2009
diff
changeset
|
130 |
Ptr<WifiPhy> m_phy; |
2009
afed751cc0b5
dynamically update the list of supported rates based on the ap supported rates
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1964
diff
changeset
|
131 |
MacStations *m_stations; |
1948 | 132 |
}; |
133 |
||
134 |
} // namespace ns3 |
|
135 |
||
136 |
||
137 |
#endif /* MAC_HIGH_NQSTA_H */ |