00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "assa/UNIXAddress.h"
00016
00017 #if !defined (WIN32)
00018
00019 using namespace ASSA;
00020
00021 UNIXAddress::
00022 UNIXAddress (const char* socket_name_)
00023 {
00024 trace("UNIXAddress::UNIXAddress(char* name_)");
00025
00026 size_t len;
00027 m_address.sun_family = AF_UNIX;
00028
00029 if ( (len = strlen(socket_name_)) > sizeof(m_address.sun_path) ) {
00030 EL((ASSAERR,"Socket path name is too long (%d bytes)\n", len));
00031 setstate (Address::badbit);
00032 }
00033 strcpy (m_address.sun_path, socket_name_);
00034 }
00035
00036 UNIXAddress::
00037 UNIXAddress (SA* saddr_)
00038 {
00039 trace("UNIXAddress::UNIXAddress(SA_UN*)");
00040
00041 SA_UN* sa_un = (SA_UN*) saddr_;
00042 m_address.sun_family = AF_UNIX;
00043
00044 size_t len = strlen(sa_un->sun_path);
00045
00046 if ( len > sizeof (m_address.sun_path) - 1 ) {
00047 EL((ASSAERR,"Socket path name is too long (%d bytes)\n", len));
00048 setstate (Address::badbit);
00049 }
00050 strcpy(m_address.sun_path, sa_un->sun_path);
00051 }
00052
00053 #endif