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
ipv6-queue-disc-item.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2016 Universita' degli Studi di Napoli Federico II
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
19
#include "ns3/log.h"
20
#include "
ipv6-queue-disc-item.h
"
21
22
namespace
ns3
{
23
24
NS_LOG_COMPONENT_DEFINE
(
"Ipv6QueueDiscItem"
);
25
26
Ipv6QueueDiscItem::Ipv6QueueDiscItem
(
Ptr<Packet>
p,
const
Address
& addr,
27
uint16_t protocol,
const
Ipv6Header
& header)
28
:
QueueDiscItem
(p, addr, protocol),
29
m_header (header),
30
m_headerAdded (false)
31
{
32
}
33
34
Ipv6QueueDiscItem::~Ipv6QueueDiscItem
()
35
{
36
NS_LOG_FUNCTION
(
this
);
37
}
38
39
uint32_t
Ipv6QueueDiscItem::GetPacketSize
(
void
)
const
40
{
41
Ptr<Packet>
p =
GetPacket
();
42
NS_ASSERT
(p != 0);
43
uint32_t ret = p->
GetSize
();
44
if
(!
m_headerAdded
)
45
{
46
ret +=
m_header
.
GetSerializedSize
();
47
}
48
return
ret;
49
}
50
51
const
Ipv6Header
&
52
Ipv6QueueDiscItem::GetHeader
(
void
)
const
53
{
54
return
m_header
;
55
}
56
57
void
Ipv6QueueDiscItem::AddHeader
(
void
)
58
{
59
NS_LOG_FUNCTION
(
this
);
60
61
NS_ASSERT_MSG
(!
m_headerAdded
,
"The header has been already added to the packet"
);
62
Ptr<Packet>
p =
GetPacket
();
63
NS_ASSERT
(p != 0);
64
p->
AddHeader
(
m_header
);
65
m_headerAdded
=
true
;
66
}
67
68
void
69
Ipv6QueueDiscItem::Print
(std::ostream& os)
const
70
{
71
if
(!
m_headerAdded
)
72
{
73
os <<
m_header
<<
" "
;
74
}
75
os <<
GetPacket
() <<
" "
76
<<
"Dst addr "
<<
GetAddress
() <<
" "
77
<<
"proto "
<< (uint16_t)
GetProtocol
() <<
" "
78
<<
"txq "
<< (uint8_t)
GetTxQueueIndex
()
79
;
80
}
81
82
}
// namespace ns3
ns3::QueueDiscItem::GetTxQueueIndex
uint8_t GetTxQueueIndex(void) const
Get the transmission queue index included in this item.
Definition:
queue-disc.cc:59
ns3::Ipv6Header::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
Definition:
ipv6-header.cc:143
ns3::Ipv6Header
Introspection did not find any typical Config paths.
Definition:
ipv6-header.h:33
ns3::Ptr< Packet >
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Definition:
log-macros-enabled.h:213
ns3::Ipv6QueueDiscItem::GetPacketSize
virtual uint32_t GetPacketSize(void) const
Definition:
ipv6-queue-disc-item.cc:39
NS_ASSERT
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition:
assert.h:67
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:201
ns3::Ipv6QueueDiscItem::Print
virtual void Print(std::ostream &os) const
Print the item contents.
Definition:
ipv6-queue-disc-item.cc:69
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:786
ns3::QueueDiscItem
QueueDiscItem is the abstract base class for items that are stored in a queue disc.
Definition:
queue-disc.h:43
ns3::QueueDiscItem::GetAddress
Address GetAddress(void) const
Get the MAC address included in this item.
Definition:
queue-disc.cc:47
ipv6-queue-disc-item.h
ns3::Ipv6QueueDiscItem::AddHeader
virtual void AddHeader(void)
Add the header to the packet.
Definition:
ipv6-queue-disc-item.cc:57
ns3::Address
a polymophic address class
Definition:
address.h:90
ns3::Ipv6QueueDiscItem::m_header
Ipv6Header m_header
Definition:
ipv6-queue-disc-item.h:93
ns3::Ipv6QueueDiscItem::~Ipv6QueueDiscItem
virtual ~Ipv6QueueDiscItem()
Definition:
ipv6-queue-disc-item.cc:34
ns3::Ipv6QueueDiscItem::GetHeader
const Ipv6Header & GetHeader(void) const
Definition:
ipv6-queue-disc-item.cc:52
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
NS_ASSERT_MSG
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition:
assert.h:90
ns3::Ipv6QueueDiscItem::m_headerAdded
bool m_headerAdded
Definition:
ipv6-queue-disc-item.h:94
ns3::QueueDiscItem::GetProtocol
uint16_t GetProtocol(void) const
Get the L3 protocol included in this item.
Definition:
queue-disc.cc:53
ns3::Ipv6QueueDiscItem::Ipv6QueueDiscItem
Ipv6QueueDiscItem()
Default constructor.
ns3::Packet::AddHeader
void AddHeader(const Header &header)
Add header to this packet.
Definition:
packet.cc:257
ns3::QueueItem::GetPacket
Ptr< Packet > GetPacket(void) const
Definition:
net-device.cc:44
src
internet
model
ipv6-queue-disc-item.cc
Generated on Thu Mar 24 2016 00:46:38 for ns-3 by
1.8.9.1