|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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);
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void SetSenderCpFteid(GtpcHeader::Fteid_t fteid)
void RecvFromS1uSocket(Ptr< Socket > socket)
Method to be assigned to the recv callback of the S1-U socket.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
void SendToS1uSocket(Ptr< Packet > packet, Ipv4Address enbS1uAddress, uint32_t teid)
Send a data packet to an eNB via the S1-U interface.
void AddPgw(Ipv4Address pgwAddr)
Let the SGW be aware of a PGW.
GtpcHeader::Fteid_t sgwS5uFteid
FTEID.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
void AddHeader(const Header &header)
Add header to this packet.
Ptr< Socket > m_s11Socket
UDP socket to send/receive control messages to/from the S11 interface.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::list< BearerContextToBeCreated > GetBearerContextsToBeCreated() const
Ptr< Socket > m_s1uSocket
UDP socket to send/receive GTP-U packets to/from the S1-U interface.
void SetImsi(uint64_t imsi)
void DoRecvDeleteBearerCommand(Ptr< Packet > packet)
Process GTP-C Delete Bearer Command message.
void AddEnb(uint16_t cellId, Ipv4Address enbAddr, Ipv4Address sgwAddr)
Let the SGW be aware of a new eNB.
void SetBearerContextsToBeCreated(std::list< BearerContextToBeCreated > bearerContexts)
EpsBearer bearerLevelQos
Bearer QOS level.
uint32_t GetUliEcgi() const
void SetEpsBearerIds(std::list< uint8_t > epsBearerIds)
Ipv4 addresses are stored in host order in this class.
std::list< uint8_t > GetEpsBearerIds() const
void SetEpsBearerIds(std::list< uint8_t > epsBearerIds)
uint32_t m_teidCount
TEID count.
EpcSgwApplication(const Ptr< Socket > s1uSocket, Ipv4Address s5Addr, const Ptr< Socket > s5uSocket, const Ptr< Socket > s5cSocket)
Constructor that binds callback methods of sockets.
virtual void DoDispose()
Destructor implementation.
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer.
uint16_t m_gtpuUdpPort
UDP port to be used for GTP-U.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
uint8_t epsBearerId
EPS bearer ID.
Ipv4Address m_mmeS11Addr
MME address in the S11 interface.
Callback< R, Ts... > MakeNullCallback(void)
void RecvFromS5uSocket(Ptr< Socket > socket)
Method to be assigned to the recv callback of the S5-U socket.
void SetImsi(uint64_t imsi)
GtpcHeader::Fteid_t GetSenderCpFteid() const
uint8_t epsBearerId
EPS bearer ID.
static TypeId GetTypeId(void)
Get the type ID.
void SendToS5uSocket(Ptr< Packet > packet, Ipv4Address pgwAddr, uint32_t teid)
Send a data packet to the PGW via the S5 interface.
virtual ~EpcSgwApplication(void)
Destructor.
Ptr< EpcTft > tft
Bearer traffic flow template.
void DoRecvCreateSessionRequest(Ptr< Packet > packet)
Process GTP-C Create Session Request message.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
void AddMme(Ipv4Address mmeS11Addr, Ptr< Socket > s11Socket)
Let the SGW be aware of an MME.
void SetRecvCallback(Callback< void, Ptr< Socket > > receivedData)
Notify application when new data is available to be read.
std::list< BearerContextCreated > GetBearerContextsCreated() const
void DoRecvCreateSessionResponse(Ptr< Packet > packet)
Process GTP-C Create Session Response message.
A base class which provides memory management and object aggregation.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Ptr< Socket > m_s5uSocket
UDP socket to send/receive GTP-U packets to/from the S5 interface.
std::map< uint32_t, Ipv4Address > m_enbByTeidMap
Map for eNB address by TEID.
Ipv4Address m_pgwAddr
PGW address in the S5 interface.
void SetUliEcgi(uint32_t uliEcgi)
void SetCause(Cause_t cause)
Ptr< Socket > m_s5cSocket
UDP socket to send/receive GTP-C packets to/from the S5 interface.
std::list< uint8_t > GetEpsBearerIds() const
Ipv4Address sgwAddr
SGW address.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
void SetBearerContextsCreated(std::list< BearerContextCreated > bearerContexts)
void DoRecvModifyBearerResponse(Ptr< Packet > packet)
Process GTP-C Modify Bearer Response message.
uint32_t GetUliEcgi() const
void DoRecvDeleteBearerResponse(Ptr< Packet > packet)
Process GTP-C Delete Bearer Response message.
void DoRecvDeleteBearerRequest(Ptr< Packet > packet)
Process GTP-C Delete Bearer Request message.
GtpcHeader::Fteid_t GetSenderCpFteid() const
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...
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
GtpcHeader::Fteid_t fteid
FTEID.
EpsBearer bearerLevelQos
bearer QOS level
std::list< BearerContextToBeModified > GetBearerContextsToBeModified() const
std::list< BearerContext > GetBearerContexts() const
uint16_t m_gtpcUdpPort
UDP port to be used for GTP-C.
Ipv4Address m_s5Addr
SGW address in the S5 interface.
void SetCause(Cause_t cause)
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
void DoRecvModifyBearerRequest(Ptr< Packet > packet)
Process GTP-C Modify Bearer Request message.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Ptr< EpcTft > tft
traffic flow template
void RecvFromS11Socket(Ptr< Socket > socket)
Method to be assigned to the recv callback of the S11 socket.
uint8_t epsBearerId
EPS bearer ID.
GtpcHeader::Fteid_t fteid
FTEID.
std::map< uint16_t, EnbInfo > m_enbInfoByCellId
Map for eNB info by cell ID.
void SetUliEcgi(uint32_t uliEcgi)
Ipv4Address enbAddr
eNB address
std::map< uint32_t, GtpcHeader::Fteid_t > m_mmeS11FteidBySgwS5cTeid
MME S11 FTEID by SGW S5C TEID.
void RecvFromS5cSocket(Ptr< Socket > socket)
Method to be assigned to the recv callback of the S5-C socket.
uint8_t m_epsBearerId
EPS bearer ID.
void SetBearerContexts(std::list< BearerContext > bearerContexts)
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.