Proud::AddrPort Struct Reference

Public Member Functions

union PN_ALIGN (4) ExtendAddr
 
PROUD_API bool IsIPv4MappedIPv6Addr () const
 
PROUD_API void SetIPv4MappedIPv6Address (uint32_t ipv4Address)
 
PROUD_API void SetIPv6Address (const in6_addr &addr)
 
PROUD_API void SetIPv6Address (const uint8_t *src, const size_t length)
 
PROUD_API void Synthesize (const uint8_t *pref, const size_t prefLength, const uint32_t v4BinaryAddress)
 
PROUD_API bool GetIPv4Address (uint32_t *outIPv4Address) const
 
bool IsAddressEqualTo (const AddrPort &a) const
 
PROUD_API AddrPort ()
 
PROUD_API bool ToNativeV4 (ExtendSockAddr &output, ErrorInfo &outErrorInfo) const
 
PROUD_API void ToNativeV6 (ExtendSockAddr &out) const
 
PROUD_API void FromNativeV4 (const sockaddr_in &in)
 
PROUD_API void FromNativeV6 (const sockaddr_in6 &in)
 
PROUD_API void FromNative (const ExtendSockAddr &in)
 
virtual PROUD_API String ToString () const
 
virtual PROUD_API String IPToString () const
 
PROUD_API bool IsUnicastEndpoint () const
 
PROUD_API 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 PROUD_API AddrPort FromIPPortV4 (const String &ipAddress, uint16_t port)
 
static PROUD_API AddrPort FromIPPortV6 (const String &ipAddress, uint16_t port)
 
static PROUD_API AddrPort FromIPPort (const int32_t &af, const String &ipAddress, uint16_t port)
 
static PROUD_API AddrPort FromAnyIPPort (const int32_t &af, uint16_t port)
 
static PROUD_API bool FromHostNamePort (AddrPort *outAddrPort, SocketErrorCode &errorCode, const String &hostName, uint16_t port)
 
static PROUD_API 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 PROUD_API AddrPort Unassigned
 

Detailed Description

IP, Port Identifier

Constructor & Destructor Documentation

PROUD_API Proud::AddrPort::AddrPort ( )

Generator

Member Function Documentation

static PROUD_API 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 PROUD_API AddrPort Proud::AddrPort::FromAnyIPPort ( const int32_t &  af,
uint16_t  port 
)
static

Set to Any:port.

static PROUD_API 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.
PROUD_API void Proud::AddrPort::FromNativeV4 ( const sockaddr_in &  in)

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

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

Extract xxx.xxx.xxx.xxx string

PROUD_API bool Proud::AddrPort::IsIPv4MappedIPv6Addr ( ) const

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

PROUD_API bool Proud::AddrPort::IsUnicastEndpoint ( ) const

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

virtual PROUD_API 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.
PROUD_API AddrPort Proud::AddrPort::Unassigned
static

Undesignated IP object. It is default value.