Proud::AddrPort Struct Reference

Public Member Functions

union PN_ALIGN (4) ExtendAddr
 
bool IsIPv4MappedIPv6Addr () const
 
void SetIPv4MappedIPv6Address (uint32_t ipv4Address)
 
void SetIPv6Address (const in6_addr &addr)
 
void SetIPv6Address (const uint8_t *src, const size_t length)
 
void Synthesize (const uint8_t *pref, const size_t prefLength, const uint32_t v4BinaryAddress)
 
bool GetIPv4Address (uint32_t *outIPv4Address) const
 
bool IsAddressEqualTo (const AddrPort &a) const
 
 AddrPort ()
 
void ToNativeV4 (ExtendSockAddr &out) const
 
void ToNativeV6 (ExtendSockAddr &out) const
 
void FromNativeV4 (const sockaddr_in &in)
 
void FromNativeV6 (const sockaddr_in6 &in)
 
void FromNative (const ExtendSockAddr &in)
 
virtual String ToString () const
 
virtual String IPToString () const
 
bool IsUnicastEndpoint () const
 
bool IsAnyOrUnicastEndpoint () const
 
uint32_t Hash () const
 
bool operator!= (const AddrPort &rhs) const
 
bool operator== (const AddrPort &b) const
 
bool operator< (const AddrPort &b) const
 

Static Public Member Functions

static AddrPort FromIPPortV4 (const String &ipAddress, uint16_t port)
 
static AddrPort FromIPPortV6 (const String &ipAddress, uint16_t port)
 
static AddrPort FromIPPort (const int32_t &af, const String &ipAddress, uint16_t port)
 
static AddrPort FromAnyIPPort (const int32_t &af, uint16_t port)
 
static AddrPort FromHostNamePort (const String &hostName, uint16_t port)
 
static AddrPort From (const NamedAddrPort &src)
 
static bool IsEqualAddress (const AddrPort &a, const AddrPort &b)
 

Public Attributes

 m_addr
 
uint16_t m_port
 

Static Public Attributes

static AddrPort Unassigned
 

Detailed Description

IP, Port Identifier

Constructor & Destructor Documentation

Proud::AddrPort::AddrPort ( )
inline

Generator

Member Function Documentation

static AddrPort Proud::AddrPort::From ( const NamedAddrPort src)
static

This method gets a value from NamedAddrPort object.

  • If host name of NamedAddrPort is in "my.somename.net" format, then this method converts the host name to IP address and returns it.
static AddrPort Proud::AddrPort::FromAnyIPPort ( const int32_t &  af,
uint16_t  port 
)
static

Set to Any:port.

static AddrPort Proud::AddrPort::FromIPPortV4 ( const String ipAddress,
uint16_t  port 
)
static

Input an IP address string and a port to get the return value from AddrPort object. Host name can’t be processed. Use FromHostNamePort() instead.

Parameters
ipAddressIP is the address value. Ex. “11.22.33.44”
portis the port value.
void Proud::AddrPort::FromNativeV4 ( const sockaddr_in &  in)

This method passes a value to Socket API Parameter, sockaddr_in structure.

virtual String Proud::AddrPort::IPToString ( ) const
virtual

Extract xxx.xxx.xxx.xxx string

bool Proud::AddrPort::IsIPv4MappedIPv6Addr ( ) const

IPv4 주소가 들어있으면, true를 리턴합니다. RFC 4291 에서 정의 하고 있는, 표준 IPv4 표현 방식을 일컫습니다. 예: 11.22.33.44는 ::ffff:11.22.33.44 형식으로 저장되며, 이때 이 함수는 true를 리턴합니다.

bool Proud::AddrPort::IsUnicastEndpoint ( ) const

Is it correct address that point 1 port of 1 host instead of broadcast address, null address?

void Proud::AddrPort::ToNativeV4 ( ExtendSockAddr &  out) const

This method gets a value from Socket API Parameter, sockaddr_in structure.

virtual String Proud::AddrPort::ToString ( ) const
virtual

Extract xxx.xxx.xxx.xxx:XXXX string

Member Data Documentation

uint16_t Proud::AddrPort::m_port

Port Number

  • It's native endian, not network endian. So it can be used as-is without converting it through htons or ntohs.
AddrPort Proud::AddrPort::Unassigned
static

Undesignated IP object. It is default value.