author | Nicola Baldo <nbaldo@cttc.es> |
Wed, 28 Nov 2012 11:37:28 +0100 | |
changeset 9430 | e8b87593ee5b |
parent 9414 | 7b0db3dbf19b |
child 9431 | d157ce87b1c0 |
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 |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
131 |
EpcEnbApplication::ErabSetupRequest (uint32_t teid, uint64_t imsi, EpsBearer bearer) |
8380 | 132 |
{ |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
133 |
NS_LOG_FUNCTION (this << teid << imsi); |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
134 |
// request the RRC to setup a radio bearer |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
135 |
struct EpcEnbS1SapUser::DataRadioBearerSetupRequestParameters params; |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
136 |
params.bearer = bearer; |
9408
80fa1de0bef2
implemented UeManager::GetErabList ()
Nicola Baldo <nbaldo@cttc.es>
parents:
9406
diff
changeset
|
137 |
params.gtpTeid = teid; |
9345
8290ae6cab62
add/remove UEs and bearers upon handover
Nicola Baldo <nicola@baldo.biz>
parents:
9337
diff
changeset
|
138 |
std::map<uint64_t, uint16_t>::iterator it = m_imsiRntiMap.find (imsi); |
8290ae6cab62
add/remove UEs and bearers upon handover
Nicola Baldo <nicola@baldo.biz>
parents:
9337
diff
changeset
|
139 |
NS_ASSERT_MSG (it != m_imsiRntiMap.end (), "unknown IMSI"); |
8290ae6cab62
add/remove UEs and bearers upon handover
Nicola Baldo <nicola@baldo.biz>
parents:
9337
diff
changeset
|
140 |
params.rnti = it->second; |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
141 |
m_s1SapUser->DataRadioBearerSetupRequest (params); |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
142 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
143 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
144 |
void |
9345
8290ae6cab62
add/remove UEs and bearers upon handover
Nicola Baldo <nicola@baldo.biz>
parents:
9337
diff
changeset
|
145 |
EpcEnbApplication::DoS1BearerSetupRequest (EpcEnbS1SapProvider::S1BearerSetupRequestParameters params) |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
8462
diff
changeset
|
146 |
{ |
9406 | 147 |
NS_LOG_FUNCTION (this << params.rnti << params.bid); |
148 |
EpsFlowId_t rbid (params.rnti, params.bid); |
|
8380 | 149 |
// side effect: create entries if not exist |
9408
80fa1de0bef2
implemented UeManager::GetErabList ()
Nicola Baldo <nbaldo@cttc.es>
parents:
9406
diff
changeset
|
150 |
m_rbidTeidMap[rbid] = params.gtpTeid; |
80fa1de0bef2
implemented UeManager::GetErabList ()
Nicola Baldo <nbaldo@cttc.es>
parents:
9406
diff
changeset
|
151 |
m_teidRbidMap[params.gtpTeid] = rbid; |
8380 | 152 |
} |
8378 | 153 |
|
9345
8290ae6cab62
add/remove UEs and bearers upon handover
Nicola Baldo <nicola@baldo.biz>
parents:
9337
diff
changeset
|
154 |
|
8290ae6cab62
add/remove UEs and bearers upon handover
Nicola Baldo <nicola@baldo.biz>
parents:
9337
diff
changeset
|
155 |
void |
8290ae6cab62
add/remove UEs and bearers upon handover
Nicola Baldo <nicola@baldo.biz>
parents:
9337
diff
changeset
|
156 |
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
|
157 |
{ |
8290ae6cab62
add/remove UEs and bearers upon handover
Nicola Baldo <nicola@baldo.biz>
parents:
9337
diff
changeset
|
158 |
NS_LOG_FUNCTION (this); |
8290ae6cab62
add/remove UEs and bearers upon handover
Nicola Baldo <nicola@baldo.biz>
parents:
9337
diff
changeset
|
159 |
// side effect: create entry if not exist |
8290ae6cab62
add/remove UEs and bearers upon handover
Nicola Baldo <nicola@baldo.biz>
parents:
9337
diff
changeset
|
160 |
m_imsiRntiMap[imsi] = rnti; |
9430
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
161 |
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
|
162 |
} |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
163 |
|
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
164 |
|
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
165 |
void |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
166 |
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
|
167 |
{ |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
168 |
NS_LOG_FUNCTION (this); |
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 |
for (std::list<EpcS1apSapEnb::ErabToBeSetupItem>::iterator it = erabToBeSetupList.begin (); |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
171 |
it != erabToBeSetupList.end (); |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
172 |
++it) |
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 |
ErabSetupRequest (it->sgwTeid, mmeUeS1Id, it->erabLevelQosParameters); |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
175 |
} |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
176 |
} |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
177 |
|
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
178 |
void |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
179 |
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
|
180 |
{ |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
181 |
NS_LOG_FUNCTION (this); |
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9414
diff
changeset
|
182 |
NS_FATAL_ERROR ("not implemented"); |
9345
8290ae6cab62
add/remove UEs and bearers upon handover
Nicola Baldo <nicola@baldo.biz>
parents:
9337
diff
changeset
|
183 |
} |
8290ae6cab62
add/remove UEs and bearers upon handover
Nicola Baldo <nicola@baldo.biz>
parents:
9337
diff
changeset
|
184 |
|
8378 | 185 |
void |
186 |
EpcEnbApplication::RecvFromLteSocket (Ptr<Socket> socket) |
|
187 |
{ |
|
188 |
NS_LOG_FUNCTION (this); |
|
189 |
NS_ASSERT (socket == m_lteSocket); |
|
190 |
Ptr<Packet> packet = socket->Recv (); |
|
8386
419cbd9e357f
S1-U now working also in uplink
Nicola Baldo <nbaldo@cttc.es>
parents:
8380
diff
changeset
|
191 |
|
419cbd9e357f
S1-U now working also in uplink
Nicola Baldo <nbaldo@cttc.es>
parents:
8380
diff
changeset
|
192 |
// 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
|
193 |
SocketAddressTag satag; |
419cbd9e357f
S1-U now working also in uplink
Nicola Baldo <nbaldo@cttc.es>
parents:
8380
diff
changeset
|
194 |
packet->RemovePacketTag (satag); |
419cbd9e357f
S1-U now working also in uplink
Nicola Baldo <nbaldo@cttc.es>
parents:
8380
diff
changeset
|
195 |
|
9406 | 196 |
EpsBearerTag tag; |
8380 | 197 |
bool found = packet->RemovePacketTag (tag); |
198 |
NS_ASSERT (found); |
|
9406 | 199 |
EpsFlowId_t flowId; |
8380 | 200 |
flowId.m_rnti = tag.GetRnti (); |
9406 | 201 |
flowId.m_bid = tag.GetBid (); |
202 |
NS_LOG_LOGIC ("received packet with RNTI=" << flowId.m_rnti << ", BID=" << (uint16_t) flowId.m_bid); |
|
203 |
std::map<EpsFlowId_t, uint32_t>::iterator it = m_rbidTeidMap.find (flowId); |
|
8380 | 204 |
NS_ASSERT (it != m_rbidTeidMap.end ()); |
205 |
uint32_t teid = it->second; |
|
8378 | 206 |
SendToS1uSocket (packet, teid); |
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
207 |
} |
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
208 |
|
8378 | 209 |
void |
210 |
EpcEnbApplication::RecvFromS1uSocket (Ptr<Socket> socket) |
|
211 |
{ |
|
8380 | 212 |
NS_LOG_FUNCTION (this << socket); |
8378 | 213 |
NS_ASSERT (socket == m_s1uSocket); |
214 |
Ptr<Packet> packet = socket->Recv (); |
|
215 |
GtpuHeader gtpu; |
|
216 |
packet->RemoveHeader (gtpu); |
|
217 |
uint32_t teid = gtpu.GetTeid (); |
|
9406 | 218 |
std::map<uint32_t, EpsFlowId_t>::iterator it = m_teidRbidMap.find (teid); |
8380 | 219 |
NS_ASSERT (it != m_teidRbidMap.end ()); |
220 |
||
221 |
// workaround for bug 231 https://www.nsnam.org/bugzilla/show_bug.cgi?id=231 |
|
222 |
SocketAddressTag tag; |
|
223 |
packet->RemovePacketTag (tag); |
|
224 |
||
9406 | 225 |
SendToLteSocket (packet, it->second.m_rnti, it->second.m_bid); |
8378 | 226 |
} |
227 |
||
228 |
void |
|
9406 | 229 |
EpcEnbApplication::SendToLteSocket (Ptr<Packet> packet, uint16_t rnti, uint8_t bid) |
8380 | 230 |
{ |
9406 | 231 |
NS_LOG_FUNCTION (this << packet << rnti << (uint16_t) bid); |
232 |
EpsBearerTag tag (rnti, bid); |
|
8380 | 233 |
packet->AddPacketTag (tag); |
234 |
int sentBytes = m_lteSocket->Send (packet); |
|
235 |
NS_ASSERT (sentBytes > 0); |
|
236 |
} |
|
237 |
||
238 |
||
239 |
void |
|
8378 | 240 |
EpcEnbApplication::SendToS1uSocket (Ptr<Packet> packet, uint32_t teid) |
241 |
{ |
|
8380 | 242 |
NS_LOG_FUNCTION (this << packet << teid); |
243 |
GtpuHeader gtpu; |
|
8378 | 244 |
gtpu.SetTeid (teid); |
245 |
// From 3GPP TS 29.281 v10.0.0 Section 5.1 |
|
246 |
// Length of the payload + the non obligatory GTP-U header |
|
8380 | 247 |
gtpu.SetLength (packet->GetSize () + gtpu.GetSerializedSize () - 8); |
8378 | 248 |
packet->AddHeader (gtpu); |
249 |
uint32_t flags = 0; |
|
8386
419cbd9e357f
S1-U now working also in uplink
Nicola Baldo <nbaldo@cttc.es>
parents:
8380
diff
changeset
|
250 |
m_s1uSocket->SendTo (packet, flags, InetSocketAddress(m_sgwAddress, m_gtpuUdpPort)); |
8378 | 251 |
} |
252 |
||
253 |
||
8357
7bb52f00c205
Refurbished GTP tunneling implementation + documentation
Jaume Nin
parents:
diff
changeset
|
254 |
}; // namespace ns3 |