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

an Inet address class More...

#include "inet-socket-address.h"

Public Member Functions

 InetSocketAddress (Ipv4Address ipv4, uint16_t port)
 
 InetSocketAddress (Ipv4Address ipv4)
 
 InetSocketAddress (uint16_t port)
 
 InetSocketAddress (const char *ipv4, uint16_t port)
 
 InetSocketAddress (const char *ipv4)
 
Ipv4Address GetIpv4 (void) const
 
uint16_t GetPort (void) const
 
uint8_t GetTos (void) const
 
 operator Address () const
 
void SetIpv4 (Ipv4Address address)
 
void SetPort (uint16_t port)
 
void SetTos (uint8_t tos)
 

Static Public Member Functions

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

Private Member Functions

Address ConvertTo (void) const
 Convert to an Address type. More...
 

Static Private Member Functions

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

Private Attributes

Ipv4Address m_ipv4
 the IPv4 address More...
 
uint16_t m_port
 the port More...
 
uint8_t m_tos
 the ToS More...
 

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 40 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 29 of file inet-socket-address.cc.

References NS_LOG_FUNCTION, and port.

◆ InetSocketAddress() [2/5]

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

The port number is set to zero by default.

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

References 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 57 of file inet-socket-address.cc.

References 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 43 of file inet-socket-address.cc.

References 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 50 of file inet-socket-address.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ ConvertFrom()

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

◆ ConvertTo()

Address ns3::InetSocketAddress::ConvertTo ( void  ) const
private

Convert to an Address type.

Returns
the Address corresponding to this object.

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

References GetType(), m_ipv4, m_port, m_tos, NS_LOG_FUNCTION, and ns3::Ipv4Address::Serialize().

◆ GetIpv4()

Ipv4Address ns3::InetSocketAddress::GetIpv4 ( void  ) const

◆ GetPort()

uint16_t ns3::InetSocketAddress::GetPort ( void  ) const

◆ GetTos()

uint8_t ns3::InetSocketAddress::GetTos ( void  ) const

◆ GetType()

uint8_t ns3::InetSocketAddress::GetType ( void  )
staticprivate

Get the underlying address type (automatically assigned).

Returns
the address type

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

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

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

◆ IsMatchingType()

bool ns3::InetSocketAddress::IsMatchingType ( const Address address)
static

◆ operator Address()

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

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

◆ SetIpv4()

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

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

References first::address, m_ipv4, and NS_LOG_FUNCTION.

◆ SetPort()

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

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

References m_port, NS_LOG_FUNCTION, and port.

◆ SetTos()

void ns3::InetSocketAddress::SetTos ( uint8_t  tos)

Member Data Documentation

◆ m_ipv4

Ipv4Address ns3::InetSocketAddress::m_ipv4
private

the IPv4 address

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

Referenced by ConvertTo(), GetIpv4(), and SetIpv4().

◆ m_port

uint16_t ns3::InetSocketAddress::m_port
private

the port

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

Referenced by ConvertTo(), GetPort(), and SetPort().

◆ m_tos

uint8_t ns3::InetSocketAddress::m_tos
private

the ToS

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

Referenced by ConvertTo(), GetTos(), and SetTos().


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