A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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.
 

Private Member Functions

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

Private Attributes

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

Detailed Description

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

Definition at line 54 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 184 of file virtual-net-device-example.cc.

References ns3::Socket::Bind(), ns3::CreateObject(), ns3::Socket::CreateSocket(), ns3::Ipv4Address::GetAny(), ns3::TypeId::LookupByName(), m_n0Socket, m_n0Tap, m_n1Socket, m_n1Tap, m_n3Socket, m_n3Tap, m_rng, ns3::MakeCallback(), N0SocketRecv(), N0VirtualSend(), N1SocketRecv(), N1VirtualSend(), N3SocketRecv(), N3VirtualSend(), and ns3::Socket::SetRecvCallback().

+ 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 148 of file virtual-net-device-example.cc.

References m_n0Tap, NS_LOG_DEBUG, and ns3::NetDevice::PACKET_HOST.

Referenced by Tunnel().

+ 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 75 of file virtual-net-device-example.cc.

References m_n0Socket, m_n3Address, 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 163 of file virtual-net-device-example.cc.

References m_n1Tap, NS_LOG_DEBUG, and ns3::NetDevice::PACKET_HOST.

Referenced by Tunnel().

+ 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 93 of file virtual-net-device-example.cc.

References m_n1Socket, m_n3Address, 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 133 of file virtual-net-device-example.cc.

References m_n3Tap, NS_LOG_DEBUG, and ns3::NetDevice::PACKET_HOST.

Referenced by Tunnel().

+ 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 111 of file virtual-net-device-example.cc.

References m_n0Address, m_n1Address, m_n3Socket, m_rng, 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 60 of file virtual-net-device-example.cc.

Referenced by N3VirtualSend().

◆ m_n0Socket

Ptr<Socket> Tunnel::m_n0Socket
private

Socket on the N0 node.

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

Referenced by Tunnel(), and N0VirtualSend().

◆ m_n0Tap

Ptr<VirtualNetDevice> Tunnel::m_n0Tap
private

VirtualNetDevice on the N0 node.

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

Referenced by Tunnel(), and N0SocketRecv().

◆ m_n1Address

Ipv4Address Tunnel::m_n1Address
private

Address of the N1 node.

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

Referenced by N3VirtualSend().

◆ m_n1Socket

Ptr<Socket> Tunnel::m_n1Socket
private

Socket on the N1 node.

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

Referenced by Tunnel(), and N1VirtualSend().

◆ m_n1Tap

Ptr<VirtualNetDevice> Tunnel::m_n1Tap
private

VirtualNetDevice on the N1 node.

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

Referenced by Tunnel(), and N1SocketRecv().

◆ m_n3Address

Ipv4Address Tunnel::m_n3Address
private

Address of the N3 node.

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

Referenced by N0VirtualSend(), and N1VirtualSend().

◆ m_n3Socket

Ptr<Socket> Tunnel::m_n3Socket
private

Socket on the N3 node.

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

Referenced by Tunnel(), and N3VirtualSend().

◆ m_n3Tap

Ptr<VirtualNetDevice> Tunnel::m_n3Tap
private

VirtualNetDevice on the N3 node.

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

Referenced by Tunnel(), and N3SocketRecv().

◆ m_rng

Ptr<UniformRandomVariable> Tunnel::m_rng
private

Random number generator.

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

Referenced by Tunnel(), and N3VirtualSend().


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