A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
epc-sgw-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_SGW_APPLICATION_H
10#define EPC_SGW_APPLICATION_H
11
12#include "epc-gtpc-header.h"
13
14#include "ns3/address.h"
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 Serving Gateway Entity (SGW)
27 * according to the 3GPP TS 23.401 document.
28 *
29 * This Application implements the SGW side of the S5 interface between
30 * the SGW node and the PGW node and the SGW side of the S11 interface between
31 * the SGW node and the MME node hosts. It supports the following functions and messages:
32 *
33 * - S5 connectivity (i.e. GTPv2-C signalling and GTP-U data plane)
34 * - Bearer management functions including dedicated bearer establishment
35 * - UL and DL bearer binding
36 * - Tunnel Management messages
37 *
38 * Others functions enumerated in section 4.4.3.2 of 3GPP TS 23.401 are not supported.
39 */
41{
42 public:
43 /**
44 * \brief Get the type ID.
45 * \return the object TypeId
46 */
47 static TypeId GetTypeId();
48 void DoDispose() override;
49
50 /**
51 * Constructor that binds callback methods of sockets.
52 *
53 * \param s1uSocket socket used to send/receive GTP-U packets to/from the eNBs
54 * \param s5Addr IPv4 address of the S5 interface
55 * \param s5uSocket socket used to send/receive GTP-U packets to/from the PGW
56 * \param s5cSocket socket used to send/receive GTP-C packets to/from the PGW
57 */
58 EpcSgwApplication(const Ptr<Socket> s1uSocket,
59 Ipv4Address s5Addr,
60 const Ptr<Socket> s5uSocket,
61 const Ptr<Socket> s5cSocket);
62
63 /** Destructor */
64 ~EpcSgwApplication() override;
65
66 /**
67 * Let the SGW be aware of an MME
68 *
69 * \param mmeS11Addr the address of the MME
70 * \param s11Socket the socket to send/receive messages from the MME
71 */
72 void AddMme(Ipv4Address mmeS11Addr, Ptr<Socket> s11Socket);
73
74 /**
75 * Let the SGW be aware of a PGW
76 *
77 * \param pgwAddr the address of the PGW
78 */
79 void AddPgw(Ipv4Address pgwAddr);
80
81 /**
82 * Let the SGW be aware of a new eNB
83 *
84 * \param cellId the cell identifier
85 * \param enbAddr the address of the eNB
86 * \param sgwAddr the address of the SGW
87 */
88 void AddEnb(uint16_t cellId, Ipv4Address enbAddr, Ipv4Address sgwAddr);
89
90 private:
91 /**
92 * Method to be assigned to the recv callback of the S11 socket.
93 * It is called when the SGW receives a control packet from the MME.
94 *
95 * \param socket pointer to the S11 socket
96 */
97 void RecvFromS11Socket(Ptr<Socket> socket);
98
99 /**
100 * Method to be assigned to the recv callback of the S5-U socket.
101 * It is called when the SGW receives a data packet from the PGW
102 * that is to be forwarded to an eNB.
103 *
104 * \param socket pointer to the S5-U socket
105 */
106 void RecvFromS5uSocket(Ptr<Socket> socket);
107
108 /**
109 * Method to be assigned to the recv callback of the S5-C socket.
110 * It is called when the SGW receives a control packet from the PGW.
111 *
112 * \param socket pointer to the S5-C socket
113 */
114 void RecvFromS5cSocket(Ptr<Socket> socket);
115
116 /**
117 * Method to be assigned to the recv callback of the S1-U socket.
118 * It is called when the SGW receives a data packet from the eNB
119 * that is to be forwarded to the PGW.
120 *
121 * \param socket pointer to the S1-U socket
122 */
123 void RecvFromS1uSocket(Ptr<Socket> socket);
124
125 /**
126 * Send a data packet to the PGW via the S5 interface
127 *
128 * \param packet packet to be sent
129 * \param pgwAddr the address of the PGW
130 * \param teid the Tunnel Endpoint Identifier
131 */
132 void SendToS5uSocket(Ptr<Packet> packet, Ipv4Address pgwAddr, uint32_t teid);
133
134 /**
135 * Send a data packet to an eNB via the S1-U interface
136 *
137 * \param packet packet to be sent
138 * \param enbS1uAddress the address of the eNB
139 * \param teid the Tunnel Endpoint Identifier
140 */
141 void SendToS1uSocket(Ptr<Packet> packet, Ipv4Address enbS1uAddress, uint32_t teid);
142
143 // Process messages received from the MME
144
145 /**
146 * Process GTP-C Create Session Request message
147 * \param packet the packet containing the message
148 */
150
151 /**
152 * Process GTP-C Modify Bearer Request message
153 * \param packet the packet containing the message
154 */
156
157 /**
158 * Process GTP-C Delete Bearer Command message
159 * \param packet the packet containing the message
160 */
162
163 /**
164 * Process GTP-C Delete Bearer Response message
165 * \param packet the packet containing the message
166 */
168
169 // Process messages received from the PGW
170
171 /**
172 * Process GTP-C Create Session Response message
173 * \param packet the packet containing the message
174 */
176
177 /**
178 * Process GTP-C Modify Bearer Response message
179 * \param packet the packet containing the message
180 */
182
183 /**
184 * Process GTP-C Delete Bearer Request message
185 * \param packet the packet containing the message
186 */
188
189 /**
190 * SGW address in the S5 interface
191 */
193
194 /**
195 * MME address in the S11 interface
196 */
198
199 /**
200 * UDP socket to send/receive control messages to/from the S11 interface
201 */
203
204 /**
205 * PGW address in the S5 interface
206 */
208
209 /**
210 * UDP socket to send/receive GTP-U packets to/from the S5 interface
211 */
213
214 /**
215 * UDP socket to send/receive GTP-C packets to/from the S5 interface
216 */
218
219 /**
220 * UDP socket to send/receive GTP-U packets to/from the S1-U interface
221 */
223
224 /**
225 * UDP port to be used for GTP-U
226 */
228
229 /**
230 * UDP port to be used for GTP-C
231 */
233
234 /**
235 * TEID count
236 */
238
239 /// EnbInfo structure
240 struct EnbInfo
241 {
242 Ipv4Address enbAddr; ///< eNB address
243 Ipv4Address sgwAddr; ///< SGW address
244 };
245
246 /**
247 * Map for eNB info by cell ID
248 */
249 std::map<uint16_t, EnbInfo> m_enbInfoByCellId;
250
251 /**
252 * Map for eNB address by TEID
253 */
254 std::map<uint32_t, Ipv4Address> m_enbByTeidMap;
255
256 /**
257 * MME S11 FTEID by SGW S5C TEID
258 */
259 std::map<uint32_t, GtpcHeader::Fteid_t> m_mmeS11FteidBySgwS5cTeid;
260};
261
262} // namespace ns3
263
264#endif // EPC_SGW_APPLICATION_H
The base class for all ns3 applications.
Definition application.h:51
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.
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.
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.
~EpcSgwApplication() override
Destructor.
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.
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 DoDispose() override
Destructor implementation.
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.
static TypeId GetTypeId()
Get the type ID.
Ipv4 addresses are stored in host order in this class.
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.