This GTP tunnel application is responsible for implementing the logical port operations to encapsulate and de-encapsulated packets withing GTP tunnel. More...
#include "gtp-tunnel-app.h"
Public Member Functions | |
GtpTunnelApp (Ptr< VirtualNetDevice > logicalPort, Ptr< CsmaNetDevice > physicalDev) | |
Complete constructor. More... | |
~GtpTunnelApp () override | |
Dummy destructor, see DoDispose. More... | |
bool | RecvFromLogicalPort (Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNo) |
Method to be assigned to the send callback of the VirtualNetDevice implementing the OpenFlow logical port. More... | |
void | RecvFromTunnelSocket (Ptr< Socket > socket) |
Method to be assigned to the receive callback of the UDP tunnel socket. More... | |
![]() | |
Application () | |
~Application () override | |
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... | |
![]() | |
Object () | |
Constructor. More... | |
~Object () override | |
Destructor. More... | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. More... | |
void | Dispose () |
Dispose of this Object. More... | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. More... | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. More... | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. More... | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. More... | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. More... | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. More... | |
bool | IsInitialized () const |
Check if the object has been initialized. More... | |
![]() | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o[[maybe_unused]]) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o[[maybe_unused]]) |
Assignment operator. More... | |
void | Ref () const |
Increment the reference count. More... | |
void | Unref () const |
Decrement the reference count. More... | |
![]() | |
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 errors. 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 () |
Register this type. More... | |
![]() | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
![]() | |
static TypeId | GetTypeId () |
Register this type. More... | |
![]() | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Protected Member Functions | |
void | DoDispose () override |
Destructor implementation. More... | |
void | StartApplication () override |
Application specific startup code. More... | |
![]() | |
void | DoInitialize () override |
Initialize() implementation. More... | |
![]() | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. More... | |
![]() | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. More... | |
Private Member Functions | |
void | AddHeader (Ptr< Packet > packet, Mac48Address source=Mac48Address(), Mac48Address dest=Mac48Address(), uint16_t protocolNo=Ipv4L3Protocol::PROT_NUMBER) |
Adds the necessary Ethernet headers and trailers to a packet of data. More... | |
Private Attributes | |
Ptr< VirtualNetDevice > | m_logicalPort |
OpenFlow logical port device. More... | |
Ptr< CsmaNetDevice > | m_physicalDev |
Node physical network device. More... | |
const uint16_t | m_port = 2152 |
GTP tunnel port. More... | |
Ptr< Socket > | m_tunnelSocket |
UDP tunnel socket. More... | |
Additional Inherited Members | |
![]() | |
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... | |
![]() | |
Ptr< Node > | m_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... | |
![]() | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
This GTP tunnel application is responsible for implementing the logical port operations to encapsulate and de-encapsulated packets withing GTP tunnel.
It provides the callback implementations that are used by the logical switch port and UDP socket. This application is stateless: it only adds/removes protocols headers over packets leaving/entering the OpenFlow switch based on information that is carried by packet tags.
When sending a packet to the GTP tunnel, this application expects that the packet carries the TunnelId tag set with the destination address in the 32 MSB and the TEID in the 32 LSB of packet tag. When a packet is received from the GTP tunnel, this application attachs the TunnelId tag only with the GTP TEID value.
Definition at line 47 of file gtp-tunnel-app.h.
ns3::GtpTunnelApp::GtpTunnelApp | ( | Ptr< VirtualNetDevice > | logicalPort, |
Ptr< CsmaNetDevice > | physicalDev | ||
) |
Complete constructor.
logicalPort | The OpenFlow logical port device. |
physicalDev | The physical network device on node. |
Definition at line 31 of file gtp-tunnel-app.cc.
References m_logicalPort, m_physicalDev, ns3::MakeCallback(), NS_LOG_FUNCTION, RecvFromLogicalPort(), and ns3::VirtualNetDevice::SetSendCallback().
|
override |
Dummy destructor, see DoDispose.
Definition at line 41 of file gtp-tunnel-app.cc.
References NS_LOG_FUNCTION.
|
private |
Adds the necessary Ethernet headers and trailers to a packet of data.
packet | Packet to which header should be added. |
source | MAC source address from which packet should be sent. |
dest | MAC destination address to which packet should be sent. |
protocolNo | The type of payload contained in this packet. |
Definition at line 158 of file gtp-tunnel-app.cc.
References ns3::Packet::AddAtEnd(), ns3::Packet::AddHeader(), ns3::Packet::AddTrailer(), ns3::EthernetTrailer::CalcFcs(), ns3::Node::ChecksumEnabled(), ns3::EthernetTrailer::EnableFcs(), ns3::Packet::GetSize(), NS_LOG_FUNCTION, ns3::EthernetHeader::SetDestination(), ns3::EthernetHeader::SetLengthType(), and ns3::EthernetHeader::SetSource().
Referenced by RecvFromTunnelSocket().
|
overrideprotectedvirtual |
Destructor implementation.
Reimplemented from ns3::Application.
Definition at line 130 of file gtp-tunnel-app.cc.
References m_logicalPort, m_physicalDev, m_tunnelSocket, and NS_LOG_FUNCTION.
|
static |
Register this type.
Definition at line 47 of file gtp-tunnel-app.cc.
References ns3::TypeId::SetParent().
bool ns3::GtpTunnelApp::RecvFromLogicalPort | ( | Ptr< Packet > | packet, |
const Address & | source, | ||
const Address & | dest, | ||
uint16_t | protocolNo | ||
) |
Method to be assigned to the send callback of the VirtualNetDevice implementing the OpenFlow logical port.
It is called when the OpenFlow switch sends a packet out over the logical port. The logical port callbacks here, and we must encapsulate the packet withing GTP and forward it to the UDP tunnel socket.
packet | The packet received from the logical port. |
source | Ethernet source address. |
dest | Ethernet destination address. |
protocolNo | The type of payload contained in this packet. |
Definition at line 55 of file gtp-tunnel-app.cc.
References ns3::Packet::AddHeader(), ns3::GtpuHeader::GetSerializedSize(), ns3::Packet::GetSize(), ns3::TunnelIdTag::GetTunnelId(), ns3::Packet::GetUid(), m_port, m_tunnelSocket, NS_ASSERT_MSG, NS_LOG_DEBUG, NS_LOG_ERROR, NS_LOG_FUNCTION, ns3::Packet::RemovePacketTag(), ns3::Socket::SendTo(), ns3::GtpuHeader::SetLength(), and ns3::GtpuHeader::SetTeid().
Referenced by GtpTunnelApp().
Method to be assigned to the receive callback of the UDP tunnel socket.
It is called when the tunnel socket receives a packet, and must forward the packet to the logical port.
socket | Pointer to the tunnel socket. |
Definition at line 94 of file gtp-tunnel-app.cc.
References AddHeader(), ns3::Mac48Address::ConvertFrom(), ns3::GtpuHeader::GetTeid(), ns3::Packet::GetUid(), m_logicalPort, m_physicalDev, m_tunnelSocket, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::NetDevice::PACKET_HOST, ns3::Ipv4L3Protocol::PROT_NUMBER, ns3::VirtualNetDevice::Receive(), ns3::Socket::Recv(), ns3::Packet::RemoveHeader(), and ns3::Packet::ReplacePacketTag().
Referenced by StartApplication().
|
overrideprotectedvirtual |
Application specific startup code.
The StartApplication method is called at the start time specified by Start This method should be overridden by all or most application subclasses.
Reimplemented from ns3::Application.
Definition at line 140 of file gtp-tunnel-app.cc.
References ns3::Socket::Bind(), ns3::Socket::BindToNetDevice(), ns3::Socket::CreateSocket(), ns3::Application::GetNode(), ns3::Object::GetObject(), ns3::TypeId::LookupByName(), m_physicalDev, m_port, m_tunnelSocket, ns3::MakeCallback(), NS_LOG_FUNCTION, RecvFromTunnelSocket(), and ns3::Socket::SetRecvCallback().
|
private |
OpenFlow logical port device.
Definition at line 110 of file gtp-tunnel-app.h.
Referenced by GtpTunnelApp(), DoDispose(), and RecvFromTunnelSocket().
|
private |
Node physical network device.
Definition at line 111 of file gtp-tunnel-app.h.
Referenced by GtpTunnelApp(), DoDispose(), RecvFromTunnelSocket(), and StartApplication().
|
private |
GTP tunnel port.
Definition at line 112 of file gtp-tunnel-app.h.
Referenced by RecvFromLogicalPort(), and StartApplication().
UDP tunnel socket.
Definition at line 109 of file gtp-tunnel-app.h.
Referenced by DoDispose(), RecvFromLogicalPort(), RecvFromTunnelSocket(), and StartApplication().