A Discrete-Event Network Simulator
API
epc-mme-application.h
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2017-2018 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Manuel Requena <manuel.requena@cttc.es>
19  */
20 
21 #ifndef EPC_MME_APPLICATION_H
22 #define EPC_MME_APPLICATION_H
23 
24 #include "ns3/application.h"
25 #include "ns3/socket.h"
26 #include "ns3/epc-s1ap-sap.h"
27 
28 namespace ns3 {
29 
47 {
50 
51 public:
56  static TypeId GetTypeId (void);
57  virtual void DoDispose ();
58 
61 
63  virtual ~EpcMmeApplication ();
64 
70 
71 
79  void AddSgw (Ipv4Address sgwS11Addr, Ipv4Address mmeS11Addr, Ptr<Socket> mmeS11Socket);
80 
88  void AddEnb (uint16_t ecgi, Ipv4Address enbS1UAddr, EpcS1apSapEnb* enbS1apSap);
89 
96  void AddUe (uint64_t imsi);
97 
108  uint8_t AddBearer (uint64_t imsi, Ptr<EpcTft> tft, EpsBearer bearer);
109 
110 
111 private:
112  // S1-AP SAP MME forwarded methods
113 
121  void DoInitialUeMessage (uint64_t mmeUeS1Id, uint16_t enbUeS1Id, uint64_t imsi, uint16_t ecgi);
122 
129  void DoInitialContextSetupResponse (uint64_t mmeUeS1Id, uint16_t enbUeS1Id, std::list<EpcS1apSapMme::ErabSetupItem> erabSetupList);
130 
138  void DoPathSwitchRequest (uint64_t enbUeS1Id, uint64_t mmeUeS1Id, uint16_t cgi, std::list<EpcS1apSapMme::ErabSwitchedInDownlinkItem> erabToBeSwitchedInDownlinkList);
139 
146  void DoErabReleaseIndication (uint64_t mmeUeS1Id, uint16_t enbUeS1Id, std::list<EpcS1apSapMme::ErabToBeReleasedIndication> erabToBeReleaseIndication);
147 
148 
149  // Methods to read/process GTP-C messages of the S11 interface
150 
155  void RecvFromS11Socket (Ptr<Socket> socket);
156 
162  void DoRecvCreateSessionResponse (GtpcHeader &header, Ptr<Packet> packet);
163 
169  void DoRecvModifyBearerResponse (GtpcHeader &header, Ptr<Packet> packet);
170 
176  void DoRecvDeleteBearerRequest (GtpcHeader &header, Ptr<Packet> packet);
177 
178 
182  struct BearerInfo
183  {
186  uint8_t bearerId;
187  };
188 
192  struct UeInfo : public SimpleRefCount<UeInfo>
193  {
194  uint64_t imsi;
195  uint64_t mmeUeS1Id;
196  uint16_t enbUeS1Id;
197  uint16_t cellId;
198  uint16_t bearerCounter;
199  std::list<BearerInfo> bearersToBeActivated;
200  };
201 
205  std::map<uint64_t, Ptr<UeInfo> > m_ueInfoMap;
206 
212  void RemoveBearer (Ptr<UeInfo> ueInfo, uint8_t epsBearerId);
213 
217  struct EnbInfo : public SimpleRefCount<EnbInfo>
218  {
219  uint16_t gci;
222  };
223 
227  std::map<uint16_t, Ptr<EnbInfo> > m_enbInfoMap;
228 
229 
231 
235  uint16_t m_gtpcUdpPort;
236 };
237 
238 } // namespace ns3
239 
240 #endif // EPC_MME_APPLICATION_H
void RemoveBearer(Ptr< UeInfo > ueInfo, uint8_t epsBearerId)
This Function erases all contexts of bearer from MME side.
Hold info on an EPS bearer to be activated.
EpcS1apSapEnb * s1apSapEnb
EpcS1apSapEnb.
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
Ipv4Address m_mmeS11Addr
IPv4 address of the MME S11 interface.
void DoRecvDeleteBearerRequest(GtpcHeader &header, Ptr< Packet > packet)
Process GTP-C Delete Bearer Request message.
std::map< uint64_t, Ptr< UeInfo > > m_ueInfoMap
UeInfo stored by IMSI.
void RecvFromS11Socket(Ptr< Socket > socket)
Reads the S11 messages from a socket.
void DoErabReleaseIndication(uint64_t mmeUeS1Id, uint16_t enbUeS1Id, std::list< EpcS1apSapMme::ErabToBeReleasedIndication > erabToBeReleaseIndication)
Process ERAB Release Indication received from an eNB.
uint16_t m_gtpcUdpPort
UDP port for GTP-C protocol. Fixed by the standard to port 2123.
Ipv4Address s1uAddr
IP address of the S1-U interface.
void AddEnb(uint16_t ecgi, Ipv4Address enbS1UAddr, EpcS1apSapEnb *enbS1apSap)
Add a new eNB to the MME.
EpsBearer bearer
bearer QOS characteristics
EpcMmeApplication()
Constructor.
void DoInitialUeMessage(uint64_t mmeUeS1Id, uint16_t enbUeS1Id, uint64_t imsi, uint16_t ecgi)
Process the S1 Initial UE Message received from an eNB.
void DoInitialContextSetupResponse(uint64_t mmeUeS1Id, uint16_t enbUeS1Id, std::list< EpcS1apSapMme::ErabSetupItem > erabSetupList)
Process the S1 Initial Context Setup Response received from an eNB.
Ptr< Socket > m_s11Socket
Socket to send/receive messages in the S11 interface.
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:141
The base class for all ns3 applications.
Definition: application.h:60
void DoRecvCreateSessionResponse(GtpcHeader &header, Ptr< Packet > packet)
Process GTP-C Create Session Response message.
EpcS1apSapMme * GetS1apSapMme()
uint16_t bearerCounter
bearer counter
std::map< uint16_t, Ptr< EnbInfo > > m_enbInfoMap
EnbInfo stored by EGCI.
static TypeId GetTypeId(void)
Get the type ID.
void AddUe(uint64_t imsi)
Add a new UE to the MME.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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.
virtual void DoDispose()
Destructor implementation.
virtual ~EpcMmeApplication()
Destructor.
void DoRecvModifyBearerResponse(GtpcHeader &header, Ptr< Packet > packet)
Process GTP-C Modify Bearer Response message.
Ipv4Address m_sgwS11Addr
IPv4 address of the SGW S11 interface.
std::list< BearerInfo > bearersToBeActivated
list of bearers to be activated
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.
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:91
EpcS1apSapMme * m_s1apSapMme
EpcS1apSapMme.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
This application implements the Mobility Management Entity (MME) according to the 3GPP TS 23...
Template for the implementation of the EpcS1apSapMme as a member of an owner class of type C to which...
Definition: epc-s1ap-sap.h:203
Header of the GTPv2-C protocol.
A template-based reference counting class.
a unique identifier for an interface.
Definition: type-id.h:58
void AddSgw(Ipv4Address sgwS11Addr, Ipv4Address mmeS11Addr, Ptr< Socket > mmeS11Socket)
Add a new SGW to the MME.
Ptr< EpcTft > tft
traffic flow template