00001 /* -*- C++ -*- */ 00002 // $Id: UNIX_Addr.i,v 1.1.1.2 2001/12/04 14:33:11 chad Exp $ 00003 00004 // UNIX_Addr.i 00005 00006 #if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) 00007 00008 // Return a pointer to the underlying address. 00009 00010 ACE_INLINE void * 00011 ACE_UNIX_Addr::get_addr (void) const 00012 { 00013 return (void *) &this->unix_addr_; 00014 } 00015 00016 // Transform the string into the current addressing format. 00017 00018 ACE_INLINE int 00019 ACE_UNIX_Addr::string_to_addr (const char addr[]) 00020 { 00021 ACE_OS::strsncpy (this->unix_addr_.sun_path, addr, 00022 sizeof this->unix_addr_.sun_path); 00023 return 0; 00024 } 00025 00026 // Transform the current address into string format. 00027 00028 ACE_INLINE int 00029 ACE_UNIX_Addr::addr_to_string (char s[], size_t len) const 00030 { 00031 ACE_OS::strsncpy (s, this->unix_addr_.sun_path, len); 00032 return 0; 00033 } 00034 00035 // Compare two addresses for equality. 00036 00037 ACE_INLINE int 00038 ACE_UNIX_Addr::operator == (const ACE_UNIX_Addr &sap) const 00039 { 00040 return ACE_OS::strncmp (this->unix_addr_.sun_path, 00041 sap.unix_addr_.sun_path, 00042 sizeof this->unix_addr_.sun_path) == 0; 00043 } 00044 00045 // Compare two addresses for inequality. 00046 00047 ACE_INLINE int 00048 ACE_UNIX_Addr::operator != (const ACE_UNIX_Addr &sap) const 00049 { 00050 return !((*this) == sap); // This is lazy, of course... ;-) 00051 } 00052 00053 // Return the path name used for the rendezvous point. 00054 00055 ACE_INLINE const char * 00056 ACE_UNIX_Addr::get_path_name (void) const 00057 { 00058 return this->unix_addr_.sun_path; 00059 } 00060 00061 ACE_INLINE u_long 00062 ACE_UNIX_Addr::hash (void) const 00063 { 00064 return ACE::hash_pjw (this->unix_addr_.sun_path); 00065 } 00066 00067 #endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */
1.2.14 written by Dimitri van Heesch,
© 1997-2002