A Discrete-Event Network Simulator
API
Public Member Functions | Private Attributes | List of all members
ns3::Ipv6EndPoint Class Reference

A representation of an IPv6 endpoint/connection. More...

#include "ipv6-end-point.h"

Public Member Functions

 Ipv6EndPoint (Ipv6Address addr, uint16_t port)
 Constructor. More...
 
 ~Ipv6EndPoint ()
 
void BindToNetDevice (Ptr< NetDevice > netdevice)
 Bind a socket to specific device. More...
 
void ForwardIcmp (Ipv6Address src, uint8_t ttl, uint8_t type, uint8_t code, uint32_t info)
 Forward the ICMP packet to the upper level. More...
 
void ForwardUp (Ptr< Packet > p, Ipv6Header header, uint16_t port, Ptr< Ipv6Interface > incomingInterface)
 Forward the packet to the upper level. More...
 
Ptr< NetDeviceGetBoundNetDevice (void)
 Returns socket's bound netdevice, if any. More...
 
Ipv6Address GetLocalAddress ()
 Get the local address. More...
 
uint16_t GetLocalPort ()
 Get the local port. More...
 
Ipv6Address GetPeerAddress ()
 Get the peer address. More...
 
uint16_t GetPeerPort ()
 Get the peer port. More...
 
bool IsRxEnabled (void)
 Checks if the endpoint can receive packets. More...
 
void SetDestroyCallback (Callback< void > callback)
 Set the default destroy callback. More...
 
void SetIcmpCallback (Callback< void, Ipv6Address, uint8_t, uint8_t, uint8_t, uint32_t > callback)
 Set the ICMP callback. More...
 
void SetLocalAddress (Ipv6Address addr)
 Set the local address. More...
 
void SetLocalPort (uint16_t port)
 Set the local port. More...
 
void SetPeer (Ipv6Address addr, uint16_t port)
 Set the peer information (address and port). More...
 
void SetRxCallback (Callback< void, Ptr< Packet >, Ipv6Header, uint16_t, Ptr< Ipv6Interface > > callback)
 Set the reception callback. More...
 
void SetRxEnabled (bool enabled)
 Enable or Disable the endpoint Rx capability. More...
 

Private Attributes

Ptr< NetDevicem_boundnetdevice
 The NetDevice the EndPoint is bound to (if any). More...
 
Callback< void > m_destroyCallback
 The destroy callback. More...
 
Callback< void, Ipv6Address, uint8_t, uint8_t, uint8_t, uint32_t > m_icmpCallback
 The ICMPv6 callback. More...
 
Ipv6Address m_localAddr
 The local address. More...
 
uint16_t m_localPort
 The local port. More...
 
Ipv6Address m_peerAddr
 The peer address. More...
 
uint16_t m_peerPort
 The peer port. More...
 
Callback< void, Ptr< Packet >, Ipv6Header, uint16_t, Ptr< Ipv6Interface > > m_rxCallback
 The RX callback. More...
 
bool m_rxEnabled
 true if the endpoint can receive packets. More...
 

Detailed Description

A representation of an IPv6 endpoint/connection.

This class provides an Internet four-tuple (source and destination ports and addresses). These are used in the ns3::Ipv6EndPointDemux as targets of lookups. The class also has a callback for notification to higher layers that a packet from a lower layer was received. In the ns3 internet-stack, these notifications are automatically registered to be received by the corresponding socket.

Definition at line 50 of file ipv6-end-point.h.

Constructor & Destructor Documentation

◆ Ipv6EndPoint()

ns3::Ipv6EndPoint::Ipv6EndPoint ( Ipv6Address  addr,
uint16_t  port 
)

Constructor.

Parameters
addrthe IPv6 address
portthe port

Definition at line 32 of file ipv6-end-point.cc.

◆ ~Ipv6EndPoint()

ns3::Ipv6EndPoint::~Ipv6EndPoint ( )

Member Function Documentation

◆ BindToNetDevice()

void ns3::Ipv6EndPoint::BindToNetDevice ( Ptr< NetDevice netdevice)

Bind a socket to specific device.

This method corresponds to using setsockopt() SO_BINDTODEVICE of real network or BSD sockets. If set on a socket, this option will force packets to leave the bound device regardless of the device that IP routing would naturally choose. In the receive direction, only packets received from the bound interface will be delivered.

