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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Manuel Requena <manuel.requena@cttc.es>
7 */
8
9#ifndef EPC_MME_APPLICATION_H
10#define EPC_MME_APPLICATION_H
11
12#include "epc-gtpc-header.h"
13#include "epc-s1ap-sap.h"
14
15#include "ns3/application.h"
16#include "ns3/socket.h"
17
18#include <map>
19
20namespace ns3
21{
22
23/**
24 * \ingroup lte
25 *
26 * This application implements the Mobility Management Entity (MME) according to
27 * the 3GPP TS 23.401 document.
28 *
29 * This Application implements the MME side of the S1-MME interface between
30 * the MME node and the eNB nodes and the MME side of the S11 interface between
31 * the MME node and the SGW node. It supports the following functions and messages:
32 *
33 * - Bearer management functions including dedicated bearer establishment
34 * - NAS signalling
35 * - Tunnel Management messages
36 *
37 * Others functions enumerated in section 4.4.2 of 3GPP TS 23.401 are not supported.
38 */
40{
41 /// allow MemberEpcS1apSapMme<EpcMme> class friend access
43
44 public:
45 /**
46 * \brief Get the type ID.
47 * \return the object TypeId
48 */
49 static TypeId GetTypeId();
50 void DoDispose() override;
51
52 /** Constructor */
54
55 /** Destructor */
56 ~EpcMmeApplication() override;
57
58 /**
59 *
60 * \return the MME side of the S1-AP SAP
61 */
63
64 /**
65 * Add a new SGW to the MME
66 *
67 * \param sgwS11Addr IPv4 address of the SGW S11 interface
68 * \param mmeS11Addr IPv4 address of the MME S11 interface
69 * \param mmeS11Socket socket of the MME S11 interface
70 */
71 void AddSgw(Ipv4Address sgwS11Addr, Ipv4Address mmeS11Addr, Ptr<Socket> mmeS11Socket);
72
73 /**
74 * Add a new eNB to the MME
75 *
76 * \param ecgi E-UTRAN Cell Global ID, the unique identifier of the eNodeB
77 * \param enbS1UAddr IPv4 address of the eNB for S1-U communications
78 * \param enbS1apSap the eNB side of the S1-AP SAP
79 */
80 void AddEnb(uint16_t ecgi, Ipv4Address enbS1UAddr, EpcS1apSapEnb* enbS1apSap);
81
82 /**
83 * Add a new UE to the MME. This is the equivalent of storing the UE
84 * credentials before the UE is ever turned on.
85 *
86 * \param imsi the unique identifier of the UE
87 */
88 void AddUe(uint64_t imsi);
89
90 /**
91 * Add an EPS bearer to the list of bearers to be activated for this UE.
92 * The bearer will be activated when the UE enters the ECM
93 * connected state.
94 *
95 * \param imsi UE identifier
96 * \param tft traffic flow template of the bearer
97 * \param bearer QoS characteristics of the bearer
98 * \returns bearer ID
99 */
100 uint8_t AddBearer(uint64_t imsi, Ptr<EpcTft> tft, EpsBearer bearer);
101
102 private:
103 // S1-AP SAP MME forwarded methods
104
105 /**
106 * Process the S1 Initial UE Message received from an eNB
107 * \param mmeUeS1Id the MME UE S1 ID
108 * \param enbUeS1Id the ENB UE S1 ID
109 * \param imsi the IMSI
110 * \param ecgi the ECGI
111 */
112 void DoInitialUeMessage(uint64_t mmeUeS1Id, uint16_t enbUeS1Id, uint64_t imsi, uint16_t ecgi);
113
114 /**
115 * Process the S1 Initial Context Setup Response received from an eNB
116 * \param mmeUeS1Id the MME UE S1 ID
117 * \param enbUeS1Id the ENB UE S1 ID
118 * \param erabSetupList the ERAB setup list
119 */
120 void DoInitialContextSetupResponse(uint64_t mmeUeS1Id,
121 uint16_t enbUeS1Id,
122 std::list<EpcS1apSapMme::ErabSetupItem> erabSetupList);
123
124 /**
125 * Process the S1 Path Switch Request received from an eNB
126 * \param mmeUeS1Id the MME UE S1 ID
127 * \param enbUeS1Id the ENB UE S1 ID
128 * \param cgi the CGI
129 * \param erabToBeSwitchedInDownlinkList the ERAB to be switched in downlink list
130 */
132 uint64_t enbUeS1Id,
133 uint64_t mmeUeS1Id,
134 uint16_t cgi,
135 std::list<EpcS1apSapMme::ErabSwitchedInDownlinkItem> erabToBeSwitchedInDownlinkList);
136
137 /**
138 * Process ERAB Release Indication received from an eNB
139 * \param mmeUeS1Id the MME UE S1 ID
140 * \param enbUeS1Id the ENB UE S1 ID
141 * \param erabToBeReleaseIndication the ERAB to be release indication list
142 */
144 uint64_t mmeUeS1Id,
145 uint16_t enbUeS1Id,
146 std::list<EpcS1apSapMme::ErabToBeReleasedIndication> erabToBeReleaseIndication);
147
148 // Methods to read/process GTP-C messages of the S11 interface
149
150 /**
151 * Reads the S11 messages from a socket
152 * \param socket the socket
153 */
154 void RecvFromS11Socket(Ptr<Socket> socket);
155
156 /**
157 * Process GTP-C Create Session Response message
158 * \param header the GTP-C header
159 * \param packet the packet containing the message
160 */
162
163 /**
164 * Process GTP-C Modify Bearer Response message
165 * \param header the GTP-C header
166 * \param packet the packet containing the message
167 */
169
170 /**
171 * Process GTP-C Delete Bearer Request message
172 * \param header the GTP-C header
173 * \param packet the packet containing the message
174 */
176
177 /**
178 * Hold info on an EPS bearer to be activated
179 */
181 {
182 Ptr<EpcTft> tft; ///< traffic flow template
183 EpsBearer bearer; ///< bearer QOS characteristics
184 uint8_t bearerId; ///< bearer ID
185 };
186
187 /**
188 * Hold info on a UE
189 */
190 struct UeInfo : public SimpleRefCount<UeInfo>
191 {
192 uint64_t imsi; ///< UE identifier
193 uint64_t mmeUeS1Id; ///< mmeUeS1Id
194 uint16_t enbUeS1Id; ///< enbUeS1Id
195 uint16_t cellId; ///< cell ID
196 uint16_t bearerCounter; ///< bearer counter
197 std::list<BearerInfo> bearersToBeActivated; ///< list of bearers to be activated
198 };
199
200 /**
201 * UeInfo stored by IMSI
202 */
203 std::map<uint64_t, Ptr<UeInfo>> m_ueInfoMap;
204
205 /**
206 * \brief This Function erases all contexts of bearer from MME side
207 * \param ueInfo UE information pointer
208 * \param epsBearerId Bearer Id which need to be removed corresponding to UE
209 */
210 void RemoveBearer(Ptr<UeInfo> ueInfo, uint8_t epsBearerId);
211
212 /**
213 * Hold info on an ENB
214 */
215 struct EnbInfo : public SimpleRefCount<EnbInfo>
216 {
217 uint16_t gci; ///< GCI
218 Ipv4Address s1uAddr; ///< IP address of the S1-U interface
219 EpcS1apSapEnb* s1apSapEnb; ///< EpcS1apSapEnb
220 };
221
222 /**
223 * EnbInfo stored by EGCI
224 */
225 std::map<uint16_t, Ptr<EnbInfo>> m_enbInfoMap;
226
227 EpcS1apSapMme* m_s1apSapMme; ///< EpcS1apSapMme
228
229 Ptr<Socket> m_s11Socket; ///< Socket to send/receive messages in the S11 interface
230 Ipv4Address m_mmeS11Addr; ///< IPv4 address of the MME S11 interface
231 Ipv4Address m_sgwS11Addr; ///< IPv4 address of the SGW S11 interface
232 uint16_t m_gtpcUdpPort; ///< UDP port for GTP-C protocol. Fixed by the standard to port 2123
233};
234
235} // namespace ns3
236
237#endif // EPC_MME_APPLICATION_H
The base class for all ns3 applications.
Definition application.h:51
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...
MME side of the S1-AP Service Access Point (SAP), provides the MME methods to be called when an S1-AP...
This class contains the specification of EPS Bearers.
Definition eps-bearer.h:80
Header of the GTPv2-C protocol.
Ipv4 addresses are stored in host order in this class.
Template for the implementation of the EpcS1apSapMme as a member of an owner class of type C to which...
Smart pointer class similar to boost::intrusive_ptr.
A template-based reference counting class.
a unique identifier for an interface.
Definition type-id.h:48
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