LEFT | RIGHT |
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) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) | 3 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 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 | 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 | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 * Author: Jaume Nin <jnin@cttc.cat> | 18 * Author: Jaume Nin <jnin@cttc.cat> |
19 * Nicola Baldo <nbaldo@cttc.cat> | 19 * Nicola Baldo <nbaldo@cttc.cat> |
20 */ | 20 */ |
21 | 21 |
22 | 22 |
23 #include "epc-sgw-pgw-application.h" | 23 #include "epc-sgw-pgw-application.h" |
24 #include "ns3/log.h" | 24 #include "ns3/log.h" |
25 #include "ns3/mac48-address.h" | 25 #include "ns3/mac48-address.h" |
26 #include "ns3/ipv4.h" | 26 #include "ns3/ipv4.h" |
| 27 #include "ns3/ipv6.h" |
| 28 #include "ns3/ipv6-header.h" |
27 #include "ns3/inet-socket-address.h" | 29 #include "ns3/inet-socket-address.h" |
28 #include "ns3/epc-gtpu-header.h" | 30 #include "ns3/epc-gtpu-header.h" |
29 #include "ns3/abort.h" | 31 #include "ns3/abort.h" |
30 | 32 |
31 namespace ns3 { | 33 namespace ns3 { |
32 | 34 |
33 NS_LOG_COMPONENT_DEFINE ("EpcSgwPgwApplication"); | 35 NS_LOG_COMPONENT_DEFINE ("EpcSgwPgwApplication"); |
34 | 36 |
35 ///////////////////////// | 37 ///////////////////////// |
36 // UeInfo | 38 // UeInfo |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 { | 86 { |
85 return m_ueAddr; | 87 return m_ueAddr; |
86 } | 88 } |
87 | 89 |
88 void | 90 void |
89 EpcSgwPgwApplication::UeInfo::SetUeAddr (Ipv4Address ueAddr) | 91 EpcSgwPgwApplication::UeInfo::SetUeAddr (Ipv4Address ueAddr) |
90 { | 92 { |
91 m_ueAddr = ueAddr; | 93 m_ueAddr = ueAddr; |
92 } | 94 } |
93 | 95 |
| 96 Ipv6Address· |
| 97 EpcSgwPgwApplication::UeInfo::GetUeAddr6 () |
| 98 { |
| 99 return m_ueAddr6; |
| 100 } |
| 101 |
| 102 void |
| 103 EpcSgwPgwApplication::UeInfo::SetUeAddr6 (Ipv6Address ueAddr) |
| 104 { |
| 105 m_ueAddr6 = ueAddr; |
| 106 } |
| 107 |
94 ///////////////////////// | 108 ///////////////////////// |
95 // EpcSgwPgwApplication | 109 // EpcSgwPgwApplication |
96 ///////////////////////// | 110 ///////////////////////// |
97 | 111 |
98 | 112 |
99 TypeId | 113 TypeId |
100 EpcSgwPgwApplication::GetTypeId (void) | 114 EpcSgwPgwApplication::GetTypeId (void) |
101 { | 115 { |
102 static TypeId tid = TypeId ("ns3::EpcSgwPgwApplication") | 116 static TypeId tid = TypeId ("ns3::EpcSgwPgwApplication") |
103 .SetParent<Object> () | 117 .SetParent<Object> () |
104 .SetGroupName("Lte"); | 118 .SetGroupName("Lte") |
| 119 .AddTraceSource ("RxFromTun", |
| 120 "Receive data packets from internet in Tunnel net device", |
| 121 MakeTraceSourceAccessor (&EpcSgwPgwApplication::m_rxTunPktT
race), |
| 122 "ns3::EpcSgwPgwApplication::RxTracedCallback") |
| 123 .AddTraceSource ("RxFromS1u", |
| 124 "Receive data packets from S1 U Socket", |
| 125 MakeTraceSourceAccessor (&EpcSgwPgwApplication::m_rxS1uPktT
race), |
| 126 "ns3::EpcSgwPgwApplication::RxTracedCallback") |
| 127 ; |
105 return tid; | 128 return tid; |
106 } | 129 } |
107 | 130 |
108 void | 131 void |
109 EpcSgwPgwApplication::DoDispose () | 132 EpcSgwPgwApplication::DoDispose () |
110 { | 133 { |
111 NS_LOG_FUNCTION (this); | 134 NS_LOG_FUNCTION (this); |
112 m_s1uSocket->SetRecvCallback (MakeNullCallback<void, Ptr<Socket> > ()); | 135 m_s1uSocket->SetRecvCallback (MakeNullCallback<void, Ptr<Socket> > ()); |
113 m_s1uSocket = 0; | 136 m_s1uSocket = 0; |
114 delete (m_s11SapSgw); | 137 delete (m_s11SapSgw); |
115 } | 138 } |
116 | 139 |
117 ·· | 140 ·· |
118 | |
119 EpcSgwPgwApplication::EpcSgwPgwApplication (const Ptr<VirtualNetDevice> tunDevic
e, const Ptr<Socket> s1uSocket) | 141 EpcSgwPgwApplication::EpcSgwPgwApplication (const Ptr<VirtualNetDevice> tunDevic
e, const Ptr<Socket> s1uSocket) |
120 : m_s1uSocket (s1uSocket), | 142 : m_s1uSocket (s1uSocket), |
121 m_tunDevice (tunDevice), | 143 m_tunDevice (tunDevice), |
122 m_gtpuUdpPort (2152), // fixed by the standard | 144 m_gtpuUdpPort (2152), // fixed by the standard |
123 m_teidCount (0), | 145 m_teidCount (0), |
124 m_s11SapMme (0) | 146 m_s11SapMme (0) |
125 { | 147 { |
126 NS_LOG_FUNCTION (this << tunDevice << s1uSocket); | 148 NS_LOG_FUNCTION (this << tunDevice << s1uSocket); |
127 m_s1uSocket->SetRecvCallback (MakeCallback (&EpcSgwPgwApplication::RecvFromS1u
Socket, this)); | 149 m_s1uSocket->SetRecvCallback (MakeCallback (&EpcSgwPgwApplication::RecvFromS1u
Socket, this)); |
128 m_s11SapSgw = new MemberEpcS11SapSgw<EpcSgwPgwApplication> (this); | 150 m_s11SapSgw = new MemberEpcS11SapSgw<EpcSgwPgwApplication> (this); |
129 } | 151 } |
130 | 152 |
131 ·· | 153 ·· |
132 EpcSgwPgwApplication::~EpcSgwPgwApplication () | 154 EpcSgwPgwApplication::~EpcSgwPgwApplication () |
133 { | 155 { |
134 NS_LOG_FUNCTION (this); | 156 NS_LOG_FUNCTION (this); |
135 } | 157 } |
136 | 158 |
137 | 159 |
138 bool | 160 bool |
139 EpcSgwPgwApplication::RecvFromTunDevice (Ptr<Packet> packet, const Address& sour
ce, const Address& dest, uint16_t protocolNumber) | 161 EpcSgwPgwApplication::RecvFromTunDevice (Ptr<Packet> packet, const Address& sour
ce, const Address& dest, uint16_t protocolNumber) |
140 { | 162 { |
| 163 NS_UNUSED (protocolNumber); |
141 NS_LOG_FUNCTION (this << source << dest << packet << packet->GetSize ()); | 164 NS_LOG_FUNCTION (this << source << dest << packet << packet->GetSize ()); |
142 NS_UNUSED(protocolNumber); | 165 m_rxTunPktTrace (packet->Copy ()); |
| 166 Ptr<Packet> pCopy = packet->Copy (); |
| 167 |
| 168 uint8_t ipType; |
| 169 pCopy->CopyData (&ipType, 1); |
| 170 ipType = (ipType>>4) & 0x0f; |
143 | 171 |
144 // get IP address of UE | 172 // get IP address of UE |
145 Ptr<Packet> pCopy = packet->Copy (); | 173 if (ipType == 0x04) |
146 Ipv4Header ipv4Header; | 174 { |
147 pCopy->RemoveHeader (ipv4Header); | 175 Ipv4Header ipv4Header; |
148 Ipv4Address ueAddr = ipv4Header.GetDestination (); | 176 pCopy->RemoveHeader (ipv4Header); |
149 NS_LOG_LOGIC ("packet addressed to UE " << ueAddr); | 177 Ipv4Address ueAddr = ipv4Header.GetDestination (); |
150 | 178 NS_LOG_LOGIC ("packet addressed to UE " << ueAddr); |
151 // find corresponding UeInfo address | 179 // find corresponding UeInfo address |
152 std::map<Ipv4Address, Ptr<UeInfo> >::iterator it = m_ueInfoByAddrMap.find (ueA
ddr); | 180 std::map<Ipv4Address, Ptr<UeInfo> >::iterator it = m_ueInfoByAddrMap.find
(ueAddr); |
153 if (it == m_ueInfoByAddrMap.end ()) | 181 if (it == m_ueInfoByAddrMap.end ()) |
154 {········ | 182 {········ |
155 NS_LOG_WARN ("unknown UE address " << ueAddr); | 183 NS_LOG_WARN ("unknown UE address " << ueAddr); |
156 } | |
157 else | |
158 { | |
159 Ipv4Address enbAddr = it->second->GetEnbAddr ();······ | |
160 uint32_t teid = it->second->Classify (packet);··· | |
161 if (teid == 0) | |
162 { | |
163 NS_LOG_WARN ("no matching bearer for this packet");··················· | |
164 } | 184 } |
165 else | 185 else |
166 { | 186 { |
167 SendToS1uSocket (packet, enbAddr, teid); | 187 Ipv4Address enbAddr = it->second->GetEnbAddr ();······ |
| 188 uint32_t teid = it->second->Classify (packet);··· |
| 189 if (teid == 0) |
| 190 { |
| 191 NS_LOG_WARN ("no matching bearer for this packet");
···· |
| 192 } |
| 193 else |
| 194 { |
| 195 SendToS1uSocket (packet, enbAddr, teid); |
| 196 } |
168 } | 197 } |
169 } | 198 } |
| 199 else if (ipType == 0x06) |
| 200 { |
| 201 Ipv6Header ipv6Header; |
| 202 pCopy->RemoveHeader (ipv6Header); |
| 203 Ipv6Address ueAddr = ipv6Header.GetDestinationAddress (); |
| 204 NS_LOG_LOGIC ("packet addressed to UE " << ueAddr); |
| 205 // find corresponding UeInfo address |
| 206 std::map<Ipv6Address, Ptr<UeInfo> >::iterator it = m_ueInfoByAddrMap6.find
(ueAddr); |
| 207 if (it == m_ueInfoByAddrMap6.end ()) |
| 208 {········ |
| 209 NS_LOG_WARN ("unknown UE address " << ueAddr); |
| 210 } |
| 211 else |
| 212 { |
| 213 Ipv4Address enbAddr = it->second->GetEnbAddr ();······ |
| 214 uint32_t teid = it->second->Classify (packet);··· |
| 215 if (teid == 0) |
| 216 { |
| 217 NS_LOG_WARN ("no matching bearer for this packet");························· |
| 218 } |
| 219 else |
| 220 { |
| 221 SendToS1uSocket (packet, enbAddr, teid); |
| 222 } |
| 223 } |
| 224 } |
| 225 else |
| 226 { |
| 227 NS_ABORT_MSG ("EpcSgwPgwApplication::RecvFromTunDevice - Unknown IP type..
."); |
| 228 } |
| 229 |
170 // there is no reason why we should notify the TUN | 230 // there is no reason why we should notify the TUN |
171 // VirtualNetDevice that he failed to send the packet: if we receive | 231 // VirtualNetDevice that he failed to send the packet: if we receive |
172 // any bogus packet, it will just be silently discarded. | 232 // any bogus packet, it will just be silently discarded. |
173 const bool succeeded = true; | 233 const bool succeeded = true; |
174 return succeeded; | 234 return succeeded; |
175 } | 235 } |
176 | 236 |
177 void· | 237 void· |
178 EpcSgwPgwApplication::RecvFromS1uSocket (Ptr<Socket> socket) | 238 EpcSgwPgwApplication::RecvFromS1uSocket (Ptr<Socket> socket) |
179 { | 239 { |
180 NS_LOG_FUNCTION (this << socket);·· | 240 NS_LOG_FUNCTION (this << socket);·· |
181 NS_ASSERT (socket == m_s1uSocket); | 241 NS_ASSERT (socket == m_s1uSocket); |
182 Ptr<Packet> packet = socket->Recv (); | 242 Ptr<Packet> packet = socket->Recv (); |
183 GtpuHeader gtpu; | 243 GtpuHeader gtpu; |
184 packet->RemoveHeader (gtpu); | 244 packet->RemoveHeader (gtpu); |
185 uint32_t teid = gtpu.GetTeid (); | 245 uint32_t teid = gtpu.GetTeid (); |
186 | 246 |
187 SendToTunDevice (packet, teid); | 247 SendToTunDevice (packet, teid); |
| 248 |
| 249 m_rxS1uPktTrace (packet->Copy ()); |
188 } | 250 } |
189 | 251 |
190 void· | 252 void· |
191 EpcSgwPgwApplication::SendToTunDevice (Ptr<Packet> packet, uint32_t teid) | 253 EpcSgwPgwApplication::SendToTunDevice (Ptr<Packet> packet, uint32_t teid) |
192 { | 254 { |
193 NS_LOG_FUNCTION (this << packet << teid); | 255 NS_LOG_FUNCTION (this << packet << teid); |
194 NS_LOG_LOGIC (" packet size: " << packet->GetSize () << " bytes"); | 256 NS_LOG_LOGIC (" packet size: " << packet->GetSize () << " bytes"); |
195 m_tunDevice->Receive (packet, 0x0800, m_tunDevice->GetAddress (), m_tunDevice-
>GetAddress (), NetDevice::PACKET_HOST); | 257 |
| 258 uint8_t ipType; |
| 259 packet->CopyData (&ipType, 1); |
| 260 ipType = (ipType>>4) & 0x0f; |
| 261 |
| 262 if (ipType == 0x04) |
| 263 { |
| 264 m_tunDevice->Receive (packet, 0x0800, m_tunDevice->GetAddress (), m_tunDev
ice->GetAddress (), NetDevice::PACKET_HOST); |
| 265 } |
| 266 else if (ipType == 0x06) |
| 267 { |
| 268 m_tunDevice->Receive (packet, 0x86DD, m_tunDevice->GetAddress (), m_tunDev
ice->GetAddress (), NetDevice::PACKET_HOST); |
| 269 } |
| 270 else |
| 271 { |
| 272 NS_ABORT_MSG ("EpcSgwPgwApplication::SendToTunDevice - Unknown IP type..."
); |
| 273 } |
196 } | 274 } |
197 | 275 |
198 void· | 276 void· |
199 EpcSgwPgwApplication::SendToS1uSocket (Ptr<Packet> packet, Ipv4Address enbAddr,
uint32_t teid) | 277 EpcSgwPgwApplication::SendToS1uSocket (Ptr<Packet> packet, Ipv4Address enbAddr,
uint32_t teid) |
200 { | 278 { |
201 NS_LOG_FUNCTION (this << packet << enbAddr << teid); | 279 NS_LOG_FUNCTION (this << packet << enbAddr << teid); |
202 | 280 |
203 GtpuHeader gtpu; | 281 GtpuHeader gtpu; |
204 gtpu.SetTeid (teid); | 282 gtpu.SetTeid (teid); |
205 // From 3GPP TS 29.281 v10.0.0 Section 5.1 | 283 // From 3GPP TS 29.281 v10.0.0 Section 5.1 |
206 // Length of the payload + the non obligatory GTP-U header | 284 // Length of the payload + the non obligatory GTP-U header |
207 gtpu.SetLength (static_cast<uint16_t>(packet->GetSize () + gtpu.GetSerializedS
ize () - 8));·· | 285 gtpu.SetLength (static_cast<uint16_t> (packet->GetSize () + gtpu.GetSerialized
Size () - 8));·· |
208 packet->AddHeader (gtpu); | 286 packet->AddHeader (gtpu); |
209 uint32_t flags = 0; | 287 uint32_t flags = 0; |
210 m_s1uSocket->SendTo (packet, flags, InetSocketAddress (enbAddr, m_gtpuUdpPort)
); | 288 m_s1uSocket->SendTo (packet, flags, InetSocketAddress (enbAddr, m_gtpuUdpPort)
); |
211 } | 289 } |
212 | 290 |
213 | 291 |
214 void· | 292 void· |
215 EpcSgwPgwApplication::SetS11SapMme (EpcS11SapMme * s) | 293 EpcSgwPgwApplication::SetS11SapMme (EpcS11SapMme * s) |
216 { | 294 { |
217 m_s11SapMme = s; | 295 m_s11SapMme = s; |
(...skipping 24 matching lines...) Expand all Loading... |
242 } | 320 } |
243 | 321 |
244 void· | 322 void· |
245 EpcSgwPgwApplication::SetUeAddress (uint64_t imsi, Ipv4Address ueAddr) | 323 EpcSgwPgwApplication::SetUeAddress (uint64_t imsi, Ipv4Address ueAddr) |
246 { | 324 { |
247 NS_LOG_FUNCTION (this << imsi << ueAddr); | 325 NS_LOG_FUNCTION (this << imsi << ueAddr); |
248 std::map<uint64_t, Ptr<UeInfo> >::iterator ueit = m_ueInfoByImsiMap.find (imsi
); | 326 std::map<uint64_t, Ptr<UeInfo> >::iterator ueit = m_ueInfoByImsiMap.find (imsi
); |
249 NS_ASSERT_MSG (ueit != m_ueInfoByImsiMap.end (), "unknown IMSI " << imsi);· | 327 NS_ASSERT_MSG (ueit != m_ueInfoByImsiMap.end (), "unknown IMSI " << imsi);· |
250 m_ueInfoByAddrMap[ueAddr] = ueit->second; | 328 m_ueInfoByAddrMap[ueAddr] = ueit->second; |
251 ueit->second->SetUeAddr (ueAddr); | 329 ueit->second->SetUeAddr (ueAddr); |
| 330 } |
| 331 |
| 332 void· |
| 333 EpcSgwPgwApplication::SetUeAddress6 (uint64_t imsi, Ipv6Address ueAddr) |
| 334 { |
| 335 NS_LOG_FUNCTION (this << imsi << ueAddr); |
| 336 std::map<uint64_t, Ptr<UeInfo> >::iterator ueit = m_ueInfoByImsiMap.find (imsi
); |
| 337 NS_ASSERT_MSG (ueit != m_ueInfoByImsiMap.end (), "unknown IMSI " << imsi);· |
| 338 m_ueInfoByAddrMap6[ueAddr] = ueit->second; |
| 339 ueit->second->SetUeAddr6 (ueAddr); |
252 } | 340 } |
253 | 341 |
254 void· | 342 void· |
255 EpcSgwPgwApplication::DoCreateSessionRequest (EpcS11SapSgw::CreateSessionRequest
Message req) | 343 EpcSgwPgwApplication::DoCreateSessionRequest (EpcS11SapSgw::CreateSessionRequest
Message req) |
256 { | 344 { |
257 NS_LOG_FUNCTION (this << req.imsi); | 345 NS_LOG_FUNCTION (this << req.imsi); |
258 std::map<uint64_t, Ptr<UeInfo> >::iterator ueit = m_ueInfoByImsiMap.find (req.
imsi); | 346 std::map<uint64_t, Ptr<UeInfo> >::iterator ueit = m_ueInfoByImsiMap.find (req.
imsi); |
259 NS_ASSERT_MSG (ueit != m_ueInfoByImsiMap.end (), "unknown IMSI " << req.imsi);······· | 347 NS_ASSERT_MSG (ueit != m_ueInfoByImsiMap.end (), "unknown IMSI " << req.imsi);······· |
260 uint16_t cellId = req.uli.gci; | 348 uint16_t cellId = req.uli.gci; |
261 std::map<uint16_t, EnbInfo>::iterator enbit = m_enbInfoByCellId.find (cellId); | 349 std::map<uint16_t, EnbInfo>::iterator enbit = m_enbInfoByCellId.find (cellId); |
262 NS_ASSERT_MSG (enbit != m_enbInfoByCellId.end (), "unknown CellId " << cellId)
;· | 350 NS_ASSERT_MSG (enbit != m_enbInfoByCellId.end (), "unknown CellId " << cellId)
;· |
263 Ipv4Address enbAddr = enbit->second.enbAddr; | 351 Ipv4Address enbAddr = enbit->second.enbAddr; |
264 ueit->second->SetEnbAddr (enbAddr); | 352 ueit->second->SetEnbAddr (enbAddr); |
265 | 353 |
266 EpcS11SapMme::CreateSessionResponseMessage res; | 354 EpcS11SapMme::CreateSessionResponseMessage res; |
267 res.teid = static_cast<uint32_t>(req.imsi); // trick to avoid the need for all
ocating TEIDs on the S11 interface | 355 res.teid = static_cast<uint32_t> (req.imsi); // trick to avoid the need for al
locating TEIDs on the S11 interface |
268 | 356 |
269 for (std::list<EpcS11SapSgw::BearerContextToBeCreated>::iterator bit = req.bea
rerContextsToBeCreated.begin (); | 357 for (std::list<EpcS11SapSgw::BearerContextToBeCreated>::iterator bit = req.bea
rerContextsToBeCreated.begin (); |
270 bit != req.bearerContextsToBeCreated.end (); | 358 bit != req.bearerContextsToBeCreated.end (); |
271 ++bit) | 359 ++bit) |
272 { | 360 { |
273 // simple sanity check. If you ever need more than 4M teids | 361 // simple sanity check. If you ever need more than 4M teids |
274 // throughout your simulation, you'll need to implement a smarter teid | 362 // throughout your simulation, you'll need to implement a smarter teid |
275 // management algorithm.· | 363 // management algorithm.· |
276 NS_ABORT_IF (m_teidCount == 0xFFFFFFFF); | 364 NS_ABORT_IF (m_teidCount == 0xFFFFFFFF); |
277 uint32_t teid = ++m_teidCount;·· | 365 uint32_t teid = ++m_teidCount;·· |
(...skipping 18 matching lines...) Expand all Loading... |
296 uint64_t imsi = req.teid; // trick to avoid the need for allocating TEIDs on t
he S11 interface | 384 uint64_t imsi = req.teid; // trick to avoid the need for allocating TEIDs on t
he S11 interface |
297 std::map<uint64_t, Ptr<UeInfo> >::iterator ueit = m_ueInfoByImsiMap.find (imsi
); | 385 std::map<uint64_t, Ptr<UeInfo> >::iterator ueit = m_ueInfoByImsiMap.find (imsi
); |
298 NS_ASSERT_MSG (ueit != m_ueInfoByImsiMap.end (), "unknown IMSI " << imsi);· | 386 NS_ASSERT_MSG (ueit != m_ueInfoByImsiMap.end (), "unknown IMSI " << imsi);· |
299 uint16_t cellId = req.uli.gci; | 387 uint16_t cellId = req.uli.gci; |
300 std::map<uint16_t, EnbInfo>::iterator enbit = m_enbInfoByCellId.find (cellId); | 388 std::map<uint16_t, EnbInfo>::iterator enbit = m_enbInfoByCellId.find (cellId); |
301 NS_ASSERT_MSG (enbit != m_enbInfoByCellId.end (), "unknown CellId " << cellId)
;· | 389 NS_ASSERT_MSG (enbit != m_enbInfoByCellId.end (), "unknown CellId " << cellId)
;· |
302 Ipv4Address enbAddr = enbit->second.enbAddr; | 390 Ipv4Address enbAddr = enbit->second.enbAddr; |
303 ueit->second->SetEnbAddr (enbAddr); | 391 ueit->second->SetEnbAddr (enbAddr); |
304 // no actual bearer modification: for now we just support the minimum needed f
or path switch request (handover) | 392 // no actual bearer modification: for now we just support the minimum needed f
or path switch request (handover) |
305 EpcS11SapMme::ModifyBearerResponseMessage res; | 393 EpcS11SapMme::ModifyBearerResponseMessage res; |
306 res.teid = static_cast<uint32_t>(imsi); // trick to avoid the need for allocat
ing TEIDs on the S11 interface | 394 res.teid = static_cast<uint32_t> (imsi); // trick to avoid the need for alloca
ting TEIDs on the S11 interface |
307 res.cause = EpcS11SapMme::ModifyBearerResponseMessage::REQUEST_ACCEPTED; | 395 res.cause = EpcS11SapMme::ModifyBearerResponseMessage::REQUEST_ACCEPTED; |
308 m_s11SapMme->ModifyBearerResponse (res); | 396 m_s11SapMme->ModifyBearerResponse (res); |
309 } | 397 } |
310 · | 398 · |
311 void | 399 void |
312 EpcSgwPgwApplication::DoDeleteBearerCommand (EpcS11SapSgw::DeleteBearerCommandMe
ssage req) | 400 EpcSgwPgwApplication::DoDeleteBearerCommand (EpcS11SapSgw::DeleteBearerCommandMe
ssage req) |
313 { | 401 { |
314 NS_LOG_FUNCTION (this << req.teid); | 402 NS_LOG_FUNCTION (this << req.teid); |
315 uint64_t imsi = req.teid; // trick to avoid the need for allocating TEIDs on t
he S11 interface | 403 uint64_t imsi = req.teid; // trick to avoid the need for allocating TEIDs on t
he S11 interface |
316 std::map<uint64_t, Ptr<UeInfo> >::iterator ueit = m_ueInfoByImsiMap.find (imsi
); | 404 std::map<uint64_t, Ptr<UeInfo> >::iterator ueit = m_ueInfoByImsiMap.find (imsi
); |
317 NS_ASSERT_MSG (ueit != m_ueInfoByImsiMap.end (), "unknown IMSI " << imsi); | 405 NS_ASSERT_MSG (ueit != m_ueInfoByImsiMap.end (), "unknown IMSI " << imsi); |
318 | 406 |
319 EpcS11SapMme::DeleteBearerRequestMessage res; | 407 EpcS11SapMme::DeleteBearerRequestMessage res; |
320 res.teid = static_cast<uint32_t>(imsi); | 408 res.teid = static_cast<uint32_t> (imsi); |
321 | 409 |
322 for (std::list<EpcS11SapSgw::BearerContextToBeRemoved>::iterator bit = req.bea
rerContextsToBeRemoved.begin (); | 410 for (std::list<EpcS11SapSgw::BearerContextToBeRemoved>::iterator bit = req.bea
rerContextsToBeRemoved.begin (); |
323 bit != req.bearerContextsToBeRemoved.end (); | 411 bit != req.bearerContextsToBeRemoved.end (); |
324 ++bit) | 412 ++bit) |
325 { | 413 { |
326 EpcS11SapMme::BearerContextRemoved bearerContext; | 414 EpcS11SapMme::BearerContextRemoved bearerContext; |
327 bearerContext.epsBearerId = bit->epsBearerId; | 415 bearerContext.epsBearerId = bit->epsBearerId; |
328 res.bearerContextsRemoved.push_back (bearerContext); | 416 res.bearerContextsRemoved.push_back (bearerContext); |
329 } | 417 } |
330 //schedules Delete Bearer Request towards MME | 418 //schedules Delete Bearer Request towards MME |
(...skipping 11 matching lines...) Expand all Loading... |
342 for (std::list<EpcS11SapSgw::BearerContextRemovedSgwPgw>::iterator bit = req.b
earerContextsRemoved.begin (); | 430 for (std::list<EpcS11SapSgw::BearerContextRemovedSgwPgw>::iterator bit = req.b
earerContextsRemoved.begin (); |
343 bit != req.bearerContextsRemoved.end (); | 431 bit != req.bearerContextsRemoved.end (); |
344 ++bit) | 432 ++bit) |
345 { | 433 { |
346 //Function to remove de-activated bearer contexts from S-Gw and P-Gw side | 434 //Function to remove de-activated bearer contexts from S-Gw and P-Gw side |
347 ueit->second->RemoveBearer (bit->epsBearerId); | 435 ueit->second->RemoveBearer (bit->epsBearerId); |
348 } | 436 } |
349 } | 437 } |
350 | 438 |
351 } // namespace ns3 | 439 } // namespace ns3 |
LEFT | RIGHT |