OLD | NEW |
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari | 3 * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari |
| 4 * Copyright (c) 2015 Danilo Abrignani |
4 * | 5 * |
5 * This program is free software; you can redistribute it and/or modify | 6 * 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 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 8 * published by the Free Software Foundation; |
8 * | 9 * |
9 * This program is distributed in the hope that it will be useful, | 10 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 13 * GNU General Public License for more details. |
13 * | 14 * |
14 * You should have received a copy of the GNU General Public License | 15 * 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 * 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 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 18 * |
18 * Author: Giuseppe Piro <g.piro@poliba.it> | 19 * Author: Giuseppe Piro <g.piro@poliba.it> |
19 * Nicola Baldo <nbaldo@cttc.es> | 20 * Nicola Baldo <nbaldo@cttc.es> |
20 * Marco Miozzo <mmiozzo@cttc.es> | 21 * Marco Miozzo <mmiozzo@cttc.es> |
| 22 * Danilo Abrignani <danilo.abrignani@unibo.it> - Carrier Aggregation -
GSoC 2015 |
21 */ | 23 */ |
22 | 24 |
23 #include "ns3/llc-snap-header.h" | 25 #include "ns3/llc-snap-header.h" |
24 #include "ns3/simulator.h" | 26 #include "ns3/simulator.h" |
25 #include "ns3/callback.h" | 27 #include "ns3/callback.h" |
26 #include "ns3/node.h" | 28 #include "ns3/node.h" |
27 #include "ns3/packet.h" | 29 #include "ns3/packet.h" |
28 #include "lte-net-device.h" | 30 #include "lte-net-device.h" |
29 #include "ns3/packet-burst.h" | 31 #include "ns3/packet-burst.h" |
30 #include "ns3/uinteger.h" | 32 #include "ns3/uinteger.h" |
31 #include "ns3/trace-source-accessor.h" | 33 #include "ns3/trace-source-accessor.h" |
32 #include "ns3/pointer.h" | 34 #include "ns3/pointer.h" |
33 #include "ns3/enum.h" | 35 #include "ns3/enum.h" |
34 #include "ns3/lte-enb-net-device.h" | 36 #include "ns3/lte-enb-net-device.h" |
35 #include "lte-ue-net-device.h" | 37 #include "lte-ue-net-device.h" |
36 #include "lte-ue-mac.h" | 38 #include "lte-ue-mac.h" |
37 #include "lte-ue-rrc.h" | 39 #include "lte-ue-rrc.h" |
38 #include "ns3/ipv4-header.h" | 40 #include "ns3/ipv4-header.h" |
39 #include "ns3/ipv4.h" | 41 #include "ns3/ipv4.h" |
40 #include "lte-amc.h" | 42 #include "lte-amc.h" |
41 #include "lte-ue-phy.h" | 43 #include "lte-ue-phy.h" |
42 #include "epc-ue-nas.h" | 44 #include "epc-ue-nas.h" |
43 #include <ns3/ipv4-l3-protocol.h> | 45 #include <ns3/ipv4-l3-protocol.h> |
44 #include <ns3/log.h> | 46 #include <ns3/log.h> |
45 #include "epc-tft.h" | 47 #include "epc-tft.h" |
| 48 #include <ns3/lte-ue-component-carrier-manager.h> |
| 49 |
| 50 #include <ns3/object-map.h> |
| 51 #include <ns3/object-factory.h> |
46 | 52 |
47 namespace ns3 { | 53 namespace ns3 { |
48 | 54 |
49 NS_LOG_COMPONENT_DEFINE ("LteUeNetDevice"); | 55 NS_LOG_COMPONENT_DEFINE ("LteUeNetDevice"); |
50 | 56 |
51 NS_OBJECT_ENSURE_REGISTERED ( LteUeNetDevice); | 57 NS_OBJECT_ENSURE_REGISTERED ( LteUeNetDevice); |
52 | 58 |
53 | 59 |
54 TypeId LteUeNetDevice::GetTypeId (void) | 60 TypeId LteUeNetDevice::GetTypeId (void) |
55 { | 61 { |
(...skipping 15 matching lines...) Expand all Loading... |
71 .AddAttribute ("LteUeMac", | 77 .AddAttribute ("LteUeMac", |
72 "The MAC associated to this UeNetDevice", | 78 "The MAC associated to this UeNetDevice", |
73 PointerValue (), | 79 PointerValue (), |
74 MakePointerAccessor (&LteUeNetDevice::m_mac), | 80 MakePointerAccessor (&LteUeNetDevice::m_mac), |
75 MakePointerChecker <LteUeMac> ()) | 81 MakePointerChecker <LteUeMac> ()) |
76 .AddAttribute ("LteUePhy", | 82 .AddAttribute ("LteUePhy", |
77 "The PHY associated to this UeNetDevice", | 83 "The PHY associated to this UeNetDevice", |
78 PointerValue (), | 84 PointerValue (), |
79 MakePointerAccessor (&LteUeNetDevice::m_phy), | 85 MakePointerAccessor (&LteUeNetDevice::m_phy), |
80 MakePointerChecker <LteUePhy> ()) | 86 MakePointerChecker <LteUePhy> ()) |
| 87 .AddAttribute ("LteUeComponentCarrierManager", |
| 88 "The ComponentCarrierManager associated to this UeNetDevice", |
| 89 PointerValue (), |
| 90 MakePointerAccessor (&LteUeNetDevice::m_componentCarrierManag
er), |
| 91 MakePointerChecker <LteUeComponentCarrierManager> ()) |
| 92 .AddAttribute ("ComponentCarrierMapUe", "List of all component Carrier.", |
| 93 ObjectMapValue (), |
| 94 MakeObjectMapAccessor (&LteUeNetDevice::m_ccMap), |
| 95 MakeObjectMapChecker<ComponentCarrierUe> ()) |
81 .AddAttribute ("Imsi", | 96 .AddAttribute ("Imsi", |
82 "International Mobile Subscriber Identity assigned to this UE
", | 97 "International Mobile Subscriber Identity assigned to this UE
", |
83 UintegerValue (0), | 98 UintegerValue (0), |
84 MakeUintegerAccessor (&LteUeNetDevice::m_imsi), | 99 MakeUintegerAccessor (&LteUeNetDevice::m_imsi), |
85 MakeUintegerChecker<uint64_t> ()) | 100 MakeUintegerChecker<uint64_t> ()) |
86 .AddAttribute ("DlEarfcn", | 101 .AddAttribute ("DlEarfcn", |
87 "Downlink E-UTRA Absolute Radio Frequency Channel Number (EAR
FCN) " | 102 "Downlink E-UTRA Absolute Radio Frequency Channel Number (EAR
FCN) " |
88 "as per 3GPP 36.101 Section 5.7.3. ", | 103 "as per 3GPP 36.101 Section 5.7.3. ", |
89 UintegerValue (100), | 104 UintegerValue (100), |
90 MakeUintegerAccessor (&LteUeNetDevice::SetDlEarfcn, | 105 MakeUintegerAccessor (&LteUeNetDevice::SetDlEarfcn, |
(...skipping 23 matching lines...) Expand all Loading... |
114 LteUeNetDevice::~LteUeNetDevice (void) | 129 LteUeNetDevice::~LteUeNetDevice (void) |
115 { | 130 { |
116 NS_LOG_FUNCTION (this); | 131 NS_LOG_FUNCTION (this); |
117 } | 132 } |
118 | 133 |
119 void | 134 void |
120 LteUeNetDevice::DoDispose (void) | 135 LteUeNetDevice::DoDispose (void) |
121 { | 136 { |
122 NS_LOG_FUNCTION (this); | 137 NS_LOG_FUNCTION (this); |
123 m_targetEnb = 0; | 138 m_targetEnb = 0; |
124 m_mac->Dispose (); | 139 // m_mac->Dispose (); |
125 m_mac = 0; | 140 // m_mac = 0; |
126 m_rrc->Dispose (); | 141 m_rrc->Dispose (); |
127 m_rrc = 0; | 142 m_rrc = 0; |
128 m_phy->Dispose (); | 143 // m_phy->Dispose (); |
129 m_phy = 0; | 144 // m_phy = 0; |
130 m_nas->Dispose (); | 145 m_nas->Dispose (); |
131 m_nas = 0; | 146 m_nas = 0; |
| 147 for (uint32_t i = 0; i < m_ccMap.size (); i++) |
| 148 { |
| 149 m_ccMap.at (i)->Dispose (); |
| 150 } |
| 151 m_componentCarrierManager->Dispose (); |
132 LteNetDevice::DoDispose (); | 152 LteNetDevice::DoDispose (); |
133 } | 153 } |
134 | 154 |
135 void | 155 void |
136 LteUeNetDevice::UpdateConfig (void) | 156 LteUeNetDevice::UpdateConfig (void) |
137 { | 157 { |
138 NS_LOG_FUNCTION (this); | 158 NS_LOG_FUNCTION (this); |
139 | 159 |
140 if (m_isConstructed) | 160 if (m_isConstructed) |
141 { | 161 { |
(...skipping 11 matching lines...) Expand all Loading... |
153 */ | 173 */ |
154 } | 174 } |
155 } | 175 } |
156 | 176 |
157 | 177 |
158 | 178 |
159 Ptr<LteUeMac> | 179 Ptr<LteUeMac> |
160 LteUeNetDevice::GetMac (void) const | 180 LteUeNetDevice::GetMac (void) const |
161 { | 181 { |
162 NS_LOG_FUNCTION (this); | 182 NS_LOG_FUNCTION (this); |
163 return m_mac; | 183 return m_ccMap.at (0)->GetMac (); |
164 } | 184 } |
165 | 185 |
166 | 186 |
167 Ptr<LteUeRrc> | 187 Ptr<LteUeRrc> |
168 LteUeNetDevice::GetRrc (void) const | 188 LteUeNetDevice::GetRrc (void) const |
169 { | 189 { |
170 NS_LOG_FUNCTION (this); | 190 NS_LOG_FUNCTION (this); |
171 return m_rrc; | 191 return m_rrc; |
172 } | 192 } |
173 | 193 |
174 | 194 |
175 Ptr<LteUePhy> | 195 Ptr<LteUePhy> |
176 LteUeNetDevice::GetPhy (void) const | 196 LteUeNetDevice::GetPhy (void) const |
177 { | 197 { |
178 NS_LOG_FUNCTION (this); | 198 NS_LOG_FUNCTION (this); |
179 return m_phy; | 199 return m_ccMap.at (0)->GetPhy (); |
| 200 } |
| 201 |
| 202 Ptr<LteUeComponentCarrierManager> |
| 203 LteUeNetDevice::GetComponentCarrierManager (void) const |
| 204 { |
| 205 NS_LOG_FUNCTION (this); |
| 206 return m_componentCarrierManager; |
180 } | 207 } |
181 | 208 |
182 Ptr<EpcUeNas> | 209 Ptr<EpcUeNas> |
183 LteUeNetDevice::GetNas (void) const | 210 LteUeNetDevice::GetNas (void) const |
184 { | 211 { |
185 NS_LOG_FUNCTION (this); | 212 NS_LOG_FUNCTION (this); |
186 return m_nas; | 213 return m_nas; |
187 } | 214 } |
188 | 215 |
189 uint64_t | 216 uint64_t |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 } | 257 } |
231 | 258 |
232 | 259 |
233 Ptr<LteEnbNetDevice> | 260 Ptr<LteEnbNetDevice> |
234 LteUeNetDevice::GetTargetEnb (void) | 261 LteUeNetDevice::GetTargetEnb (void) |
235 { | 262 { |
236 NS_LOG_FUNCTION (this); | 263 NS_LOG_FUNCTION (this); |
237 return m_targetEnb; | 264 return m_targetEnb; |
238 } | 265 } |
239 | 266 |
| 267 std::map < uint8_t, Ptr<ComponentCarrierUe> > |
| 268 LteUeNetDevice::GetCcMap () |
| 269 { |
| 270 return m_ccMap; |
| 271 } |
| 272 |
| 273 void |
| 274 LteUeNetDevice::SetCcMap (std::map< uint8_t, Ptr<ComponentCarrierUe> > ccm) |
| 275 { |
| 276 m_ccMap = ccm; |
| 277 } |
| 278 |
240 void· | 279 void· |
241 LteUeNetDevice::DoInitialize (void) | 280 LteUeNetDevice::DoInitialize (void) |
242 { | 281 { |
243 NS_LOG_FUNCTION (this); | 282 NS_LOG_FUNCTION (this); |
244 m_isConstructed = true; | 283 m_isConstructed = true; |
245 UpdateConfig (); | 284 UpdateConfig (); |
246 m_phy->Initialize (); | 285 |
247 m_mac->Initialize (); | 286 // m_phy->Initialize (); |
| 287 std::map< uint8_t, Ptr<ComponentCarrierUe> >::iterator it; |
| 288 for (it = m_ccMap.begin (); it != m_ccMap.end (); ++it) |
| 289 { |
| 290 it->second->GetPhy ()->Initialize (); |
| 291 it->second->GetMac ()->Initialize (); |
| 292 } |
| 293 // m_mac->Initialize (); |
248 m_rrc->Initialize (); | 294 m_rrc->Initialize (); |
249 } | 295 } |
250 | 296 |
251 bool | 297 bool |
252 LteUeNetDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protocol
Number) | 298 LteUeNetDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protocol
Number) |
253 { | 299 { |
254 NS_LOG_FUNCTION (this << dest << protocolNumber); | 300 NS_LOG_FUNCTION (this << dest << protocolNumber); |
255 if (protocolNumber != Ipv4L3Protocol::PROT_NUMBER) | 301 if (protocolNumber != Ipv4L3Protocol::PROT_NUMBER) |
256 { | 302 { |
257 NS_LOG_INFO("unsupported protocol " << protocolNumber << ", only IPv4 is s
upported"); | 303 NS_LOG_INFO ("unsupported protocol " << protocolNumber << ", only IPv4 is
supported"); |
258 return true; | 304 return true; |
259 } | 305 } |
260 return m_nas->Send (packet); | 306 return m_nas->Send (packet); |
261 } | 307 } |
262 | 308 |
263 | 309 |
264 } // namespace ns3 | 310 } // namespace ns3 |
OLD | NEW |