A Discrete-Event Network Simulator
API
 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 
44 TypeId
46 {
47  static TypeId tid = TypeId ("ns3::BSScheduler").SetParent<Object> ();
48  return tid;
49 }
50 
52  : m_downlinkBursts (new std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > > ())
53 {
54  // m_downlinkBursts is filled by AddDownlinkBurst and emptied by
55  // wimax-bs-net-device::sendBurst and wimax-ss-net-device::sendBurst
56 }
57 
59  : m_downlinkBursts (new std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > > ())
60 {
61 
62 }
63 
65 {
66  std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > > *downlinkBursts = m_downlinkBursts;
67  std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > pair;
68  while (downlinkBursts->size ())
69  {
70  pair = downlinkBursts->front ();
71  pair.second = 0;
72  delete pair.first;
73  }
74  SetBs (0);
75  delete m_downlinkBursts;
76  m_downlinkBursts = 0;
77 }
78 
79 void
81 {
82  m_bs = bs;
83 }
84 
86 {
87  return m_bs;
88 }
89 
90 bool
92  int availableSymbols,
93  WimaxPhy::ModulationType modulationType)
94 {
95  NS_LOG_INFO ("BS Scheduler, CheckForFragmentation");
96  if (connection->GetType () != Cid::TRANSPORT)
97  {
98  NS_LOG_INFO ("\t No Transport connction, Fragmentation IS NOT possible");
99  return false;
100  }
101  uint32_t availableByte = GetBs ()->GetPhy ()->
102  GetNrBytes (availableSymbols, modulationType);
103 
104  uint32_t headerSize = connection->GetQueue ()->GetFirstPacketHdrSize (
106  NS_LOG_INFO ("\t availableByte = " << availableByte <<
107  " headerSize = " << headerSize);
108 
109  if (availableByte > headerSize)
110  {
111  NS_LOG_INFO ("\t Fragmentation IS possible");
112  return true;
113  }
114  else
115  {
116  NS_LOG_INFO ("\t Fragmentation IS NOT possible");
117  return false;
118  }
119 }
120 } // namespace ns3
NS_LOG_COMPONENT_DEFINE("BSScheduler")
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
#define NS_LOG_INFO(msg)
Definition: log.h:298
bool CheckForFragmentation(Ptr< WimaxConnection > connection, int availableSymbols, WimaxPhy::ModulationType modulationType)
Definition: bs-scheduler.cc:91
std::list< std::pair< OfdmDlMapIe *, Ptr< PacketBurst > > > * m_downlinkBursts
Definition: bs-scheduler.h:109
static TypeId GetTypeId(void)
Definition: bs-scheduler.cc:45
#define list
virtual Ptr< BaseStationNetDevice > GetBs(void)
Definition: bs-scheduler.cc:85
virtual void SetBs(Ptr< BaseStationNetDevice > bs)
Definition: bs-scheduler.cc:80
Ptr< BaseStationNetDevice > m_bs
Definition: bs-scheduler.h:108
Doxygen introspection did not find any typical Config paths.
Definition: packet-burst.h:32
a base class which provides memory management and object aggregation
Definition: object.h:63
a unique identifier for an interface.
Definition: type-id.h:49
TypeId SetParent(TypeId tid)
Definition: type-id.cc:611