A Discrete-Event Network Simulator
API
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
ns3::EpcSgwPgwApplication Class Reference

This application implements the SGW/PGW functionality. More...

#include "epc-sgw-pgw-application.h"

+ Inheritance diagram for ns3::EpcSgwPgwApplication:

Classes

struct  EnbInfo
 EnbInfo structure. More...
 
class  UeInfo
 store info for each UE connected to this SGW More...
 

Public Types

typedef void(* RxTracedCallback) (Ptr< Packet > packet)
 TracedCallback signature for data Packet reception event. More...
 
- Public Types inherited from ns3::Application
typedef void(* DelayAddressCallback) (const Time &delay, const Address &from)
 Common callback signature for packet delay and address. More...
 
typedef void(* StateTransitionCallback) (const std::string &oldState, const std::string &newState)
 Common signature used by callbacks to application's state transition trace source. 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 ()
 Destructor implementation. More...
 
EpcS11SapSgwGetS11SapSgw ()
 
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...
 
void SetUeAddress6 (uint64_t imsi, Ipv6Address ueAddr)
 set the address of a previously added UE More...
 
- Public Member Functions inherited from ns3::Application
 Application ()
 
virtual ~Application ()
 
Ptr< NodeGetNode () 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 ()
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose (void)
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator (void) const
 Get an iterator to the Objects aggregated to this one. More...
 
virtual TypeId GetInstanceTypeId (void) const
 Get the most derived TypeId for this Object. More...
 
template<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. More...
 
void Initialize (void)
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
bool IsInitialized (void) const
 Check if the object has been initialized. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator. 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
 Get the value of an attribute, raising fatal errors if unsuccessful. More...
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising erros. More...
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful. More...
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors. More...
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context. More...
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context. More...
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context. More...
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context. More...
 

Static Public Member Functions

static TypeId GetTypeId (void)
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Application
static TypeId GetTypeId (void)
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. 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)
 Create session request function. More...
 
void DoDeleteBearerCommand (EpcS11SapSgw::DeleteBearerCommandMessage req)
 Delete bearer command function. More...
 
void DoDeleteBearerResponse (EpcS11SapSgw::DeleteBearerResponseMessage req)
 Delete bearer response function. More...
 
void DoModifyBearerRequest (EpcS11SapSgw::ModifyBearerRequestMessage msg)
 Modify bearer request function. More...
 

Private Attributes

std::map< uint16_t, EnbInfom_enbInfoByCellId
 eNB info by cell ID More...
 
uint16_t m_gtpuUdpPort
 UDP port to be used for GTP. More...
 
TracedCallback< Ptr< Packet > > m_rxS1uPktTrace
 Callback to trace RX (reception) data packets from S1-U socket. More...
 
TracedCallback< Ptr< Packet > > m_rxTunPktTrace
 Callback to trace RX (reception) data packets at Tun Net Device from internet. More...
 
EpcS11SapMmem_s11SapMme
 MME side of the S11 SAP. More...
 
EpcS11SapSgwm_s11SapSgw
 SGW side of the S11 SAP. More...
 
Ptr< Socketm_s1uSocket
 UDP socket to send and receive GTP-U packets to and from the S1-U interface. More...
 
uint32_t m_teidCount
 TEID count. More...
 
Ptr< VirtualNetDevicem_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 IPv4 address the corresponding UE info. More...
 
std::map< Ipv6Address, Ptr< UeInfo > > m_ueInfoByAddrMap6
 Map telling for each UE IPv6 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 >
 allow MemberEpcS11SapSgw<EpcSgwPgwApplication> class friend access More...
 

Additional Inherited Members

- Protected Member Functions inherited from ns3::Application
virtual void DoInitialize (void)
 Initialize() implementation. More...
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void NotifyNewAggregate (void)
 Notify all Objects aggregated to this one of a new Object being aggregated. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes. More...
 
virtual void NotifyConstructionCompleted (void)
 Notifier called once the ObjectBase is fully constructed. More...
 
- Protected Attributes inherited from ns3::Application
Ptr< Nodem_node
 The node that this application is installed on. More...
 
EventId m_startEvent
 The event that will fire at m_startTime to start the application. More...
 
Time m_startTime
 The simulation time that the application will start. More...
 
