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-ue-net-device.cc
Go to the documentation of this file.
1
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
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: Giuseppe Piro <g.piro@poliba.it>
19
* Nicola Baldo <nbaldo@cttc.es>
20
* Marco Miozzo <mmiozzo@cttc.es>
21
*/
22
23
#include "ns3/llc-snap-header.h"
24
#include "ns3/simulator.h"
25
#include "ns3/callback.h"
26
#include "ns3/node.h"
27
#include "ns3/packet.h"
28
#include "
lte-net-device.h
"
29
#include "ns3/packet-burst.h"
30
#include "ns3/uinteger.h"
31
#include "ns3/trace-source-accessor.h"
32
#include "ns3/pointer.h"
33
#include "ns3/enum.h"
34
#include "ns3/lte-enb-net-device.h"
35
#include "
lte-ue-net-device.h
"
36
#include "
lte-ue-mac.h
"
37
#include "
lte-ue-rrc.h
"
38
#include "ns3/ipv4-header.h"
39
#include "ns3/ipv4.h"
40
#include "
lte-amc.h
"
41
#include "
lte-ue-phy.h
"
42
#include "
epc-ue-nas.h
"
43
#include <ns3/ipv4-l3-protocol.h>
44
#include <ns3/log.h>
45
#include "
epc-tft.h
"
46
47
NS_LOG_COMPONENT_DEFINE
(
"LteUeNetDevice"
);
48
49
namespace
ns3 {
50
51
NS_OBJECT_ENSURE_REGISTERED
( LteUeNetDevice);
52
53
54
TypeId
LteUeNetDevice::GetTypeId
(
void
)
55
{
56
static
TypeId
57
tid =
58
TypeId
(
"ns3::LteUeNetDevice"
)
59
.
SetParent
<
LteNetDevice
> ()
60
.AddAttribute (
"LteUeRrc"
,
61
"The RRC associated to this UeNetDevice"
,
62
PointerValue
(),
63
MakePointerAccessor (&
LteUeNetDevice::m_rrc
),
64
MakePointerChecker <LteUeRrc> ())
65
.AddAttribute (
"LteUeMac"
,
66
"The MAC associated to this UeNetDevice"
,
67
PointerValue
(),
68
MakePointerAccessor (&
LteUeNetDevice::m_mac
),
69
MakePointerChecker <LteUeMac> ())
70
.AddAttribute (
"LteUePhy"
,
71
"The PHY associated to this UeNetDevice"
,
72
PointerValue
(),
73
MakePointerAccessor (&
LteUeNetDevice::m_phy
),
74
MakePointerChecker <LteUePhy> ())
75
.AddAttribute (
"Imsi"
,
76
"International Mobile Subscriber Identity assigned to this UE"
,
77
TypeId::ATTR_GET
,
78
UintegerValue
(0),
// not used because the attribute is read-only
79
MakeUintegerAccessor (&
LteUeNetDevice::m_imsi
),
80
MakeUintegerChecker<uint64_t> ())
81
;
82
83
return
tid;
84
}
85
86
87
LteUeNetDevice::LteUeNetDevice
(
void
)
88
{
89
NS_LOG_FUNCTION
(
this
);
90
NS_FATAL_ERROR
(
"This constructor should not be called"
);
91
}
92
93
94
LteUeNetDevice::LteUeNetDevice
(
Ptr<Node>
node,
Ptr<LteUePhy>
phy,
Ptr<LteUeMac>
mac,
Ptr<LteUeRrc>
rrc,
Ptr<EpcUeNas>
nas, uint64_t imsi)
95
{
96
NS_LOG_FUNCTION
(
this
);
97
m_phy
= phy;
98
m_mac
= mac;
99
m_rrc
= rrc;
100
m_nas
= nas;
101
SetNode
(node);
102
m_imsi
= imsi;
103
}
104
105
LteUeNetDevice::~LteUeNetDevice
(
void
)
106
{
107
NS_LOG_FUNCTION
(
this
);
108
}
109
110
void
111
LteUeNetDevice::DoDispose
(
void
)
112
{
113
NS_LOG_FUNCTION
(
this
);
114
m_targetEnb
= 0;
115
m_mac
->
Dispose
();
116
m_mac
= 0;
117
m_rrc
->
Dispose
();
118
m_rrc
= 0;
119
m_phy
->
Dispose
();
120
m_phy
= 0;
121
m_nas
->
Dispose
();
122
m_nas
= 0;
123
LteNetDevice::DoDispose
();
124
}
125
126
void
127
LteUeNetDevice::UpdateConfig
(
void
)
128
{
129
NS_LOG_FUNCTION
(
this
);
130
m_nas
->
SetImsi
(
m_imsi
);
131
m_rrc
->
SetImsi
(
m_imsi
);
132
133
}
134
135
136
137
Ptr<LteUeMac>
138
LteUeNetDevice::GetMac
(
void
)
const
139
{
140
NS_LOG_FUNCTION
(
this
);
141
return
m_mac
;
142
}
143
144
145
Ptr<LteUeRrc>
146
LteUeNetDevice::GetRrc
(
void
)
const
147
{
148
NS_LOG_FUNCTION
(
this
);
149
return
m_rrc
;
150
}
151
152
153
Ptr<LteUePhy>
154
LteUeNetDevice::GetPhy
(
void
)
const
155
{
156
NS_LOG_FUNCTION
(
this
);
157
return
m_phy
;
158
}
159
160
Ptr<EpcUeNas>
161
LteUeNetDevice::GetNas
(
void
)
const
162
{
163
NS_LOG_FUNCTION
(
this
);
164
return
m_nas
;
165
}
166
167
uint64_t
168
LteUeNetDevice::GetImsi
()
const
169
{
170
NS_LOG_FUNCTION
(
this
);
171
return
m_imsi
;
172
}
173
174
void
175
LteUeNetDevice::SetTargetEnb
(
Ptr<LteEnbNetDevice>
enb)
176
{
177
NS_LOG_FUNCTION
(
this
<< enb);
178
m_targetEnb
= enb;
179
}
180
181
182
Ptr<LteEnbNetDevice>
183
LteUeNetDevice::GetTargetEnb
(
void
)
184
{
185
NS_LOG_FUNCTION
(
this
);
186
return
m_targetEnb
;
187
}
188
189
void
190
LteUeNetDevice::DoInitialize
(
void
)
191
{
192
NS_LOG_FUNCTION
(
this
);
193
UpdateConfig
();
194
m_phy
->
Initialize
();
195
m_mac
->
Initialize
();
196
m_rrc
->
Initialize
();
197
}
198
199
bool
200
LteUeNetDevice::Send
(
Ptr<Packet>
packet,
const
Address
& dest, uint16_t protocolNumber)
201
{
202
NS_LOG_FUNCTION
(
this
<< dest << protocolNumber);
203
if
(protocolNumber !=
Ipv4L3Protocol::PROT_NUMBER
)
204
{
205
NS_LOG_INFO
(
"unsupported protocol "
<< protocolNumber <<
", only IPv4 is supported"
);
206
return
true
;
207
}
208
return
m_nas
->
Send
(packet);
209
}
210
211
212
}
// namespace ns3
src
lte
model
lte-ue-net-device.cc
Generated on Fri Aug 30 2013 01:42:56 for ns-3 by
1.8.1.2