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-phy.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 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
21
#ifndef WIFI_PHY_H
22
#define WIFI_PHY_H
23
24
#include <stdint.h>
25
#include "ns3/callback.h"
26
#include "ns3/packet.h"
27
#include "ns3/object.h"
28
#include "ns3/nstime.h"
29
#include "ns3/ptr.h"
30
#include "
wifi-mode.h
"
31
#include "
wifi-preamble.h
"
32
#include "
wifi-phy-standard.h
"
33
#include "ns3/traced-callback.h"
34
#include "
wifi-tx-vector.h
"
35
36
namespace
ns3 {
37
38
class
WifiChannel;
39
class
NetDevice;
40
44
class
WifiPhyListener
45
{
46
public
:
47
virtual
~WifiPhyListener
();
48
61
virtual
void
NotifyRxStart
(
Time
duration) = 0;
67
virtual
void
NotifyRxEndOk
(
void
) = 0;
73
virtual
void
NotifyRxEndError
(
void
) = 0;
83
virtual
void
NotifyTxStart
(
Time
duration) = 0;
84
100
virtual
void
NotifyMaybeCcaBusyStart
(
Time
duration) = 0;
108
virtual
void
NotifySwitchingStart
(
Time
duration) = 0;
109
};
110
111
117
class
WifiPhy
:
public
Object
118
{
119
public
:
123
enum
State
124
{
128
IDLE
,
132
CCA_BUSY
,
136
TX
,
140
RX
,
144
SWITCHING
145
};
146
153
typedef
Callback<void,Ptr<Packet>
, double,
WifiMode
,
enum
WifiPreamble
>
RxOkCallback
;
158
typedef
Callback<void,Ptr<const Packet>
,
double
>
RxErrorCallback
;
159
160
static
TypeId
GetTypeId
(
void
);
161
162
WifiPhy
();
163
virtual
~WifiPhy
();
164
165
virtual
double
GetTxPowerStart
(
void
)
const
= 0;
166
virtual
double
GetTxPowerEnd
(
void
)
const
= 0;
170
virtual
uint32_t
GetNTxPower
(
void
)
const
= 0;
171
176
virtual
void
SetReceiveOkCallback
(
RxOkCallback
callback) = 0;
181
virtual
void
SetReceiveErrorCallback
(
RxErrorCallback
callback) = 0;
182
190
virtual
void
SendPacket
(
Ptr<const Packet>
packet,
WifiMode
mode,
enum
WifiPreamble
preamble,
WifiTxVector
txvector) = 0;
191
198
virtual
void
RegisterListener
(
WifiPhyListener
*listener) = 0;
199
203
virtual
bool
IsStateIdle
(
void
) = 0;
207
virtual
bool
IsStateCcaBusy
(
void
) = 0;
211
virtual
bool
IsStateBusy
(
void
) = 0;
215
virtual
bool
IsStateRx
(
void
) = 0;
219
virtual
bool
IsStateTx
(
void
) = 0;
223
virtual
bool
IsStateSwitching
(
void
) = 0;
227
virtual
Time
GetStateDuration
(
void
) = 0;
234
virtual
Time
GetDelayUntilIdle
(
void
) = 0;
235
236
virtual
Time
GetLastRxStartTime
(
void
)
const
= 0;
237
245
static
Time
CalculateTxDuration
(uint32_t size,
WifiTxVector
txvector,
enum
WifiPreamble
preamble);
246
254
static
uint32_t
GetPlcpHtTrainingSymbolDurationMicroSeconds
(
WifiMode
payloadMode,
WifiPreamble
preamble,
WifiTxVector
txvector);
261
static
WifiMode
GetMFPlcpHeaderMode
(
WifiMode
payloadMode,
WifiPreamble
preamble);
268
static
uint32_t
GetPlcpHtSigHeaderDurationMicroSeconds
(
WifiMode
payloadMode,
WifiPreamble
preamble);
269
270
277
static
WifiMode
GetPlcpHeaderMode
(
WifiMode
payloadMode,
WifiPreamble
preamble);
278
285
static
uint32_t
GetPlcpHeaderDurationMicroSeconds
(
WifiMode
payloadMode,
WifiPreamble
preamble);
286
293
static
uint32_t
GetPlcpPreambleDurationMicroSeconds
(
WifiMode
payloadMode,
WifiPreamble
preamble);
294
301
static
double
GetPayloadDurationMicroSeconds
(uint32_t size,
WifiTxVector
txvector);
302
320
virtual
uint32_t
GetNModes
(
void
)
const
= 0;
339
virtual
WifiMode
GetMode
(uint32_t mode)
const
= 0;
346
virtual
double
CalculateSnr
(
WifiMode
txMode,
double
ber)
const
= 0;
361
virtual
uint32_t
GetNBssMembershipSelectors
(
void
)
const
=0;
362
363
virtual
uint32_t
GetBssMembershipSelector
(uint32_t selector)
const
=0;
378
virtual
WifiModeList
GetMembershipSelectorModes
(uint32_t selector)=0;
393
virtual
uint8_t
GetNMcs
(
void
)
const
=0;
394
virtual
uint8_t
GetMcs
(uint8_t mcs)
const
=0;
395
396
/* Converts from DataRate to MCS index and vice versa */
397
virtual
uint32_t
WifiModeToMcs
(
WifiMode
mode)=0;
398
virtual
WifiMode
McsToWifiMode
(uint8_t mcs)=0;
399
400
409
virtual
void
SetChannelNumber
(uint16_t
id
) = 0;
411
virtual
uint16_t
GetChannelNumber
()
const
= 0;
412
413
virtual
void
ConfigureStandard
(
enum
WifiPhyStandard
standard) = 0;
414
415
virtual
Ptr<WifiChannel>
GetChannel
(
void
)
const
= 0;
416
417
static
WifiMode
GetDsssRate1Mbps
();
418
static
WifiMode
GetDsssRate2Mbps
();
419
static
WifiMode
GetDsssRate5_5Mbps
();
420
static
WifiMode
GetDsssRate11Mbps
();
421
static
WifiMode
GetErpOfdmRate6Mbps
();
422
static
WifiMode
GetErpOfdmRate9Mbps
();
423
static
WifiMode
GetErpOfdmRate12Mbps
();
424
static
WifiMode
GetErpOfdmRate18Mbps
();
425
static
WifiMode
GetErpOfdmRate24Mbps
();
426
static
WifiMode
GetErpOfdmRate36Mbps
();
427
static
WifiMode
GetErpOfdmRate48Mbps
();
428
static
WifiMode
GetErpOfdmRate54Mbps
();
429
static
WifiMode
GetOfdmRate6Mbps
();
430
static
WifiMode
GetOfdmRate9Mbps
();
431
static
WifiMode
GetOfdmRate12Mbps
();
432
static
WifiMode
GetOfdmRate18Mbps
();
433
static
WifiMode
GetOfdmRate24Mbps
();
434
static
WifiMode
GetOfdmRate36Mbps
();
435
static
WifiMode
GetOfdmRate48Mbps
();
436
static
WifiMode
GetOfdmRate54Mbps
();
437
static
WifiMode
GetOfdmRate3MbpsBW10MHz
();
438
static
WifiMode
GetOfdmRate4_5MbpsBW10MHz
();
439
static
WifiMode
GetOfdmRate6MbpsBW10MHz
();
440
static
WifiMode
GetOfdmRate9MbpsBW10MHz
();
441
static
WifiMode
GetOfdmRate12MbpsBW10MHz
();
442
static
WifiMode
GetOfdmRate18MbpsBW10MHz
();
443
static
WifiMode
GetOfdmRate24MbpsBW10MHz
();
444
static
WifiMode
GetOfdmRate27MbpsBW10MHz
();
445
static
WifiMode
GetOfdmRate1_5MbpsBW5MHz
();
446
static
WifiMode
GetOfdmRate2_25MbpsBW5MHz
();
447
static
WifiMode
GetOfdmRate3MbpsBW5MHz
();
448
static
WifiMode
GetOfdmRate4_5MbpsBW5MHz
();
449
static
WifiMode
GetOfdmRate6MbpsBW5MHz
();
450
static
WifiMode
GetOfdmRate9MbpsBW5MHz
();
451
static
WifiMode
GetOfdmRate12MbpsBW5MHz
();
452
static
WifiMode
GetOfdmRate13_5MbpsBW5MHz
();
453
static
WifiMode
GetOfdmRate6_5MbpsBW20MHz
();
454
static
WifiMode
GetOfdmRate13MbpsBW20MHz
();
455
static
WifiMode
GetOfdmRate19_5MbpsBW20MHz
();
456
static
WifiMode
GetOfdmRate26MbpsBW20MHz
();
457
static
WifiMode
GetOfdmRate39MbpsBW20MHz
();
458
static
WifiMode
GetOfdmRate52MbpsBW20MHz
();
459
static
WifiMode
GetOfdmRate58_5MbpsBW20MHz
();
460
static
WifiMode
GetOfdmRate65MbpsBW20MHz
();
461
static
WifiMode
GetOfdmRate13_5MbpsBW40MHz
();
462
static
WifiMode
GetOfdmRate27MbpsBW40MHz
();
463
static
WifiMode
GetOfdmRate40_5MbpsBW40MHz
();
464
static
WifiMode
GetOfdmRate54MbpsBW40MHz
();
465
static
WifiMode
GetOfdmRate81MbpsBW40MHz
();
466
static
WifiMode
GetOfdmRate108MbpsBW40MHz
();
467
static
WifiMode
GetOfdmRate121_5MbpsBW40MHz
();
468
static
WifiMode
GetOfdmRate135MbpsBW40MHz
();
469
//Rates for clause 20 with short guard interval
470
static
WifiMode
GetOfdmRate7_2MbpsBW20MHz
();
471
static
WifiMode
GetOfdmRate14_4MbpsBW20MHz
();
472
static
WifiMode
GetOfdmRate21_7MbpsBW20MHz
();
473
static
WifiMode
GetOfdmRate28_9MbpsBW20MHz
();
474
static
WifiMode
GetOfdmRate43_3MbpsBW20MHz
();
475
static
WifiMode
GetOfdmRate57_8MbpsBW20MHz
();
476
static
WifiMode
GetOfdmRate65MbpsBW20MHzShGi
();
477
static
WifiMode
GetOfdmRate72_2MbpsBW20MHz
();
478
static
WifiMode
GetOfdmRate15MbpsBW40MHz
();
479
static
WifiMode
GetOfdmRate30MbpsBW40MHz
();
480
static
WifiMode
GetOfdmRate45MbpsBW40MHz
();
481
static
WifiMode
GetOfdmRate60MbpsBW40MHz
();
482
static
WifiMode
GetOfdmRate90MbpsBW40MHz
();
483
static
WifiMode
GetOfdmRate120MbpsBW40MHz
();
484
static
WifiMode
GetOfdmRate135MbpsBW40MHzShGi
();
485
static
WifiMode
GetOfdmRate150MbpsBW40MHz
();
486
487
492
void
NotifyTxBegin
(
Ptr<const Packet>
packet);
493
498
void
NotifyTxEnd
(
Ptr<const Packet>
packet);
499
504
void
NotifyTxDrop
(
Ptr<const Packet>
packet);
505
510
void
NotifyRxBegin
(
Ptr<const Packet>
packet);
511
516
void
NotifyRxEnd
(
Ptr<const Packet>
packet);
517
522
void
NotifyRxDrop
(
Ptr<const Packet>
packet);
523
544
void
NotifyMonitorSniffRx
(
Ptr<const Packet>
packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate,
bool
isShortPreamble,
545
double
signalDbm,
double
noiseDbm);
546
560
void
NotifyMonitorSniffTx
(
Ptr<const Packet>
packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate,
bool
isShortPreamble, uint8_t txPower);
561
570
virtual
int64_t
AssignStreams
(int64_t stream) = 0;
571
575
virtual
void
SetFrequency
(uint32_t freq)=0;
576
virtual
uint32_t
GetFrequency
(
void
)
const
=0;
580
virtual
void
SetNumberOfTransmitAntennas
(uint32_t tx)=0;
581
582
virtual
uint32_t
GetNumberOfTransmitAntennas
(
void
)
const
=0;
586
virtual
void
SetNumberOfReceiveAntennas
(uint32_t rx)=0 ;
590
virtual
uint32_t
GetNumberOfReceiveAntennas
(
void
)
const
=0;
594
virtual
void
SetGuardInterval
(
bool
GuardInterval)=0;
598
virtual
bool
GetGuardInterval
(
void
)
const
= 0;
602
virtual
void
SetLdpc
(
bool
Ldpc)=0;
606
virtual
bool
GetLdpc
(
void
)
const
=0;
610
virtual
void
SetStbc
(
bool
stbc)=0;
614
virtual
bool
GetStbc
(
void
)
const
=0;
615
619
virtual
void
SetGreenfield
(
bool
greenfield)=0;
623
virtual
bool
GetGreenfield
(
void
)
const
=0;
627
virtual
bool
GetChannelBonding
(
void
)
const
= 0;
631
virtual
void
SetChannelBonding
(
bool
channelbonding) = 0 ;
632
633
private
:
640
TracedCallback<Ptr<const Packet>
>
m_phyTxBeginTrace
;
641
648
TracedCallback<Ptr<const Packet>
>
m_phyTxEndTrace
;
649
656
TracedCallback<Ptr<const Packet>
>
m_phyTxDropTrace
;
657
664
TracedCallback<Ptr<const Packet>
>
m_phyRxBeginTrace
;
665
672
TracedCallback<Ptr<const Packet>
>
m_phyRxEndTrace
;
673
679
TracedCallback<Ptr<const Packet>
>
m_phyRxDropTrace
;
680
691
TracedCallback<Ptr<const Packet>
, uint16_t, uint16_t, uint32_t, bool, double,
double
>
m_phyMonitorSniffRxTrace
;
692
703
TracedCallback<Ptr<const Packet>
, uint16_t, uint16_t, uint32_t, bool,uint8_t>
m_phyMonitorSniffTxTrace
;
704
705
};
706
711
std::ostream&
operator<<
(std::ostream& os,
enum
WifiPhy::State
state);
712
713
}
// namespace ns3
714
715
#endif
/* WIFI_PHY_H */
src
wifi
model
wifi-phy.h
Generated on Fri Aug 30 2013 01:43:05 for ns-3 by
1.8.1.2