diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-10-21 21:41:34 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-10-21 21:41:34 +0000 |
commit | a5fdebc5f6375078ec1763850a4ca23ec7fe6458 (patch) | |
tree | bcf0a25c3d45a209a6e3ac37b233a4812f29c732 /ace/UNIX_Addr.i | |
download | ATCD-a5fdebc5f6375078ec1763850a4ca23ec7fe6458.tar.gz |
Initial revision
Diffstat (limited to 'ace/UNIX_Addr.i')
-rw-r--r-- | ace/UNIX_Addr.i | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/ace/UNIX_Addr.i b/ace/UNIX_Addr.i new file mode 100644 index 00000000000..88fcc688cc5 --- /dev/null +++ b/ace/UNIX_Addr.i @@ -0,0 +1,61 @@ +/* -*- C++ -*- */ +// $Id$ + +// UNIX_Addr.i + +#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) + +// Return a pointer to the underlying address. + +ACE_INLINE void * +ACE_UNIX_Addr::get_addr (void) const +{ + return (void *) &this->unix_addr_; +} + +// Transform the string into the current addressing format. + +ACE_INLINE int +ACE_UNIX_Addr::string_to_addr (const char addr[]) +{ + ACE_OS::strncpy (this->unix_addr_.sun_path, addr, + sizeof this->unix_addr_.sun_path); + return 0; +} + +// Transform the current address into string format. + +ACE_INLINE int +ACE_UNIX_Addr::addr_to_string (char s[], size_t len) const +{ + ACE_OS::strncpy (s, this->unix_addr_.sun_path, len); + return 0; +} + +// Compare two addresses for equality. + +ACE_INLINE int +ACE_UNIX_Addr::operator == (const ACE_Addr &sap) const +{ + return ACE_OS::strncmp (this->unix_addr_.sun_path, + ((const ACE_UNIX_Addr &) sap).unix_addr_.sun_path, + sizeof this->unix_addr_.sun_path) == 0; +} + +// Compare two addresses for inequality. + +ACE_INLINE int +ACE_UNIX_Addr::operator != (const ACE_Addr &sap) const +{ + return !((*this) == sap); // This is lazy, of course... ;-) +} + +// Return the path name used for the rendezvous point. + +ACE_INLINE const char * +ACE_UNIX_Addr::get_path_name (void) const +{ + return this->unix_addr_.sun_path; +} + +#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ |