A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
wimax
model
bs-scheduler.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007,2008 INRIA
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
* Author: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
19
*/
20
21
#include "
bs-scheduler.h
"
22
#include "ns3/simulator.h"
23
#include "
bs-net-device.h
"
24
#include "ns3/packet-burst.h"
25
#include "
cid.h
"
26
#include "
wimax-mac-header.h
"
27
#include "
ss-record.h
"
28
#include "
wimax-mac-queue.h
"
29
#include "ns3/log.h"
30
#include "
burst-profile-manager.h
"
31
#include "
wimax-connection.h
"
32
#include "
connection-manager.h
"
33
#include "
ss-manager.h
"
34
#include "
service-flow.h
"
35
#include "
service-flow-record.h
"
36
#include "
service-flow-manager.h
"
37
38
namespace
ns3
{
39
40
NS_LOG_COMPONENT_DEFINE
(
"BSScheduler"
);
41
42
NS_OBJECT_ENSURE_REGISTERED
(BSScheduler);
43
44
TypeId
45
BSScheduler::GetTypeId
(
void
)
46
{
47
static
TypeId
tid =
TypeId
(
"ns3::BSScheduler"
)
48
.
SetParent
<
Object
> ()
49
.SetGroupName(
"Wimax"
)
50
// No AddConstructor because this is an abstract class.
51
;
52
return
tid;
53
}
54
55
BSScheduler::BSScheduler
()
56
: m_downlinkBursts (new
std
::
list
<
std
::pair<
OfdmDlMapIe
*,
Ptr
<
PacketBurst
> > > ())
57
{
58
// m_downlinkBursts is filled by AddDownlinkBurst and emptied by
59
// wimax-bs-net-device::sendBurst and wimax-ss-net-device::sendBurst
60
}
61
62
BSScheduler::BSScheduler
(
Ptr<BaseStationNetDevice>
bs)
63
: m_downlinkBursts (new
std
::
list
<
std
::pair<
OfdmDlMapIe
*,
Ptr
<
PacketBurst
> > > ())
64
{
65
66
}
67
68
BSScheduler::~BSScheduler
(
void
)
69
{
70
std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > > *downlinkBursts =
m_downlinkBursts
;
71
std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > pair;
72
while
(downlinkBursts->size ())
73
{
74
pair = downlinkBursts->front ();
75
pair.second = 0;
76
delete
pair.first;
77
}
78
SetBs
(0);
79
delete
m_downlinkBursts
;
80
m_downlinkBursts
= 0;
81
}
82
83
void
84
BSScheduler::SetBs
(
Ptr<BaseStationNetDevice>
bs)
85
{
86
m_bs
= bs;
87
}
88
89
Ptr<BaseStationNetDevice>
BSScheduler::GetBs
(
void
)
90
{
91
return
m_bs
;
92
}
93
94
bool
95
BSScheduler::CheckForFragmentation
(
Ptr<WimaxConnection>
connection,
96
int
availableSymbols,
97
WimaxPhy::ModulationType
modulationType)
98
{
99
NS_LOG_INFO
(
"BS Scheduler, CheckForFragmentation"
);
100
if
(connection->GetType () !=
Cid::TRANSPORT
)
101
{
102
NS_LOG_INFO
(
"\t No Transport connction, Fragmentation IS NOT possible"
);
103
return
false
;
104
}
105
uint32_t availableByte =
GetBs
()->GetPhy ()->
106
GetNrBytes (availableSymbols, modulationType);
107
108
uint32_t headerSize = connection->GetQueue ()->GetFirstPacketHdrSize (
109
MacHeaderType::HEADER_TYPE_GENERIC
);
110
NS_LOG_INFO
(
"\t availableByte = "
<< availableByte <<
111
" headerSize = "
<< headerSize);
112
113
if
(availableByte > headerSize)
114
{
115
NS_LOG_INFO
(
"\t Fragmentation IS possible"
);
116
return
true
;
117
}
118
else
119
{
120
NS_LOG_INFO
(
"\t Fragmentation IS NOT possible"
);
121
return
false
;
122
}
123
}
124
}
// namespace ns3
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:73
wimax-connection.h
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:45
ns3::MacHeaderType::HEADER_TYPE_GENERIC
Definition:
wimax-mac-header.h:42
burst-profile-manager.h
service-flow-record.h
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:202
service-flow.h
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition:
log.h:278
std
STL namespace.
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:95
ns3::BSScheduler::~BSScheduler
~BSScheduler(void)
Definition:
bs-scheduler.cc:68
ns3::BSScheduler::m_downlinkBursts
std::list< std::pair< OfdmDlMapIe *, Ptr< PacketBurst > > > * m_downlinkBursts
down link bursts
Definition:
bs-scheduler.h:126
ns3::BSScheduler::BSScheduler
BSScheduler()
Definition:
bs-scheduler.cc:55
bs-net-device.h
ns3::BSScheduler::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
bs-scheduler.cc:45
list
#define list
Definition:
openflow-interface.h:47
wimax-mac-header.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ss-record.h
ns3::Cid::TRANSPORT
Definition:
cid.h:47
ns3::BSScheduler::GetBs
virtual Ptr< BaseStationNetDevice > GetBs(void)
Get the base station.
Definition:
bs-scheduler.cc:89
bs-scheduler.h
ns3::BSScheduler::SetBs
virtual void SetBs(Ptr< BaseStationNetDevice > bs)
Set the base station.
Definition:
bs-scheduler.cc:84
cid.h
ns3::BSScheduler::m_bs
Ptr< BaseStationNetDevice > m_bs
base station
Definition:
bs-scheduler.h:125
ns3::WimaxPhy::ModulationType
ModulationType
ModulationType enumeration.
Definition:
wimax-phy.h:49
ns3::PacketBurst
this class implement a burst as a list of packets
Definition:
packet-burst.h:35
connection-manager.h
service-flow-manager.h
wimax-mac-queue.h
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:87
ss-manager.h
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:58
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:915
ns3::OfdmDlMapIe
This class implements the OFDM DL-MAP information element as described by "IEEE Standard for Local an...
Definition:
dl-mac-messages.h:446
Generated on Wed Nov 7 2018 10:02:15 for ns-3 by
1.8.14