00001 // -*- C++ -*- 00002 // 00003 // $Id: UNIX_Addr.inl 77304 2007-02-21 22:29:49Z ossama $ 00004 00005 00006 #include "ace/OS_NS_string.h" 00007 00008 00009 #if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) 00010 00011 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00012 00013 #if defined (ACE_HAS_WCHAR) 00014 /// Creates an ACE_UNIX_Addr from a string. 00015 ACE_INLINE 00016 ACE_UNIX_Addr::ACE_UNIX_Addr (const wchar_t rendezvous_point[]) 00017 { 00018 this->set (ACE_Wide_To_Ascii (rendezvous_point).char_rep ()); 00019 } 00020 00021 /// Creates an ACE_UNIX_Addr from a string. 00022 ACE_INLINE int 00023 ACE_UNIX_Addr::set (const wchar_t rendezvous_point[]) 00024 { 00025 return this->set (ACE_Wide_To_Ascii (rendezvous_point).char_rep ()); 00026 } 00027 #endif /* ACE_HAS_WCHAR */ 00028 00029 // Compare two addresses for equality. 00030 00031 ACE_INLINE bool 00032 ACE_UNIX_Addr::operator == (const ACE_UNIX_Addr &sap) const 00033 { 00034 return ACE_OS::strncmp (this->unix_addr_.sun_path, 00035 sap.unix_addr_.sun_path, 00036 sizeof this->unix_addr_.sun_path) == 0; 00037 } 00038 00039 // Compare two addresses for inequality. 00040 00041 ACE_INLINE bool 00042 ACE_UNIX_Addr::operator != (const ACE_UNIX_Addr &sap) const 00043 { 00044 return !((*this) == sap); // This is lazy, of course... ;-) 00045 } 00046 00047 // Return the path name used for the rendezvous point. 00048 00049 ACE_INLINE const char * 00050 ACE_UNIX_Addr::get_path_name (void) const 00051 { 00052 return this->unix_addr_.sun_path; 00053 } 00054 00055 ACE_END_VERSIONED_NAMESPACE_DECL 00056 00057 #endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */