|
Mixe for Privacy and Anonymity in the Internet
|
00001 /* 00002 Copyright (c) 2000, The JAP-Team 00003 All rights reserved. 00004 Redistribution and use in source and binary forms, with or without modification, 00005 are permitted provided that the following conditions are met: 00006 00007 - Redistributions of source code must retain the above copyright notice, 00008 this list of conditions and the following disclaimer. 00009 00010 - Redistributions in binary form must reproduce the above copyright notice, 00011 this list of conditions and the following disclaimer in the documentation and/or 00012 other materials provided with the distribution. 00013 00014 - Neither the name of the University of Technology Dresden, Germany nor the names of its contributors 00015 may be used to endorse or promote products derived from this software without specific 00016 prior written permission. 00017 00018 00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS 00020 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 00021 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS 00022 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00023 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 00024 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 00025 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00026 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE 00027 */ 00028 #ifndef __CASOCKETADDRUNIX__ 00029 #define __CASOCKETADDRUNIX__ 00030 #include "CASocketAddr.hpp" 00031 00033 class CASocketAddrUnix:public CASocketAddr,private sockaddr_un 00034 { 00035 public: 00036 CASocketAddrUnix(); 00037 CASocketAddrUnix(const CASocketAddrUnix& addr); 00038 00042 SINT32 getType() const 00043 { 00044 return AF_LOCAL; 00045 } 00046 00047 00052 CASocketAddr* clone() const 00053 { 00054 return new CASocketAddrUnix(*this); 00055 } 00056 00057 00061 SINT32 getSize() const 00062 { 00063 return sizeof(sockaddr_un); 00064 } 00065 00067 const SOCKADDR* LPSOCKADDR() const 00068 { 00069 return (const ::LPSOCKADDR)(static_cast<const sockaddr_un*>(this)); 00070 } 00071 00077 SINT32 setPath(const char* path); 00078 00083 UINT8* getPath() const; 00084 00092 virtual SINT32 toString(UINT8* buff,UINT32 bufflen) const 00093 { 00094 UINT8* tmppath=getPath(); 00095 if(tmppath==NULL) 00096 return E_UNKNOWN; 00097 SINT32 ret=snprintf((char*)buff,bufflen,"Unix address: %s",tmppath); 00098 delete[]tmppath; 00099 tmppath = NULL; 00100 if(ret<0) 00101 { 00102 return E_SPACE; 00103 } 00104 return E_SUCCESS; 00105 } 00106 00107 }; 00108 00109 #endif
1.7.6.1