22 #include "ns3/epc-gtpu-header.h"
23 #include "ns3/epc-sgw-application.h"
34 m_s5uSocket (s5uSocket),
35 m_s5cSocket (s5cSocket),
36 m_s1uSocket (s1uSocket),
41 NS_LOG_FUNCTION (
this << s1uSocket << s5Addr << s5uSocket << s5cSocket);
144 uint32_t teid = gtpu.
GetTeid ();
189 uint32_t teid = gtpu.
GetTeid ();
234 uint64_t imsi = msg.
GetImsi ();
245 "wrong interface type");
253 sgwS5cFteid.
teid = imsi;
258 std::list<GtpcCreateSessionRequestMessage::BearerContextToBeCreated> bearerContexts =
260 NS_LOG_DEBUG (
"BearerContextToBeCreated size = " << bearerContexts.size ());
261 std::list<GtpcCreateSessionRequestMessage::BearerContextToBeCreated> bearerContextsOut;
262 for (
auto &bearerContext : bearerContexts)
277 bearerContextOut.
epsBearerId = bearerContext.epsBearerId;
279 bearerContextOut.
tft = bearerContext.tft;
280 bearerContextsOut.push_back (bearerContextOut);
301 uint64_t imsi = msg.
GetImsi ();
314 std::list<GtpcModifyBearerRequestMessage::BearerContextToBeModified> bearerContextsOut;
315 std::list<GtpcModifyBearerRequestMessage::BearerContextToBeModified> bearerContexts
317 NS_LOG_DEBUG (
"BearerContextsToBeModified size = " << bearerContexts.size ());
318 for (
auto &bearerContext : bearerContexts)
321 "Wrong FTEID in ModifyBearerRequest msg");
322 uint32_t teid = bearerContext.fteid.teid;
324 NS_LOG_DEBUG (
"bearerId " << (uint16_t)bearerContext.epsBearerId <<
326 std::map<uint32_t, Ipv4Address>::iterator addrit =
m_enbByTeidMap.find (teid);
328 addrit->second = enbAddr;
330 bearerContextOut.
epsBearerId = bearerContext.epsBearerId;
333 bearerContextOut.
fteid.
teid = bearerContext.fteid.teid;
335 bearerContextsOut.push_back (bearerContextOut);
355 std::list<GtpcDeleteBearerCommandMessage::BearerContext> bearerContextsOut;
358 NS_LOG_DEBUG (
"ebid " << (uint16_t) bearerContext.m_epsBearerId);
360 bearerContextOut.
m_epsBearerId = bearerContext.m_epsBearerId;
361 bearerContextsOut.push_back (bearerContextOut);
408 "wrong interface type");
413 uint32_t teid = msg.
GetTeid ();
416 std::list<GtpcCreateSessionResponseMessage::BearerContextCreated> bearerContexts =
418 NS_LOG_DEBUG (
"BearerContextsCreated size = " << bearerContexts.size ());
419 std::list<GtpcCreateSessionResponseMessage::BearerContextCreated> bearerContextsOut;
420 for (
auto &bearerContext : bearerContexts)
424 bearerContextOut.
fteid.
teid = bearerContext.fteid.teid;
426 bearerContextOut.
epsBearerId = bearerContext.epsBearerId;
428 bearerContextOut.
tft = bearerContext.tft;
429 bearerContextsOut.push_back (bearerContext);
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.
GTP-C Create Session Request Message.
uint64_t GetImsi() const
Get the IMSI.
void SetUliEcgi(uint32_t uliEcgi)
Set the UliEcgi.
GtpcHeader::Fteid_t GetSenderCpFteid() const
Get the Sender CpFteid.
uint32_t GetUliEcgi() const
Get the UliEcgi.
void SetBearerContextsToBeCreated(std::list< BearerContextToBeCreated > bearerContexts)
Set the Bearer Contexts.
std::list< BearerContextToBeCreated > GetBearerContextsToBeCreated() const
Get the Bearer Contexts.
void SetImsi(uint64_t imsi)
Set the IMSI.
void SetSenderCpFteid(GtpcHeader::Fteid_t fteid)
Set the Sender CpFteid.
GTP-C Create Session Response Message.
void SetCause(Cause_t cause)
Set the Cause.
void SetBearerContextsCreated(std::list< BearerContextCreated > bearerContexts)
Set the Bearer Contexts.
std::list< BearerContextCreated > GetBearerContextsCreated() const
Get the Container of Bearer Contexts.
GtpcHeader::Fteid_t GetSenderCpFteid() const
Get the Sender CpFteid.
GTP-C Delete Bearer Command Message.
std::list< BearerContext > GetBearerContexts() const
Get the Bearer contexts.
void SetBearerContexts(std::list< BearerContext > bearerContexts)
Set the Bearer contexts.
GTP-C Delete Bearer Request Message.
std::list< uint8_t > GetEpsBearerIds() const
Get the Bearers IDs.
void SetEpsBearerIds(std::list< uint8_t > epsBearerIds)
Set the Bearers IDs.
GTP-C Delete Bearer Response Message.
std::list< uint8_t > GetEpsBearerIds() const
Get the Bearers IDs.
void SetEpsBearerIds(std::list< uint8_t > epsBearerIds)
Set the Bearers IDs.
GTP-C Modify Bearer Request Message.
uint64_t GetImsi() const
Get the IMSI.
uint32_t GetUliEcgi() const
Get the UliEcgi.
void SetUliEcgi(uint32_t uliEcgi)
Set the UliEcgi.
std::list< BearerContextToBeModified > GetBearerContextsToBeModified() const
Get the Bearer Contexts.
void SetImsi(uint64_t imsi)
Set the IMSI.
GTP-C Modify Bearer Response Message.
void SetCause(Cause_t cause)
Set the Cause.
Ipv4 addresses are stored in host order in this class.
A base class which provides memory management and object aggregation.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
void AddHeader(const Header &header)
Add header to this packet.
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
void SetRecvCallback(Callback< void, Ptr< Socket > > receivedData)
Notify application when new data is available to be read.
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Callback< R, Ts... > MakeNullCallback(void)
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Ipv4Address enbAddr
eNB address
Ipv4Address sgwAddr
SGW address.
Bearer Context structure.
EpsBearer bearerLevelQos
bearer QOS level
uint8_t epsBearerId
EPS bearer ID.
GtpcHeader::Fteid_t sgwS5uFteid
FTEID.
Ptr< EpcTft > tft
traffic flow template
Bearer Context structure.
GtpcHeader::Fteid_t fteid
FTEID.
uint8_t epsBearerId
EPS bearer ID.
Ptr< EpcTft > tft
Bearer traffic flow template.
EpsBearer bearerLevelQos
Bearer QOS level.
uint8_t m_epsBearerId
EPS bearer ID.
Bearer Context structure.
uint8_t epsBearerId
EPS bearer ID.
GtpcHeader::Fteid_t fteid
FTEID.