A Discrete-Event Network Simulator
API
epc-sgw-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_SGW_APPLICATION_H
22 #define EPC_SGW_APPLICATION_H
23 
24 #include "ns3/application.h"
25 #include "ns3/address.h"
26 #include "ns3/socket.h"
27 #include "ns3/epc-gtpc-header.h"
28 
29 namespace ns3 {
30 
49 {
50 public:
51 
56  static TypeId GetTypeId (void);
57  virtual void DoDispose ();
58 
67  EpcSgwApplication (const Ptr<Socket> s1uSocket, Ipv4Address s5Addr,
68  const Ptr<Socket> s5uSocket, const Ptr<Socket> s5cSocket);
69 
71  virtual ~EpcSgwApplication (void);
72 
73 
80  void AddMme (Ipv4Address mmeS11Addr, Ptr<Socket> s11Socket);
81 
87  void AddPgw (Ipv4Address pgwAddr);
88 
96  void AddEnb (uint16_t cellId, Ipv4Address enbAddr, Ipv4Address sgwAddr);
97 
98 
99 private:
106  void RecvFromS11Socket (Ptr<Socket> socket);
107 
115  void RecvFromS5uSocket (Ptr<Socket> socket);
116 
123  void RecvFromS5cSocket (Ptr<Socket> socket);
124 
132  void RecvFromS1uSocket (Ptr<Socket> socket);
133 
141  void SendToS5uSocket (Ptr<Packet> packet, Ipv4Address pgwAddr, uint32_t teid);
142 
150  void SendToS1uSocket (Ptr<Packet> packet, Ipv4Address enbS1uAddress, uint32_t teid);
151 
152 
153  // Process messages received from the MME
154 
160 
166 
172 
178 
179 
180  // Process messages received from the PGW
181 
187 
193 
199 
200 
205 
210 
215 
220 
225 
230 
235 
239  uint16_t m_gtpuUdpPort;
240 
244  uint16_t m_gtpcUdpPort;
245 
249  uint32_t m_teidCount;
250 
251 
253  struct EnbInfo
254  {
257  };
258 
262  std::map<uint16_t, EnbInfo> m_enbInfoByCellId;
263 
267  std::map<uint32_t, Ipv4Address> m_enbByTeidMap;
268 
272  std::map<uint32_t, GtpcHeader::Fteid_t> m_mmeS11FteidBySgwS5cTeid;
273 };
274 
275 } // namespace ns3
276 
277 #endif // EPC_SGW_APPLICATION_H
The base class for all ns3 applications.
Definition: application.h:61
This application implements the Serving Gateway Entity (SGW) according to the 3GPP TS 23....
Ptr< Socket > m_s5cSocket
UDP socket to send/receive GTP-C packets to/from the S5 interface.
void SendToS1uSocket(Ptr< Packet > packet, Ipv4Address enbS1uAddress, uint32_t teid)
Send a data packet to an eNB via the S1-U interface.
uint16_t m_gtpuUdpPort
UDP port to be used for GTP-U.
std::map< uint32_t, GtpcHeader::Fteid_t > m_mmeS11FteidBySgwS5cTeid
MME S11 FTEID by SGW S5C TEID.
static TypeId GetTypeId(void)
Get the type ID.
void DoRecvModifyBearerRequest(Ptr< Packet > packet)
Process GTP-C Modify Bearer Request message.
void DoRecvCreateSessionResponse(Ptr< Packet > packet)
Process GTP-C Create Session Response message.
Ipv4Address m_mmeS11Addr
MME address in the S11 interface.
void DoRecvDeleteBearerRequest(Ptr< Packet > packet)
Process GTP-C Delete Bearer Request message.
void AddMme(Ipv4Address mmeS11Addr, Ptr< Socket > s11Socket)
Let the SGW be aware of an MME.
virtual void DoDispose()
Destructor implementation.
void DoRecvDeleteBearerCommand(Ptr< Packet > packet)
Process GTP-C Delete Bearer Command message.
void RecvFromS5cSocket(Ptr< Socket > socket)
Method to be assigned to the recv callback of the S5-C socket.
void SendToS5uSocket(Ptr< Packet > packet, Ipv4Address pgwAddr, uint32_t teid)
Send a data packet to the PGW via the S5 interface.
void DoRecvCreateSessionRequest(Ptr< Packet > packet)
Process GTP-C Create Session Request message.
EpcSgwApplication(const Ptr< Socket > s1uSocket, Ipv4Address s5Addr, const Ptr< Socket > s5uSocket, const Ptr< Socket > s5cSocket)
Constructor that binds callback methods of sockets.
void AddPgw(Ipv4Address pgwAddr)
Let the SGW be aware of a PGW.
void RecvFromS5uSocket(Ptr< Socket > socket)
Method to be assigned to the recv callback of the S5-U socket.
std::map< uint32_t, Ipv4Address > m_enbByTeidMap
Map for eNB address by TEID.
Ptr< Socket > m_s1uSocket
UDP socket to send/receive GTP-U packets to/from the S1-U interface.
Ptr< Socket > m_s11Socket
UDP socket to send/receive control messages to/from the S11 interface.
virtual ~EpcSgwApplication(void)
Destructor.
std::map< uint16_t, EnbInfo > m_enbInfoByCellId
Map for eNB info by cell ID.
uint32_t m_teidCount
TEID count.
void RecvFromS11Socket(Ptr< Socket > socket)
Method to be assigned to the recv callback of the S11 socket.
Ipv4Address m_s5Addr
SGW address in the S5 interface.
uint16_t m_gtpcUdpPort
UDP port to be used for GTP-C.
void RecvFromS1uSocket(Ptr< Socket > socket)
Method to be assigned to the recv callback of the S1-U socket.
void DoRecvDeleteBearerResponse(Ptr< Packet > packet)
Process GTP-C Delete Bearer Response message.
Ptr< Socket > m_s5uSocket
UDP socket to send/receive GTP-U packets to/from the S5 interface.
Ipv4Address m_pgwAddr
PGW address in the S5 interface.
void DoRecvModifyBearerResponse(Ptr< Packet > packet)
Process GTP-C Modify Bearer Response message.
void AddEnb(uint16_t cellId, Ipv4Address enbAddr, Ipv4Address sgwAddr)
Let the SGW be aware of a new eNB.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.