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 |
operator Address () const | |
void | SetIpv4 (Ipv4Address address) |
void | SetPort (uint16_t port) |
Static Public Member Functions | |
static InetSocketAddress | ConvertFrom (const Address &address) |
static bool | IsMatchingType (const Address &address) |
Private Member Functions | |
Address | ConvertTo (void) const |
Static Private Member Functions | |
static uint8_t | GetType (void) |
Private Attributes | |
Ipv4Address | m_ipv4 |
uint16_t | m_port |
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.
ns3::InetSocketAddress::InetSocketAddress | ( | Ipv4Address | ipv4, |
uint16_t | port | ||
) |
ipv4 | the ipv4 address |
port | the port number |
Definition at line 29 of file inet-socket-address.cc.
References NS_LOG_FUNCTION.
Referenced by ConvertFrom().
ns3::InetSocketAddress::InetSocketAddress | ( | Ipv4Address | ipv4 | ) |
ipv4 | the ipv4 address |
The port number is set to zero by default.
Definition at line 35 of file inet-socket-address.cc.
References NS_LOG_FUNCTION.
ns3::InetSocketAddress::InetSocketAddress | ( | uint16_t | port | ) |
port | the port number |
The ipv4 address is set to the "Any" address by default.
Definition at line 53 of file inet-socket-address.cc.
References NS_LOG_FUNCTION.
ns3::InetSocketAddress::InetSocketAddress | ( | const char * | ipv4, |
uint16_t | port | ||
) |
ipv4 | string which represents an ipv4 address |
port | the port number |
Definition at line 41 of file inet-socket-address.cc.
References NS_LOG_FUNCTION.
ns3::InetSocketAddress::InetSocketAddress | ( | const char * | ipv4 | ) |
ipv4 | string which represents an ipv4 address |
The port number is set to zero.
Definition at line 47 of file inet-socket-address.cc.
References NS_LOG_FUNCTION.
|
static |
address | the Address instance to convert from. |
Returns an InetSocketAddress which corresponds to the input Address
Definition at line 108 of file inet-socket-address.cc.
References ns3::Address::CheckCompatible(), ns3::Address::CopyTo(), ns3::Ipv4Address::Deserialize(), GetType(), InetSocketAddress(), NS_ASSERT, NS_LOG_FUNCTION, and port.
Referenced by ns3::Ipv4RawSocketImpl::Bind(), ns3::UdpSocketImpl::Bind(), ns3::NscTcpSocketImpl::Bind(), ns3::TcpSocketBase::Bind(), ns3::TcpSocketBase::CompleteFork(), ns3::Ipv4RawSocketImpl::Connect(), ns3::UdpSocketImpl::Connect(), ns3::NscTcpSocketImpl::Connect(), ns3::TcpSocketBase::Connect(), ns3::UdpSocketImpl::DoSendTo(), dstSocketRecv(), ns3::UdpEchoServer::HandleRead(), ns3::UdpServer::HandleRead(), ns3::PacketSink::HandleRead(), ns3::UdpEchoClient::HandleRead(), ns3::addressUtils::IsMulticast(), PrintReceivedPacket(), ns3::TcpSocketBase::ProcessSynRcvd(), ns3::V4Ping::Receive(), ns3::aodv::RoutingProtocol::RecvAodv(), ns3::dsdv::RoutingProtocol::RecvDsdv(), ns3::olsr::RoutingProtocol::RecvOlsr(), ns3::OnOffApplication::SendPacket(), ns3::Ipv4RawSocketImpl::SendTo(), ns3::UdpSocketImpl::SendTo(), and srcSocketRecv().
|
private |
Definition at line 98 of file inet-socket-address.cc.
References GetType(), m_ipv4, m_port, NS_LOG_FUNCTION, and ns3::Ipv4Address::Serialize().
Ipv4Address ns3::InetSocketAddress::GetIpv4 | ( | void | ) | const |
Definition at line 66 of file inet-socket-address.cc.
References m_ipv4, and NS_LOG_FUNCTION.
Referenced by ns3::Ipv4RawSocketImpl::Bind(), ns3::UdpSocketImpl::Bind(), ns3::NscTcpSocketImpl::Bind(), ns3::TcpSocketBase::Bind(), ns3::Ipv4RawSocketImpl::Connect(), ns3::UdpSocketImpl::Connect(), ns3::NscTcpSocketImpl::Connect(), ns3::TcpSocketBase::Connect(), ns3::UdpSocketImpl::DoSendTo(), dstSocketRecv(), ns3::UdpEchoServer::HandleRead(), ns3::UdpServer::HandleRead(), ns3::PacketSink::HandleRead(), ns3::UdpEchoClient::HandleRead(), ns3::addressUtils::IsMulticast(), PrintReceivedPacket(), ns3::V4Ping::Receive(), ns3::aodv::RoutingProtocol::RecvAodv(), ns3::dsdv::RoutingProtocol::RecvDsdv(), ns3::olsr::RoutingProtocol::RecvOlsr(), ns3::OnOffApplication::SendPacket(), ns3::Ipv4RawSocketImpl::SendTo(), ns3::UdpSocketImpl::SendTo(), and srcSocketRecv().
uint16_t ns3::InetSocketAddress::GetPort | ( | void | ) | const |
Definition at line 60 of file inet-socket-address.cc.
References m_port, and NS_LOG_FUNCTION.
Referenced by ns3::UdpSocketImpl::Bind(), ns3::NscTcpSocketImpl::Bind(), ns3::TcpSocketBase::Bind(), ns3::UdpSocketImpl::Connect(), ns3::NscTcpSocketImpl::Connect(), ns3::TcpSocketBase::Connect(), ns3::UdpSocketImpl::DoSendTo(), dstSocketRecv(), ns3::UdpEchoServer::HandleRead(), ns3::PacketSink::HandleRead(), ns3::UdpEchoClient::HandleRead(), PrintReceivedPacket(), ns3::V4Ping::Receive(), ns3::olsr::RoutingProtocol::RecvOlsr(), ns3::OnOffApplication::SendPacket(), and ns3::UdpSocketImpl::SendTo().
|
staticprivate |
Definition at line 119 of file inet-socket-address.cc.
References NS_LOG_FUNCTION_NOARGS, and ns3::Address::Register().
Referenced by ConvertFrom(), ConvertTo(), and IsMatchingType().
|
static |
address | address to test |
Definition at line 86 of file inet-socket-address.cc.
References ns3::Address::CheckCompatible(), GetType(), and NS_LOG_FUNCTION.
Referenced by ns3::Ipv4RawSocketImpl::Bind(), ns3::UdpSocketImpl::Bind(), ns3::NscTcpSocketImpl::Bind(), ns3::TcpSocketBase::Bind(), ns3::TcpSocketBase::CompleteFork(), ns3::Ipv4RawSocketImpl::Connect(), ns3::UdpSocketImpl::Connect(), ns3::TcpSocketBase::Connect(), ns3::UdpSocketImpl::DoSend(), ns3::UdpSocketImpl::DoSendTo(), ns3::UdpEchoServer::HandleRead(), ns3::UdpServer::HandleRead(), ns3::PacketSink::HandleRead(), ns3::UdpEchoClient::HandleRead(), ns3::addressUtils::IsMulticast(), ns3::V4Ping::Receive(), ns3::OnOffApplication::SendPacket(), ns3::Ipv4RawSocketImpl::SendTo(), ns3::UdpSocketImpl::SendTo(), ns3::BulkSendApplication::StartApplication(), and ns3::OnOffApplication::StartApplication().
ns3::InetSocketAddress::operator Address | ( | ) | const |
Definition at line 92 of file inet-socket-address.cc.
void ns3::InetSocketAddress::SetIpv4 | ( | Ipv4Address | address | ) |
address | the new ipv4 address |
Definition at line 79 of file inet-socket-address.cc.
References first::address, m_ipv4, and NS_LOG_FUNCTION.
void ns3::InetSocketAddress::SetPort | ( | uint16_t | port | ) |
port | the new port number. |
Definition at line 73 of file inet-socket-address.cc.
References m_port, NS_LOG_FUNCTION, and port.
|
private |
Definition at line 112 of file inet-socket-address.h.
Referenced by ConvertTo(), GetIpv4(), and SetIpv4().
|
private |
Definition at line 113 of file inet-socket-address.h.
Referenced by ConvertTo(), GetPort(), and SetPort().