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

An IPv6 end point, four tuples identification. More...

#include <ipv6-end-point.h>

Public Member Functions

 Ipv6EndPoint (Ipv6Address addr, uint16_t port)
 Constructor. More...
 
 ~Ipv6EndPoint ()
 Destructor.
 
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)
 Function called from an L4Protocol implementation to notify an endpoint of an icmp message reception. More...
 
void ForwardUp (Ptr< Packet > p, Ipv6Header header, uint16_t port)
 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...
 
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 informations (address and port). More...
 
void SetRxCallback (Callback< void, Ptr< Packet >, Ipv6Header, uint16_t > callback)
 Set the reception callback. More...
 

Private Member Functions

void DoForwardIcmp (Ipv6Address src, uint8_t ttl, uint8_t type, uint8_t code, uint32_t info)
 ForwardIcmp wrapper. More...
 
void DoForwardUp (Ptr< Packet > p, Ipv6Header header, uint16_t sport)
 ForwardUp wrapper. More...
 

Private Attributes

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

Detailed Description

An IPv6 end point, four tuples identification.

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

Constructor & Destructor Documentation

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.

Member Function Documentation

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
Returns
nothing

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

References m_boundnetdevice.

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

ForwardIcmp wrapper.

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

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

References m_icmpCallback.

Referenced by ForwardIcmp().

void ns3::Ipv6EndPoint::DoForwardUp ( Ptr< Packet p,
Ipv6Header  header,
uint16_t  sport 
)
private

ForwardUp wrapper.

Parameters
ppacket
saddrsource IPv6 address
daddrdest IPv6 address
sportsource port

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

References m_rxCallback.

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

Function 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 121 of file ipv6-end-point.cc.

References DoForwardIcmp(), m_icmpCallback, and ns3::Simulator::ScheduleNow().

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

Forward the packet to the upper level.

Parameters
pthe packet
srcAddrsource address
dstAddrsource address
portsource port

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

References m_rxCallback.

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 87 of file ipv6-end-point.cc.

References m_boundnetdevice.

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

Ipv6Address ns3::Ipv6EndPoint::GetLocalAddress ( void  )

Get the local address.

Returns
the local address

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

References m_localAddr.

Referenced by ns3::TcpSocketBase::GetSockName(), ns3::Ipv6EndPointDemux::Lookup(), ns3::TcpSocketBase::SendDataPacket(), and ns3::TcpSocketBase::SendEmptyPacket().

uint16_t ns3::Ipv6EndPoint::GetLocalPort ( void  )

Get the local port.

Returns
the local port

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

References m_localPort.

Referenced by ns3::TcpSocketBase::GetSockName(), ns3::Ipv6EndPointDemux::Lookup(), ns3::TcpSocketBase::SendDataPacket(), and ns3::TcpSocketBase::SendEmptyPacket().

Ipv6Address ns3::Ipv6EndPoint::GetPeerAddress ( void  )
uint16_t ns3::Ipv6EndPoint::GetPeerPort ( void  )
void ns3::Ipv6EndPoint::SetDestroyCallback ( Callback< void >  callback)

Set the default destroy callback.

Parameters
callbackcallback function

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

References m_destroyCallback.

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

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 103 of file ipv6-end-point.cc.

References m_icmpCallback.

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

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

Set the local address.

Parameters
addrthe address to set

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

References m_localAddr.

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

Set the local port.

Parameters
portthe port to set

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

References m_localPort.

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

Set the peer informations (address and port).

Parameters
addrpeer address
portpeer port

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

References m_peerAddr, and m_peerPort.

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

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

Set the reception callback.

Parameters
callbackcallback function

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

References m_rxCallback.

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


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