A Discrete-Event Network Simulator
API
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 
31 namespace ns3
32 {
33 
51 {
54 
55  public:
60  static TypeId GetTypeId();
61  void DoDispose() override;
62 
65 
67  ~EpcMmeApplication() override;
68 
74 
82  void AddSgw(Ipv4Address sgwS11Addr, Ipv4Address mmeS11Addr, Ptr<Socket> mmeS11Socket);
83 
91  void AddEnb(uint16_t ecgi, Ipv4Address enbS1UAddr, EpcS1apSapEnb* enbS1apSap);
92 
99  void AddUe(uint64_t imsi);
100 
111  uint8_t AddBearer(uint64_t imsi, Ptr<EpcTft> tft, EpsBearer bearer);
112 
113  private:
114  // S1-AP SAP MME forwarded methods
115 
123  void DoInitialUeMessage(uint64_t mmeUeS1Id, uint16_t enbUeS1Id, uint64_t imsi, uint16_t ecgi);
124 
131  void DoInitialContextSetupResponse(uint64_t mmeUeS1Id,
132  uint16_t enbUeS1Id,
133  std::list<EpcS1apSapMme::ErabSetupItem> erabSetupList);
134 
142  void DoPathSwitchRequest(
143  uint64_t enbUeS1Id,
144  uint64_t mmeUeS1Id,
145  uint16_t cgi,
146  std::list<EpcS1apSapMme::ErabSwitchedInDownlinkItem> erabToBeSwitchedInDownlinkList);
147 
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 
165  void RecvFromS11Socket(Ptr<Socket> socket);
166 
172  void DoRecvCreateSessionResponse(GtpcHeader& header, Ptr<Packet> packet);
173 
179  void DoRecvModifyBearerResponse(GtpcHeader& header, Ptr<Packet> packet);
180 
186  void DoRecvDeleteBearerRequest(GtpcHeader& header, Ptr<Packet> packet);
187 
191  struct BearerInfo
192  {
195  uint8_t bearerId;
196  };
197 
201  struct UeInfo : public SimpleRefCount<UeInfo>
202  {
203  uint64_t imsi;
204  uint64_t mmeUeS1Id;
205  uint16_t enbUeS1Id;
206  uint16_t cellId;
207  uint16_t bearerCounter;
208  std::list<BearerInfo> bearersToBeActivated;
209  };
210 
214  std::map<uint64_t, Ptr<UeInfo>> m_ueInfoMap;
215 
221  void RemoveBearer(Ptr<UeInfo> ueInfo, uint8_t epsBearerId);
222 
226  struct EnbInfo : public SimpleRefCount<EnbInfo>
227  {
228  uint16_t gci;
231  };
232 
236  std::map<uint16_t, Ptr<EnbInfo>> m_enbInfoMap;
237 
239 
243  uint16_t m_gtpcUdpPort;
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
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