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
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
ul-job.h
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
36
enum
ReqType
37
{
38
DATA, UNICAST_POLLING
39
};
40
45
class
UlJob
:
public
Object
46
{
47
public
:
48
enum
JobPriority
49
{
50
LOW, INTERMEDIATE, HIGH
51
};
52
UlJob
(
void
);
53
virtual
~
UlJob
(
void
);
54
SSRecord
*
55
GetSsRecord (
void
);
56
void
SetSsRecord (
SSRecord
* ssRecord);
57
enum
ServiceFlow::SchedulingType GetSchedulingType (
void
);
58
void
SetSchedulingType (ServiceFlow::SchedulingType schedulingType);
59
ServiceFlow
*
60
GetServiceFlow (
void
);
61
void
SetServiceFlow (
ServiceFlow
*serviceFlow);
62
63
ReqType GetType (
void
);
64
void
SetType (ReqType type);
65
66
Time
GetReleaseTime (
void
);
67
void
SetReleaseTime (
Time
releaseTime);
68
69
Time
GetPeriod (
void
);
70
void
SetPeriod (
Time
period);
71
72
Time
GetDeadline (
void
);
73
void
SetDeadline (
Time
deadline);
74
75
uint32_t GetSize (
void
);
76
void
SetSize (uint32_t size);
77
78
private
:
79
friend
bool
operator == (
const
UlJob
&a,
const
UlJob
&b);
80
81
Time
m_releaseTime;
/* The time after which the job can be processed*/
82
Time
m_period;
/* For periodic jobs*/
83
Time
m_deadline;
/* Request should be satisfied by this time */
84
uint32_t m_size;
/* Number of minislots requested */
85
enum
ServiceFlow::SchedulingType m_schedulingType;
/* Scheduling type of flow */
86
87
uint8_t m_flag;
/* To delete or not..*/
88
uint8_t m_retryCount;
89
double
m_ugsJitter;
/* The jitter in the grant, valid only for UGS flows */
90
int
m_jitterSamples;
91
double
m_last_jitterCalTime;
/* Last time avg jitter was calculated */
92
93
SSRecord
*m_ssRecord;
/* Pointer to SSRecord */
94
95
ReqType m_type;
/* Type of request, DATA or Unicast req slots */
96
ServiceFlow
*m_serviceFlow;
97
98
};
99
100
101
class
PriorityUlJob
:
public
Object
102
{
103
108
public
:
109
PriorityUlJob
();
110
int
GetPriority (
void
);
111
void
SetPriority (
int
priority);
112
113
Ptr<UlJob>
114
GetUlJob (
void
);
115
void
SetUlJob (
Ptr<UlJob>
job);
116
117
private
:
118
int
m_priority;
119
Ptr<UlJob>
m_job;
120
};
121
122
struct
SortProcess
:
public
std::binary_function<PriorityUlJob*, PriorityUlJob*, bool>
123
{
124
bool
operator () (
PriorityUlJob
& left,
PriorityUlJob
& right)
const
125
{
// return true if left is logically less then right for given comparison
126
if
(left.GetPriority () < right.GetPriority ())
127
{
128
return
true
;
129
}
130
else
if
(left.GetPriority () == right.GetPriority ())
131
{
132
int32_t leftBacklogged = left.GetUlJob ()->GetServiceFlow ()->GetRecord ()->GetBacklogged ();
133
int32_t rightBacklogged = left.GetUlJob ()->GetServiceFlow ()->GetRecord ()->GetBacklogged ();
134
if
(leftBacklogged <= rightBacklogged)
135
{
136
return
true
;
137
}
138
else
139
{
140
return
false
;
141
}
142
}
143
else
144
{
145
return
false
;
146
}
147
}
148
};
149
150
struct
SortProcessPtr
:
public
std::binary_function< Ptr<PriorityUlJob>, Ptr<PriorityUlJob>, bool>
151
{
152
bool
operator () (
Ptr<PriorityUlJob>
& left,
Ptr<PriorityUlJob>
& right)
const
153
{
//return true if left is logically less then right for given comparison
154
if
(left->GetPriority () < right->GetPriority ())
155
{
156
return
true
;
157
}
158
else
if
(left->GetPriority () == right->GetPriority ())
159
{
160
int32_t leftBacklogged = left->GetUlJob ()->GetServiceFlow ()->GetRecord ()->GetBacklogged ();
161
int32_t rightBacklogged = left->GetUlJob ()->GetServiceFlow ()->GetRecord ()->GetBacklogged ();
162
if
(leftBacklogged <= rightBacklogged)
163
{
164
return
true
;
165
}
166
else
167
{
168
return
false
;
169
}
170
}
171
else
172
{
173
return
false
;
174
}
175
}
176
};
177
178
179
}
// namespace ns3
180
181
#endif
/* UL_JOB_H */
ns3::Time
keep track of time unit.
Definition:
nstime.h:149
ns3::Ptr
smart pointer class similar to boost::intrusive_ptr
Definition:
ptr.h:59
ns3::UlJob
this class implements a structure to compute the priority of service flows
Definition:
ul-job.h:45
ns3::PriorityUlJob
Definition:
ul-job.h:101
ns3::SortProcessPtr
Definition:
ul-job.h:150
ns3::SortProcess
Definition:
ul-job.h:122
ns3::ServiceFlow
Definition:
service-flow.h:39
ns3::PriorityUlJob::PriorityUlJob
PriorityUlJob()
this class implements an auxiliar struct to compute the priority of the rtPS and nrtPS in the interme...
Definition:
ul-job.cc:140
ns3::SSRecord
This class is used by the base station to store some information related to subscriber station in the...
Definition:
ss-record.h:43
ns3::Object
a base class which provides memory management and object aggregation
Definition:
object.h:63
src
wimax
model
ul-job.h
Generated on Sun Mar 16 2014 11:25:13 for ns-3 by
1.8.6