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
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
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
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 */
src
wimax
model
ul-job.h
Generated on Tue Oct 9 2012 16:45:50 for ns-3 by
1.8.1.2