A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
wifi-mac-queue-item.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2005, 2009 INRIA
4
* Copyright (c) 2009 MIRKO BANCHI
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
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20
* Mirko Banchi <mk.banchi@gmail.com>
21
* Stefano Avallone <stavallo@unina.it>
22
*/
23
24
#include "ns3/simulator.h"
25
#include "ns3/packet.h"
26
#include "ns3/log.h"
27
#include "
wifi-mac-queue-item.h
"
28
#include "
wifi-mac-trailer.h
"
29
30
namespace
ns3
{
31
32
NS_LOG_COMPONENT_DEFINE
(
"WifiMacQueueItem"
);
33
34
WifiMacQueueItem::WifiMacQueueItem
(
Ptr<const Packet>
p,
const
WifiMacHeader
& header)
35
:
WifiMacQueueItem
(p, header,
Simulator
::
Now
())
36
{
37
}
38
39
WifiMacQueueItem::WifiMacQueueItem
(
Ptr<const Packet>
p,
const
WifiMacHeader
& header,
Time
tstamp)
40
: m_packet (p),
41
m_header (header),
42
m_tstamp (tstamp)
43
{
44
}
45
46
WifiMacQueueItem::~WifiMacQueueItem
()
47
{
48
}
49
50
Ptr<const Packet>
51
WifiMacQueueItem::GetPacket
(
void
)
const
52
{
53
return
m_packet
;
54
}
55
56
const
WifiMacHeader
&
57
WifiMacQueueItem::GetHeader
(
void
)
const
58
{
59
return
m_header
;
60
}
61
62
WifiMacHeader
&
63
WifiMacQueueItem::GetHeader
(
void
)
64
{
65
return
m_header
;
66
}
67
68
Mac48Address
69
WifiMacQueueItem::GetDestinationAddress
(
void
)
const
70
{
71
return
m_header
.
GetAddr1
();
72
}
73
74
Time
75
WifiMacQueueItem::GetTimeStamp
(
void
)
const
76
{
77
return
m_tstamp
;
78
}
79
80
uint32_t
81
WifiMacQueueItem::GetSize
(
void
)
const
82
{
83
return
m_packet
->
GetSize
() +
m_header
.
GetSerializedSize
() +
WIFI_MAC_FCS_LENGTH
;
84
}
85
86
void
87
WifiMacQueueItem::Print
(std::ostream& os)
const
88
{
89
os <<
"size="
<<
m_packet
->
GetSize
()
90
<<
", to="
<<
m_header
.
GetAddr1
()
91
<<
", seqN="
<<
m_header
.
GetSequenceNumber
()
92
<<
", lifetime="
<< (
Simulator::Now
() -
m_tstamp
).GetMicroSeconds () <<
"us"
;
93
if
(
m_header
.
IsQosData
())
94
{
95
os <<
", tid="
<< +
m_header
.
GetQosTid
();
96
if
(
m_header
.
IsQosNoAck
())
97
{
98
os <<
", ack=NoAck"
;
99
}
100
else
if
(
m_header
.
IsQosAck
())
101
{
102
os <<
", ack=NormalAck"
;
103
}
104
else
if
(
m_header
.
IsQosBlockAck
())
105
{
106
os <<
", ack=BlockAck"
;
107
}
108
}
109
}
110
111
std::ostream &
operator <<
(std::ostream &os,
const
WifiMacQueueItem
&item)
112
{
113
item.
Print
(os);
114
return
os;
115
}
116
117
}
//namespace ns3
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:102
ns3::Ptr< const Packet >
ns3::Simulator
Control the scheduling of simulation events.
Definition:
simulator.h:68
ns3::Packet::GetSize
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition:
packet.h:852
ns3::WifiMacQueueItem::Print
virtual void Print(std::ostream &os) const
Print the item contents.
Definition:
wifi-mac-queue-item.cc:87
ns3::WifiMacQueueItem::GetSize
uint32_t GetSize(void) const
Return the size of the packet stored by this item, including header size and trailer size...
Definition:
wifi-mac-queue-item.cc:81
ns3::WifiMacHeader::GetAddr1
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
Definition:
wifi-mac-header.cc:395
ns3::WifiMacQueueItem::GetTimeStamp
Time GetTimeStamp(void) const
Get the timestamp included in this item.
Definition:
wifi-mac-queue-item.cc:75
ns3::WIFI_MAC_FCS_LENGTH
static const uint16_t WIFI_MAC_FCS_LENGTH
The length in octects of the IEEE 802.11 MAC FCS field.
Definition:
wifi-mac-trailer.h:31
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:204
ns3::WifiMacQueueItem::GetDestinationAddress
Mac48Address GetDestinationAddress(void) const
Return the destination address present in the header.
Definition:
wifi-mac-queue-item.cc:69
ns3::WifiMacQueueItem::m_packet
Ptr< const Packet > m_packet
The packet contained in this queue item.
Definition:
wifi-mac-queue-item.h:106
ns3::WifiMacQueueItem
WifiMacQueueItem stores (const) packets along with their Wifi MAC headers and the time when they were...
Definition:
wifi-mac-queue-item.h:41
ns3::WifiMacQueueItem::GetHeader
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
Definition:
wifi-mac-queue-item.cc:57
ns3::WifiMacQueueItem::m_tstamp
Time m_tstamp
timestamp when the packet arrived at the queue
Definition:
wifi-mac-queue-item.h:108
ns3::WifiMacHeader::IsQosNoAck
bool IsQosNoAck(void) const
Return if the QoS ACK policy is No ACK.
Definition:
wifi-mac-header.cc:771
ns3::WifiMacHeader::GetQosTid
uint8_t GetQosTid(void) const
Return the Traffic ID of a QoS header.
Definition:
wifi-mac-header.cc:825
ns3::WifiMacQueueItem::m_header
WifiMacHeader m_header
Wifi MAC header associated with the packet.
Definition:
wifi-mac-queue-item.h:107
ns3::WifiMacHeader::IsQosAck
bool IsQosAck(void) const
Return if the QoS ACK policy is Normal ACK.
Definition:
wifi-mac-header.cc:778
ns3::WifiMacQueueItem::~WifiMacQueueItem
virtual ~WifiMacQueueItem()
Definition:
wifi-mac-queue-item.cc:46
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition:
angles.cc:42
ns3::WifiMacQueueItem::GetPacket
Ptr< const Packet > GetPacket(void) const
Get the packet stored in this item.
Definition:
wifi-mac-queue-item.cc:51
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WifiMacHeader::GetSequenceNumber
uint16_t GetSequenceNumber(void) const
Return the sequence number of the header.
Definition:
wifi-mac-header.cc:740
ns3::WifiMacQueueItem::WifiMacQueueItem
WifiMacQueueItem(Ptr< const Packet > p, const WifiMacHeader &header)
Create a Wifi MAC queue item containing a packet and a Wifi MAC header.
Definition:
wifi-mac-queue-item.cc:34
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:43
ns3::Simulator::Now
static Time Now(void)
Return the current simulation virtual time.
Definition:
simulator.cc:193
ns3::WifiMacHeader::IsQosBlockAck
bool IsQosBlockAck(void) const
Return if the QoS ACK policy is Block ACK.
Definition:
wifi-mac-header.cc:764
ns3::WifiMacHeader::GetSerializedSize
uint32_t GetSerializedSize(void) const
Definition:
wifi-mac-header.cc:1108
ns3::WifiMacHeader::IsQosData
bool IsQosData(void) const
Return true if the Type is DATA and Subtype is one of the possible values for QoS DATA...
Definition:
wifi-mac-header.cc:534
wifi-mac-queue-item.h
ns3::Now
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition:
simulator.cc:309
wifi-mac-trailer.h
ns3::WifiMacHeader
Implements the IEEE 802.11 MAC header.
Definition:
wifi-mac-header.h:83
src
wifi
model
wifi-mac-queue-item.cc
Generated on Wed Aug 21 2019 03:38:35 for ns-3 by
1.8.14