A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
bs-uplink-scheduler-mbqos.h
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 INRIA/LRC - Computer Networks Laboratory
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  * Authors: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
19  * Flavio Kobuta <flaviokubota@gmail.com>
20  *
21  */
22 
23 #ifndef UPLINK_SCHEDULER_MBQOS_H
24 #define UPLINK_SCHEDULER_MBQOS_H
25 
26 #include <stdint.h>
27 #include "ul-mac-messages.h"
28 #include "ns3/nstime.h"
29 #include "wimax-phy.h"
30 #include "ul-job.h"
31 #include "service-flow-record.h"
32 #include "ns3/object.h"
33 #include "bs-uplink-scheduler.h"
34 #include "service-flow.h"
35 
36 namespace ns3 {
37 
38 class BaseStationNetDevice;
39 class SSRecord;
40 class ServiceFlow;
41 class ServiceFlowRecord;
42 class UlJob;
43 
70 {
71 public:
74  ~UplinkSchedulerMBQoS (void);
75 
76  static TypeId GetTypeId (void);
77 
78  std::list<OfdmUlMapIe> GetUplinkAllocations (void) const;
79 
84  void GetChannelDescriptorsToUpdate (bool&, bool&, bool&, bool&);
85  uint32_t CalculateAllocationStartTime (void);
86  void AddUplinkAllocation (OfdmUlMapIe &ulMapIe,
87  const uint32_t &allocationSize,
88  uint32_t &symbolsToAllocation,
89  uint32_t &availableSymbols);
90 
91  void Schedule (void);
92  void ServiceUnsolicitedGrants (const SSRecord *ssRecord,
93  enum ServiceFlow::SchedulingType schedulingType,
94  OfdmUlMapIe &ulMapIe,
95  const WimaxPhy::ModulationType modulationType,
96  uint32_t &symbolsToAllocation,
97  uint32_t &availableSymbols);
98  void ServiceBandwidthRequests (const SSRecord *ssRecord,
99  enum ServiceFlow::SchedulingType schedulingType,
100  OfdmUlMapIe &ulMapIe,
101  const WimaxPhy::ModulationType modulationType,
102  uint32_t &symbolsToAllocation,
103  uint32_t &availableSymbols);
104  bool ServiceBandwidthRequests (ServiceFlow *serviceFlow,
105  enum ServiceFlow::SchedulingType schedulingType,
106  OfdmUlMapIe &ulMapIe,
107  const WimaxPhy::ModulationType modulationType,
108  uint32_t &symbolsToAllocation,
109  uint32_t &availableSymbols);
110  void AllocateInitialRangingInterval (uint32_t &symbolsToAllocation, uint32_t &availableSymbols);
111  void SetupServiceFlow (SSRecord *ssRecord, ServiceFlow *serviceFlow);
112 
123  void CheckDeadline (uint32_t &availableSymbols);
124 
134  void CheckMinimumBandwidth (uint32_t &availableSymbols);
135 
140  void UplinkSchedWindowTimer (void);
141 
148  void EnqueueJob (UlJob::JobPriority priority, Ptr<UlJob> job);
149 
155  Ptr<UlJob> DequeueJob (UlJob::JobPriority priority);
156 
157  void ProcessBandwidthRequest (const BandwidthRequestHeader &bwRequestHdr);
158 
164  Time DetermineDeadline (ServiceFlow *serviceFlow);
165 
169  void InitOnce (void);
170 
176  uint32_t CountSymbolsQueue (std::list<Ptr<UlJob> > jobs);
177 
183  uint32_t CountSymbolsJobs (Ptr<UlJob> job);
184 
185  void OnSetRequestedBandwidth (ServiceFlowRecord *sfr);
186 
194  Ptr<UlJob>
195  CreateUlJob (SSRecord *ssRecord, enum ServiceFlow::SchedulingType schedType, ReqType reqType);
196 
197  uint32_t
198  GetPendingSize (ServiceFlow* serviceFlow);
199 
200  bool
201  ServiceBandwidthRequestsBytes (ServiceFlow *serviceFlow,
202  enum ServiceFlow::SchedulingType schedulingType, OfdmUlMapIe &ulMapIe,
203  const WimaxPhy::ModulationType modulationType,
204  uint32_t &symbolsToAllocation, uint32_t &availableSymbols, uint32_t allocationSizeBytes);
205 
206 private:
207  std::list<OfdmUlMapIe> m_uplinkAllocations;
208 
209  // queues for scheduler
210  std::list<Ptr<UlJob> > m_uplinkJobs_high;
211  std::list<Ptr<UlJob> > m_uplinkJobs_inter;
212  std::list<Ptr<UlJob> > m_uplinkJobs_low;
213 
214  // interval to reset window
215  Time m_windowInterval;
216 };
217 
218 } // namespace ns3
219 
220 #endif /* UPLINK_SCHEDULER_MBQOS_H */
keep track of time unit.
Definition: nstime.h:149
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
this class implements a structure to manage some parameters and statistics related to a service flow ...
this class implements the bandwidth-request mac Header as described by IEEE Standard for Local and me...
This class is used by the base station to store some information related to subscriber station in the...
Definition: ss-record.h:43
a unique identifier for an interface.
Definition: type-id.h:44