diff options
Diffstat (limited to 'ace/INET_Addr.i')
-rw-r--r-- | ace/INET_Addr.i | 53 |
1 files changed, 14 insertions, 39 deletions
diff --git a/ace/INET_Addr.i b/ace/INET_Addr.i index 2ec940e02c4..5e419feafbb 100644 --- a/ace/INET_Addr.i +++ b/ace/INET_Addr.i @@ -15,7 +15,11 @@ ACE_INLINE u_short ACE_INET_Addr::get_port_number (void) const { ACE_TRACE ("ACE_INET_Addr::get_port_number"); +#if defined (ACE_HAS_IPV6) + return ntohs (this->inet_addr_.sin6_port); +#else return ntohs (this->inet_addr_.sin_port); +#endif } // Return the address. @@ -27,36 +31,7 @@ ACE_INET_Addr::get_addr (void) const return (void *) &this->inet_addr_; } -// Return the dotted Internet address. - -ACE_INLINE const char * -ACE_INET_Addr::get_host_addr (void) const -{ - ACE_TRACE ("ACE_INET_Addr::get_host_addr"); -#if defined (VXWORKS) - // It would be nice to be able to encapsulate this into - // ACE_OS::inet_ntoa(), but that would lead to either inefficiencies - // on vxworks or lack of thread safety. - // - // So, we use the way that vxworks suggests. - ACE_INET_Addr *ncthis = ACE_const_cast (ACE_INET_Addr *, this); - inet_ntoa_b (this->inet_addr_.sin_addr, ncthis->buf_); - return &buf_[0]; -#else /* VXWORKS */ - return ACE_OS::inet_ntoa (this->inet_addr_.sin_addr); -#endif /* VXWORKS */ -} - -// Return the 4-byte IP address, converting it into host byte order. - -ACE_INLINE ACE_UINT32 -ACE_INET_Addr::get_ip_address (void) const -{ - ACE_TRACE ("ACE_INET_Addr::get_ip_address"); - return ntohl (ACE_UINT32 (this->inet_addr_.sin_addr.s_addr)); -} - -ACE_INLINE u_long +ACE_INLINE u_long ACE_INET_Addr::hash (void) const { return this->get_ip_address () + this->get_port_number (); @@ -71,27 +46,27 @@ ACE_INET_Addr::operator < (const ACE_INET_Addr &rhs) const } #if defined (ACE_HAS_WCHAR) -ACE_INLINE int -ACE_INET_Addr::set (u_short port_number, - const wchar_t host_name[], +ACE_INLINE int +ACE_INET_Addr::set (u_short port_number, + const wchar_t host_name[], int encode) { - return this->set (port_number, + return this->set (port_number, ACE_Wide_To_Ascii (host_name).char_rep (), encode); } -ACE_INLINE int +ACE_INLINE int ACE_INET_Addr::set (const wchar_t port_name[], - const wchar_t host_name[], + const wchar_t host_name[], const wchar_t protocol[]) { - return this->set (ACE_Wide_To_Ascii (port_name).char_rep (), + return this->set (ACE_Wide_To_Ascii (port_name).char_rep (), ACE_Wide_To_Ascii (host_name).char_rep (), ACE_Wide_To_Ascii (protocol).char_rep ()); } -ACE_INLINE int +ACE_INLINE int ACE_INET_Addr::set (const wchar_t port_name[], ACE_UINT32 ip_addr, const wchar_t protocol[]) @@ -101,7 +76,7 @@ ACE_INET_Addr::set (const wchar_t port_name[], ACE_Wide_To_Ascii (protocol).char_rep ()); } -ACE_INLINE int +ACE_INLINE int ACE_INET_Addr::set (const wchar_t addr[]) { return this->set (ACE_Wide_To_Ascii (addr).char_rep ()); |