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_PROTOCOL_AWARE_STREAM_SOCKET_H_ 00028 #define CEYLAN_ANONYMOUS_PROTOCOL_AWARE_STREAM_SOCKET_H_ 00029 00030 00031 #include "CeylanAnonymousStreamSocket.h" // for inheritance 00032 #include "CeylanSystem.h" // for FileDescriptor 00033 00034 #include <string> 00035 00036 00037 00038 namespace Ceylan 00039 { 00040 00041 00042 namespace Middleware 00043 { 00044 00045 00046 /* 00047 * An anonymous protocol-aware stream sockets triggers a protocol 00048 * server. 00049 * 00050 */ 00051 class ProtocolServer ; 00052 00053 } 00054 00055 00056 00057 namespace Network 00058 { 00059 00060 00061 00076 class CEYLAN_DLL AnonymousProtocolAwareStreamSocket: 00077 public AnonymousStreamSocket 00078 { 00079 00080 00081 00082 public: 00083 00084 00085 00108 AnonymousProtocolAwareStreamSocket( 00109 System::FileDescriptor listeningFD, 00110 Middleware::ProtocolServer & protocolServerToTrigger ) ; 00111 00112 00113 00133 explicit AnonymousProtocolAwareStreamSocket( 00134 System::FileDescriptor listeningFD ) ; 00135 00136 00137 00139 virtual ~AnonymousProtocolAwareStreamSocket() throw() ; 00140 00141 00142 00151 virtual bool hasProtocolServer() const ; 00152 00153 00154 00163 virtual Middleware::ProtocolServer & getProtocolServer() ; 00164 00165 00166 00177 virtual void setProtocolServer( 00178 Middleware::ProtocolServer & newProtocolServer ) ; 00179 00180 00181 00194 virtual const std::string toString( 00195 Ceylan::VerbosityLevels level = Ceylan::high ) const ; 00196 00197 00198 00199 00200 protected: 00201 00202 00203 00210 Middleware::ProtocolServer * _protocolServer ; 00211 00212 00213 00214 00215 private: 00216 00217 00218 00227 AnonymousProtocolAwareStreamSocket( 00228 const AnonymousProtocolAwareStreamSocket & source ) ; 00229 00230 00231 00240 AnonymousProtocolAwareStreamSocket & operator = ( 00241 const AnonymousProtocolAwareStreamSocket & source ) ; 00242 00243 00244 } ; 00245 00246 00247 } 00248 00249 } 00250 00251 00252 00253 #endif // CEYLAN_ANONYMOUS_PROTOCOL_AWARE_STREAM_SOCKET_H_ 00254