A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
epc-mme-application.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017-2018 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Manuel Requena <manuel.requena@cttc.es>
18 */
19
20#ifndef EPC_MME_APPLICATION_H
21#define EPC_MME_APPLICATION_H
22
23#include "epc-gtpc-header.h"
24#include "epc-s1ap-sap.h"
25
26#include "ns3/application.h"
27#include "ns3/socket.h"
28
29#include <map>
30
31namespace ns3
32{
33
34/**
35 * \ingroup lte
36 *
37 * This application implements the Mobility Management Entity (MME) according to
38 * the 3GPP TS 23.401 document.
39 *
40 * This Application implements the MME side of the S1-MME interface between
41 * the MME node and the eNB nodes and the MME side of the S11 interface between
42 * the MME node and the SGW node. It supports the following functions and messages:
43 *
44 * - Bearer management functions including dedicated bearer establishment
45 * - NAS signalling
46 * - Tunnel Management messages
47 *
48 * Others functions enumerated in section 4.4.2 of 3GPP TS 23.401 are not supported.
49 */
51{
52 /// allow MemberEpcS1apSapMme<EpcMme> class friend access
54
55 public:
56 /**
57 * \brief Get the type ID.
58 * \return the object TypeId
59 */
60 static TypeId GetTypeId();
61 void DoDispose() override;
62
63 /** Constructor */
65
66 /** Destructor */
67 ~EpcMmeApplication() override;
68
69 /**
70 *
71 * \return the MME side of the S1-AP SAP
72 */
74
75 /**
76 * Add a new SGW to the MME
77 *
78 * \param sgwS11Addr IPv4 address of the SGW S11 interface
79 * \param mmeS11Addr IPv4 address of the MME S11 interface
80 * \param mmeS11Socket socket of the MME S11 interface
81 */
82 void AddSgw(Ipv4Address sgwS11Addr, Ipv4Address mmeS11Addr, Ptr<Socket> mmeS11Socket);
83
84 /**
85 * Add a new eNB to the MME
86 *
87 * \param ecgi E-UTRAN Cell Global ID, the unique identifier of the eNodeB
88 * \param enbS1UAddr IPv4 address of the eNB for S1-U communications
89 * \param enbS1apSap the eNB side of the S1-AP SAP
90 */
91 void AddEnb(uint16_t ecgi, Ipv4Address enbS1UAddr, EpcS1apSapEnb* enbS1apSap);
92
93 /**
94 * Add a new UE to the MME. This is the equivalent of storing the UE
95 * credentials before the UE is ever turned on.
96 *
97 * \param imsi the unique identifier of the UE
98 */
99 void AddUe(uint64_t imsi);
100
101 /**
102 * Add an EPS bearer to the list of bearers to be activated for this UE.
103 * The bearer will be activated when the UE enters the ECM
104 * connected state.
105 *
106 * \param imsi UE identifier
107 * \param tft traffic flow template of the bearer
108 * \param bearer QoS characteristics of the bearer
109 * \returns bearer ID
110 */
111 uint8_t AddBearer(uint64_t imsi, Ptr<EpcTft> tft, EpsBearer bearer);
112
113 private:
114 // S1-AP SAP MME forwarded methods
115
116 /**
117 * Process the S1 Initial UE Message received from an eNB
118 * \param mmeUeS1Id the MME UE S1 ID
119 * \param enbUeS1Id the ENB UE S1 ID
120 * \param imsi the IMSI
121 * \param ecgi the ECGI
122 */
123 void DoInitialUeMessage(uint64_t mmeUeS1Id, uint16_t enbUeS1Id, uint64_t imsi, uint16_t ecgi);
124
125 /**
126 * Process the S1 Initial Context Setup Response received from an eNB
127 * \param mmeUeS1Id the MME UE S1 ID
128 * \param enbUeS1Id the ENB UE S1 ID
129 * \param erabSetupList the ERAB setup list
130 */
131 void DoInitialContextSetupResponse(uint64_t mmeUeS1Id,
132 uint16_t enbUeS1Id,
133 std::list<EpcS1apSapMme::ErabSetupItem> erabSetupList);
134
135 /**
136 * Process the S1 Path Switch Request received from an eNB
137 * \param mmeUeS1Id the MME UE S1 ID
138 * \param enbUeS1Id the ENB UE S1 ID
139 * \param cgi the CGI
140 * \param erabToBeSwitchedInDownlinkList the ERAB to be switched in downlink list
141 */
143 uint64_t enbUeS1Id,
144 uint64_t mmeUeS1Id,
145 uint16_t cgi,
146 std::list<EpcS1apSapMme::ErabSwitchedInDownlinkItem> erabToBeSwitchedInDownlinkList);
147
148 /**
149 * Process ERAB Release Indication received from an eNB
150 * \param mmeUeS1Id the MME UE S1 ID
151 * \param enbUeS1Id the ENB UE S1 ID
152 * \param erabToBeReleaseIndication the ERAB to be release indication list
153 */
155 uint64_t mmeUeS1Id,
156 uint16_t enbUeS1Id,
157 std::list<EpcS1apSapMme::ErabToBeReleasedIndication> erabToBeReleaseIndication);
158
159 // Methods to read/process GTP-C messages of the S11 interface
160
161 /**
162 * Reads the S11 messages from a socket
163 * \param socket the socket
164 */
165 void RecvFromS11Socket(Ptr<Socket> socket);
166
167 /**
168 * Process GTP-C Create Session Response message
169 * \param header the GTP-C header
170 * \param packet the packet containing the message
171 */
173
174 /**
175 * Process GTP-C Modify Bearer Response message
176 * \param header the GTP-C header
177 * \param packet the packet containing the message
178 */
180
181 /**
182 * Process GTP-C Delete Bearer Request message
183 * \param header the GTP-C header
184 * \param packet the packet containing the message
185 */
187
188 /**
189 * Hold info on an EPS bearer to be activated
190 */
192 {
193 Ptr<EpcTft> tft; ///< traffic flow template
194 EpsBearer bearer; ///< bearer QOS characteristics
195 uint8_t bearerId; ///< bearer ID
196 };
197
198 /**
199 * Hold info on a UE
200 */
201 struct UeInfo : public SimpleRefCount<UeInfo>
202 {
203 uint64_t imsi; ///< UE identifier
204 uint64_t mmeUeS1Id; ///< mmeUeS1Id
205 uint16_t enbUeS1Id; ///< enbUeS1Id
206 uint16_t cellId; ///< cell ID
207 uint16_t bearerCounter; ///< bearer counter
208 std::list<BearerInfo> bearersToBeActivated; ///< list of bearers to be activated
209 };
210
211 /**
212 * UeInfo stored by IMSI
213 */
214 std::map<uint64_t, Ptr<UeInfo>> m_ueInfoMap;
215
216 /**
217 * \brief This Function erases all contexts of bearer from MME side
218 * \param ueInfo UE information pointer
219 * \param epsBearerId Bearer Id which need to be removed corresponding to UE
220 */
221 void RemoveBearer(Ptr<UeInfo> ueInfo, uint8_t epsBearerId);
222
223 /**
224 * Hold info on an ENB
225 */
226 struct EnbInfo : public SimpleRefCount<EnbInfo>
227 {
228 uint16_t gci; ///< GCI
229 Ipv4Address s1uAddr; ///< IP address of the S1-U interface
230 EpcS1apSapEnb* s1apSapEnb; ///< EpcS1apSapEnb
231 };
232
233 /**
234 * EnbInfo stored by EGCI
235 */
236 std::map<uint16_t, Ptr<EnbInfo>> m_enbInfoMap;
237
238 EpcS1apSapMme* m_s1apSapMme; ///< EpcS1apSapMme
239
240 Ptr<Socket> m_s11Socket; ///< Socket to send/receive messages in the S11 interface
241 Ipv4Address m_mmeS11Addr; ///< IPv4 address of the MME S11 interface
242 Ipv4Address m_sgwS11Addr; ///< IPv4 address of the SGW S11 interface
243 uint16_t m_gtpcUdpPort; ///< UDP port for GTP-C protocol. Fixed by the standard to port 2123
244};
245
246} // namespace ns3
247
248#endif // EPC_MME_APPLICATION_H
The base class for all ns3 applications.
Definition: application.h:62
This application implements the Mobility Management Entity (MME) according to the 3GPP TS 23....
void AddUe(uint64_t imsi)
Add a new UE to the MME.
void DoPathSwitchRequest(uint64_t enbUeS1Id, uint64_t mmeUeS1Id, uint16_t cgi, std::list< EpcS1apSapMme::ErabSwitchedInDownlinkItem > erabToBeSwitchedInDownlinkList)
Process the S1 Path Switch Request received from an eNB.
void AddEnb(uint16_t ecgi, Ipv4Address enbS1UAddr, EpcS1apSapEnb *enbS1apSap)
Add a new eNB to the MME.
std::map< uint64_t, Ptr< UeInfo > > m_ueInfoMap
UeInfo stored by IMSI.
void AddSgw(Ipv4Address sgwS11Addr, Ipv4Address mmeS11Addr, Ptr< Socket > mmeS11Socket)
Add a new SGW to the MME.
Ptr< Socket > m_s11Socket
Socket to send/receive messages in the S11 interface.
EpcS1apSapMme * m_s1apSapMme
EpcS1apSapMme.
Ipv4Address m_mmeS11Addr
IPv4 address of the MME S11 interface.
Ipv4Address m_sgwS11Addr
IPv4 address of the SGW S11 interface.
~EpcMmeApplication() override
Destructor.
void DoInitialContextSetupResponse(uint64_t mmeUeS1Id, uint16_t enbUeS1Id, std::list< EpcS1apSapMme::ErabSetupItem > erabSetupList)
Process the S1 Initial Context Setup Response received from an eNB.
void DoInitialUeMessage(uint64_t mmeUeS1Id, uint16_t enbUeS1Id, uint64_t imsi, uint16_t ecgi)
Process the S1 Initial UE Message received from an eNB.
static TypeId GetTypeId()
Get the type ID.
void DoErabReleaseIndication(uint64_t mmeUeS1Id, uint16_t enbUeS1Id, std::list< EpcS1apSapMme::ErabToBeReleasedIndication > erabToBeReleaseIndication)
Process ERAB Release Indication received from an eNB.
void DoRecvCreateSessionResponse(GtpcHeader &header, Ptr< Packet > packet)
Process GTP-C Create Session Response message.
void DoRecvDeleteBearerRequest(GtpcHeader &header, Ptr< Packet > packet)
Process GTP-C Delete Bearer Request message.
void DoRecvModifyBearerResponse(GtpcHeader &header, Ptr< Packet > packet)
Process GTP-C Modify Bearer Response message.
std::map< uint16_t, Ptr< EnbInfo > > m_enbInfoMap
EnbInfo stored by EGCI.
void RemoveBearer(Ptr< UeInfo > ueInfo, uint8_t epsBearerId)
This Function erases all contexts of bearer from MME side.
uint8_t AddBearer(uint64_t imsi, Ptr< EpcTft > tft, EpsBearer bearer)
Add an EPS bearer to the list of bearers to be activated for this UE.
uint16_t m_gtpcUdpPort
UDP port for GTP-C protocol. Fixed by the standard to port 2123.
void DoDispose() override
Destructor implementation.
EpcS1apSapMme * GetS1apSapMme()
void RecvFromS11Socket(Ptr< Socket > socket)
Reads the S11 messages from a socket.
eNB side of the S1-AP Service Access Point (SAP), provides the eNB methods to be called when an S1-AP...
Definition: epc-s1ap-sap.h:144
MME side of the S1-AP Service Access Point (SAP), provides the MME methods to be called when an S1-AP...
Definition: epc-s1ap-sap.h:53
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:91
Header of the GTPv2-C protocol.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
Template for the implementation of the EpcS1apSapMme as a member of an owner class of type C to which...
Definition: epc-s1ap-sap.h:197
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
A template-based reference counting class.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Hold info on an EPS bearer to be activated.
EpsBearer bearer
bearer QOS characteristics
Ptr< EpcTft > tft
traffic flow template
EpcS1apSapEnb * s1apSapEnb
EpcS1apSapEnb.
Ipv4Address s1uAddr
IP address of the S1-U interface.
uint16_t bearerCounter
bearer counter
std::list< BearerInfo > bearersToBeActivated
list of bearers to be activated