00001 /* 00002 * Copyright (C) 2003-2009 Olivier Boudeville 00003 * 00004 * This file is part of the Ceylan library. 00005 * 00006 * The Ceylan library is free software: you can redistribute it and/or modify 00007 * it under the terms of either the GNU Lesser General Public License or 00008 * the GNU General Public License, as they are published by the Free Software 00009 * Foundation, either version 3 of these Licenses, or (at your option) 00010 * any later version. 00011 * 00012 * The Ceylan library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU Lesser General Public License and the GNU General Public License 00016 * for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License and the GNU General Public License along with the Ceylan library. 00020 * If not, see <http://www.gnu.org/licenses/>. 00021 * 00022 * Author: Olivier Boudeville (olivier.boudeville@esperide.com) 00023 * 00024 */ 00025 00026 00027 #ifndef CEYLAN_ANONYMOUS_STREAM_SOCKET_H_ 00028 #define CEYLAN_ANONYMOUS_STREAM_SOCKET_H_ 00029 00030 00031 #include "CeylanStreamSocket.h" // for inheritance 00032 #include "CeylanSystem.h" // for FileDescriptor 00033 00034 #include <string> 00035 00036 00037 00038 00039 namespace Ceylan 00040 { 00041 00042 00043 namespace Network 00044 { 00045 00046 00047 00058 class CEYLAN_DLL AnonymousStreamSocket: public StreamSocket 00059 { 00060 00061 00062 00063 public: 00064 00065 00066 00072 class AnonymousStreamSocketException: 00073 public StreamSocketException 00074 { 00075 00076 public: 00077 00078 explicit AnonymousStreamSocketException( 00079 const std::string & reason ) ; 00080 00081 virtual ~AnonymousStreamSocketException() throw() ; 00082 00083 } ; 00084 00085 00086 00092 class NonBlockingAcceptException: 00093 public AnonymousStreamSocketException 00094 { 00095 public: 00096 00097 explicit NonBlockingAcceptException( 00098 const std::string & reason ) ; 00099 00100 virtual ~NonBlockingAcceptException() throw() ; 00101 00102 } ; 00103 00104 00105 00106 00137 explicit AnonymousStreamSocket( 00138 System::FileDescriptor listeningFD, 00139 bool blocking = true, 00140 bool sacrificeThroughputToPacketTiming = false ) ; 00141 00142 00143 00145 virtual ~AnonymousStreamSocket() throw() ; 00146 00147 00148 00158 virtual bool isConnected() const ; 00159 00160 00161 00174 virtual const std::string toString( 00175 Ceylan::VerbosityLevels level = Ceylan::high ) const ; 00176 00177 00178 00179 00180 private: 00181 00182 00183 00192 AnonymousStreamSocket( const AnonymousStreamSocket & source ) ; 00193 00194 00203 AnonymousStreamSocket & operator = ( 00204 const AnonymousStreamSocket & source ); 00205 00206 00207 00208 } ; 00209 00210 00211 } 00212 00213 } 00214 00215 00216 00217 #endif // CEYLAN_ANONYMOUS_STREAM_SOCKET_H_ 00218