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
ns3::Ptr< Node >
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
Definition:
log.h:311
ns3::LteUeNetDevice::m_rrc
Ptr< LteUeRrc > m_rrc
Definition:
lte-ue-net-device.h:123
ns3::LteUeNetDevice::~LteUeNetDevice
virtual ~LteUeNetDevice(void)
Definition:
lte-ue-net-device.cc:105
ns3::LteNetDevice::DoDispose
virtual void DoDispose(void)
Definition:
lte-net-device.cc:79
ns3::LteNetDevice::SetNode
virtual void SetNode(Ptr< Node > node)
Definition:
lte-net-device.cc:114
ns3::LteUeNetDevice::LteUeNetDevice
LteUeNetDevice(void)
Definition:
lte-ue-net-device.cc:87
lte-ue-phy.h
ns3::LteUeNetDevice::GetRrc
Ptr< LteUeRrc > GetRrc() const
Definition:
lte-ue-net-device.cc:146
ns3::LteUeNetDevice::GetImsi
uint64_t GetImsi() const
Definition:
lte-ue-net-device.cc:168
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Definition:
log.h:122
ns3::LteUeNetDevice::m_targetEnb
Ptr< LteEnbNetDevice > m_targetEnb
Definition:
lte-ue-net-device.h:119
lte-ue-net-device.h
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Definition:
log.h:264
ns3::LteUeNetDevice::m_imsi
uint64_t m_imsi
Definition:
lte-ue-net-device.h:126
lte-ue-mac.h
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
fatal error handling
Definition:
fatal-error.h:72
ns3::Address
a polymophic address class
Definition:
address.h:86
ns3::LteUeNetDevice::m_nas
Ptr< EpcUeNas > m_nas
Definition:
lte-ue-net-device.h:124
ns3::LteUeNetDevice::GetTypeId
static TypeId GetTypeId(void)
Definition:
lte-ue-net-device.cc:54
ns3::LteUeNetDevice::DoDispose
virtual void DoDispose()
Definition:
lte-ue-net-device.cc:111
ns3::TypeId::ATTR_GET
Definition:
type-id.h:56
ns3::LteUeNetDevice::SetTargetEnb
void SetTargetEnb(Ptr< LteEnbNetDevice > enb)
Set the targer eNB where the UE is registered.
Definition:
lte-ue-net-device.cc:175
ns3::LteUeNetDevice::DoInitialize
virtual void DoInitialize(void)
Definition:
lte-ue-net-device.cc:190
ns3::UintegerValue
Hold an unsigned integer type.
Definition:
uinteger.h:46
ns3::NS_OBJECT_ENSURE_REGISTERED
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
ns3::LteUeNetDevice::UpdateConfig
void UpdateConfig(void)
Definition:
lte-ue-net-device.cc:127
ns3::LteUeNetDevice::m_phy
Ptr< LteUePhy > m_phy
Definition:
lte-ue-net-device.h:122
epc-tft.h
lte-ue-rrc.h
ns3::PointerValue
hold objects of type Ptr<T>
Definition:
pointer.h:33
epc-ue-nas.h
ns3::LteUeNetDevice::GetTargetEnb
Ptr< LteEnbNetDevice > GetTargetEnb(void)
Get the targer eNB where the UE is registered.
Definition:
lte-ue-net-device.cc:183
ns3::LteUeNetDevice::GetNas
Ptr< EpcUeNas > GetNas(void) const
Definition:
lte-ue-net-device.cc:161
ns3::LteUeNetDevice::m_mac
Ptr< LteUeMac > m_mac
Definition:
lte-ue-net-device.h:121
ns3::LteUeNetDevice::GetPhy
Ptr< LteUePhy > GetPhy(void) const
Definition:
lte-ue-net-device.cc:154
ns3::LteNetDevice
Definition:
lte-net-device.h:48
lte-amc.h
ns3::LteUeNetDevice::Send
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
Definition:
lte-ue-net-device.cc:200
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
lte-net-device.h
ns3::LteUeNetDevice::GetMac
Ptr< LteUeMac > GetMac(void) const
Definition:
lte-ue-net-device.cc:138
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Definition:
type-id.cc:610
ns3::Ipv4L3Protocol::PROT_NUMBER
static const uint16_t PROT_NUMBER
Definition:
ipv4-l3-protocol.h:81
src
lte
model
lte-ue-net-device.cc
Generated on Sat Nov 16 2013 16:17:45 for ns-3 by
1.8.5