EventId m_stopEvent
 The event that will fire at m_stopTime to end the application. More...
 
Time m_stopTime
 The simulation time that the application will end. More...
 

Detailed Description

This application implements the SGW/PGW functionality.

Definition at line 48 of file epc-sgw-pgw-application.h.

Member Typedef Documentation

◆ RxTracedCallback

typedef void(* ns3::EpcSgwPgwApplication::RxTracedCallback) (Ptr< Packet > packet)

TracedCallback signature for data Packet reception event.

Parameters
[in]packetThe data packet sent from the internet.

Definition at line 173 of file epc-sgw-pgw-application.h.

Constructor & Destructor Documentation

◆ EpcSgwPgwApplication()

ns3::EpcSgwPgwApplication::EpcSgwPgwApplication ( const Ptr< VirtualNetDevice tunDevice,
const Ptr< Socket s1uSocket 
)

Constructor that binds the tap device to the callback methods.

Parameters
tunDeviceTUN 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
s1uSocketsocket used to send GTP-U packets to the eNBs

Definition at line 141 of file epc-sgw-pgw-application.cc.

References m_s11SapSgw, m_s1uSocket, ns3::MakeCallback(), NS_LOG_FUNCTION, RecvFromS1uSocket(), and ns3::Socket::SetRecvCallback().

◆ ~EpcSgwPgwApplication()

ns3::EpcSgwPgwApplication::~EpcSgwPgwApplication ( void  )
virtual

Destructor.

Definition at line 154 of file epc-sgw-pgw-application.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ AddEnb()

void ns3::EpcSgwPgwApplication::AddEnb ( uint16_t  cellId,
Ipv4Address  enbAddr,
Ipv4Address  sgwAddr 
)

Let the SGW be aware of a new eNB.

Parameters
cellIdthe cell identifier
enbAddrthe address of the eNB
sgwAddrthe address of the SGW

Definition at line 304 of file epc-sgw-pgw-application.cc.

References ns3::EpcSgwPgwApplication::EnbInfo::enbAddr, m_enbInfoByCellId, NS_LOG_FUNCTION, and ns3::EpcSgwPgwApplication::EnbInfo::sgwAddr.

◆ AddUe()

void ns3::EpcSgwPgwApplication::AddUe ( uint64_t  imsi)

Let the SGW be aware of a new UE.

Parameters
imsithe unique identifier of the UE

Definition at line 314 of file epc-sgw-pgw-application.cc.

References m_ueInfoByImsiMap, and NS_LOG_FUNCTION.

◆ DoCreateSessionRequest()

void ns3::EpcSgwPgwApplication::DoCreateSessionRequest ( EpcS11SapSgw::CreateSessionRequestMessage  msg)
private

◆ DoDeleteBearerCommand()

void ns3::EpcSgwPgwApplication::DoDeleteBearerCommand ( EpcS11SapSgw::DeleteBearerCommandMessage  req)
private

◆ DoDeleteBearerResponse()

void ns3::EpcSgwPgwApplication::DoDeleteBearerResponse ( EpcS11SapSgw::DeleteBearerResponseMessage  req)
private

◆ DoDispose()

void ns3::EpcSgwPgwApplication::DoDispose ( void  )
virtual

Destructor implementation.

This method is called by Dispose() or by the Object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overridden 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 132 of file epc-sgw-pgw-application.cc.

References m_s11SapSgw, m_s1uSocket, ns3::MakeNullCallback(), NS_LOG_FUNCTION, and ns3::Socket::SetRecvCallback().

◆ DoModifyBearerRequest()

void ns3::EpcSgwPgwApplication::DoModifyBearerRequest ( EpcS11SapSgw::ModifyBearerRequestMessage  msg)
private

◆ GetS11SapSgw()

EpcS11SapSgw * ns3::EpcSgwPgwApplication::GetS11SapSgw ( )
Returns
the SGW side of the S11 SAP

Definition at line 298 of file epc-sgw-pgw-application.cc.

References m_s11SapSgw.

◆ GetTypeId()

TypeId ns3::EpcSgwPgwApplication::GetTypeId ( void  )
static

Get the type ID.

Returns
the object TypeId

Definition at line 114 of file epc-sgw-pgw-application.cc.

