A Discrete-Event Network Simulator
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"
13#include "cid.h"
14#include "connection-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
28namespace ns3
29{
30
31NS_LOG_COMPONENT_DEFINE("BSScheduler");
32
34
35TypeId
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
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
52 : m_downlinkBursts(new std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst>>>())
53{
54}
55
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
71void
76
79{
80 return m_bs;
81}
82
83bool
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
~BSScheduler() override
virtual Ptr< BaseStationNetDevice > GetBs()
Get the base station.
virtual void SetBs(Ptr< BaseStationNetDevice > bs)
Set the base station.
Ptr< BaseStationNetDevice > m_bs
base station
static TypeId GetTypeId()
Get the type ID.
std::list< std::pair< OfdmDlMapIe *, Ptr< PacketBurst > > > * m_downlinkBursts
down link bursts
bool CheckForFragmentation(Ptr< WimaxConnection > connection, int availableSymbols, WimaxPhy::ModulationType modulationType)
Check if the packet fragmentation is possible for transport connection.
@ TRANSPORT
Definition cid.h:35
A base class which provides memory management and object aggregation.
Definition object.h:78
This class implements the OFDM DL-MAP information element as described by "IEEE Standard forLocal and...
this class implement a burst as a list of packets
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
ModulationType
ModulationType enumeration.
Definition wimax-phy.h:43
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition log.h:264
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.
STL namespace.