A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
bs-scheduler.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2007,2008 INRIA
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
7
*/
8
9
#include "
bs-scheduler.h
"
10
11
#include "
bs-net-device.h
"
12
#include "
burst-profile-manager.h
"
13
#include "
cid.h
"
14
#include "
connection-manager.h
"
15
#include "
service-flow-manager.h
"
16
#include "
service-flow-record.h
"
17
#include "
service-flow.h
"
18
#include "
ss-manager.h
"
19
#include "
ss-record.h
"
20
#include "
wimax-connection.h
"
21
#include "
wimax-mac-header.h
"
22
#include "
wimax-mac-queue.h
"
23
24
#include "ns3/log.h"
25
#include "ns3/packet-burst.h"
26
#include "ns3/simulator.h"
27
28
namespace
ns3
29
{
30
31
NS_LOG_COMPONENT_DEFINE
(
"BSScheduler"
);
32
33
NS_OBJECT_ENSURE_REGISTERED
(BSScheduler);
34
35
TypeId
36
BSScheduler::GetTypeId
()
37
{
38
static
TypeId
tid =
TypeId
(
"ns3::BSScheduler"
).
SetParent
<
Object
>().SetGroupName(
"Wimax"
)
39
// No AddConstructor because this is an abstract class.
40
;
41
return
tid;
42
}
43
44
BSScheduler::BSScheduler
()
45
: m_downlinkBursts(new
std
::list<
std
::pair<
OfdmDlMapIe
*,
Ptr
<
PacketBurst
>>>())
46
{
47
// m_downlinkBursts is filled by AddDownlinkBurst and emptied by
48
// wimax-bs-net-device::sendBurst and wimax-ss-net-device::sendBurst
49
}
50
51
BSScheduler::BSScheduler
(
Ptr<BaseStationNetDevice>
bs)
52
: m_downlinkBursts(new
std
::list<
std
::pair<
OfdmDlMapIe
*,
Ptr
<
PacketBurst
>>>())
53
{
54
}
55
56
BSScheduler::~BSScheduler
()
57
{
58
std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst>>>* downlinkBursts =
m_downlinkBursts
;
59
std::pair<OfdmDlMapIe*, Ptr<PacketBurst>> pair;
60
while
(!downlinkBursts->empty())
61
{
62
pair = downlinkBursts->front();
63
pair.second =
nullptr
;
64
delete
pair.first;
65
}
66
SetBs
(
nullptr
);
67
delete
m_downlinkBursts
;
68
m_downlinkBursts
=
nullptr
;
69
}
70
71
void
72
BSScheduler::SetBs
(
Ptr<BaseStationNetDevice>
bs)
73
{
74
m_bs
= bs;
75
}
76
77
Ptr<BaseStationNetDevice>
78
BSScheduler::GetBs
()
79
{
80
return
m_bs
;
81
}
82
83
bool
84
BSScheduler::CheckForFragmentation
(
Ptr<WimaxConnection>
connection,
85
int
availableSymbols,
86
WimaxPhy::ModulationType
modulationType)
87
{
88
NS_LOG_INFO
(
"BS Scheduler, CheckForFragmentation"
);
89
if
(connection->GetType() !=
Cid::TRANSPORT
)
90
{
91
NS_LOG_INFO
(
"\t No Transport connection, Fragmentation IS NOT possible"
);
92
return
false
;
93
}
94
uint32_t
availableByte =
GetBs
()->GetPhy()->GetNrBytes(availableSymbols, modulationType);
95
96
uint32_t
headerSize =
97
connection->GetQueue()->GetFirstPacketHdrSize(
MacHeaderType::HEADER_TYPE_GENERIC
);
98
NS_LOG_INFO
(
"\t availableByte = "
<< availableByte <<
" headerSize = "
<< headerSize);
99
100
if
(availableByte > headerSize)
101
{
102
NS_LOG_INFO
(
"\t Fragmentation IS possible"
);
103
return
true
;
104
}
105
else
106
{
107
NS_LOG_INFO
(
"\t Fragmentation IS NOT possible"
);
108
return
false
;
109
}
110
}
111
}
// namespace ns3
bs-net-device.h
bs-scheduler.h
burst-profile-manager.h
cid.h
ns3::BSScheduler::~BSScheduler
~BSScheduler() override
Definition
bs-scheduler.cc:56
ns3::BSScheduler::GetBs
virtual Ptr< BaseStationNetDevice > GetBs()
Get the base station.
Definition
bs-scheduler.cc:78
ns3::BSScheduler::SetBs
virtual void SetBs(Ptr< BaseStationNetDevice > bs)
Set the base station.
Definition
bs-scheduler.cc:72
ns3::BSScheduler::m_bs
Ptr< BaseStationNetDevice > m_bs
base station
Definition
bs-scheduler.h:118
ns3::BSScheduler::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
bs-scheduler.cc:36
ns3::BSScheduler::BSScheduler
BSScheduler()
Definition
bs-scheduler.cc:44
ns3::BSScheduler::m_downlinkBursts
std::list< std::pair< OfdmDlMapIe *, Ptr< PacketBurst > > > * m_downlinkBursts
down link bursts
Definition
bs-scheduler.h:119
ns3::BSScheduler::CheckForFragmentation
bool CheckForFragmentation(Ptr< WimaxConnection > connection, int availableSymbols, WimaxPhy::ModulationType modulationType)
Check if the packet fragmentation is possible for transport connection.
Definition
bs-scheduler.cc:84
ns3::Cid::TRANSPORT
@ TRANSPORT
Definition
cid.h:35
ns3::MacHeaderType::HEADER_TYPE_GENERIC
@ HEADER_TYPE_GENERIC
Definition
wimax-mac-header.h:32
ns3::Object
A base class which provides memory management and object aggregation.
Definition
object.h:78
ns3::OfdmDlMapIe
This class implements the OFDM DL-MAP information element as described by "IEEE Standard forLocal and...
Definition
dl-mac-messages.h:449
ns3::PacketBurst
this class implement a burst as a list of packets
Definition
packet-burst.h:26
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
ns3::WimaxPhy::ModulationType
ModulationType
ModulationType enumeration.
Definition
wimax-phy.h:43
uint32_t
connection-manager.h
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition
log.h:264
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std
STL namespace.
service-flow-manager.h
service-flow-record.h
service-flow.h
ss-manager.h
ss-record.h
wimax-connection.h
wimax-mac-header.h
wimax-mac-queue.h
src
wimax
model
bs-scheduler.cc
Generated on Fri Nov 8 2024 13:59:09 for ns-3 by
1.11.0