References m_rxS1uPktTrace, m_rxTunPktTrace, ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().

◆ RecvFromS1uSocket()

void ns3::EpcSgwPgwApplication::RecvFromS1uSocket ( Ptr< Socket socket)

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.

Parameters
socketpointer to the S1-U socket

Definition at line 237 of file epc-sgw-pgw-application.cc.

References ns3::Packet::Copy(), ns3::GtpuHeader::GetTeid(), m_rxS1uPktTrace, m_s1uSocket, NS_ASSERT, NS_LOG_FUNCTION, ns3::Socket::Recv(), ns3::Packet::RemoveHeader(), and SendToTunDevice().

Referenced by EpcSgwPgwApplication().

◆ RecvFromTunDevice()

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.

Parameters
packet
source
dest
protocolNumber
Returns
true always

Definition at line 161 of file epc-sgw-pgw-application.cc.

References ns3::Packet::Copy(), ns3::Packet::CopyData(), ns3::Ipv4Header::GetDestination(), ns3::Ipv6Header::GetDestinationAddress(), ns3::Packet::GetSize(), m_rxTunPktTrace, m_ueInfoByAddrMap, m_ueInfoByAddrMap6, NS_ABORT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC(), NS_LOG_WARN, and SendToS1uSocket().

Referenced by ns3::EmuEpcHelper::DoInitialize(), and ns3::PointToPointEpcHelper::PointToPointEpcHelper().

◆ SendToS1uSocket()

void ns3::EpcSgwPgwApplication::SendToS1uSocket ( Ptr< Packet packet,
Ipv4Address  enbS1uAddress,
uint32_t  teid 
)

Send a packet to the SGW via the S1-U interface.

Parameters
packetpacket to be sent
enbS1uAddressthe address of the eNB
teidthe Tunnel Enpoint IDentifier

Definition at line 276 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().

◆ SendToTunDevice()

void ns3::EpcSgwPgwApplication::SendToTunDevice ( Ptr< Packet packet,
uint32_t  teid 
)

Send a packet to the internet via the Gi interface of the SGW/PGW.

Parameters
packet
teidthe Tunnel Enpoint Identifier

Definition at line 252 of file epc-sgw-pgw-application.cc.

References ns3::Packet::CopyData(), ns3::VirtualNetDevice::GetAddress(), ns3::Packet::GetSize(), m_tunDevice, NS_ABORT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC(), ns3::NetDevice::PACKET_HOST, and ns3::VirtualNetDevice::Receive().

Referenced by RecvFromS1uSocket().

◆ SetS11SapMme()

void ns3::EpcSgwPgwApplication::SetS11SapMme ( EpcS11SapMme s)

Set the MME side of the S11 SAP.

Parameters
sthe MME side of the S11 SAP

Definition at line 292 of file epc-sgw-pgw-application.cc.

References m_s11SapMme.

◆ SetUeAddress()

void ns3::EpcSgwPgwApplication::SetUeAddress ( uint64_t  imsi,
Ipv4Address  ueAddr 
)

set the address of a previously added UE

Parameters
imsithe unique identifier of the UE
ueAddrthe IPv4 address of the UE

Definition at line 322 of file epc-sgw-pgw-application.cc.

References m_ueInfoByAddrMap, m_ueInfoByImsiMap, NS_ASSERT_MSG(), and NS_LOG_FUNCTION.

◆ SetUeAddress6()

void ns3::EpcSgwPgwApplication::SetUeAddress6 ( uint64_t  imsi,
Ipv6Address  ueAddr 
)

set the address of a previously added UE

Parameters
imsithe unique identifier of the UE
ueAddrthe IPv6 address of the UE

Definition at line 332 of file epc-sgw-pgw-application.cc.

References m_ueInfoByAddrMap6, m_ueInfoByImsiMap, NS_ASSERT_MSG(), and NS_LOG_FUNCTION.

Friends And Related Function Documentation

◆ MemberEpcS11SapSgw< EpcSgwPgwApplication >

friend class MemberEpcS11SapSgw< EpcSgwPgwApplication >
friend

allow MemberEpcS11SapSgw<EpcSgwPgwApplication> class friend access

Definition at line 51 of file epc-sgw-pgw-application.h.

