A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::EpcPgwApplication Class Reference

This application implements the Packet Data Network (PDN) Gateway Entity (PGW) according to the 3GPP TS 23.401 document. More...

#include "epc-pgw-application.h"

+ Inheritance diagram for ns3::EpcPgwApplication:
+ Collaboration diagram for ns3::EpcPgwApplication:

Classes

class  UeInfo
 store info for each UE connected to this PGW More...
 

Public Types

typedef void(* RxTracedCallback) (Ptr< Packet > packet)
 TracedCallback signature for data Packet reception event.
 
- Public Types inherited from ns3::Application
typedef void(* DelayAddressCallback) (const Time &delay, const Address &from)
 Common callback signature for packet delay and address.
 
typedef void(* StateTransitionCallback) (const std::string &oldState, const std::string &newState)
 Common signature used by callbacks to application's state transition trace source.
 

Public Member Functions

 EpcPgwApplication (const Ptr< VirtualNetDevice > tunDevice, Ipv4Address s5Addr, const Ptr< Socket > s5uSocket, const Ptr< Socket > s5cSocket)
 Constructor that binds the tap device to the callback methods.
 
 ~EpcPgwApplication () override
 Destructor.
 
void AddSgw (Ipv4Address sgwS5Addr)
 Let the PGW be aware of a new SGW.
 
void AddUe (uint64_t imsi)
 Let the PGW be aware of a new UE.
 
void DoDispose () override
 Destructor implementation.
 
void RecvFromS5cSocket (Ptr< Socket > socket)
 Method to be assigned to the receiver callback of the S5-C socket.
 
void RecvFromS5uSocket (Ptr< Socket > socket)
 Method to be assigned to the receiver callback of the S5-U socket.
 