This option has no particular relationship to binding sockets to an address via Socket::Bind (). It is possible to bind sockets to a specific IP address on the bound interface by calling both Socket::Bind (address) and Socket::BindToNetDevice (device), but it is also possible to bind to mismatching device and address, even if the socket can not receive any packets as a result.

Parameters
netdevicePointer to Netdevice of desired interface

Definition at line 82 of file ipv6-end-point.cc.

References m_boundnetdevice.

Referenced by ns3::UdpSocketImpl::Bind(), ns3::UdpSocketImpl::Bind6(), ns3::UdpSocketImpl::BindToNetDevice(), and ns3::TcpSocketBase::BindToNetDevice().

◆ ForwardIcmp()

void ns3::Ipv6EndPoint::ForwardIcmp ( Ipv6Address  src,
uint8_t  ttl,
uint8_t  type,
uint8_t  code,
uint32_t  info 
)

Forward the ICMP packet to the upper level.

Called from an L4Protocol implementation to notify an endpoint of an icmp message reception.

Parameters
srcsource IPv6 address
ttltime-to-live
typeICMPv6 type
codeICMPv6 code
infoICMPv6 info

Definition at line 122 of file ipv6-end-point.cc.

References m_icmpCallback.

Referenced by ns3::UdpL4Protocol::ReceiveIcmp(), and ns3::TcpL4Protocol::ReceiveIcmp().

◆ ForwardUp()

void ns3::Ipv6EndPoint::ForwardUp ( Ptr< Packet p,
Ipv6Header  header,
uint16_t  port,
Ptr< Ipv6Interface incomingInterface 
)

Forward the packet to the upper level.

Called from an L4Protocol implementation to notify an endpoint of a packet reception.

Parameters
pthe packet
headerthe packet header
portsource port
incomingInterfaceincoming interface

Definition at line 114 of file ipv6-end-point.cc.

References m_rxCallback, and port.

◆ GetBoundNetDevice()

Ptr< NetDevice > ns3::Ipv6EndPoint::GetBoundNetDevice ( void  )

Returns socket's bound netdevice, if any.

This method corresponds to using getsockopt() SO_BINDTODEVICE of real network or BSD sockets.

Returns
Pointer to interface.

Definition at line 88 of file ipv6-end-point.cc.

References m_boundnetdevice.

Referenced by ns3::Ipv6EndPointDemux::Lookup().

◆ GetLocalAddress()

Ipv6Address ns3::Ipv6EndPoint::GetLocalAddress ( void  )

◆ GetLocalPort()

uint16_t ns3::Ipv6EndPoint::GetLocalPort ( void  )

◆ GetPeerAddress()

Ipv6Address ns3::Ipv6EndPoint::GetPeerAddress ( void  )

◆ GetPeerPort()

uint16_t ns3::Ipv6EndPoint::GetPeerPort ( void  )

◆ IsRxEnabled()

bool ns3::Ipv6EndPoint::IsRxEnabled ( void  )

Checks if the endpoint can receive packets.

Returns
true if the endpoint can receive packets.

Definition at line 136 of file ipv6-end-point.cc.

References m_rxEnabled.

Referenced by ns3::Ipv6EndPointDemux::Lookup().

◆ SetDestroyCallback()

void ns3::Ipv6EndPoint::SetDestroyCallback ( Callback< void >  callback)

Set the default destroy callback.

Parameters
callbackcallback function

Definition at line 109 of file ipv6-end-point.cc.

References m_destroyCallback.

Referenced by ns3::UdpSocketImpl::DeallocateEndPoint(), ns3::TcpSocketBase::DeallocateEndPoint(), ns3::UdpSocketImpl::FinishBind(), and ns3::TcpSocketBase::SetupCallback().

◆ SetIcmpCallback()

void ns3::Ipv6EndPoint::SetIcmpCallback ( Callback< void, Ipv6Address, uint8_t, uint8_t, uint8_t, uint32_t >  callback)

Set the ICMP callback.

Parameters
callbackcallback function

Definition at line 104 of file ipv6-end-point.cc.

References m_icmpCallback.

Referenced by ns3::UdpSocketImpl::FinishBind(), and ns3::TcpSocketBase::SetupCallback().

◆ SetLocalAddress()

void ns3::Ipv6EndPoint::SetLocalAddress ( Ipv6Address  addr)

