25 #include "ns3/mac48-address.h"
27 #include "ns3/inet-socket-address.h"
28 #include "ns3/epc-gtpu-header.h"
29 #include "ns3/abort.h"
49 m_teidByBearerIdMap[bearerId] = teid;
50 return m_tftClassifier.Add (tft, teid);
57 m_teidByBearerIdMap.erase (bearerId);
102 static TypeId tid =
TypeId (
"ns3::EpcSgwPgwApplication")
145 pCopy->RemoveHeader (ipv4Header);
150 std::map<Ipv4Address, Ptr<UeInfo> >::iterator it =
m_ueInfoByAddrMap.find (ueAddr);
158 uint32_t teid = it->second->Classify (packet);
161 NS_LOG_WARN (
"no matching bearer for this packet");
171 const bool succeeded =
true;
183 uint32_t teid = gtpu.
GetTeid ();
254 ueit->second->SetUeAddr (ueAddr);
263 uint16_t cellId = req.
uli.
gci;
267 ueit->second->SetEnbAddr (enbAddr);
281 ueit->second->AddBearer (bit->tft, bit->epsBearerId, teid);
288 bearerContext.
tft = bit->tft;
299 uint64_t imsi = req.
teid;
302 uint16_t cellId = req.
uli.gci;
306 ueit->second->SetEnbAddr (enbAddr);
318 uint64_t imsi = req.teid;
331 res.bearerContextsRemoved.push_back (bearerContext);
341 uint64_t imsi = req.teid;
345 for (std::list<EpcS11SapSgw::BearerContextRemovedSgwPgw>::iterator bit = req.
bearerContextsRemoved.begin ();
350 ueit->second->RemoveBearer (bit->epsBearerId);
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
std::map< uint16_t, EnbInfo > m_enbInfoByCellId
enum ns3::EpcS11SapMme::ModifyBearerResponseMessage::Cause cause
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
3GPP TS 29.274 version 8.3.1 Release 8 section 8.28
Delete Bearer Command message, see 3GPP TS 29.274 Release 9 V9.3.0 section 7.2.17.1.
MME side of the S11 Service Access Point (SAP), provides the MME methods to be called when an S11 mes...
uint16_t m_gtpuUdpPort
UDP port to be used for GTP.
void SetS11SapMme(EpcS11SapMme *s)
Set the MME side of the S11 SAP.
EpcS11SapMme * m_s11SapMme
MME side of the S11 SAP.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Delete Bearer Request message, see 3GPP TS 29.274 Release 9 V9.3.0 section 7.2.9.2.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
std::list< BearerContextRemovedSgwPgw > bearerContextsRemoved
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
bool Receive(Ptr< Packet > packet, uint16_t protocol, const Address &source, const Address &destination, PacketType packetType)
Callback< R > MakeNullCallback(void)
std::list< BearerContextToBeRemoved > bearerContextsToBeRemoved
void SendToTunDevice(Ptr< Packet > packet, uint32_t teid)
Send a packet to the internet via the Gi interface of the SGW/PGW.
virtual void DeleteBearerRequest(DeleteBearerRequestMessage msg)=0
As per 3GPP TS 29.274 Release 9 V9.3.0, a Delete Bearer Request message shall be sent on the S11 inte...
Delete Bearer Response message, see 3GPP TS 29.274 Release 9 V9.3.0 section 7.2.10.2.
a polymophic address class
EpcS11Sap::Fteid sgwFteid
Template for the implementation of the EpcS11SapSgw as a member of an owner class of type C to which ...
virtual Address GetAddress(void) const
void RemoveBearer(uint8_t bearerId)
Function, deletes contexts of bearer on SGW and PGW side.
bool RecvFromTunDevice(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
Method to be assigned to the callback of the Gi TUN VirtualNetDevice.
Ptr< VirtualNetDevice > m_tunDevice
TUN VirtualNetDevice used for tunneling/detunneling IP packets from/to the internet over GTP-U/UDP/IP...
std::map< uint64_t, Ptr< UeInfo > > m_ueInfoByImsiMap
Map telling for each IMSI the corresponding UE info.
void DoCreateSessionRequest(EpcS11SapSgw::CreateSessionRequestMessage msg)
void SetUeAddr(Ipv4Address addr)
set the address of the UE
virtual void ModifyBearerResponse(ModifyBearerResponseMessage msg)=0
send a Modify Bearer Response message
uint32_t Classify(Ptr< Packet > p)
This class implements a tag that carries an address of a packet across the socket interface...
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void SetRecvCallback(Callback< void, Ptr< Socket > >)
Notify application when new data is available to be read.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Modify Bearer Request message, see 3GPP TS 29.274 7.2.7.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void AddBearer(Ptr< EpcTft > tft, uint8_t epsBearerId, uint32_t teid)
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
std::list< BearerContextCreated > bearerContextsCreated
void SetUeAddress(uint64_t imsi, Ipv4Address ueAddr)
set the address of a previously added UE
void DoDeleteBearerResponse(EpcS11SapSgw::DeleteBearerResponseMessage req)
static TypeId GetTypeId(void)
void AddUe(uint64_t imsi)
Let the SGW be aware of a new UE.
void SendToS1uSocket(Ptr< Packet > packet, Ipv4Address enbS1uAddress, uint32_t teid)
Send a packet to the SGW via the S1-U interface.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< Socket > m_s1uSocket
UDP socket to send and receive GTP-U packets to and from the S1-U interface.
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
std::map< Ipv4Address, Ptr< UeInfo > > m_ueInfoByAddrMap
Map telling for each UE address the corresponding UE info.
Ipv4 addresses are stored in host order in this class.
void DoDeleteBearerCommand(EpcS11SapSgw::DeleteBearerCommandMessage req)
SGW side of the S11 Service Access Point (SAP), provides the SGW methods to be called when an S11 mes...
std::list< BearerContextToBeCreated > bearerContextsToBeCreated
virtual void CreateSessionResponse(CreateSessionResponseMessage msg)=0
send a Create Session Response message
void SetEnbAddr(Ipv4Address addr)
set the address of the eNB to which the UE is connected
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
virtual void DoDispose()
Destructor implementation.
EpcS11SapSgw * GetS11SapSgw()
void RecvFromS1uSocket(Ptr< Socket > socket)
Method to be assigned to the recv callback of the S1-U socket.
virtual ~EpcSgwPgwApplication(void)
Destructor.
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer.
A base class which provides memory management and object aggregation.
Modify Bearer Response message, see 3GPP TS 29.274 7.2.7.
void DoModifyBearerRequest(EpcS11SapSgw::ModifyBearerRequestMessage msg)
EpcS11SapSgw * m_s11SapSgw
SGW side of the S11 SAP.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
void AddEnb(uint16_t cellId, Ipv4Address enbAddr, Ipv4Address sgwAddr)
Let the SGW be aware of a new eNB.
void AddHeader(const Header &header)
Add header to this packet.
Create Session Request message, see 3GPP TS 29.274 7.2.1.
EpcSgwPgwApplication(const Ptr< VirtualNetDevice > tunDevice, const Ptr< Socket > s1uSocket)
Constructor that binds the tap device to the callback methods.
Create Session Response message, see 3GPP TS 29.274 7.2.2.