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
#include "
wifi-tx-vector.h
"
32
#include "
ht-capabilities.h
"
33
34
namespace
ns3 {
35
36
struct
WifiRemoteStation;
37
struct
WifiRemoteStationState;
38
class
WifiPhy;
39
class
WifiMacHeader;
40
47
class
WifiRemoteStationInfo
48
{
49
public
:
50
WifiRemoteStationInfo
();
57
void
NotifyTxSuccess
(uint32_t retryCounter);
59
void
NotifyTxFailed
();
61
double
GetFrameErrorRate
()
const
;
62
private
:
68
double
CalculateAveragingCoefficient
();
70
Time
m_memoryTime
;
72
Time
m_lastUpdate
;
74
double
m_failAvg
;
75
};
76
83
class
WifiRemoteStationManager
:
public
Object
84
{
85
public
:
86
static
TypeId
GetTypeId
(
void
);
87
88
WifiRemoteStationManager
();
89
virtual
~WifiRemoteStationManager
();
90
91
virtual
void
SetupPhy
(
Ptr<WifiPhy>
phy);
92
93
uint32_t
GetMaxSsrc
(
void
)
const
;
94
uint32_t
GetMaxSlrc
(
void
)
const
;
95
uint32_t
GetRtsCtsThreshold
(
void
)
const
;
96
uint32_t
GetFragmentationThreshold
(
void
)
const
;
97
void
SetMaxSsrc
(uint32_t maxSsrc);
98
void
SetMaxSlrc
(uint32_t maxSlrc);
99
void
SetRtsCtsThreshold
(uint32_t threshold);
100
void
SetFragmentationThreshold
(uint32_t threshold);
101
void
AddStationHtCapabilities
(
Mac48Address
from,
HtCapabilities
htcapabilities);
102
void
SetHtSupported
(
bool
enable);
103
bool
HasHtSupported
(
void
)
const
;
104
105
// Invoked in a STA upon dis-association
106
// or in an AP upon reboot
107
void
Reset
(
void
);
108
// Invoked in a STA upon association to store
109
// the set of rates which belong to the
110
// BSSBasicRateSet of the associated AP
111
// and which are supported locally.
112
// Invoked in an AP to configure the BSSBasicRateSet
113
void
AddBasicMode
(
WifiMode
mode);
114
115
WifiMode
GetDefaultMode
(
void
)
const
;
116
uint32_t
GetNBasicModes
(
void
)
const
;
117
WifiMode
GetBasicMode
(uint32_t i)
const
;
118
bool
GetGreenfieldSupported
(
Mac48Address
address
)
const
;
119
void
AddBasicMcs
(uint8_t mcs);
120
121
uint8_t
GetDefaultMcs
(
void
)
const
;
122
uint32_t
GetNBasicMcs
(
void
)
const
;
123
uint8_t
GetBasicMcs
(uint32_t i)
const
;
124
void
AddSupportedMcs
(
Mac48Address
address, uint8_t mcs);
125
126
WifiMode
GetNonUnicastMode
(
void
)
const
;
127
128
133
void
Reset
(
Mac48Address
address);
141
void
AddSupportedMode
(
Mac48Address
address,
WifiMode
mode);
142
//void AddBssMembershipParameters(Mac48Address address, uint32_t selector);
143
144
bool
IsBrandNew
(
Mac48Address
address)
const
;
145
bool
IsAssociated
(
Mac48Address
address)
const
;
146
bool
IsWaitAssocTxOk
(
Mac48Address
address)
const
;
147
void
RecordWaitAssocTxOk
(
Mac48Address
address);
148
void
RecordGotAssocTxOk
(
Mac48Address
address);
149
void
RecordGotAssocTxFailed
(
Mac48Address
address);
150
void
RecordDisassociated
(
Mac48Address
address);
151
163
void
PrepareForQueue
(
Mac48Address
address,
const
WifiMacHeader
*header,
164
Ptr<const Packet>
packet, uint32_t fullPacketSize);
165
173
WifiTxVector
GetDataTxVector
(
Mac48Address
address,
const
WifiMacHeader
*header,
174
Ptr<const Packet>
packet, uint32_t fullPacketSize);
182
WifiTxVector
GetRtsTxVector
(
Mac48Address
address,
const
WifiMacHeader
*header,
183
Ptr<const Packet>
packet);
184
185
WifiTxVector
GetCtsToSelfTxVector
(
const
WifiMacHeader
*header,
186
Ptr<const Packet>
packet);
187
188
//Since CTS to Self parameters don't depened on the station it is implemented in wifiremote station manager
189
WifiTxVector
DoGetCtsToSelfTxVector
(
void
);
190
191
196
void
ReportRtsFailed
(
Mac48Address
address,
const
WifiMacHeader
*header);
201
void
ReportDataFailed
(
Mac48Address
address,
const
WifiMacHeader
*header);
206
void
ReportRtsOk
(
Mac48Address
address,
const
WifiMacHeader
*header,
207
double
ctsSnr,
WifiMode
ctsMode,
double
rtsSnr);
212
void
ReportDataOk
(
Mac48Address
address,
const
WifiMacHeader
*header,
213
double
ackSnr,
WifiMode
ackMode,
double
dataSnr);
218
void
ReportFinalRtsFailed
(
Mac48Address
address,
const
WifiMacHeader
*header);
223
void
ReportFinalDataFailed
(
Mac48Address
address,
const
WifiMacHeader
*header);
224
233
void
ReportRxOk
(
Mac48Address
address,
const
WifiMacHeader
*header,
234
double
rxSnr,
WifiMode
txMode);
235
243
bool
NeedRts
(
Mac48Address
address,
const
WifiMacHeader
*header,
244
Ptr<const Packet>
packet);
245
bool
NeedCtsToSelf
(
WifiTxVector
txVector);
246
254
bool
NeedRtsRetransmission
(
Mac48Address
address,
const
WifiMacHeader
*header,
255
Ptr<const Packet>
packet);
263
bool
NeedDataRetransmission
(
Mac48Address
address,
const
WifiMacHeader
*header,
264
Ptr<const Packet>
packet);
265
272
bool
NeedFragmentation
(
Mac48Address
address,
const
WifiMacHeader
*header,
273
Ptr<const Packet>
packet);
281
uint32_t
GetFragmentSize
(
Mac48Address
address,
const
WifiMacHeader
*header,
282
Ptr<const Packet>
packet, uint32_t fragmentNumber);
290
uint32_t
GetFragmentOffset
(
Mac48Address
address,
const
WifiMacHeader
*header,
291
Ptr<const Packet>
packet, uint32_t fragmentNumber);
299
bool
IsLastFragment
(
Mac48Address
address,
const
WifiMacHeader
*header,
300
Ptr<const Packet>
packet, uint32_t fragmentNumber);
301
308
WifiTxVector
GetCtsTxVector
(
Mac48Address
address,
WifiMode
rtsMode);
315
WifiTxVector
GetAckTxVector
(
Mac48Address
address,
WifiMode
dataMode);
322
WifiTxVector
GetBlockAckTxVector
(
Mac48Address
address,
WifiMode
dataMode);
326
uint8_t
GetDefaultTxPowerLevel
(
void
)
const
;
331
WifiRemoteStationInfo
GetInfo
(
Mac48Address
address);
335
void
SetDefaultTxPowerLevel
(uint8_t txPower);
339
uint32_t
GetNumberOfTransmitAntennas
(
void
);
340
341
protected
:
342
virtual
void
DoDispose
(
void
);
343
// for convenience
344
WifiMode
GetSupported
(
const
WifiRemoteStation
*station, uint32_t i)
const
;
345
uint32_t
GetNSupported
(
const
WifiRemoteStation
*station)
const
;
346
uint8_t
GetMcsSupported
(
const
WifiRemoteStation
*station, uint32_t i)
const
;
347
uint32_t
GetNMcsSupported
(
const
WifiRemoteStation
*station)
const
;
348
349
bool
GetShortGuardInterval
(
const
WifiRemoteStation
*station)
const
;
350
bool
GetStbc
(
const
WifiRemoteStation
*station)
const
;
351
bool
GetGreenfield
(
const
WifiRemoteStation
*station)
const
;
352
uint32_t
GetNumberOfReceiveAntennas
(
const
WifiRemoteStation
*station)
const
;
353
uint32_t
GetNumberOfTransmitAntennas
(
const
WifiRemoteStation
*station)
const
;
354
uint32_t
GetLongRetryCount
(
const
WifiRemoteStation
*station)
const
;
355
uint32_t
GetShortRetryCount
(
const
WifiRemoteStation
*station)
const
;
356
private
:
367
virtual
bool
DoNeedRts
(
WifiRemoteStation
*station,
368
Ptr<const Packet>
packet,
bool
normally);
380
virtual
bool
DoNeedRtsRetransmission
(
WifiRemoteStation
*station,
381
Ptr<const Packet>
packet,
bool
normally);
393
virtual
bool
DoNeedDataRetransmission
(
WifiRemoteStation
*station,
394
Ptr<const Packet>
packet,
bool
normally);
395
405
virtual
bool
DoNeedFragmentation
(
WifiRemoteStation
*station,
406
Ptr<const Packet>
packet,
bool
normally);
414
virtual
bool
IsLowLatency
(
void
)
const
= 0;
418
virtual
WifiRemoteStation
*
DoCreateStation
(
void
)
const
= 0;
427
virtual
WifiTxVector
DoGetDataTxVector
(
WifiRemoteStation
*station,
428
uint32_t size) = 0;
436
virtual
WifiTxVector
DoGetRtsTxVector
(
WifiRemoteStation
*station) = 0;
437
438
445
virtual
uint8_t
DoGetCtsTxPowerLevel
(
Mac48Address
address,
WifiMode
ctsMode);
446
453
virtual
uint8_t
DoGetAckTxPowerLevel
(
Mac48Address
address,
WifiMode
ackMode);
454
461
virtual
uint8_t
DoGetBlockAckTxPowerLevel
(
Mac48Address
address,
WifiMode
blockAckMode);
462
463
virtual
bool
DoGetCtsTxGuardInterval
(
Mac48Address
address,
WifiMode
ctsMode);
464
465
virtual
uint8_t
DoGetCtsTxNss
(
Mac48Address
address,
WifiMode
ctsMode);
466
virtual
uint8_t
DoGetCtsTxNess
(
Mac48Address
address,
WifiMode
ctsMode);
467
virtual
bool
DoGetCtsTxStbc
(
Mac48Address
address,
WifiMode
ctsMode);
468
virtual
bool
DoGetAckTxGuardInterval
(
Mac48Address
address,
WifiMode
ackMode);
469
virtual
uint8_t
DoGetAckTxNss
(
Mac48Address
address,
WifiMode
ackMode);
470
virtual
uint8_t
DoGetAckTxNess
(
Mac48Address
address,
WifiMode
ackMode);
471
virtual
bool
DoGetAckTxStbc
(
Mac48Address
address,
WifiMode
ackMode);
472
virtual
bool
DoGetBlockAckTxGuardInterval
(
Mac48Address
address,
WifiMode
blockAckMode);
473
virtual
uint8_t
DoGetBlockAckTxNss
(
Mac48Address
address,
WifiMode
blockAckMode);
474
virtual
uint8_t
DoGetBlockAckTxNess
(
Mac48Address
address,
WifiMode
blockAckMode);
475
virtual
bool
DoGetBlockAckTxStbc
(
Mac48Address
address,
WifiMode
blockAckMode);
476
477
virtual
void
DoReportRtsFailed
(
WifiRemoteStation
*station) = 0;
478
virtual
void
DoReportDataFailed
(
WifiRemoteStation
*station) = 0;
479
virtual
void
DoReportRtsOk
(
WifiRemoteStation
*station,
480
double
ctsSnr,
WifiMode
ctsMode,
double
rtsSnr) = 0;
481
virtual
void
DoReportDataOk
(
WifiRemoteStation
*station,
482
double
ackSnr,
WifiMode
ackMode,
double
dataSnr) = 0;
483
virtual
void
DoReportFinalRtsFailed
(
WifiRemoteStation
*station) = 0;
484
virtual
void
DoReportFinalDataFailed
(
WifiRemoteStation
*station) = 0;
485
virtual
void
DoReportRxOk
(
WifiRemoteStation
*station,
486
double
rxSnr,
WifiMode
txMode) = 0;
487
488
WifiRemoteStationState
*
LookupState
(
Mac48Address
address)
const
;
489
WifiRemoteStation
*
Lookup
(
Mac48Address
address, uint8_t tid)
const
;
491
WifiRemoteStation
*
Lookup
(
Mac48Address
address,
const
WifiMacHeader
*header)
const
;
492
WifiMode
GetControlAnswerMode
(
Mac48Address
address,
WifiMode
reqMode);
493
494
void
DoSetFragmentationThreshold
(uint32_t threshold);
495
uint32_t
DoGetFragmentationThreshold
(
void
)
const
;
496
uint32_t
GetNFragments
(
const
WifiMacHeader
*header,
Ptr<const Packet>
packet);
497
498
typedef
std::vector <WifiRemoteStation *>
Stations
;
499
typedef
std::vector <WifiRemoteStationState *>
StationStates
;
500
501
StationStates
m_states
;
502
Stations
m_stations
;
511
Ptr<WifiPhy>
m_wifiPhy
;
512
WifiMode
m_defaultTxMode
;
513
uint8_t
m_defaultTxMcs
;
514
523
WifiModeList
m_bssBasicRateSet
;
524
WifiMcsList
m_bssBasicMcsSet
;
525
526
bool
m_htSupported
;
527
bool
m_isLowLatency
;
528
uint32_t
m_maxSsrc
;
529
uint32_t
m_maxSlrc
;
530
uint32_t
m_rtsCtsThreshold
;
531
uint32_t
m_fragmentationThreshold
;
532
uint8_t
m_defaultTxPowerLevel
;
533
WifiMode
m_nonUnicastMode
;
534
double
m_avgSlrcCoefficient
;
538
TracedCallback<Mac48Address>
m_macTxRtsFailed
;
542
TracedCallback<Mac48Address>
m_macTxDataFailed
;
547
TracedCallback<Mac48Address>
m_macTxFinalRtsFailed
;
552
TracedCallback<Mac48Address>
m_macTxFinalDataFailed
;
553
554
};
555
556
struct
WifiRemoteStationState
557
{
558
enum
559
{
560
BRAND_NEW
,
561
DISASSOC
,
562
WAIT_ASSOC_TX_OK
,
563
GOT_ASSOC_TX_OK
564
}
m_state
;
565
575
WifiModeList
m_operationalRateSet
;
576
WifiMcsList
m_operationalMcsSet
;
577
Mac48Address
m_address
;
578
WifiRemoteStationInfo
m_info
;
579
bool
m_shortGuardInterval
;
580
uint32_t
m_rx
;
581
uint32_t
m_tx
;
582
bool
m_stbc
;
583
bool
m_greenfield
;
584
585
};
586
595
struct
WifiRemoteStation
596
{
597
WifiRemoteStationState
*
m_state
;
598
uint32_t
m_ssrc
;
599
uint32_t
m_slrc
;
600
uint8_t
m_tid
;
601
};
602
603
604
}
// namespace ns3
605
606
#endif
/* WIFI_REMOTE_STATION_MANAGER_H */
src
wifi
model
wifi-remote-station-manager.h
Generated on Fri Aug 30 2013 01:43:05 for ns-3 by
1.8.1.2