Set the local address.

Parameters
addrthe address to set

Definition at line 57 of file ipv6-end-point.cc.

References m_localAddr.

Referenced by ns3::TcpSocketBase::SetupEndpoint6().

◆ SetLocalPort()

void ns3::Ipv6EndPoint::SetLocalPort ( uint16_t  port)

Set the local port.

Parameters
portthe port to set

Definition at line 67 of file ipv6-end-point.cc.

References m_localPort, and port.

◆ SetPeer()

void ns3::Ipv6EndPoint::SetPeer ( Ipv6Address  addr,
uint16_t  port 
)

Set the peer information (address and port).

Parameters
addrpeer address
portpeer port

Definition at line 93 of file ipv6-end-point.cc.

References m_peerAddr, m_peerPort, and port.

Referenced by ns3::Ipv6EndPointDemux::Allocate(), ns3::TcpSocketBase::Connect(), and ns3::TcpSocketBase::ProcessSynRcvd().

◆ SetRxCallback()

void ns3::Ipv6EndPoint::SetRxCallback ( Callback< void, Ptr< Packet >, Ipv6Header, uint16_t, Ptr< Ipv6Interface > >  callback)

Set the reception callback.

Parameters
callbackcallback function

Definition at line 99 of file ipv6-end-point.cc.

References m_rxCallback.

Referenced by ns3::UdpSocketImpl::FinishBind(), and ns3::TcpSocketBase::SetupCallback().

◆ SetRxEnabled()

void ns3::Ipv6EndPoint::SetRxEnabled ( bool  enabled)

Enable or Disable the endpoint Rx capability.

Parameters
enabledtrue if Rx is enabled

Definition at line 131 of file ipv6-end-point.cc.

References m_rxEnabled.

Referenced by ns3::UdpSocketImpl::ShutdownRecv().

Member Data Documentation

◆ m_boundnetdevice

Ptr<NetDevice> ns3::Ipv6EndPoint::m_boundnetdevice
private

The NetDevice the EndPoint is bound to (if any).

Definition at line 218 of file ipv6-end-point.h.

Referenced by BindToNetDevice(), and GetBoundNetDevice().

◆ m_destroyCallback

Callback<void> ns3::Ipv6EndPoint::m_destroyCallback
private

The destroy callback.

Definition at line 233 of file ipv6-end-point.h.

Referenced by SetDestroyCallback(), and ~Ipv6EndPoint().

◆ m_icmpCallback

Callback<void, Ipv6Address, uint8_t, uint8_t, uint8_t, uint32_t> ns3::Ipv6EndPoint::m_icmpCallback
private

The ICMPv6 callback.

Definition at line 228 of file ipv6-end-point.h.

Referenced by ForwardIcmp(), SetIcmpCallback(), and ~Ipv6EndPoint().

◆ m_localAddr

Ipv6Address ns3::Ipv6EndPoint::m_localAddr
private

The local address.

Definition at line 198 of file ipv6-end-point.h.

Referenced by GetLocalAddress(), and SetLocalAddress().

◆ m_localPort

uint16_t ns3::Ipv6EndPoint::m_localPort
private

The local port.

Definition at line 203 of file ipv6-end-point.h.

Referenced by GetLocalPort(), and SetLocalPort().

◆ m_peerAddr

Ipv6Address ns3::Ipv6EndPoint::m_peerAddr
private

The peer address.

Definition at line 208 of file ipv6-end-point.h.

Referenced by GetPeerAddress(), and SetPeer().

◆ m_peerPort

uint16_t ns3::Ipv6EndPoint::m_peerPort
private

The peer port.

Definition at line 213 of file ipv6-end-point.h.

Referenced by GetPeerPort(), and SetPeer().

◆ m_rxCallback

Callback<void, Ptr<Packet>, Ipv6Header, uint16_t, Ptr<Ipv6Interface> > ns3::Ipv6EndPoint::m_rxCallback
private

The RX callback.

Definition at line 223 of file ipv6-end-point.h.

Referenced by ForwardUp(), SetRxCallback(), and ~Ipv6EndPoint().

◆ m_rxEnabled

bool ns3::Ipv6EndPoint::m_rxEnabled
private

true if the endpoint can receive packets.

Definition at line 238 of file ipv6-end-point.h.

Referenced by IsRxEnabled(), and SetRxEnabled().


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