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
lte-rlc.cc
Go to the documentation of this file.
1
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
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: Nicola Baldo <nbaldo@cttc.es>
19
*/
20
21
22
#include "ns3/log.h"
23
#include "ns3/simulator.h"
24
25
#include "ns3/lte-rlc.h"
26
#include "ns3/lte-rlc-tag.h"
27
// #include "lte-mac-sap.h"
28
#include "ns3/lte-rlc-sap.h"
29
// #include "ff-mac-sched-sap.h"
30
31
NS_LOG_COMPONENT_DEFINE
(
"LteRlc"
);
32
33
namespace
ns3 {
34
35
36
38
39
class
LteRlcSpecificLteMacSapUser
:
public
LteMacSapUser
40
{
41
public
:
42
LteRlcSpecificLteMacSapUser
(
LteRlc
* rlc);
43
44
// Interface implemented from LteMacSapUser
45
virtual
void
NotifyTxOpportunity
(uint32_t bytes, uint8_t layer);
46
virtual
void
NotifyHarqDeliveryFailure
();
47
virtual
void
ReceivePdu
(
Ptr<Packet>
p);
48
49
private
:
50
LteRlcSpecificLteMacSapUser
();
51
LteRlc
*
m_rlc
;
52
};
53
54
LteRlcSpecificLteMacSapUser::LteRlcSpecificLteMacSapUser
(
LteRlc
* rlc)
55
: m_rlc (rlc)
56
{
57
}
58
59
LteRlcSpecificLteMacSapUser::LteRlcSpecificLteMacSapUser
()
60
{
61
}
62
63
void
64
LteRlcSpecificLteMacSapUser::NotifyTxOpportunity
(uint32_t bytes, uint8_t layer)
65
{
66
m_rlc
->
DoNotifyTxOpportunity
(bytes, layer);
67
}
68
69
void
70
LteRlcSpecificLteMacSapUser::NotifyHarqDeliveryFailure
()
71
{
72
m_rlc
->
DoNotifyHarqDeliveryFailure
();
73
}
74
75
void
76
LteRlcSpecificLteMacSapUser::ReceivePdu
(
Ptr<Packet>
p)
77
{
78
m_rlc
->
DoReceivePdu
(p);
79
}
80
81
83
84
NS_OBJECT_ENSURE_REGISTERED
(
LteRlc
);
85
86
LteRlc::LteRlc
()
87
: m_rlcSapUser (0),
88
m_macSapProvider (0),
89
m_rnti (0),
90
m_lcid (0)
91
{
92
NS_LOG_FUNCTION
(
this
);
93
m_rlcSapProvider
=
new
LteRlcSpecificLteRlcSapProvider<LteRlc>
(
this
);
94
m_macSapUser
=
new
LteRlcSpecificLteMacSapUser
(
this
);
95
}
96
97
TypeId
LteRlc::GetTypeId
(
void
)
98
{
99
static
TypeId
tid =
TypeId
(
"ns3::LteRlc"
)
100
.
SetParent
<
Object
> ()
101
.AddTraceSource (
"TxPDU"
,
102
"PDU transmission notified to the MAC."
,
103
MakeTraceSourceAccessor
(&
LteRlc::m_txPdu
))
104
.AddTraceSource (
"RxPDU"
,
105
"PDU received."
,
106
MakeTraceSourceAccessor
(&
LteRlc::m_rxPdu
))
107
;
108
return
tid;
109
}
110
111
void
112
LteRlc::SetRnti
(uint16_t rnti)
113
{
114
NS_LOG_FUNCTION
(
this
<< (uint32_t) rnti);
115
m_rnti
= rnti;
116
}
117
118
void
119
LteRlc::SetLcId
(uint8_t lcId)
120
{
121
NS_LOG_FUNCTION
(
this
<< (uint32_t) lcId);
122
m_lcid
= lcId;
123
}
124
125
LteRlc::~LteRlc
()
126
{
127
NS_LOG_FUNCTION
(
this
);
128
delete
(
m_rlcSapProvider
);
129
delete
(
m_macSapUser
);
130
}
131
132
void
133
LteRlc::SetLteRlcSapUser
(
LteRlcSapUser
* s)
134
{
135
NS_LOG_FUNCTION
(
this
<< s);
136
m_rlcSapUser
= s;
137
}
138
139
LteRlcSapProvider
*
140
LteRlc::GetLteRlcSapProvider
()
141
{
142
NS_LOG_FUNCTION
(
this
);
143
return
m_rlcSapProvider
;
144
}
145
146
void
147
LteRlc::SetLteMacSapProvider
(
LteMacSapProvider
* s)
148
{
149
NS_LOG_FUNCTION
(
this
<< s);
150
m_macSapProvider
= s;
151
}
152
153
LteMacSapUser
*
154
LteRlc::GetLteMacSapUser
()
155
{
156
NS_LOG_FUNCTION
(
this
);
157
return
m_macSapUser
;
158
}
159
160
161
163
164
NS_OBJECT_ENSURE_REGISTERED
(
LteRlcSm
);
165
166
LteRlcSm::LteRlcSm
()
167
{
168
169
NS_LOG_FUNCTION
(
this
);
170
Simulator::ScheduleNow
(&
LteRlcSm::Start
,
this
);
171
}
172
173
LteRlcSm::~LteRlcSm
()
174
{
175
176
}
177
178
TypeId
179
LteRlcSm::GetTypeId
(
void
)
180
{
181
static
TypeId
tid =
TypeId
(
"ns3::LteRlcSm"
)
182
.
SetParent
<
LteRlc
> ()
183
.AddConstructor<LteRlcSm> ()
184
;
185
return
tid;
186
}
187
188
void
189
LteRlcSm::DoTransmitPdcpPdu
(
Ptr<Packet>
p)
190
{
191
NS_LOG_FUNCTION
(
this
<< p);
192
}
193
194
void
195
LteRlcSm::DoReceivePdu
(
Ptr<Packet>
p)
196
{
197
NS_LOG_FUNCTION
(
this
<< p);
198
// RLC Performance evaluation
199
RlcTag
rlcTag;
200
Time
delay;
201
if
(p->
FindFirstMatchingByteTag
(rlcTag))
202
{
203
delay =
Simulator::Now
() - rlcTag.
GetSenderTimestamp
();
204
}
205
NS_LOG_LOGIC
(
" RNTI="
<<
m_rnti
206
<<
" LCID="
<< (uint32_t)
m_lcid
207
<<
" size="
<< p->
GetSize
()
208
<<
" delay="
<< delay.
GetNanoSeconds
());
209
m_rxPdu
(
m_rnti
,
m_lcid
, p->
GetSize
(), delay.
GetNanoSeconds
() );
210
}
211
212
void
213
LteRlcSm::DoNotifyTxOpportunity
(uint32_t bytes, uint8_t layer)
214
{
215
NS_LOG_FUNCTION
(
this
<< bytes);
216
LteMacSapProvider::TransmitPduParameters
params;
217
params.
pdu
= Create<Packet> (bytes);
218
params.
rnti
=
m_rnti
;
219
params.
lcid
=
m_lcid
;
220
params.
layer
= layer;
221
222
// RLC Performance evaluation
223
RlcTag
tag (
Simulator::Now
());
224
params.
pdu
->
AddByteTag
(tag);
225
NS_LOG_LOGIC
(
" RNTI="
<<
m_rnti
226
<<
" LCID="
<< (uint32_t)
m_lcid
227
<<
" size="
<< bytes);
228
m_txPdu
(
m_rnti
,
m_lcid
, bytes);
229
230
m_macSapProvider
->
TransmitPdu
(params);
231
ReportBufferStatus
();
232
}
233
234
void
235
LteRlcSm::DoNotifyHarqDeliveryFailure
()
236
{
237
NS_LOG_FUNCTION
(
this
);
238
}
239
240
void
241
LteRlcSm::Start
()
242
{
243
NS_LOG_FUNCTION
(
this
);
244
ReportBufferStatus
();
245
}
246
247
void
248
LteRlcSm::ReportBufferStatus
()
249
{
250
NS_LOG_FUNCTION
(
this
);
251
LteMacSapProvider::ReportBufferStatusParameters
p;
252
p.
rnti
=
m_rnti
;
253
p.
lcid
=
m_lcid
;
254
p.
txQueueSize
= 80000;
255
p.
txQueueHolDelay
= 10;
256
p.
retxQueueSize
= 0;
257
p.
retxQueueHolDelay
= 0;
258
p.
statusPduSize
= 0;
259
m_macSapProvider
->
ReportBufferStatus
(p);
260
}
261
262
263
264
266
267
// LteRlcTm::~LteRlcTm ()
268
// {
269
// }
270
272
273
// LteRlcUm::~LteRlcUm ()
274
// {
275
// }
276
278
279
// LteRlcAm::~LteRlcAm ()
280
// {
281
// }
282
283
284
}
// namespace ns3
src
lte
model
lte-rlc.cc
Generated on Fri Dec 21 2012 19:00:39 for ns-3 by
1.8.1.2