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
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 "
wifi-mac-queue-item.h
"
25
#include "ns3/simulator.h"
26
27
namespace
ns3
{
28
29
NS_LOG_COMPONENT_DEFINE
(
"WifiMacQueueItem"
);
30
31
WifiMacQueueItem::WifiMacQueueItem
(
Ptr<const Packet>
p,
const
WifiMacHeader
& header)
32
: m_packet (p),
33
m_header (header),
34
m_tstamp (
Simulator
::
Now
())
35
{
36
}
37
38
WifiMacQueueItem::~WifiMacQueueItem
()
39
{
40
}
41
42
Ptr<const Packet>
43
WifiMacQueueItem::GetPacket
(
void
)
const
44
{
45
return
m_packet
;
46
}
47
48
const
WifiMacHeader
&
49
WifiMacQueueItem::GetHeader
(
void
)
const
50
{
51
return
m_header
;
52
}
53
54
Mac48Address
55
WifiMacQueueItem::GetAddress
(
WifiMacHeader::AddressType
type)
const
56
{
57
if
(type ==
WifiMacHeader::ADDR1
)
58
{
59
return
m_header
.
GetAddr1
();
60
}
61
if
(type ==
WifiMacHeader::ADDR2
)
62
{
63
return
m_header
.
GetAddr2
();
64
}
65
if
(type ==
WifiMacHeader::ADDR3
)
66
{
67
return
m_header
.
GetAddr3
();
68
}
69
return
0;
70
}
71
72
Time
73
WifiMacQueueItem::GetTimeStamp
(
void
)
const
74
{
75
return
m_tstamp
;
76
}
77
78
uint32_t
79
WifiMacQueueItem::GetSize
(
void
)
const
80
{
81
return
m_packet
->
GetSize
() +
m_header
.
GetSerializedSize
();
82
}
83
84
NS_OBJECT_TEMPLATE_CLASS_DEFINE
(
Queue
,
WifiMacQueueItem
);
85
86
}
//namespace ns3
ns3::WifiMacQueueItem::GetPacket
Ptr< const Packet > GetPacket(void) const
Get the packet stored in this item.
Definition:
wifi-mac-queue-item.cc:43
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::WifiMacQueueItem::GetAddress
Mac48Address GetAddress(enum WifiMacHeader::AddressType type) const
Return the requested address present in the header.
Definition:
wifi-mac-queue-item.cc:55
ns3::WifiMacHeader::GetAddr3
Mac48Address GetAddr3(void) const
Return the address in the Address 3 field.
Definition:
wifi-mac-header.cc:386
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:201
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:821
ns3::WifiMacQueueItem::GetTimeStamp
Time GetTimeStamp(void) const
Get the timestamp included in this item.
Definition:
wifi-mac-queue-item.cc:73
ns3::WifiMacHeader::ADDR3
Definition:
wifi-mac-header.h:101
ns3::Queue
Template class for packet Queues.
Definition:
csma-net-device.h:39
ns3::WifiMacQueueItem::m_packet
Ptr< const Packet > m_packet
The packet contained in this queue item.
Definition:
wifi-mac-queue-item.h:105
ns3::WifiMacHeader::GetSerializedSize
uint32_t GetSerializedSize(void) const
Definition:
wifi-mac-header.cc:1003
ns3::WifiMacQueueItem
WifiMacQueueItem stores (const) packets along with their Wifi MAC headers and the time when they were...
Definition:
wifi-mac-queue-item.h:40
ns3::WifiMacQueueItem::m_tstamp
Time m_tstamp
timestamp when the packet arrived at the queue
Definition:
wifi-mac-queue-item.h:107
ns3::WifiMacHeader::AddressType
AddressType
Address types.
Definition:
wifi-mac-header.h:97
ns3::WifiMacQueueItem::WifiMacQueueItem
WifiMacQueueItem()
Default constructor.
ns3::WifiMacQueueItem::m_header
WifiMacHeader m_header
Wifi MAC header associated with the packet.
Definition:
wifi-mac-queue-item.h:106
ns3::WifiMacHeader::ADDR2
Definition:
wifi-mac-header.h:100
ns3::WifiMacQueueItem::~WifiMacQueueItem
virtual ~WifiMacQueueItem()
Definition:
wifi-mac-queue-item.cc:38
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WifiMacQueueItem::GetHeader
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
Definition:
wifi-mac-queue-item.cc:49
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:43
wifi-mac-queue-item.h
NS_OBJECT_TEMPLATE_CLASS_DEFINE
#define NS_OBJECT_TEMPLATE_CLASS_DEFINE(type, param)
Explicitly instantiate a template class and register the resulting instance with the TypeId system...
Definition:
object-base.h:67
ns3::Now
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition:
simulator.cc:365
ns3::WifiMacHeader::GetAddr1
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
Definition:
wifi-mac-header.cc:374
ns3::WifiMacQueueItem::GetSize
uint32_t GetSize(void) const
Return the size of the packet included in this item.
Definition:
wifi-mac-queue-item.cc:79
ns3::WifiMacHeader::ADDR1
Definition:
wifi-mac-header.h:99
ns3::WifiMacHeader
Implements the IEEE 802.11 MAC header.
Definition:
wifi-mac-header.h:80
ns3::WifiMacHeader::GetAddr2
Mac48Address GetAddr2(void) const
Return the address in the Address 2 field.
Definition:
wifi-mac-header.cc:380
src
wifi
model
wifi-mac-queue-item.cc
Generated on Wed Mar 21 2018 14:24:33 for ns-3 by
1.8.9.1