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
wave-mac-low.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2008 INRIA
4
* Copyright (c) 2013 Dalian University of Technology
5
*
6
* 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
8
* published by the Free Software Foundation;
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
*
19
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20
* Junling Bu <linlinjavaer@gmail.com>
21
*/
22
#include "ns3/log.h"
23
#include "
wave-mac-low.h
"
24
#include "
higher-tx-tag.h
"
25
26
NS_LOG_COMPONENT_DEFINE
(
"WaveMacLow"
);
27
28
namespace
ns3 {
29
30
NS_OBJECT_ENSURE_REGISTERED
(WaveMacLow);
31
32
TypeId
33
WaveMacLow::GetTypeId
(
void
)
34
{
35
static
TypeId
tid =
TypeId
(
"ns3::WaveMacLow"
)
36
.
SetParent
<
MacLow
> ()
37
.AddConstructor<WaveMacLow> ()
38
;
39
return
tid;
40
}
41
WaveMacLow::WaveMacLow
(
void
)
42
{
43
NS_LOG_FUNCTION
(
this
);
44
}
45
WaveMacLow::~WaveMacLow
(
void
)
46
{
47
NS_LOG_FUNCTION
(
this
);
48
}
49
50
WifiTxVector
51
WaveMacLow::GetDataTxVector
(
Ptr<const Packet>
packet,
const
WifiMacHeader
*hdr)
const
52
{
53
NS_LOG_FUNCTION
(
this
<< packet << *hdr);
54
HigherDataTxVectorTag
datatag;
55
bool
found;
56
found = ConstCast<Packet> (packet)->PeekPacketTag (datatag);
57
if
(!found)
58
{
59
return
MacLow::GetDataTxVector
(packet, hdr);
60
}
61
62
if
(!datatag.
IsAdapter
())
63
{
64
return
datatag.
GetDataTxVector
();
65
}
66
67
WifiTxVector
txHigher = datatag.
GetDataTxVector
();
68
WifiTxVector
txMac =
MacLow::GetDataTxVector
(packet, hdr);
69
WifiTxVector
txAdapter;
70
// if adapter is true, DataRate set by higher layer is the minimum data rate
71
// that sets the lower bound for the actual data rate.
72
if
(txHigher.
GetMode
().
GetDataRate
() > txMac.
GetMode
().
GetDataRate
())
73
{
74
txAdapter.
SetMode
(txHigher.
GetMode
());
75
}
76
else
77
{
78
txAdapter.
SetMode
(txMac.
GetMode
());
79
}
80
81
// if adapter is true, TxPwr_Level set by higher layer is the maximum
82
// transmit power that sets the upper bound for the actual transmit power;
83
txAdapter.
SetTxPowerLevel
(std::min (txHigher.
GetTxPowerLevel
(), txMac.
GetTxPowerLevel
()));
84
return
txAdapter;
85
}
86
}
// namespace ns3
ns3::Ptr< const Packet >
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
Definition:
log.h:345
ns3::WifiTxVector
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Definition:
wifi-tx-vector.h:47
higher-tx-tag.h
ns3::NS_OBJECT_ENSURE_REGISTERED
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
ns3::WaveMacLow::GetTypeId
static TypeId GetTypeId(void)
Definition:
wave-mac-low.cc:33
ns3::WifiTxVector::GetTxPowerLevel
uint8_t GetTxPowerLevel(void) const
Definition:
wifi-tx-vector.cc:47
ns3::WaveMacLow::WaveMacLow
WaveMacLow(void)
Definition:
wave-mac-low.cc:41
ns3::HigherDataTxVectorTag
This tag will be used to support higher layer control data rate and tx power level.
Definition:
higher-tx-tag.h:35
ns3::HigherDataTxVectorTag::GetDataTxVector
WifiTxVector GetDataTxVector(void) const
Definition:
higher-tx-tag.cc:65
ns3::WaveMacLow::GetDataTxVector
virtual WifiTxVector GetDataTxVector(Ptr< const Packet > packet, const WifiMacHeader *hdr) const
Return a TXVECTOR for the DATA frame given the destination.
Definition:
wave-mac-low.cc:51
ns3::WaveMacLow::~WaveMacLow
virtual ~WaveMacLow(void)
Definition:
wave-mac-low.cc:45
ns3::WifiTxVector::SetTxPowerLevel
void SetTxPowerLevel(uint8_t powerlevel)
Sets the selected transmission power level.
Definition:
wifi-tx-vector.cc:83
wave-mac-low.h
ns3::WifiTxVector::SetMode
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
Definition:
wifi-tx-vector.cc:78
ns3::MacLow::GetDataTxVector
virtual WifiTxVector GetDataTxVector(Ptr< const Packet > packet, const WifiMacHeader *hdr) const
Return a TXVECTOR for the DATA frame given the destination.
Definition:
mac-low.cc:1026
ns3::MacLow
handle RTS/CTS/DATA/ACK transactions.
Definition:
mac-low.h:411
NS_LOG_COMPONENT_DEFINE
NS_LOG_COMPONENT_DEFINE("WaveMacLow")
ns3::WifiTxVector::GetMode
WifiMode GetMode(void) const
Definition:
wifi-tx-vector.cc:42
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::WifiMode::GetDataRate
uint64_t GetDataRate(void) const
Definition:
wifi-mode.cc:79
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Definition:
type-id.cc:611
ns3::HigherDataTxVectorTag::IsAdapter
bool IsAdapter(void) const
Definition:
higher-tx-tag.cc:71
ns3::WifiMacHeader
Implements the IEEE 802.11 MAC header.
Definition:
wifi-mac-header.h:80
src
wave
model
wave-mac-low.cc
Generated on Sat Apr 19 2014 14:07:10 for ns-3 by
1.8.6