Member Data Documentation

◆ m_enbInfoByCellId

std::map<uint16_t, EnbInfo> ns3::EpcSgwPgwApplication::m_enbInfoByCellId
private

eNB info by cell ID

Definition at line 334 of file epc-sgw-pgw-application.h.

Referenced by AddEnb(), DoCreateSessionRequest(), and DoModifyBearerRequest().

◆ m_gtpuUdpPort

uint16_t ns3::EpcSgwPgwApplication::m_gtpuUdpPort
private

UDP port to be used for GTP.

Definition at line 308 of file epc-sgw-pgw-application.h.

Referenced by SendToS1uSocket().

◆ m_rxS1uPktTrace

TracedCallback<Ptr<Packet> > ns3::EpcSgwPgwApplication::m_rxS1uPktTrace
private

Callback to trace RX (reception) data packets from S1-U socket.

Definition at line 344 of file epc-sgw-pgw-application.h.

Referenced by GetTypeId(), and RecvFromS1uSocket().

◆ m_rxTunPktTrace

TracedCallback<Ptr<Packet> > ns3::EpcSgwPgwApplication::m_rxTunPktTrace
private

Callback to trace RX (reception) data packets at Tun Net Device from internet.

Definition at line 339 of file epc-sgw-pgw-application.h.

Referenced by GetTypeId(), and RecvFromTunDevice().

◆ m_s11SapMme

EpcS11SapMme* ns3::EpcSgwPgwApplication::m_s11SapMme
private

MME side of the S11 SAP.

Definition at line 319 of file epc-sgw-pgw-application.h.

Referenced by DoCreateSessionRequest(), DoDeleteBearerCommand(), DoModifyBearerRequest(), and SetS11SapMme().

◆ m_s11SapSgw

EpcS11SapSgw* ns3::EpcSgwPgwApplication::m_s11SapSgw
private

SGW side of the S11 SAP.

Definition at line 325 of file epc-sgw-pgw-application.h.

Referenced by DoDispose(), EpcSgwPgwApplication(), and GetS11SapSgw().

◆ m_s1uSocket

Ptr<Socket> ns3::EpcSgwPgwApplication::m_s1uSocket
private

UDP socket to send and receive GTP-U packets to and from the S1-U interface.

Definition at line 282 of file epc-sgw-pgw-application.h.

Referenced by DoDispose(), EpcSgwPgwApplication(), RecvFromS1uSocket(), and SendToS1uSocket().

◆ m_teidCount

uint32_t ns3::EpcSgwPgwApplication::m_teidCount
private

TEID count.

Definition at line 313 of file epc-sgw-pgw-application.h.

Referenced by DoCreateSessionRequest().

◆ m_tunDevice

Ptr<VirtualNetDevice> ns3::EpcSgwPgwApplication::m_tunDevice
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 288 of file epc-sgw-pgw-application.h.

Referenced by SendToTunDevice().

◆ m_ueInfoByAddrMap

std::map<Ipv4Address, Ptr<UeInfo> > ns3::EpcSgwPgwApplication::m_ueInfoByAddrMap
private

Map telling for each UE IPv4 address the corresponding UE info.

Definition at line 293 of file epc-sgw-pgw-application.h.

Referenced by RecvFromTunDevice(), and SetUeAddress().

◆ m_ueInfoByAddrMap6

std::map<Ipv6Address, Ptr<UeInfo> > ns3::EpcSgwPgwApplication::m_ueInfoByAddrMap6
private

Map telling for each UE IPv6 address the corresponding UE info.

Definition at line 298 of file epc-sgw-pgw-application.h.

Referenced by RecvFromTunDevice(), and SetUeAddress6().

◆ m_ueInfoByImsiMap

std::map<uint64_t, Ptr<UeInfo> > ns3::EpcSgwPgwApplication::m_ueInfoByImsiMap
private

Map telling for each IMSI the corresponding UE info.

Definition at line 303 of file epc-sgw-pgw-application.h.

Referenced by AddUe(), DoCreateSessionRequest(), DoDeleteBearerCommand(), DoDeleteBearerResponse(), DoModifyBearerRequest(), SetUeAddress(), and SetUeAddress6().


The documentation for this class was generated from the following files: