A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::InetSocketAddress Class Reference

an Inet address class More...

#include "inet-socket-address.h"

Collaboration diagram for ns3::InetSocketAddress:

Public Member Functions

 InetSocketAddress (const char *ipv4)
 InetSocketAddress (const char *ipv4, uint16_t port)
 InetSocketAddress (Ipv4Address ipv4)
 InetSocketAddress (Ipv4Address ipv4, uint16_t port)
 InetSocketAddress (uint16_t port)
Address ConvertTo () const
 Convert to an Address type.
Ipv4Address GetIpv4 () const
uint16_t GetPort () const
 operator Address () const
void SetIpv4 (Ipv4Address address)
void SetPort (uint16_t port)

Static Public Member Functions

static InetSocketAddress ConvertFrom (const Address &address)
 Returns an InetSocketAddress which corresponds to the input Address.
static bool IsMatchingType (const Address &address)

Static Private Member Functions

static uint8_t GetType ()
 Get the underlying address type (automatically assigned).

Private Attributes

Ipv4Address m_ipv4
 the IPv4 address
uint16_t m_port
 the port

Detailed Description

an Inet address class

This class is similar to inet_sockaddr in the BSD socket API. i.e., this class holds an Ipv4Address and a port number to form an ipv4 transport endpoint.

Definition at line 30 of file inet-socket-address.h.

Constructor & Destructor Documentation

◆ InetSocketAddress() [1/5]

ns3::InetSocketAddress::InetSocketAddress ( Ipv4Address ipv4,
uint16_t port )
Parameters
ipv4the ipv4 address
portthe port number

Definition at line 19 of file inet-socket-address.cc.

References m_ipv4, m_port, NS_LOG_FUNCTION, and port.

Referenced by ConvertFrom().

Here is the caller graph for this function:

◆ InetSocketAddress() [2/5]

ns3::InetSocketAddress::InetSocketAddress ( Ipv4Address ipv4)
Parameters
ipv4the ipv4 address

The port number is set to zero by default.

Definition at line 26 of file inet-socket-address.cc.

References m_ipv4, m_port, and NS_LOG_FUNCTION.

◆ InetSocketAddress() [3/5]

ns3::InetSocketAddress::InetSocketAddress ( uint16_t port)
Parameters
portthe port number

The ipv4 address is set to the "Any" address by default.

Definition at line 47 of file inet-socket-address.cc.

References m_ipv4, m_port, NS_LOG_FUNCTION, and port.

◆ InetSocketAddress() [4/5]

ns3::InetSocketAddress::InetSocketAddress ( const char * ipv4,
uint16_t port )
Parameters
ipv4string which represents an ipv4 address
portthe port number

Definition at line 33 of file inet-socket-address.cc.

References m_ipv4, m_port, NS_LOG_FUNCTION, and port.

◆ InetSocketAddress() [5/5]

ns3::InetSocketAddress::InetSocketAddress ( const char * ipv4)
Parameters
ipv4string which represents an ipv4 address

The port number is set to zero.

Definition at line 40 of file inet-socket-address.cc.

References m_ipv4, m_port, and NS_LOG_FUNCTION.

Member Function Documentation

◆ ConvertFrom()

InetSocketAddress ns3::InetSocketAddress::ConvertFrom ( const Address & address)
static

Returns an InetSocketAddress which corresponds to the input Address.

Parameters
addressthe Address instance to convert from.
Returns
an InetSocketAddress Caller graph was not generated because of its size.

Definition at line 107 of file inet-socket-address.cc.

References InetSocketAddress(), ns3::Ipv4Address::Deserialize(), GetType(), NS_ASSERT, NS_LOG_FUNCTION, and port.

Referenced by ns3::DhcpClient::AcceptAck(), ns3::Ipv4RawSocketImpl::Bind(), ns3::TcpSocketBase::Bind(), ns3::UdpSocketImpl::Bind(), ns3::TcpSocketBase::CompleteFork(), ns3::Ipv4RawSocketImpl::Connect(), ns3::TcpSocketBase::Connect(), ns3::UdpSocketImpl::Connect(), DualStackTestCase::DoRun(), ns3::PacketSink::DoStartApplication(), ns3::ThreeGppHttpServer::DoStartApplication(), ns3::UdpClient::DoStartApplication(), ns3::UdpServer::DoStartApplication(), dstSocketRecv(), ns3::aodv::LoopbackTestCase::EchoData(), ns3::SinkTracer::FormatAddress(), ns3::UdpClient::GetPort(), ns3::UdpEchoClient::GetPort(), ns3::UdpTraceClient::GetPort(), ns3::PacketSink::HandleRead(), ns3::UdpEchoClient::HandleRead(), ns3::UdpEchoServer::HandleRead(), ns3::UdpServer::HandleRead(), HwmpProactiveRegressionTest::HandleReadClient(), HwmpProactiveRegressionTest::HandleReadServer(), ns3::addressUtils::IsMulticast(), ns3::DhcpServer::NetHandler(), ns3::PacketSink::AddressHash::operator()(), PrintReceivedPacket(), PrintReceivedPacket(), PrintReceivedPacket(), PrintReceivedPacket(), PrintReceivedPacket(), ns3::TcpSocketBase::ProcessSynRcvd(), ns3::olsr::Bug780Test::Receive(), ns3::Ping::Receive(), ns3::Rip::Receive(), ns3::V4TraceRoute::Receive(), Receiver::Receive(), ns3::ThreeGppHttpClient::ReceivedDataCallback(), ns3::ThreeGppHttpServer::ReceivedDataCallback(), Ipv4RipSplitHorizonStrategyTest::ReceivePktProbe(), ns3::aodv::RoutingProtocol::RecvAodv(), ns3::dsdv::RoutingProtocol::RecvDsdv(), ns3::olsr::RoutingProtocol::RecvOlsr(), ns3::UdpEchoClient::Send(), Ipv4FragmentationTest::SendClient(), ns3::OnOffApplication::SendPacket(), ns3::TcpL4Protocol::SendPacket(), ns3::UdpTraceClient::SendPacket(), ns3::Ipv4RawSocketImpl::SendTo(), ns3::UdpSocketImpl::SendTo(), ThreeGppHttpObjectTestCase::ServerRxCallback(), and srcSocketRecv().

Here is the call graph for this function:

◆ ConvertTo()

Address ns3::InetSocketAddress::ConvertTo ( ) const

Convert to an Address type.

Returns
the Address corresponding to this object.

Definition at line 96 of file inet-socket-address.cc.

References GetType(), m_ipv4, m_port, and NS_LOG_FUNCTION.

Referenced by operator Address().

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

◆ GetIpv4()

◆ GetPort()

◆ GetType()

uint8_t ns3::InetSocketAddress::GetType ( )
staticprivate

Get the underlying address type (automatically assigned).

Returns
the address type

Definition at line 120 of file inet-socket-address.cc.

References NS_LOG_FUNCTION_NOARGS, and ns3::Address::Register().

Referenced by ConvertFrom(), ConvertTo(), and IsMatchingType().

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

◆ IsMatchingType()

bool ns3::InetSocketAddress::IsMatchingType ( const Address & address)
static
Parameters
addressaddress to test
Returns
true if the address matches, false otherwise.

Definition at line 83 of file inet-socket-address.cc.

References GetType(), and NS_LOG_FUNCTION.

Referenced by ns3::Ipv4RawSocketImpl::Bind(), ns3::TcpSocketBase::Bind(), ns3::UdpSocketImpl::Bind(), ns3::TcpSocketBase::CompleteFork(), ns3::Ipv4RawSocketImpl::Connect(), ns3::TcpSocketBase::Connect(), ns3::UdpSocketImpl::Connect(), DualStackTestCase::DoRun(), ns3::PacketSink::DoStartApplication(), ns3::ThreeGppHttpServer::DoStartApplication(), ns3::UdpClient::DoStartApplication(), ns3::UdpServer::DoStartApplication(), ns3::SinkTracer::FormatAddress(), ns3::UdpClient::GetPort(), ns3::UdpEchoClient::GetPort(), ns3::UdpTraceClient::GetPort(), ns3::PacketSink::HandleRead(), ns3::UdpEchoClient::HandleRead(), ns3::UdpEchoServer::HandleRead(), ns3::UdpServer::HandleRead(), Ipv4FragmentationTest::HandleReadClient(), Ipv4FragmentationTest::HandleReadServer(), ns3::addressUtils::IsMulticast(), ns3::PacketSink::AddressHash::operator()(), PrintReceivedPacket(), ns3::olsr::Bug780Test::Receive(), ns3::Ping::Receive(), ns3::V4TraceRoute::Receive(), Receiver::Receive(), ns3::ThreeGppHttpClient::ReceivedDataCallback(), ns3::ThreeGppHttpServer::ReceivedDataCallback(), ns3::UdpEchoClient::Send(), ns3::OnOffApplication::SendPacket(), ns3::TcpL4Protocol::SendPacket(), ns3::UdpTraceClient::SendPacket(), ns3::Ipv4RawSocketImpl::SendTo(), ns3::UdpSocketImpl::SendTo(), ThreeGppHttpObjectTestCase::ServerRxCallback(), and ns3::SourceApplication::StartApplication().

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

◆ operator Address()

ns3::InetSocketAddress::operator Address ( ) const
Returns
an Address instance which represents this InetSocketAddress instance.

Definition at line 89 of file inet-socket-address.cc.

References ConvertTo().

Here is the call graph for this function:

◆ SetIpv4()

void ns3::InetSocketAddress::SetIpv4 ( Ipv4Address address)
Parameters
addressthe new ipv4 address

Definition at line 76 of file inet-socket-address.cc.

References m_ipv4, and NS_LOG_FUNCTION.

Referenced by Ipv4FragmentationTest::SendClient().

Here is the caller graph for this function:

◆ SetPort()

void ns3::InetSocketAddress::SetPort ( uint16_t port)
Parameters
portthe new port number.

Definition at line 69 of file inet-socket-address.cc.

References m_port, NS_LOG_FUNCTION, and port.

Referenced by Ipv4RawSocketImplTest::DoRun().

Here is the caller graph for this function:

Member Data Documentation

◆ m_ipv4

Ipv4Address ns3::InetSocketAddress::m_ipv4
private

◆ m_port

uint16_t ns3::InetSocketAddress::m_port
private

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