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
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
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
NS_LOG_COMPONENT_DEFINE
(
"BSScheduler"
);
39
40
namespace
ns3 {
41
NS_OBJECT_ENSURE_REGISTERED
(BSScheduler);
42
43
TypeId
44
BSScheduler::GetTypeId
(
void
)
45
{
46
static
TypeId
tid =
TypeId
(
"ns3::BSScheduler"
).
SetParent
<
Object
> ();
47
return
tid;
48
}
49
50
BSScheduler::BSScheduler
()
51
: m_downlinkBursts (new std::
list
<std::pair<
OfdmDlMapIe
*,
Ptr
<
PacketBurst
> > > ())
52
{
53
// m_downlinkBursts is filled by AddDownlinkBurst and emptied by
54
// wimax-bs-net-device::sendBurst and wimax-ss-net-device::sendBurst
55
}
56
57
BSScheduler::BSScheduler
(
Ptr<BaseStationNetDevice>
bs)
58
: m_downlinkBursts (new std::
list
<std::pair<
OfdmDlMapIe
*,
Ptr
<
PacketBurst
> > > ())
59
{
60
61
}
62
63
BSScheduler::~BSScheduler
(
void
)
64
{
65
std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > > *downlinkBursts =
m_downlinkBursts
;
66
std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > pair;
67
while
(downlinkBursts->size ())
68
{
69
pair = downlinkBursts->front ();
70
pair.second = 0;
71
delete
pair.first;
72
}
73
SetBs
(0);
74
delete
m_downlinkBursts
;
75
m_downlinkBursts
= 0;
76
}
77
78
void
79
BSScheduler::SetBs
(
Ptr<BaseStationNetDevice>
bs)
80
{
81
m_bs
= bs;
82
}
83
84
Ptr<BaseStationNetDevice>
BSScheduler::GetBs
(
void
)
85
{
86
return
m_bs
;
87
}
88
89
bool
90
BSScheduler::CheckForFragmentation
(
Ptr<WimaxConnection>
connection,
91
int
availableSymbols,
92
WimaxPhy::ModulationType
modulationType)
93
{
94
NS_LOG_INFO
(
"BS Scheduler, CheckForFragmentation"
);
95
if
(connection->GetType () !=
Cid::TRANSPORT
)
96
{
97
NS_LOG_INFO
(
"\t No Transport connction, Fragmentation IS NOT possible"
);
98
return
false
;
99
}
100
uint32_t availableByte =
GetBs
()->GetPhy ()->
101
GetNrBytes (availableSymbols, modulationType);
102
103
uint32_t headerSize = connection->GetQueue ()->GetFirstPacketHdrSize (
104
MacHeaderType::HEADER_TYPE_GENERIC
);
105
NS_LOG_INFO
(
"\t availableByte = "
<< availableByte <<
106
" headerSize = "
<< headerSize);
107
108
if
(availableByte > headerSize)
109
{
110
NS_LOG_INFO
(
"\t Fragmentation IS possible"
);
111
return
true
;
112
}
113
else
114
{
115
NS_LOG_INFO
(
"\t Fragmentation IS NOT possible"
);
116
return
false
;
117
}
118
}
119
}
// namespace ns3
NS_LOG_COMPONENT_DEFINE
NS_LOG_COMPONENT_DEFINE("BSScheduler")
ns3::Ptr
smart pointer class similar to boost::intrusive_ptr
Definition:
ptr.h:59
wimax-connection.h
ns3::MacHeaderType::HEADER_TYPE_GENERIC
Definition:
wimax-mac-header.h:44
burst-profile-manager.h
service-flow-record.h
service-flow.h
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Definition:
log.h:264
ns3::BSScheduler::CheckForFragmentation
bool CheckForFragmentation(Ptr< WimaxConnection > connection, int availableSymbols, WimaxPhy::ModulationType modulationType)
Definition:
bs-scheduler.cc:90
ns3::BSScheduler::~BSScheduler
~BSScheduler(void)
Definition:
bs-scheduler.cc:63
ns3::BSScheduler::m_downlinkBursts
std::list< std::pair< OfdmDlMapIe *, Ptr< PacketBurst > > > * m_downlinkBursts
Definition:
bs-scheduler.h:109
ns3::BSScheduler::BSScheduler
BSScheduler()
Definition:
bs-scheduler.cc:50
ns3::NS_OBJECT_ENSURE_REGISTERED
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
bs-net-device.h
ns3::BSScheduler::GetTypeId
static TypeId GetTypeId(void)
Definition:
bs-scheduler.cc:44
list
#define list
Definition:
openflow-interface.h:47
wimax-mac-header.h
ss-record.h
ns3::Cid::TRANSPORT
Definition:
cid.h:44
ns3::BSScheduler::GetBs
virtual Ptr< BaseStationNetDevice > GetBs(void)
Definition:
bs-scheduler.cc:84
bs-scheduler.h
ns3::BSScheduler::SetBs
virtual void SetBs(Ptr< BaseStationNetDevice > bs)
Definition:
bs-scheduler.cc:79
cid.h
ns3::BSScheduler::m_bs
Ptr< BaseStationNetDevice > m_bs
Definition:
bs-scheduler.h:108
ns3::WimaxPhy::ModulationType
ModulationType
Definition:
wimax-phy.h:48
ns3::PacketBurst
Definition:
packet-burst.h:32
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:63
ss-manager.h
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Definition:
type-id.cc:610
ns3::OfdmDlMapIe
Definition:
dl-mac-messages.h:262
src
wimax
model
bs-scheduler.cc
Generated on Sun Apr 20 2014 11:15:05 for ns-3 by
1.8.6