A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::EpcSgwPgwApplication Class Reference

#include <epc-sgw-pgw-application.h>

+ Inheritance diagram for ns3::EpcSgwPgwApplication:
+ Collaboration diagram for ns3::EpcSgwPgwApplication:

Classes

class  UeInfo

Public Member Functions

 EpcSgwPgwApplication (const Ptr< VirtualNetDevice > tunDevice, const Ptr< Socket > s1uSocket)
virtual ~EpcSgwPgwApplication (void)
uint32_t ActivateS1Bearer (Ipv4Address ueAddr, Ipv4Address enbAddr, Ptr< EpcTft > tft)
virtual void DoDispose ()
void RecvFromS1uSocket (Ptr< Socket > socket)
bool RecvFromTunDevice (Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
void SendToS1uSocket (Ptr< Packet > packet, Ipv4Address enbS1uAddress, uint32_t teid)
void SendToTunDevice (Ptr< Packet > packet, uint32_t teid)
- 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.
void SetStopTime (Time stop)
 Specify application stop time.
- Public Member Functions inherited from ns3::Object
 Object ()
virtual ~Object ()
void AggregateObject (Ptr< Object > other)
void Dispose (void)
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 Start (void)
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 SimpleRefCount (const SimpleRefCount &o)
uint32_t GetReferenceCount (void) const
SimpleRefCountoperator= (const SimpleRefCount &o)
void Ref (void) const
void Unref (void) const
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
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)
 This method returns the TypeId associated to ns3::Application.

Private Attributes

uint16_t m_gtpuUdpPort
Ptr< Socketm_s1uSocket
uint32_t m_teidCount
Ptr< VirtualNetDevicem_tunDevice
std::map< Ipv4Address, UeInfom_ueInfoMap

Additional Inherited Members

- Protected Member Functions inherited from ns3::Application
virtual void DoStart (void)
- Protected Attributes inherited from ns3::Application
Ptr< Nodem_node
EventId m_startEvent
Time m_startTime
EventId m_stopEvent
Time m_stopTime

Detailed Description

This application implements the SGW/PGW functionality.

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

Constructor & Destructor Documentation

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 97 of file epc-sgw-pgw-application.cc.

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

+ Here is the call graph for this function:

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

Destructor

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

References NS_LOG_FUNCTION_NOARGS.

Member Function Documentation

uint32_t ns3::EpcSgwPgwApplication::ActivateS1Bearer ( Ipv4Address  ueAddr,
Ipv4Address  enbAddr,
Ptr< EpcTft tft 
)

Simulates the reception by the PGW of a GTP-C message of type CreateSessionRequest or BearerResourceCommand coming from the MME. This triggers the creation of a new EPS Bearer.

Parameters
bearerthe specification of the EPS Bearer to be created
enbS1uAddressthe IPv4 address at which the SGW can reach the eNB via the S1-U interface
tftthe Traffic Flow Template related to this bearer
Returns
the TunnelEndpointIdentifier of this EPS bearer

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

References m_teidCount, m_ueInfoMap, NS_ABORT_IF, and NS_LOG_FUNCTION.

Referenced by ns3::EpcHelper::ActivateEpsBearer().

+ Here is the caller graph for this function:

void ns3::EpcSgwPgwApplication::DoDispose ( void  )
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 89 of file epc-sgw-pgw-application.cc.

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

+ Here is the call graph for this function:

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

This method returns the TypeId associated to ns3::Application.

This object is accessible through the following paths with Config::Set and Config::Connect:

  • /NodeList/[i]/ApplicationList/[i]

Attributes defined for this type:

  • StartTime: Time at which the application will start
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +0.0ns
    • Flags: construct write read
  • StopTime: Time at which the application will stop
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +0.0ns
    • Flags: construct write read

No TraceSources defined for this type.

Reimplemented from ns3::Application.

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

References ns3::TypeId::SetParent().

+ Here is the call graph for this function:

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 178 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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 140 of file epc-sgw-pgw-application.cc.

References ns3::Packet::Copy(), ns3::Ipv4Header::GetDestination(), ns3::Packet::GetSize(), m_ueInfoMap, NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_LOG_WARN, and SendToS1uSocket().

Referenced by ns3::EpcHelper::EpcHelper().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 203 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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

uint16_t ns3::EpcSgwPgwApplication::m_gtpuUdpPort
private

UDP port to be used for GTP

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

Referenced by SendToS1uSocket().

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 180 of file epc-sgw-pgw-application.h.

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

uint32_t ns3::EpcSgwPgwApplication::m_teidCount
private

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

Referenced by ActivateS1Bearer().

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 186 of file epc-sgw-pgw-application.h.

Referenced by SendToTunDevice().

std::map<Ipv4Address, UeInfo> ns3::EpcSgwPgwApplication::m_ueInfoMap
private

Map telling for each UE address the corresponding UE info

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

Referenced by ActivateS1Bearer(), and RecvFromTunDevice().


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