author | Nicola Baldo <nbaldo@cttc.es> |
Wed, 28 Nov 2012 12:21:56 +0100 | |
changeset 9431 | d157ce87b1c0 |
parent 9430 | e8b87593ee5b |
child 9439 | 5107601b7a75 |
permissions | -rw-r--r-- |
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
2 |
/* |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
3 |
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
4 |
* |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
8 |
* |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
13 |
* |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
17 |
* |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
18 |
* Author: Jaume Nin <jnin@cttc.cat> |
8366
a3af0a5ed1e9
draft eNB and SGW/PGW applications
Nicola Baldo <nbaldo@cttc.es>
parents:
8357
diff
changeset
|
19 |
* Nicola Baldo <nbaldo@cttc.cat> |
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
20 |
*/ |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
21 |
|
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
22 |
|
8366
a3af0a5ed1e9
draft eNB and SGW/PGW applications
Nicola Baldo <nbaldo@cttc.es>
parents:
8357
diff
changeset
|
23 |
#include "epc-enb-application.h" |
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
24 |
#include "ns3/log.h" |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
25 |
#include "ns3/mac48-address.h" |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
26 |
#include "ns3/ipv4.h" |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
27 |
#include "ns3/inet-socket-address.h" |
8380 | 28 |
#include "ns3/uinteger.h" |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
29 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
30 |
#include "epc-gtpu-header.h" |
9406 | 31 |
#include "eps-bearer-tag.h" |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
32 |
|
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
33 |
|
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
34 |
namespace ns3 { |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
35 |
|
8366
a3af0a5ed1e9
draft eNB and SGW/PGW applications
Nicola Baldo <nbaldo@cttc.es>
parents:
8357
diff
changeset
|
36 |
NS_LOG_COMPONENT_DEFINE ("EpcEnbApplication"); |
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
37 |
|
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
38 |
|
9406 | 39 |
EpcEnbApplication::EpsFlowId_t::EpsFlowId_t () |
40 |
{ |
|
41 |
} |
|
42 |
||
43 |
EpcEnbApplication::EpsFlowId_t::EpsFlowId_t (const uint16_t a, const uint8_t b) |
|
44 |
: m_rnti (a), |
|
45 |
m_bid (b) |
|
46 |
{ |
|
47 |
} |
|
48 |
||
49 |
bool |
|
50 |
operator == (const EpcEnbApplication::EpsFlowId_t &a, const EpcEnbApplication::EpsFlowId_t &b) |
|
51 |
{ |
|
52 |
return ( (a.m_rnti == b.m_rnti) && (a.m_bid == b.m_bid) ); |
|
53 |
} |
|
54 |
||
55 |
bool |
|
56 |
operator < (const EpcEnbApplication::EpsFlowId_t& a, const EpcEnbApplication::EpsFlowId_t& b) |
|
57 |
{ |
|
58 |
return ( (a.m_rnti < b.m_rnti) || ( (a.m_rnti == b.m_rnti) && (a.m_bid < b.m_bid) ) ); |
|
59 |
} |
|
60 |
||
61 |
||
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
62 |
TypeId |
8366
a3af0a5ed1e9
draft eNB and SGW/PGW applications
Nicola Baldo <nbaldo@cttc.es>
parents:
8357
diff
changeset
|
63 |
EpcEnbApplication::GetTypeId (void) |
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
64 |
{ |
8366
a3af0a5ed1e9
draft eNB and SGW/PGW applications
Nicola Baldo <nbaldo@cttc.es>
parents:
8357
diff
changeset
|
65 |
static TypeId tid = TypeId ("ns3::EpcEnbApplication") |
8380 | 66 |
.SetParent<Object> (); |
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
67 |
return tid; |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
68 |
} |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
69 |
|
9380
890e3ccc4bc5
fixed valgrind error in EpcEnbApplication
Nicola Baldo <nbaldo@cttc.es>
parents:
9345
diff
changeset
|
70 |
void |
890e3ccc4bc5
fixed valgrind error in EpcEnbApplication
Nicola Baldo <nbaldo@cttc.es>
parents:
9345
diff
changeset
|
71 |
EpcEnbApplication::DoDispose (void) |
890e3ccc4bc5
fixed valgrind error in EpcEnbApplication
Nicola Baldo <nbaldo@cttc.es>
parents:
9345
diff
changeset
|
72 |
{ |
890e3ccc4bc5
fixed valgrind error in EpcEnbApplication
Nicola Baldo <nbaldo@cttc.es>
parents:
9345
diff
changeset
|
73 |
NS_LOG_FUNCTION (this); |
890e3ccc4bc5
fixed valgrind error in EpcEnbApplication
Nicola Baldo <nbaldo@cttc.es>
parents:
9345
diff
changeset
|
74 |
m_lteSocket = 0; |
890e3ccc4bc5
fixed valgrind error in EpcEnbApplication
Nicola Baldo <nbaldo@cttc.es>
parents:
9345
diff
changeset
|
75 |
m_s1uSocket = 0; |
890e3ccc4bc5
fixed valgrind error in EpcEnbApplication
Nicola Baldo <nbaldo@cttc.es>
parents:
9345
diff
changeset
|
76 |
delete m_s1SapProvider; |
9430
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
77 |
delete m_s1apSapEnb; |
9380
890e3ccc4bc5
fixed valgrind error in EpcEnbApplication
Nicola Baldo <nbaldo@cttc.es>
parents:
9345
diff
changeset
|
78 |
} |
890e3ccc4bc5
fixed valgrind error in EpcEnbApplication
Nicola Baldo <nbaldo@cttc.es>
parents:
9345
diff
changeset
|
79 |
|
890e3ccc4bc5
fixed valgrind error in EpcEnbApplication
Nicola Baldo <nbaldo@cttc.es>
parents:
9345
diff
changeset
|
80 |
|
9430
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
81 |
EpcEnbApplication::EpcEnbApplication (Ptr<Socket> lteSocket, Ptr<Socket> s1uSocket, Ipv4Address sgwAddress, uint16_t cellId) |
8380 | 82 |
: m_lteSocket (lteSocket), |
83 |
m_s1uSocket (s1uSocket), |
|
8386
419cbd9e357f
S1-U now working also in uplink
Nicola Baldo <nbaldo@cttc.es>
parents:
8380
diff
changeset
|
84 |
m_sgwAddress (sgwAddress), |
9430
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
85 |
m_gtpuUdpPort (2152), // fixed by the standard |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
86 |
m_s1SapUser (0), |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
87 |
m_s1apSapMme (0), |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
88 |
m_cellId (cellId) |
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
89 |
{ |
8386
419cbd9e357f
S1-U now working also in uplink
Nicola Baldo <nbaldo@cttc.es>
parents:
8380
diff
changeset
|
90 |
NS_LOG_FUNCTION (this << lteSocket << s1uSocket << sgwAddress); |
8380 | 91 |
m_s1uSocket->SetRecvCallback (MakeCallback (&EpcEnbApplication::RecvFromS1uSocket, this)); |
92 |
m_lteSocket->SetRecvCallback (MakeCallback (&EpcEnbApplication::RecvFromLteSocket, this)); |
|
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
93 |
m_s1SapProvider = new MemberEpcEnbS1SapProvider<EpcEnbApplication> (this); |
9430
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
94 |
m_s1apSapEnb = new MemberEpcS1apSapEnb<EpcEnbApplication> (this); |
8378 | 95 |
} |
96 |
||
97 |
||
98 |
EpcEnbApplication::~EpcEnbApplication (void) |
|
99 |
{ |
|
8380 | 100 |
NS_LOG_FUNCTION (this); |
8378 | 101 |
} |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
102 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
103 |
|
8380 | 104 |
void |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
105 |
EpcEnbApplication::SetS1SapUser (EpcEnbS1SapUser * s) |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
106 |
{ |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
107 |
m_s1SapUser = s; |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
108 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
109 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
110 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
111 |
EpcEnbS1SapProvider* |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
112 |
EpcEnbApplication::GetS1SapProvider () |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
113 |
{ |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
114 |
return m_s1SapProvider; |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
115 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
116 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
117 |
void |
9430
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
118 |
EpcEnbApplication::SetS1apSapMme (EpcS1apSapMme * s) |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
119 |
{ |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
120 |
m_s1apSapMme = s; |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
121 |
} |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
122 |
|
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
123 |
|
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
124 |
EpcS1apSapEnb* |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
125 |
EpcEnbApplication::GetS1apSapEnb () |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
126 |
{ |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
127 |
return m_s1apSapEnb; |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
128 |
} |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
129 |
|
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
130 |
void |
9345
8290ae6cab62
add/remove UEs and bearers upon handover
Nicola Baldo <nicola@baldo.biz>
parents:
9337
diff
changeset
|
131 |
EpcEnbApplication::DoInitialUeMessage (uint64_t imsi, uint16_t rnti) |
8290ae6cab62
add/remove UEs and bearers upon handover
Nicola Baldo <nicola@baldo.biz>
parents:
9337
diff
changeset
|
132 |
{ |
8290ae6cab62
add/remove UEs and bearers upon handover
Nicola Baldo <nicola@baldo.biz>
parents:
9337
diff
changeset
|
133 |
NS_LOG_FUNCTION (this); |
8290ae6cab62
add/remove UEs and bearers upon handover
Nicola Baldo <nicola@baldo.biz>
parents:
9337
diff
changeset
|
134 |
// side effect: create entry if not exist |
8290ae6cab62
add/remove UEs and bearers upon handover
Nicola Baldo <nicola@baldo.biz>
parents:
9337
diff
changeset
|
135 |
m_imsiRntiMap[imsi] = rnti; |
9430
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
136 |
m_s1apSapMme->InitialUeMessage (imsi, rnti, imsi, m_cellId); |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
137 |
} |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
138 |
|
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
139 |
|
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
140 |
void |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
141 |
EpcEnbApplication::DoInitialContextSetupRequest (uint64_t mmeUeS1Id, uint16_t enbUeS1Id, std::list<EpcS1apSapEnb::ErabToBeSetupItem> erabToBeSetupList) |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
142 |
{ |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
143 |
NS_LOG_FUNCTION (this); |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
144 |
|
9431
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
145 |
for (std::list<EpcS1apSapEnb::ErabToBeSetupItem>::iterator erabIt = erabToBeSetupList.begin (); |
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
146 |
erabIt != erabToBeSetupList.end (); |
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
147 |
++erabIt) |
9430
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
148 |
{ |
9431
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
149 |
// request the RRC to setup a radio bearer |
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
150 |
|
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
151 |
uint64_t imsi = mmeUeS1Id; |
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
152 |
std::map<uint64_t, uint16_t>::iterator imsiIt = m_imsiRntiMap.find (imsi); |
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
153 |
NS_ASSERT_MSG (imsiIt != m_imsiRntiMap.end (), "unknown IMSI"); |
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
154 |
uint16_t rnti = imsiIt->second; |
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
155 |
|
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
156 |
struct EpcEnbS1SapUser::DataRadioBearerSetupRequestParameters params; |
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
157 |
params.rnti = rnti; |
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
158 |
params.bearer = erabIt->erabLevelQosParameters; |
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
159 |
params.bearerId = erabIt->erabId; |
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
160 |
params.gtpTeid = erabIt->sgwTeid; |
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
161 |
m_s1SapUser->DataRadioBearerSetupRequest (params); |
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
162 |
|
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
163 |
EpsFlowId_t rbid (rnti, erabIt->erabId); |
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
164 |
// side effect: create entries if not exist |
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
165 |
m_rbidTeidMap[rbid] = params.gtpTeid; |
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
166 |
m_teidRbidMap[params.gtpTeid] = rbid; |
d157ce87b1c0
removed obsolete S1BearerSetupRequest method from EpcEnbS1Sap
Nicola Baldo <nbaldo@cttc.es>
parents:
9430
diff
changeset
|
167 |
|
9430
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
168 |
} |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
169 |
} |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
170 |
|
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
171 |
void |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
172 |
EpcEnbApplication::DoPathSwitchRequestAcknowledge (uint64_t enbUeS1Id, uint64_t mmeUeS1Id, uint16_t gci, std::list<EpcS1apSapEnb::ErabSwitchedInUplinkItem> erabToBeSwitchedInUplinkList) |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
173 |
{ |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
174 |
NS_LOG_FUNCTION (this); |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
175 |
NS_FATAL_ERROR ("not implemented"); |
9345
8290ae6cab62
add/remove UEs and bearers upon handover
Nicola Baldo <nicola@baldo.biz>
parents:
9337
diff
changeset
|
176 |
} |
8290ae6cab62
add/remove UEs and bearers upon handover
Nicola Baldo <nicola@baldo.biz>
parents:
9337
diff
changeset
|
177 |
|
8378 | 178 |
void |
179 |
EpcEnbApplication::RecvFromLteSocket (Ptr<Socket> socket) |
|
180 |
{ |
|
181 |
NS_LOG_FUNCTION (this); |
|
182 |
NS_ASSERT (socket == m_lteSocket); |
|
183 |
Ptr<Packet> packet = socket->Recv (); |
|
8386
419cbd9e357f
S1-U now working also in uplink
Nicola Baldo <nbaldo@cttc.es>
parents:
8380
diff
changeset
|
184 |
|
419cbd9e357f
S1-U now working also in uplink
Nicola Baldo <nbaldo@cttc.es>
parents:
8380
diff
changeset
|
185 |
// workaround for bug 231 https://www.nsnam.org/bugzilla/show_bug.cgi?id=231 |
419cbd9e357f
S1-U now working also in uplink
Nicola Baldo <nbaldo@cttc.es>
parents:
8380
diff
changeset
|
186 |
SocketAddressTag satag; |
419cbd9e357f
S1-U now working also in uplink
Nicola Baldo <nbaldo@cttc.es>
parents:
8380
diff
changeset
|
187 |
packet->RemovePacketTag (satag); |
419cbd9e357f
S1-U now working also in uplink
Nicola Baldo <nbaldo@cttc.es>
parents:
8380
diff
changeset
|
188 |
|
9406 | 189 |
EpsBearerTag tag; |
8380 | 190 |
bool found = packet->RemovePacketTag (tag); |
191 |
NS_ASSERT (found); |
|
9406 | 192 |
EpsFlowId_t flowId; |
8380 | 193 |
flowId.m_rnti = tag.GetRnti (); |
9406 | 194 |
flowId.m_bid = tag.GetBid (); |
195 |
NS_LOG_LOGIC ("received packet with RNTI=" << flowId.m_rnti << ", BID=" << (uint16_t) flowId.m_bid); |
|
196 |
std::map<EpsFlowId_t, uint32_t>::iterator it = m_rbidTeidMap.find (flowId); |
|
8380 | 197 |
NS_ASSERT (it != m_rbidTeidMap.end ()); |
198 |
uint32_t teid = it->second; |
|
8378 | 199 |
SendToS1uSocket (packet, teid); |
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
200 |
} |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
201 |
|
8378 | 202 |
void |
203 |
EpcEnbApplication::RecvFromS1uSocket (Ptr<Socket> socket) |
|
204 |
{ |
|
8380 | 205 |
NS_LOG_FUNCTION (this << socket); |
8378 | 206 |
NS_ASSERT (socket == m_s1uSocket); |
207 |
Ptr<Packet> packet = socket->Recv (); |
|
208 |
GtpuHeader gtpu; |
|
209 |
packet->RemoveHeader (gtpu); |
|
210 |
uint32_t teid = gtpu.GetTeid (); |
|
9406 | 211 |
std::map<uint32_t, EpsFlowId_t>::iterator it = m_teidRbidMap.find (teid); |
8380 | 212 |
NS_ASSERT (it != m_teidRbidMap.end ()); |
213 |
||
214 |
// workaround for bug 231 https://www.nsnam.org/bugzilla/show_bug.cgi?id=231 |
|
215 |
SocketAddressTag tag; |
|
216 |
packet->RemovePacketTag (tag); |
|
217 |
||
9406 | 218 |
SendToLteSocket (packet, it->second.m_rnti, it->second.m_bid); |
8378 | 219 |
} |
220 |
||
221 |
void |
|
9406 | 222 |
EpcEnbApplication::SendToLteSocket (Ptr<Packet> packet, uint16_t rnti, uint8_t bid) |
8380 | 223 |
{ |
9406 | 224 |
NS_LOG_FUNCTION (this << packet << rnti << (uint16_t) bid); |
225 |
EpsBearerTag tag (rnti, bid); |
|
8380 | 226 |
packet->AddPacketTag (tag); |
227 |
int sentBytes = m_lteSocket->Send (packet); |
|
228 |
NS_ASSERT (sentBytes > 0); |
|
229 |
} |
|
230 |
||
231 |
||
232 |
void |
|
8378 | 233 |
EpcEnbApplication::SendToS1uSocket (Ptr<Packet> packet, uint32_t teid) |
234 |
{ |
|
8380 | 235 |
NS_LOG_FUNCTION (this << packet << teid); |
236 |
GtpuHeader gtpu; |
|
8378 | 237 |
gtpu.SetTeid (teid); |
238 |
// From 3GPP TS 29.281 v10.0.0 Section 5.1 |
|
239 |
// Length of the payload + the non obligatory GTP-U header |
|
8380 | 240 |
gtpu.SetLength (packet->GetSize () + gtpu.GetSerializedSize () - 8); |
8378 | 241 |
packet->AddHeader (gtpu); |
242 |
uint32_t flags = 0; |
|
8386
419cbd9e357f
S1-U now working also in uplink
Nicola Baldo <nbaldo@cttc.es>
parents:
8380
diff
changeset
|
243 |
m_s1uSocket->SendTo (packet, flags, InetSocketAddress(m_sgwAddress, m_gtpuUdpPort)); |
8378 | 244 |
} |
245 |
||
246 |
||
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
247 |
}; // namespace ns3 |