bool RecvFromTunDevice (Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
 Method to be assigned to the callback of the SGi TUN VirtualNetDevice.
 
void SendToS5uSocket (Ptr< Packet > packet, Ipv4Address sgwS5uAddress, uint32_t teid)
 Send a data packet to the SGW via the S5-U interface.
 
void SendToTunDevice (Ptr< Packet > packet, uint32_t teid)
 Send a data packet to the internet via the SGi interface of the PGW.
 
void SetUeAddress (uint64_t imsi, Ipv4Address ueAddr)
 Set the address of a previously added UE.
 
void SetUeAddress6 (uint64_t imsi, Ipv6Address ueAddr)
 set the address of a previously added UE
 
- Public Member Functions inherited from ns3::Application
 Application ()
 
 ~Application () override
 
Ptr< NodeGetNode () const
 
void SetNode (Ptr< Node > node)
 
void SetStartTime (Time start)
 Specify application start time.
 
void SetStopTime (Time stop)
 Specify application stop time.
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor.
 
 ~Object () override
 Destructor.
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together.
 
void Dispose ()
 Dispose of this Object.
 
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one.
 
TypeId GetInstanceTypeId () const override
 Get the most derived TypeId for this Object.
 
template<typename T >
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object.
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object.
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId.
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object.
 
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one.
 
bool IsInitialized () const
 Check if the object has been initialized.
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor.
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor.
 
uint32_t GetReferenceCount () const
 Get the reference count of the object.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor.
 
void GetAttribute (std::string name, AttributeValue &value) const
 Get the value of an attribute, raising fatal errors if unsuccessful.
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors.
 
virtual TypeId GetInstanceTypeId () const =0
 Get the most derived TypeId for this Object.
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful.
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors.
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context.
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context.
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context.
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context.
 

Static Public Member Functions

static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::Application
static TypeId GetTypeId ()
 Get the type ID.
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId ()
 Register this type.
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.
 

Private Member Functions

void DoRecvCreateSessionRequest (Ptr< Packet > packet)
 Process Create Session Request message.
 
void DoRecvDeleteBearerCommand (Ptr< Packet > packet)
 Process Delete Bearer Command message.
 
void DoRecvDeleteBearerResponse (Ptr< Packet > packet)
 Process Delete Bearer Response message.
 
void DoRecvModifyBearerRequest (Ptr< Packet > packet)
 Process Modify Bearer Request message.
 

Private Attributes

uint16_t m_gtpcUdpPort
 UDP port to be used for GTPv2-C.
 
uint16_t m_gtpuUdpPort
 UDP port to be used for GTP-U.
 
Ipv4Address m_pgwS5Addr
 PGW address of the S5 interface.
 
TracedCallback< Ptr< Packet > > m_rxS5PktTrace
 Callback to trace received data packets from S5 socket.
 
TracedCallback< Ptr< Packet > > m_rxTunPktTrace
 Callback to trace received data packets at Tun NetDevice from internet.
 
Ptr< Socketm_s5cSocket
 UDP socket to send/receive GTPv2-C packets to/from the S5 interface.
 
Ptr< Socketm_s5uSocket
 UDP socket to send/receive GTP-U packets to/from the S5 interface.
 
Ipv4Address m_sgwS5Addr
 SGW address of the S5 interface.
 
Ptr< VirtualNetDevicem_tunDevice
 TUN VirtualNetDevice used for tunneling/detunneling IP packets from/to the internet over GTP-U/UDP/IP on the S5 interface.
 
std::map< Ipv4Address, Ptr< UeInfo > > m_ueInfoByAddrMap
 UeInfo stored by UE IPv4 address.
 
std::map< Ipv6Address, Ptr< UeInfo > > m_ueInfoByAddrMap6
 UeInfo stored by UE IPv6 address.
 
std::map< uint64_t, Ptr< UeInfo > > m_ueInfoByImsiMap
 UeInfo stored by IMSI.
 

Additional Inherited Members

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

Detailed Description

This application implements the Packet Data Network (PDN) Gateway Entity (PGW) according to the 3GPP TS 23.401 document.

This Application implements the PGW side of the S5 interface between the PGW node and the SGW nodes and the PGW side of the SGi interface between the PGW node and the internet hosts. It supports the following functions and messages:

  • S5 connectivity (i.e. GTPv2-C signalling and GTP-U data plane)
  • Bearer management functions including dedicated bearer establishment
  • Per-user based packet filtering
  • UL and DL bearer binding
  • Tunnel Management messages

Others functions enumerated in section 4.4.3.3 of 3GPP TS 23.401 are not supported.

Definition at line 52 of file epc-pgw-application.h.

Member Typedef Documentation

◆ RxTracedCallback

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

TracedCallback signature for data Packet reception event.

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

Definition at line 166 of file epc-pgw-application.h.

Constructor & Destructor Documentation

◆ EpcPgwApplication()

ns3::EpcPgwApplication::EpcPgwApplication ( const Ptr< VirtualNetDevice tunDevice,
Ipv4Address  s5Addr,
const Ptr< Socket s5uSocket,
const Ptr< Socket s5cSocket 
)

Constructor that binds the tap device to the callback methods.

Parameters
tunDeviceTUN VirtualNetDevice used to tunnel IP packets from the SGi interface of the PGW in the internet over GTP-U/UDP/IP on the S5 interface
s5AddrIP address of the PGW S5 interface
s5uSocketsocket used to send GTP-U packets to the peer SGW
s5cSocketsocket used to send GTP-C packets to the peer SGW

Definition at line 144 of file epc-pgw-application.cc.

References m_s5cSocket, m_s5uSocket, ns3::MakeCallback(), NS_LOG_FUNCTION, RecvFromS5cSocket(), RecvFromS5uSocket(), and ns3::Socket::SetRecvCallback().

+ Here is the call graph for this function:

◆ ~EpcPgwApplication()

ns3::EpcPgwApplication::~EpcPgwApplication ( )
override

Destructor.

Definition at line 160 of file epc-pgw-application.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ AddSgw()

void ns3::EpcPgwApplication::AddSgw ( Ipv4Address  sgwS5Addr)

Let the PGW be aware of a new SGW.

Parameters
sgwS5Addrthe address of the SGW S5 interface

Definition at line 483 of file epc-pgw-application.cc.

References m_sgwS5Addr, and NS_LOG_FUNCTION.

◆ AddUe()

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

Let the PGW be aware of a new UE.

Parameters
imsithe unique identifier of the UE

Definition at line 490 of file epc-pgw-application.cc.

References m_ueInfoByImsiMap, and NS_LOG_FUNCTION.

◆ DoDispose()

void ns3::EpcPgwApplication::DoDispose ( )
overridevirtual

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::Object.

Definition at line 135 of file epc-pgw-application.cc.

References m_s5cSocket, m_s5uSocket, ns3::MakeNullCallback(), NS_LOG_FUNCTION, and ns3::Socket::SetRecvCallback().

+ Here is the call graph for this function:

◆ DoRecvCreateSessionRequest()

void ns3::EpcPgwApplication::DoRecvCreateSessionRequest ( Ptr< Packet packet)
private

◆ DoRecvDeleteBearerCommand()

void ns3::EpcPgwApplication::DoRecvDeleteBearerCommand ( Ptr< Packet packet)
private

Process Delete Bearer Command message.

Parameters
packetGTPv2-C Delete Bearer Command message

Definition at line 391 of file epc-pgw-application.cc.

References ns3::GtpcHeader::ComputeMessageLength(), ns3::GtpcDeleteBearerCommandMessage::GetBearerContexts(), ns3::GtpcHeader::GetTeid(), m_gtpcUdpPort, m_s5cSocket, m_sgwS5Addr, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Socket::SendTo(), ns3::GtpcDeleteBearerRequestMessage::SetEpsBearerIds(), and ns3::GtpcHeader::SetTeid().

Referenced by RecvFromS5cSocket().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoRecvDeleteBearerResponse()

void ns3::EpcPgwApplication::DoRecvDeleteBearerResponse ( Ptr< Packet packet)
private

Process Delete Bearer Response message.

Parameters
packetGTPv2-C Delete Bearer Response message

Definition at line 417 of file epc-pgw-application.cc.

References ns3::GtpcDeleteBearerResponseMessage::GetEpsBearerIds(), ns3::GtpcHeader::GetTeid(), m_ueInfoByImsiMap, NS_ASSERT_MSG, NS_LOG_FUNCTION, and NS_LOG_INFO.

Referenced by RecvFromS5cSocket().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoRecvModifyBearerRequest()

void ns3::EpcPgwApplication::DoRecvModifyBearerRequest ( Ptr< Packet packet)
private

◆ GetTypeId()

TypeId ns3::EpcPgwApplication::GetTypeId ( )
static

Get the type ID.

Returns
the object TypeId

Definition at line 117 of file epc-pgw-application.cc.

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

+ Here is the call graph for this function:

◆ RecvFromS5cSocket()

void ns3::EpcPgwApplication::RecvFromS5cSocket ( Ptr< Socket socket)

Method to be assigned to the receiver callback of the S5-C socket.

It is called when the PGW receives a control packet from the SGW.

Parameters
socketpointer to the S5-C socket

Definition at line 257 of file epc-pgw-application.cc.

References ns3::GtpcHeader::CreateSessionRequest, ns3::GtpcHeader::DeleteBearerCommand, ns3::GtpcHeader::DeleteBearerResponse, DoRecvCreateSessionRequest(), DoRecvDeleteBearerCommand(), DoRecvDeleteBearerResponse(), DoRecvModifyBearerRequest(), ns3::GtpcHeader::GetMessageType(), m_s5cSocket, ns3::GtpcHeader::ModifyBearerRequest, NS_ASSERT, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

Referenced by EpcPgwApplication().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RecvFromS5uSocket()

void ns3::EpcPgwApplication::RecvFromS5uSocket ( Ptr< Socket socket)

Method to be assigned to the receiver callback of the S5-U socket.

It is called when the PGW receives a data packet from the SGW that is to be forwarded to the internet.

Parameters
socketpointer to the S5-U socket

Definition at line 242 of file epc-pgw-application.cc.

References ns3::GtpuHeader::GetTeid(), m_rxS5PktTrace, m_s5uSocket, NS_ASSERT, NS_LOG_FUNCTION, and SendToTunDevice().

Referenced by EpcPgwApplication().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RecvFromTunDevice()

bool ns3::EpcPgwApplication::RecvFromTunDevice ( Ptr< Packet packet,
const Address source,
const Address dest,
uint16_t  protocolNumber 
)

Method to be assigned to the callback of the SGi TUN VirtualNetDevice.

It is called when the PGW receives a data packet from the internet (including IP headers) that is to be sent to the UE via its associated SGW and eNB, tunneling IP over GTP-U/UDP/IP.

Parameters
packet
source
dest
protocolNumber
Returns
true always

Definition at line 166 of file epc-pgw-application.cc.

References ns3::Ipv4Header::GetDestination(), ns3::Ipv6Header::GetDestination(), m_rxTunPktTrace, m_ueInfoByAddrMap, m_ueInfoByAddrMap6, NS_ABORT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_LOG_WARN, ns3::Ipv4L3Protocol::PROT_NUMBER, ns3::Ipv6L3Protocol::PROT_NUMBER, and SendToS5uSocket().

Referenced by ns3::NoBackhaulEpcHelper::NoBackhaulEpcHelper().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendToS5uSocket()

void ns3::EpcPgwApplication::SendToS5uSocket ( Ptr< Packet packet,
Ipv4Address  sgwS5uAddress,
uint32_t  teid 
)

Send a data packet to the SGW via the S5-U interface.

Parameters
packetpacket to be sent
sgwS5uAddressthe address of the SGW
teidthe Tunnel Endpoint Identifier

Definition at line 468 of file epc-pgw-application.cc.

References ns3::GtpuHeader::GetSerializedSize(), m_gtpuUdpPort, m_s5uSocket, NS_LOG_FUNCTION, ns3::Socket::SendTo(), ns3::GtpuHeader::SetLength(), and ns3::GtpuHeader::SetTeid().

Referenced by RecvFromTunDevice().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendToTunDevice()

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

Send a data packet to the internet via the SGi interface of the PGW.

Parameters
packetpacket to be sent
teidthe Tunnel Endpoint Identifier

Definition at line 437 of file epc-pgw-application.cc.

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

Referenced by RecvFromS5uSocket().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetUeAddress()

void ns3::EpcPgwApplication::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 498 of file epc-pgw-application.cc.

References m_ueInfoByAddrMap, m_ueInfoByImsiMap, NS_ASSERT_MSG, and NS_LOG_FUNCTION.

◆ SetUeAddress6()

void ns3::EpcPgwApplication::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 508 of file epc-pgw-application.cc.

References m_ueInfoByAddrMap6, m_ueInfoByImsiMap, NS_ASSERT_MSG, and NS_LOG_FUNCTION.

Member Data Documentation

◆ m_gtpcUdpPort

uint16_t ns3::EpcPgwApplication::m_gtpcUdpPort
private

UDP port to be used for GTPv2-C.

Definition at line 324 of file epc-pgw-application.h.

Referenced by DoRecvCreateSessionRequest(), DoRecvDeleteBearerCommand(), and DoRecvModifyBearerRequest().

◆ m_gtpuUdpPort

uint16_t ns3::EpcPgwApplication::m_gtpuUdpPort
private

UDP port to be used for GTP-U.

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

Referenced by SendToS5uSocket().

◆ m_pgwS5Addr

Ipv4Address ns3::EpcPgwApplication::m_pgwS5Addr
private

PGW address of the S5 interface.

Definition at line 283 of file epc-pgw-application.h.

Referenced by DoRecvCreateSessionRequest().

◆ m_rxS5PktTrace

TracedCallback<Ptr<Packet> > ns3::EpcPgwApplication::m_rxS5PktTrace
private

Callback to trace received data packets from S5 socket.

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

Referenced by GetTypeId(), and RecvFromS5uSocket().

◆ m_rxTunPktTrace

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

Callback to trace received data packets at Tun NetDevice from internet.

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

Referenced by GetTypeId(), and RecvFromTunDevice().

◆ m_s5cSocket

Ptr<Socket> ns3::EpcPgwApplication::m_s5cSocket
private

UDP socket to send/receive GTPv2-C packets to/from the S5 interface.

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

Referenced by EpcPgwApplication(), DoDispose(), DoRecvCreateSessionRequest(), DoRecvDeleteBearerCommand(), DoRecvModifyBearerRequest(), and RecvFromS5cSocket().

◆ m_s5uSocket

Ptr<Socket> ns3::EpcPgwApplication::m_s5uSocket
private

UDP socket to send/receive GTP-U packets to/from the S5 interface.

Definition at line 288 of file epc-pgw-application.h.

Referenced by EpcPgwApplication(), DoDispose(), RecvFromS5uSocket(), and SendToS5uSocket().

◆ m_sgwS5Addr

Ipv4Address ns3::EpcPgwApplication::m_sgwS5Addr
private

SGW address of the S5 interface.

Definition at line 329 of file epc-pgw-application.h.

Referenced by AddSgw(), DoRecvCreateSessionRequest(), DoRecvDeleteBearerCommand(), and DoRecvModifyBearerRequest().

◆ m_tunDevice

Ptr<VirtualNetDevice> ns3::EpcPgwApplication::m_tunDevice
private

TUN VirtualNetDevice used for tunneling/detunneling IP packets from/to the internet over GTP-U/UDP/IP on the S5 interface.

Definition at line 299 of file epc-pgw-application.h.

Referenced by SendToTunDevice().

◆ m_ueInfoByAddrMap

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

UeInfo stored by UE IPv4 address.

Definition at line 304 of file epc-pgw-application.h.

Referenced by RecvFromTunDevice(), and SetUeAddress().

◆ m_ueInfoByAddrMap6

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

UeInfo stored by UE IPv6 address.

Definition at line 309 of file epc-pgw-application.h.

Referenced by RecvFromTunDevice(), and SetUeAddress6().

◆ m_ueInfoByImsiMap

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

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