A Discrete-Event Network Simulator
API
ul-job.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c)
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: Juliana Freitag Borin, Flavio Kubota and Nelson L.
19  * S. da Fonseca - wimaxgroup@lrc.ic.unicamp.br
20  */
21 
22 #ifndef UL_JOB_H
23 #define UL_JOB_H
24 
25 #include <stdint.h>
26 #include "ns3/header.h"
27 #include "ss-record.h"
28 #include "service-flow.h"
29 #include "service-flow-record.h"
30 
31 namespace ns3 {
32 
33 class SSRecord;
34 class ServiceFlow;
35 
37 enum ReqType
38 {
41 };
42 
47 class UlJob : public Object
48 {
49 public:
52  {
53  LOW,
56  };
57  UlJob (void);
58  virtual ~UlJob (void);
63  SSRecord *
64  GetSsRecord (void);
69  void SetSsRecord (SSRecord* ssRecord);
79  void SetSchedulingType (ServiceFlow::SchedulingType schedulingType);
84  ServiceFlow *
85  GetServiceFlow (void);
90  void SetServiceFlow (ServiceFlow *serviceFlow);
91 
96  ReqType GetType (void);
101  void SetType (ReqType type);
102 
107  Time GetReleaseTime (void);
112  void SetReleaseTime (Time releaseTime);
113 
118  Time GetPeriod (void);
123  void SetPeriod (Time period);
124 
129  Time GetDeadline (void);
134  void SetDeadline (Time deadline);
135 
140  uint32_t GetSize (void);
145  void SetSize (uint32_t size);
146 
147 private:
149  friend bool operator == (const UlJob &a, const UlJob &b);
150 
154  uint32_t m_size;
156 
157  uint8_t m_flag;
158  uint8_t m_retryCount;
159  double m_ugsJitter;
162 
164 
167 
168 };
169 
173 class PriorityUlJob : public Object
174 {
175 
180 public:
181  PriorityUlJob ();
186  int GetPriority (void);
191  void SetPriority (int priority);
192 
197  Ptr<UlJob>
198  GetUlJob (void);
203  void SetUlJob (Ptr<UlJob> job);
204 
205 private:
208 };
209 
211 struct SortProcess : public std::binary_function<PriorityUlJob*, PriorityUlJob*, bool>
212 {
219  bool operator () (PriorityUlJob& left, PriorityUlJob& right) const
220  {
221  if (left.GetPriority () < right.GetPriority ())
222  {
223  return true;
224  }
225  else if (left.GetPriority () == right.GetPriority ())
226  {
227  int32_t leftBacklogged = left.GetUlJob ()->GetServiceFlow ()->GetRecord ()->GetBacklogged ();
228  int32_t rightBacklogged = left.GetUlJob ()->GetServiceFlow ()->GetRecord ()->GetBacklogged ();
229  if (leftBacklogged <= rightBacklogged)
230  {
231  return true;
232  }
233  else
234  {
235  return false;
236  }
237  }
238  else
239  {
240  return false;
241  }
242  }
243 };
244 
246 struct SortProcessPtr: public std::binary_function< Ptr<PriorityUlJob>, Ptr<PriorityUlJob>, bool>
247 {
255  {
256  if (left->GetPriority () < right->GetPriority ())
257  {
258  return true;
259  }
260  else if (left->GetPriority () == right->GetPriority ())
261  {
262  int32_t leftBacklogged = left->GetUlJob ()->GetServiceFlow ()->GetRecord ()->GetBacklogged ();
263  int32_t rightBacklogged = left->GetUlJob ()->GetServiceFlow ()->GetRecord ()->GetBacklogged ();
264  if (leftBacklogged <= rightBacklogged)
265  {
266  return true;
267  }
268  else
269  {
270  return false;
271  }
272  }
273  else
274  {
275  return false;
276  }
277  }
278 };
279 
280 
281 } // namespace ns3
282 
283 #endif /* UL_JOB_H */
ReqType GetType(void)
Get type.
Definition: ul-job.cc:59
bool operator()(Ptr< PriorityUlJob > &left, Ptr< PriorityUlJob > &right) const
comparison operator
Definition: ul-job.h:254
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
Time GetPeriod(void)
Get period.
Definition: ul-job.cc:95
ReqType
Request type enumeration.
Definition: ul-job.h:37
void SetDeadline(Time deadline)
Set deadline.
Definition: ul-job.cc:111
virtual ~UlJob(void)
Definition: ul-job.cc:31
Time m_releaseTime
The time after which the job can be processed.
Definition: ul-job.h:151
void SetSize(uint32_t size)
Set size.
Definition: ul-job.cc:123
this class implements a structure to compute the priority of service flows
Definition: ul-job.h:47
UlJob(void)
Definition: ul-job.cc:27
Ptr< UlJob > GetUlJob(void)
Get UL job functiion.
Definition: ul-job.cc:163
SSRecord * m_ssRecord
Pointer to SSRecord.
Definition: ul-job.h:163
Time GetDeadline(void)
Get deadline.
Definition: ul-job.cc:106
void SetReleaseTime(Time releaseTime)
Set release time.
Definition: ul-job.cc:89
void SetPeriod(Time period)
Set period.
Definition: ul-job.cc:100
PriorityUlJob class.
Definition: ul-job.h:173
SortProcessPtr structure.
Definition: ul-job.h:246
enum ServiceFlow::SchedulingType m_schedulingType
Scheduling type of flow.
Definition: ul-job.h:155
Time GetReleaseTime(void)
Get release time.
Definition: ul-job.cc:83
friend bool operator==(const UlJob &a, const UlJob &b)
equality operator
Definition: ul-job.cc:134
uint8_t m_retryCount
retry count
Definition: ul-job.h:158
Time m_deadline
Request should be satisfied by this time.
Definition: ul-job.h:153
void SetSsRecord(SSRecord *ssRecord)
Set SS record.
Definition: ul-job.cc:41
bool operator()(PriorityUlJob &left, PriorityUlJob &right) const
comparison operator
Definition: ul-job.h:219
void SetPriority(int priority)
Set priority.
Definition: ul-job.cc:157
SortProcess structure.
Definition: ul-job.h:211
SSRecord * GetSsRecord(void)
Get SS record.
Definition: ul-job.cc:36
void SetServiceFlow(ServiceFlow *serviceFlow)
Set service flow.
Definition: ul-job.cc:77
ReqType m_type
Type of request, DATA or Unicast req slots.
Definition: ul-job.h:165
Every class exported by the ns3 library is enclosed in the ns3 namespace.
This class implements service flows as described by the IEEE-802.16 standard.
Definition: service-flow.h:39
void SetUlJob(Ptr< UlJob > job)
Set UL job.
Definition: ul-job.cc:168
Time m_period
For periodic jobs.
Definition: ul-job.h:152
uint32_t m_size
Number of minislots requested.
Definition: ul-job.h:154
int m_jitterSamples
jitter samples
Definition: ul-job.h:160
int m_priority
the priority
Definition: ul-job.h:206
double m_ugsJitter
The jitter in the grant, valid only for UGS flows.
Definition: ul-job.h:159
JobPriority
Job priority enumeration.
Definition: ul-job.h:51
void SetSchedulingType(ServiceFlow::SchedulingType schedulingType)
Set scheduling type.
Definition: ul-job.cc:53
ServiceFlow * GetServiceFlow(void)
Get service flow.
Definition: ul-job.cc:71
PriorityUlJob()
this class implements an auxiliary struct to compute the priority of the rtPS and nrtPS in the interm...
Definition: ul-job.cc:146
ServiceFlow * m_serviceFlow
service flow
Definition: ul-job.h:166
This class is used by the base station to store some information related to subscriber station in the...
Definition: ss-record.h:43
A base class which provides memory management and object aggregation.
Definition: object.h:87
int GetPriority(void)
Get priority.
Definition: ul-job.cc:151
enum ServiceFlow::SchedulingType GetSchedulingType(void)
Get scheduling type.
Definition: ul-job.cc:47
uint32_t GetSize(void)
Get size.
Definition: ul-job.cc:117
uint8_t m_flag
To delete or not.
Definition: ul-job.h:157
SchedulingType
section 11.13.11 Service flow scheduling type, page 701
Definition: service-flow.h:58
double m_last_jitterCalTime
Last time avg jitter was calculated.
Definition: ul-job.h:161
Ptr< UlJob > m_job
the job
Definition: ul-job.h:207
void SetType(ReqType type)
Set type.
Definition: ul-job.cc:65