This application implements the SGW/PGW functionality. More...
#include <epc-sgw-pgw-application.h>
Classes | |
struct | EnbInfo |
class | UeInfo |
store info for each UE connected to this SGW More... | |
Public Member Functions | |
EpcSgwPgwApplication (const Ptr< VirtualNetDevice > tunDevice, const Ptr< Socket > s1uSocket) | |
Constructor that binds the tap device to the callback methods. More... | |
virtual | ~EpcSgwPgwApplication (void) |
Destructor. More... | |
void | AddEnb (uint16_t cellId, Ipv4Address enbAddr, Ipv4Address sgwAddr) |
Let the SGW be aware of a new eNB. More... | |
void | AddUe (uint64_t imsi) |
Let the SGW be aware of a new UE. More... | |
virtual void | DoDispose () |
This method is called by Object::Dispose or by the object's destructor, whichever comes first. More... | |
EpcS11SapSgw * | GetS11SapSgw () |
void | RecvFromS1uSocket (Ptr< Socket > socket) |
Method to be assigned to the recv callback of the S1-U socket. More... | |
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. More... | |
void | SendToS1uSocket (Ptr< Packet > packet, Ipv4Address enbS1uAddress, uint32_t teid) |
Send a packet to the SGW via the S1-U interface. More... | |
void | SendToTunDevice (Ptr< Packet > packet, uint32_t teid) |
Send a packet to the internet via the Gi interface of the SGW/PGW. More... | |
void | SetS11SapMme (EpcS11SapMme *s) |
Set the MME side of the S11 SAP. More... | |
void | SetUeAddress (uint64_t imsi, Ipv4Address ueAddr) |
set the address of a previously added UE More... | |
Public Member Functions inherited from ns3::Application | |
Application () | |
virtual | ~Application () |
Ptr< Node > | GetNode () const |
void | SetNode (Ptr< Node > node) |
void | SetStartTime (Time start) |
Specify application start time. More... | |
void | SetStopTime (Time stop) |
Specify application stop time. More... | |
Public Member Functions inherited from ns3::Object | |
Object () | |
virtual | ~Object () |
void | AggregateObject (Ptr< Object > other) |
void | Dispose (void) |
Run the DoDispose methods of this object and all the objects aggregated to it. More... | |
AggregateIterator | GetAggregateIterator (void) const |
virtual TypeId | GetInstanceTypeId (void) const |
template<typename T > | |
Ptr< T > | GetObject (void) const |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
void | Initialize (void) |
This method calls the virtual DoInitialize method on all the objects aggregated to this object. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Constructor. More... | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
bool | GetAttributeFailSafe (std::string name, AttributeValue &attribute) const |
void | SetAttribute (std::string name, const AttributeValue &value) |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::Application | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId (void) |
Register this type. More... | |
Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
static void | Cleanup (void) |
Noop. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Private Member Functions | |
void | DoCreateSessionRequest (EpcS11SapSgw::CreateSessionRequestMessage msg) |
void | DoModifyBearerRequest (EpcS11SapSgw::ModifyBearerRequestMessage msg) |
Private Attributes | |
std::map< uint16_t, EnbInfo > | m_enbInfoByCellId |
uint16_t | m_gtpuUdpPort |
UDP port to be used for GTP. More... | |
EpcS11SapMme * | m_s11SapMme |
MME side of the S11 SAP. More... | |
EpcS11SapSgw * | m_s11SapSgw |
SGW side of the S11 SAP. More... | |
Ptr< Socket > | m_s1uSocket |
UDP socket to send and receive GTP-U packets to and from the S1-U interface. More... | |
uint32_t | m_teidCount |
Ptr< VirtualNetDevice > | m_tunDevice |
TUN VirtualNetDevice used for tunneling/detunneling IP packets from/to the internet over GTP-U/UDP/IP on the S1 interface. More... | |
std::map< Ipv4Address, Ptr < UeInfo > > | m_ueInfoByAddrMap |
Map telling for each UE address the corresponding UE info. More... | |
std::map< uint64_t, Ptr< UeInfo > > | m_ueInfoByImsiMap |
Map telling for each IMSI the corresponding UE info. More... | |
Friends | |
class | MemberEpcS11SapSgw< EpcSgwPgwApplication > |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::Application | |
virtual void | DoInitialize (void) |
This method is called only once by Object::Initialize. More... | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
virtual void | NotifyNewAggregate (void) |
This method is invoked whenever two sets of objects are aggregated together. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
virtual void | NotifyConstructionCompleted (void) |
This method is invoked once all member attributes have been initialized. More... | |
Protected Attributes inherited from ns3::Application | |
Ptr< Node > | m_node |
EventId | m_startEvent |
The simulation time that the appliacation will end. More... | |
Time | m_startTime |
The node that this application is installed on. More... | |
EventId | m_stopEvent |
The event that will fire at m_startTime to start the application. More... | |
Time | m_stopTime |
The simulation time that the appliacation will start. More... | |
This application implements the SGW/PGW functionality.
Definition at line 48 of file epc-sgw-pgw-application.h.
ns3::EpcSgwPgwApplication::EpcSgwPgwApplication | ( | const Ptr< VirtualNetDevice > | tunDevice, |
const Ptr< Socket > | s1uSocket | ||
) |
Constructor that binds the tap device to the callback methods.
tunDevice | TUN VirtualNetDevice used to tunnel IP packets from the Gi interface of the PGW/SGW over the internet over GTP-U/UDP/IP on the S1-U interface |
s1uSocket | socket used to send GTP-U packets to the eNBs |
Definition at line 113 of file epc-sgw-pgw-application.cc.
References m_s11SapSgw, m_s1uSocket, ns3::MakeCallback(), NS_LOG_FUNCTION, RecvFromS1uSocket(), and ns3::Socket::SetRecvCallback().
|
virtual |
void ns3::EpcSgwPgwApplication::AddEnb | ( | uint16_t | cellId, |
Ipv4Address | enbAddr, | ||
Ipv4Address | sgwAddr | ||
) |
Let the SGW be aware of a new eNB.
cellId | the cell identifier |
enbAddr | the address of the eNB |
sgwAddr | the address of the SGW |
Definition at line 225 of file epc-sgw-pgw-application.cc.
References ns3::EpcSgwPgwApplication::EnbInfo::enbAddr, m_enbInfoByCellId, NS_LOG_FUNCTION, and ns3::EpcSgwPgwApplication::EnbInfo::sgwAddr.
void ns3::EpcSgwPgwApplication::AddUe | ( | uint64_t | imsi | ) |
Let the SGW be aware of a new UE.
imsi | the unique identifier of the UE |
Definition at line 235 of file epc-sgw-pgw-application.cc.
References m_ueInfoByImsiMap, and NS_LOG_FUNCTION.
|
private |
Definition at line 253 of file epc-sgw-pgw-application.cc.
References ns3::EpcS11Sap::Fteid::address, ns3::EpcS11SapMme::CreateSessionResponseMessage::bearerContextsCreated, ns3::EpcS11SapSgw::CreateSessionRequestMessage::bearerContextsToBeCreated, ns3::EpcS11SapMme::BearerContextCreated::bearerLevelQos, ns3::EpcS11SapMme::CreateSessionResponse(), ns3::EpcS11SapMme::BearerContextCreated::epsBearerId, ns3::EpcS11Sap::Uli::gci, ns3::EpcS11SapSgw::CreateSessionRequestMessage::imsi, m_enbInfoByCellId, m_s11SapMme, m_teidCount, m_ueInfoByImsiMap, NS_ABORT_IF, NS_ASSERT_MSG, NS_LOG_FUNCTION, ns3::EpcS11SapMme::BearerContextCreated::sgwFteid, ns3::EpcS11Sap::Fteid::teid, ns3::EpcS11SapMme::BearerContextCreated::tft, and ns3::EpcS11SapSgw::CreateSessionRequestMessage::uli.
|
virtual |
This method is called by Object::Dispose or by the object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overriden version of this method and chain up to their parent's implementation once they are done. i.e., for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose method.
It is safe to call GetObject from within this method.
Reimplemented from ns3::Application.
Definition at line 103 of file epc-sgw-pgw-application.cc.
References m_s11SapSgw, m_s1uSocket, ns3::MakeNullCallback(), NS_LOG_FUNCTION, and ns3::Socket::SetRecvCallback().
|
private |
Definition at line 291 of file epc-sgw-pgw-application.cc.
References ns3::EpcS11SapMme::ModifyBearerResponseMessage::cause, m_enbInfoByCellId, m_s11SapMme, m_ueInfoByImsiMap, ns3::EpcS11SapMme::ModifyBearerResponse(), NS_ASSERT_MSG, NS_LOG_FUNCTION, ns3::EpcS11SapMme::ModifyBearerResponseMessage::REQUEST_ACCEPTED, ns3::EpcS11Sap::GtpcMessage::teid, and ns3::EpcS11SapSgw::ModifyBearerRequestMessage::uli.
EpcS11SapSgw * ns3::EpcSgwPgwApplication::GetS11SapSgw | ( | ) |
Definition at line 219 of file epc-sgw-pgw-application.cc.
References m_s11SapSgw.
|
static |
Definition at line 95 of file epc-sgw-pgw-application.cc.
References ns3::TypeId::SetParent().
Method to be assigned to the recv callback of the S1-U socket.
It is called when the SGW/PGW receives a data packet from the eNB that is to be forwarded to the internet.
socket | pointer to the S1-U socket |
Definition at line 171 of file epc-sgw-pgw-application.cc.
References ns3::GtpuHeader::GetTeid(), m_s1uSocket, NS_ASSERT, NS_LOG_FUNCTION, ns3::Socket::Recv(), ns3::Packet::RemoveHeader(), ns3::Packet::RemovePacketTag(), and SendToTunDevice().
Referenced by EpcSgwPgwApplication().
bool ns3::EpcSgwPgwApplication::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.
It is called when the SGW/PGW receives a data packet from the internet (including IP headers) that is to be sent to the UE via its associated eNB, tunneling IP over GTP-U/UDP/IP.
packet | |
source | |
dest | |
protocolNumber |
Definition at line 133 of file epc-sgw-pgw-application.cc.
References ns3::Packet::Copy(), ns3::Ipv4Header::GetDestination(), ns3::Packet::GetSize(), m_ueInfoByAddrMap, NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_LOG_WARN, and SendToS1uSocket().
Referenced by ns3::PointToPointEpcHelper::PointToPointEpcHelper().
void ns3::EpcSgwPgwApplication::SendToS1uSocket | ( | Ptr< Packet > | packet, |
Ipv4Address | enbS1uAddress, | ||
uint32_t | teid | ||
) |
Send a packet to the SGW via the S1-U interface.
packet | packet to be sent |
enbS1uAddress | the address of the eNB |
teid | the Tunnel Enpoint IDentifier |
Definition at line 197 of file epc-sgw-pgw-application.cc.
References ns3::Packet::AddHeader(), ns3::GtpuHeader::GetSerializedSize(), ns3::Packet::GetSize(), m_gtpuUdpPort, m_s1uSocket, NS_LOG_FUNCTION, ns3::Socket::SendTo(), ns3::GtpuHeader::SetLength(), and ns3::GtpuHeader::SetTeid().
Referenced by RecvFromTunDevice().
Send a packet to the internet via the Gi interface of the SGW/PGW.
packet |
Definition at line 189 of file epc-sgw-pgw-application.cc.
References ns3::VirtualNetDevice::GetAddress(), ns3::Packet::GetSize(), m_tunDevice, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::NetDevice::PACKET_HOST, and ns3::VirtualNetDevice::Receive().
Referenced by RecvFromS1uSocket().
void ns3::EpcSgwPgwApplication::SetS11SapMme | ( | EpcS11SapMme * | s | ) |
Set the MME side of the S11 SAP.
s | the MME side of the S11 SAP |
Definition at line 213 of file epc-sgw-pgw-application.cc.
References m_s11SapMme, and s.
void ns3::EpcSgwPgwApplication::SetUeAddress | ( | uint64_t | imsi, |
Ipv4Address | ueAddr | ||
) |
set the address of a previously added UE
imsi | the unique identifier of the UE |
ueAddr | the IPv4 address of the UE |
Definition at line 243 of file epc-sgw-pgw-application.cc.
References m_ueInfoByAddrMap, m_ueInfoByImsiMap, NS_ASSERT_MSG, and NS_LOG_FUNCTION.
|
friend |
Definition at line 50 of file epc-sgw-pgw-application.h.
|
private |
Definition at line 265 of file epc-sgw-pgw-application.h.
Referenced by AddEnb(), DoCreateSessionRequest(), and DoModifyBearerRequest().
|
private |
UDP port to be used for GTP.
Definition at line 243 of file epc-sgw-pgw-application.h.
Referenced by SendToS1uSocket().
|
private |
MME side of the S11 SAP.
Definition at line 251 of file epc-sgw-pgw-application.h.
Referenced by DoCreateSessionRequest(), DoModifyBearerRequest(), and SetS11SapMme().
|
private |
SGW side of the S11 SAP.
Definition at line 257 of file epc-sgw-pgw-application.h.
Referenced by DoDispose(), EpcSgwPgwApplication(), and GetS11SapSgw().
UDP socket to send and receive GTP-U packets to and from the S1-U interface.
Definition at line 222 of file epc-sgw-pgw-application.h.
Referenced by DoDispose(), EpcSgwPgwApplication(), RecvFromS1uSocket(), and SendToS1uSocket().
|
private |
Definition at line 245 of file epc-sgw-pgw-application.h.
Referenced by DoCreateSessionRequest().
|
private |
TUN VirtualNetDevice used for tunneling/detunneling IP packets from/to the internet over GTP-U/UDP/IP on the S1 interface.
Definition at line 228 of file epc-sgw-pgw-application.h.
Referenced by SendToTunDevice().
|
private |
Map telling for each UE address the corresponding UE info.
Definition at line 233 of file epc-sgw-pgw-application.h.
Referenced by RecvFromTunDevice(), and SetUeAddress().
Map telling for each IMSI the corresponding UE info.
Definition at line 238 of file epc-sgw-pgw-application.h.
Referenced by AddUe(), DoCreateSessionRequest(), DoModifyBearerRequest(), and SetUeAddress().