A Discrete-Event Network Simulator
API
Tunnel Class Reference

Tunnel class - its goal is to create and manage the tunnels between endpoints. More...

+ Collaboration diagram for Tunnel:

Public Member Functions

 Tunnel (Ptr< Node > n3, Ptr< Node > n0, Ptr< Node > n1, Ipv4Address n3Addr, Ipv4Address n0Addr, Ipv4Address n1Addr)
 Constructor. More...
 

Private Member Functions

void N0SocketRecv (Ptr< Socket > socket)
 Receive a packet on the N0 VirtualNetDevice. More...
 
bool N0VirtualSend (Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
 Send a packet through the N0 VirtualNetDevice. More...
 
void N1SocketRecv (Ptr< Socket > socket)
 Receive a packet on the N1 VirtualNetDevice. More...
 
bool N1VirtualSend (Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
 Send a packet through the N1 VirtualNetDevice. More...
 
void N3SocketRecv (Ptr< Socket > socket)
 Receive a packet on the N3 VirtualNetDevice. More...
 
bool N3VirtualSend (Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
 Send a packet through the N3 VirtualNetDevice. More...
 

Private Attributes

Ipv4Address m_n0Address
 Address of the N0 node. More...
 
Ptr< Socketm_n0Socket
 Socket on the N0 node. More...
 
Ptr< VirtualNetDevicem_n0Tap
 VirtualNetDevice on the N0 node. More...
 
Ipv4Address m_n1Address
 Address of the N1 node. More...
 
Ptr< Socketm_n1Socket
 Socket on the N1 node. More...
 
Ptr< VirtualNetDevicem_n1Tap
 VirtualNetDevice on the N1 node. More...
 
Ipv4Address m_n3Address
 Address of the N3 node. More...
 
Ptr< Socketm_n3Socket
 Socket on the N3 node. More...
 
Ptr< VirtualNetDevicem_n3Tap
 VirtualNetDevice on the N3 node. More...
 
Ptr< UniformRandomVariablem_rng
 Random number generator. More...
 

Detailed Description

Tunnel class - its goal is to create and manage the tunnels between endpoints.

Definition at line 65 of file virtual-net-device-example.cc.

Constructor & Destructor Documentation

◆ Tunnel()

Tunnel::Tunnel ( Ptr< Node n3,
Ptr< Node n0,
Ptr< Node n1,
Ipv4Address  n3Addr,
Ipv4Address  n0Addr,
Ipv4Address  n1Addr 
)
inline

Constructor.

Parameters
n3Pointer of Node 3
n0Pointer of Node 0
n1Pointer of Node 1
n3AddrIPv4 address of Node 3
n0AddrIPv4 address of Node 0
n1AddrIPv4 address of Node 1

Definition at line 195 of file virtual-net-device-example.cc.

References ns3::Node::AddDevice(), ns3::Socket::Bind(), ns3::Socket::CreateSocket(), ns3::Ipv4Address::GetAny(), ns3::Object::GetObject(), nsclick-simple-lan::ipv4, ns3::TypeId::LookupByName(), ns3::MakeCallback(), N0SocketRecv(), N0VirtualSend(), N1SocketRecv(), N1VirtualSend(), N3SocketRecv(), N3VirtualSend(), ns3::VirtualNetDevice::SetAddress(), ns3::Socket::SetRecvCallback(), and ns3::VirtualNetDevice::SetSendCallback().

+ Here is the call graph for this function:

Member Function Documentation

◆ N0SocketRecv()

void Tunnel::N0SocketRecv ( Ptr< Socket socket)
inlineprivate

Receive a packet on the N0 VirtualNetDevice.

Parameters
socketReceiving socket

Definition at line 159 of file virtual-net-device-example.cc.

References ns3::VirtualNetDevice::GetAddress(), NS_LOG_DEBUG, ns3::NetDevice::PACKET_HOST, ns3::VirtualNetDevice::Receive(), and ns3::Socket::Recv().

Referenced by Tunnel().

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

◆ N0VirtualSend()

bool Tunnel::N0VirtualSend ( Ptr< Packet packet,
const Address source,
const Address dest,
uint16_t  protocolNumber 
)
inlineprivate

Send a packet through the N0 VirtualNetDevice.

Parameters
packetPacket to send
sourceSource IPv4 address
destDestination IPv4 address
protocolNumberProtocol number
Returns
true (always)

Definition at line 86 of file virtual-net-device-example.cc.

References NS_LOG_DEBUG, and ns3::Socket::SendTo().

Referenced by Tunnel().

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

◆ N1SocketRecv()

void Tunnel::N1SocketRecv ( Ptr< Socket socket)
inlineprivate

Receive a packet on the N1 VirtualNetDevice.

Parameters
socketReceiving socket

Definition at line 174 of file virtual-net-device-example.cc.

References ns3::VirtualNetDevice::GetAddress(), NS_LOG_DEBUG, ns3::NetDevice::PACKET_HOST, ns3::VirtualNetDevice::Receive(), and ns3::Socket::Recv().

Referenced by Tunnel().

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

◆ N1VirtualSend()

bool Tunnel::N1VirtualSend ( Ptr< Packet packet,
const Address source,
const Address dest,
uint16_t  protocolNumber 
)
inlineprivate

Send a packet through the N1 VirtualNetDevice.

Parameters
packetPacket to send
sourceSource IPv4 address
destDestination IPv4 address
protocolNumberProtocol number
Returns
true (always)

Definition at line 104 of file virtual-net-device-example.cc.

References NS_LOG_DEBUG, and ns3::Socket::SendTo().

Referenced by Tunnel().

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

◆ N3SocketRecv()

void Tunnel::N3SocketRecv ( Ptr< Socket socket)
inlineprivate

Receive a packet on the N3 VirtualNetDevice.

Parameters
socketReceiving socket

Definition at line 144 of file virtual-net-device-example.cc.

References ns3::VirtualNetDevice::GetAddress(), NS_LOG_DEBUG, ns3::NetDevice::PACKET_HOST, ns3::VirtualNetDevice::Receive(), and ns3::Socket::Recv().

Referenced by Tunnel().

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

◆ N3VirtualSend()

bool Tunnel::N3VirtualSend ( Ptr< Packet packet,
const Address source,
const Address dest,
uint16_t  protocolNumber 
)
inlineprivate

Send a packet through the N3 VirtualNetDevice.

Parameters
packetPacket to send
sourceSource IPv4 address
destDestination IPv4 address
protocolNumberProtocol number
Returns
true (always)

Definition at line 122 of file virtual-net-device-example.cc.

References ns3::UniformRandomVariable::GetValue(), NS_LOG_DEBUG, and ns3::Socket::SendTo().

Referenced by Tunnel().

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

Member Data Documentation

◆ m_n0Address

Ipv4Address Tunnel::m_n0Address
private

Address of the N0 node.

Definition at line 71 of file virtual-net-device-example.cc.

◆ m_n0Socket

Ptr<Socket> Tunnel::m_n0Socket
private

Socket on the N0 node.

Definition at line 68 of file virtual-net-device-example.cc.

◆ m_n0Tap

Ptr<VirtualNetDevice> Tunnel::m_n0Tap
private

VirtualNetDevice on the N0 node.

Definition at line 74 of file virtual-net-device-example.cc.

◆ m_n1Address

Ipv4Address Tunnel::m_n1Address
private

Address of the N1 node.

Definition at line 72 of file virtual-net-device-example.cc.

◆ m_n1Socket

Ptr<Socket> Tunnel::m_n1Socket
private

Socket on the N1 node.

Definition at line 69 of file virtual-net-device-example.cc.

◆ m_n1Tap

Ptr<VirtualNetDevice> Tunnel::m_n1Tap
private

VirtualNetDevice on the N1 node.

Definition at line 75 of file virtual-net-device-example.cc.

◆ m_n3Address

Ipv4Address Tunnel::m_n3Address
private

Address of the N3 node.

Definition at line 70 of file virtual-net-device-example.cc.

◆ m_n3Socket

Ptr<Socket> Tunnel::m_n3Socket
private

Socket on the N3 node.

Definition at line 67 of file virtual-net-device-example.cc.

◆ m_n3Tap

Ptr<VirtualNetDevice> Tunnel::m_n3Tap
private

VirtualNetDevice on the N3 node.

Definition at line 76 of file virtual-net-device-example.cc.

◆ m_rng

Ptr<UniformRandomVariable> Tunnel::m_rng
private

Random number generator.

Definition at line 73 of file virtual-net-device-example.cc.


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