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 "
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 <ns3/lte-ue-phy.h>
42
#include <ns3/ipv4-l3-protocol.h>
43
#include <ns3/log.h>
44
45
NS_LOG_COMPONENT_DEFINE
(
"LteUeNetDevice"
);
46
47
namespace
ns3 {
48
49
NS_OBJECT_ENSURE_REGISTERED
( LteUeNetDevice);
50
51
uint64_t
LteUeNetDevice::m_imsiCounter
= 0;
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)
95
{
96
NS_LOG_FUNCTION
(
this
);
97
m_phy
= phy;
98
m_mac
= mac;
99
m_rrc
= rrc;
100
SetNode
(node);
101
m_imsi
= ++
m_imsiCounter
;
102
}
103
104
LteUeNetDevice::~LteUeNetDevice
(
void
)
105
{
106
NS_LOG_FUNCTION
(
this
);
107
}
108
109
void
110
LteUeNetDevice::DoDispose
(
void
)
111
{
112
NS_LOG_FUNCTION
(
this
);
113
m_targetEnb
= 0;
114
m_mac
->
Dispose
();
115
m_mac
= 0;
116
m_rrc
->
Dispose
();
117
m_rrc
= 0;
118
m_phy
->
Dispose
();
119
m_phy
= 0;
120
LteNetDevice::DoDispose
();
121
}
122
123
void
124
LteUeNetDevice::UpdateConfig
(
void
)
125
{
126
NS_LOG_FUNCTION
(
this
);
127
}
128
129
130
131
Ptr<LteUeMac>
132
LteUeNetDevice::GetMac
(
void
)
133
{
134
NS_LOG_FUNCTION
(
this
);
135
return
m_mac
;
136
}
137
138
139
Ptr<LteUeRrc>
140
LteUeNetDevice::GetRrc
(
void
)
141
{
142
NS_LOG_FUNCTION
(
this
);
143
return
m_rrc
;
144
}
145
146
147
Ptr<LteUePhy>
148
LteUeNetDevice::GetPhy
(
void
)
const
149
{
150
NS_LOG_FUNCTION
(
this
);
151
return
m_phy
;
152
}
153
154
void
155
LteUeNetDevice::SetTargetEnb
(
Ptr<LteEnbNetDevice>
enb)
156
{
157
NS_LOG_FUNCTION
(
this
<< enb);
158
m_targetEnb
= enb;
159
160
// should go through RRC and then through PHY SAP
161
m_phy
->
DoSetCellId
(enb->
GetCellId
());
162
}
163
164
165
Ptr<LteEnbNetDevice>
166
LteUeNetDevice::GetTargetEnb
(
void
)
167
{
168
NS_LOG_FUNCTION
(
this
);
169
return
m_targetEnb
;
170
}
171
172
uint64_t
173
LteUeNetDevice::GetImsi
()
174
{
175
NS_LOG_FUNCTION
(
this
);
176
return
m_imsi
;
177
}
178
179
180
void
181
LteUeNetDevice::DoStart
(
void
)
182
{
183
NS_LOG_FUNCTION
(
this
);
184
UpdateConfig
();
185
m_phy
->
Start
();
186
m_mac
->
Start
();
187
m_rrc
->
Start
();
188
}
189
190
bool
191
LteUeNetDevice::Send
(
Ptr<Packet>
packet,
const
Address
& dest, uint16_t protocolNumber)
192
{
193
NS_LOG_FUNCTION
(
this
<< dest << protocolNumber);
194
NS_ASSERT_MSG
(protocolNumber ==
Ipv4L3Protocol::PROT_NUMBER
,
"unsupported protocol "
<< protocolNumber <<
", only IPv4 is supported"
);
195
196
return
m_rrc
->
Send
(packet);
197
}
198
199
200
}
// namespace ns3
src
lte
model
lte-ue-net-device.cc
Generated on Tue Oct 9 2012 16:45:41 for ns-3 by
1.8.1.2