A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
wifi-remote-station-manager.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2005,2006,2007 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 WIFI_REMOTE_STATION_MANAGER_H
21
#define WIFI_REMOTE_STATION_MANAGER_H
22
23
#include <vector>
24
#include <utility>
25
#include "ns3/mac48-address.h"
26
#include "ns3/traced-callback.h"
27
#include "ns3/packet.h"
28
#include "ns3/object.h"
29
#include "ns3/nstime.h"
30
#include "
wifi-mode.h
"
31
32
namespace
ns3 {
33
34
struct
WifiRemoteStation;
35
struct
WifiRemoteStationState;
36
class
WifiPhy;
37
class
WifiMacHeader;
38
45
class
WifiRemoteStationInfo
46
{
47
public
:
48
WifiRemoteStationInfo
();
55
void
NotifyTxSuccess
(uint32_t retryCounter);
57
void
NotifyTxFailed
();
59
double
GetFrameErrorRate
()
const
;
60
private
:
66
double
CalculateAveragingCoefficient
();
68
Time
m_memoryTime
;
70
Time
m_lastUpdate
;
72
double
m_failAvg
;
73
};
74
81
class
WifiRemoteStationManager
:
public
Object
82
{
83
public
:
84
static
TypeId
GetTypeId
(
void
);
85
86
WifiRemoteStationManager
();
87
virtual
~WifiRemoteStationManager
();
88
89
virtual
void
SetupPhy
(
Ptr<WifiPhy>
phy);
90
91
uint32_t
GetMaxSsrc
(
void
)
const
;
92
uint32_t
GetMaxSlrc
(
void
)
const
;
93
uint32_t
GetRtsCtsThreshold
(
void
)
const
;
94
uint32_t
GetFragmentationThreshold
(
void
)
const
;
95
void
SetMaxSsrc
(uint32_t maxSsrc);
96
void
SetMaxSlrc
(uint32_t maxSlrc);
97
void
SetRtsCtsThreshold
(uint32_t threshold);
98
void
SetFragmentationThreshold
(uint32_t threshold);
99
100
// Invoked in a STA upon dis-association
101
// or in an AP upon reboot
102
void
Reset
(
void
);
103
// Invoked in a STA upon association to store
104
// the set of rates which belong to the
105
// BSSBasicRateSet of the associated AP
106
// and which are supported locally.
107
// Invoked in an AP to configure the BSSBasicRateSet
108
void
AddBasicMode
(
WifiMode
mode);
109
110
WifiMode
GetDefaultMode
(
void
)
const
;
111
uint32_t
GetNBasicModes
(
void
)
const
;
112
WifiMode
GetBasicMode
(uint32_t i)
const
;
113
114
WifiMode
GetNonUnicastMode
(
void
)
const
;
115
116
121
void
Reset
(
Mac48Address
address);
129
void
AddSupportedMode
(
Mac48Address
address,
WifiMode
mode);
130
131
bool
IsBrandNew
(
Mac48Address
address)
const
;
132
bool
IsAssociated
(
Mac48Address
address)
const
;
133
bool
IsWaitAssocTxOk
(
Mac48Address
address)
const
;
134
void
RecordWaitAssocTxOk
(
Mac48Address
address);
135
void
RecordGotAssocTxOk
(
Mac48Address
address);
136
void
RecordGotAssocTxFailed
(
Mac48Address
address);
137
void
RecordDisassociated
(
Mac48Address
address);
138
150
void
PrepareForQueue
(
Mac48Address
address,
const
WifiMacHeader
*header,
151
Ptr<const Packet>
packet, uint32_t fullPacketSize);
159
WifiMode
GetDataMode
(
Mac48Address
address,
const
WifiMacHeader
*header,
160
Ptr<const Packet>
packet, uint32_t fullPacketSize);
168
WifiMode
GetRtsMode
(
Mac48Address
address,
const
WifiMacHeader
*header,
169
Ptr<const Packet>
packet);
174
void
ReportRtsFailed
(
Mac48Address
address,
const
WifiMacHeader
*header);
179
void
ReportDataFailed
(
Mac48Address
address,
const
WifiMacHeader
*header);
184
void
ReportRtsOk
(
Mac48Address
address,
const
WifiMacHeader
*header,
185
double
ctsSnr,
WifiMode
ctsMode,
double
rtsSnr);
190
void
ReportDataOk
(
Mac48Address
address,
const
WifiMacHeader
*header,
191
double
ackSnr,
WifiMode
ackMode,
double
dataSnr);
196
void
ReportFinalRtsFailed
(
Mac48Address
address,
const
WifiMacHeader
*header);
201
void
ReportFinalDataFailed
(
Mac48Address
address,
const
WifiMacHeader
*header);
202
211
void
ReportRxOk
(
Mac48Address
address,
const
WifiMacHeader
*header,
212
double
rxSnr,
WifiMode
txMode);
213
221
bool
NeedRts
(
Mac48Address
address,
const
WifiMacHeader
*header,
222
Ptr<const Packet>
packet);
230
bool
NeedRtsRetransmission
(
Mac48Address
address,
const
WifiMacHeader
*header,
231
Ptr<const Packet>
packet);
239
bool
NeedDataRetransmission
(
Mac48Address
address,
const
WifiMacHeader
*header,
240
Ptr<const Packet>
packet);
241
248
bool
NeedFragmentation
(
Mac48Address
address,
const
WifiMacHeader
*header,
249
Ptr<const Packet>
packet);
257
uint32_t
GetFragmentSize
(
Mac48Address
address,
const
WifiMacHeader
*header,
258
Ptr<const Packet>
packet, uint32_t fragmentNumber);
266
uint32_t
GetFragmentOffset
(
Mac48Address
address,
const
WifiMacHeader
*header,
267
Ptr<const Packet>
packet, uint32_t fragmentNumber);
275
bool
IsLastFragment
(
Mac48Address
address,
const
WifiMacHeader
*header,
276
Ptr<const Packet>
packet, uint32_t fragmentNumber);
277
284
WifiMode
GetCtsMode
(
Mac48Address
address,
WifiMode
rtsMode);
291
WifiMode
GetAckMode
(
Mac48Address
address,
WifiMode
dataMode);
292
293
WifiRemoteStationInfo
GetInfo
(
Mac48Address
address);
294
protected
:
295
virtual
void
DoDispose
(
void
);
296
// for convenience
297
WifiMode
GetSupported
(
const
WifiRemoteStation
*station, uint32_t i)
const
;
298
uint32_t
GetNSupported
(
const
WifiRemoteStation
*station)
const
;
299
private
:
310
virtual
bool
DoNeedRts
(
WifiRemoteStation
*station,
311
Ptr<const Packet>
packet,
bool
normally);
323
virtual
bool
DoNeedRtsRetransmission
(
WifiRemoteStation
*station,
324
Ptr<const Packet>
packet,
bool
normally);
336
virtual
bool
DoNeedDataRetransmission
(
WifiRemoteStation
*station,
337
Ptr<const Packet>
packet,
bool
normally);
338
348
virtual
bool
DoNeedFragmentation
(
WifiRemoteStation
*station,
349
Ptr<const Packet>
packet,
bool
normally);
357
virtual
bool
IsLowLatency
(
void
)
const
= 0;
361
virtual
WifiRemoteStation
*
DoCreateStation
(
void
)
const
= 0;
370
virtual
WifiMode
DoGetDataMode
(
WifiRemoteStation
*station,
371
uint32_t size) = 0;
379
virtual
WifiMode
DoGetRtsMode
(
WifiRemoteStation
*station) = 0;
380
virtual
void
DoReportRtsFailed
(
WifiRemoteStation
*station) = 0;
381
virtual
void
DoReportDataFailed
(
WifiRemoteStation
*station) = 0;
382
virtual
void
DoReportRtsOk
(
WifiRemoteStation
*station,
383
double
ctsSnr,
WifiMode
ctsMode,
double
rtsSnr) = 0;
384
virtual
void
DoReportDataOk
(
WifiRemoteStation
*station,
385
double
ackSnr,
WifiMode
ackMode,
double
dataSnr) = 0;
386
virtual
void
DoReportFinalRtsFailed
(
WifiRemoteStation
*station) = 0;
387
virtual
void
DoReportFinalDataFailed
(
WifiRemoteStation
*station) = 0;
388
virtual
void
DoReportRxOk
(
WifiRemoteStation
*station,
389
double
rxSnr,
WifiMode
txMode) = 0;
390
391
WifiRemoteStationState
*
LookupState
(
Mac48Address
address)
const
;
392
WifiRemoteStation
*
Lookup
(
Mac48Address
address, uint8_t tid)
const
;
394
WifiRemoteStation
*
Lookup
(
Mac48Address
address,
const
WifiMacHeader
*header)
const
;
395
WifiMode
GetControlAnswerMode
(
Mac48Address
address,
WifiMode
reqMode);
396
uint32_t
GetNFragments
(
Ptr<const Packet>
packet);
397
398
typedef
std::vector <WifiRemoteStation *>
Stations
;
399
typedef
std::vector <WifiRemoteStationState *>
StationStates
;
400
401
StationStates
m_states
;
402
Stations
m_stations
;
411
Ptr<WifiPhy>
m_wifiPhy
;
412
WifiMode
m_defaultTxMode
;
413
422
WifiModeList
m_bssBasicRateSet
;
423
424
bool
m_isLowLatency
;
425
uint32_t
m_maxSsrc
;
426
uint32_t
m_maxSlrc
;
427
uint32_t
m_rtsCtsThreshold
;
428
uint32_t
m_fragmentationThreshold
;
429
WifiMode
m_nonUnicastMode
;
430
double
m_avgSlrcCoefficient
;
434
TracedCallback<Mac48Address>
m_macTxRtsFailed
;
438
TracedCallback<Mac48Address>
m_macTxDataFailed
;
443
TracedCallback<Mac48Address>
m_macTxFinalRtsFailed
;
448
TracedCallback<Mac48Address>
m_macTxFinalDataFailed
;
449
450
};
451
452
struct
WifiRemoteStationState
453
{
454
enum
455
{
456
BRAND_NEW
,
457
DISASSOC
,
458
WAIT_ASSOC_TX_OK
,
459
GOT_ASSOC_TX_OK
460
}
m_state
;
461
471
WifiModeList
m_operationalRateSet
;
472
473
Mac48Address
m_address
;
474
WifiRemoteStationInfo
m_info
;
475
};
476
485
struct
WifiRemoteStation
486
{
487
WifiRemoteStationState
*
m_state
;
488
uint32_t
m_ssrc
;
489
uint32_t
m_slrc
;
490
uint8_t
m_tid
;
491
};
492
493
494
}
// namespace ns3
495
496
#endif
/* WIFI_REMOTE_STATION_MANAGER_H */
src
wifi
model
wifi-remote-station-manager.h
Generated on Tue Oct 9 2012 16:45:49 for ns-3 by
1.8.1.2