00001 /* 00002 * indchan.h 00003 * 00004 * Indirect I/O channel class. 00005 * 00006 * Portable Windows Library 00007 * 00008 * Copyright (c) 1993-1998 Equivalence Pty. Ltd. 00009 * 00010 * The contents of this file are subject to the Mozilla Public License 00011 * Version 1.0 (the "License"); you may not use this file except in 00012 * compliance with the License. You may obtain a copy of the License at 00013 * http://www.mozilla.org/MPL/ 00014 * 00015 * Software distributed under the License is distributed on an "AS IS" 00016 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00017 * the License for the specific language governing rights and limitations 00018 * under the License. 00019 * 00020 * The Original Code is Portable Windows Library. 00021 * 00022 * The Initial Developer of the Original Code is Equivalence Pty. Ltd. 00023 * 00024 * Portions are Copyright (C) 1993 Free Software Foundation, Inc. 00025 * All Rights Reserved. 00026 * 00027 * Contributor(s): ______________________________________. 00028 * 00029 * $Revision: 24177 $ 00030 * $Author: rjongbloed $ 00031 * $Date: 2010-04-05 06:52:04 -0500 (Mon, 05 Apr 2010) $ 00032 */ 00033 00034 #ifndef PTLIB_INDIRECTCHANNEL_H 00035 #define PTLIB_INDIRECTCHANNEL_H 00036 00037 #ifdef P_USE_PRAGMA 00038 #pragma interface 00039 #endif 00040 00041 #include <ptlib/channel.h> 00042 #include <ptlib/syncthrd.h> 00043 00049 class PIndirectChannel : public PChannel 00050 { 00051 PCLASSINFO(PIndirectChannel, PChannel); 00052 00053 public: 00060 PIndirectChannel(); 00061 00063 ~PIndirectChannel(); 00065 00066 00075 Comparison Compare( 00076 const PObject & obj 00077 ) const; 00079 00080 00090 virtual PString GetName() const; 00091 00098 virtual PBoolean Close(); 00099 00107 virtual PBoolean IsOpen() const; 00108 00124 virtual PBoolean Read( 00125 void * buf, 00126 PINDEX len 00127 ); 00128 00143 virtual PBoolean Write( 00144 const void * buf, 00145 PINDEX len 00146 ); 00147 00156 virtual PBoolean Shutdown( 00157 ShutdownValue option 00158 ); 00159 00167 virtual bool SetLocalEcho( 00168 bool localEcho 00169 ); 00170 00171 00180 virtual PChannel * GetBaseReadChannel() const; 00181 00190 virtual PChannel * GetBaseWriteChannel() const; 00191 00197 virtual PString GetErrorText( 00198 ErrorGroup group = NumErrorGroups 00199 ) const; 00201 00211 PBoolean Open( 00212 PChannel & channel 00213 ); 00214 00225 PBoolean Open( 00226 PChannel * channel, 00227 PBoolean autoDelete = true 00228 ); 00229 00241 PBoolean Open( 00242 PChannel * readChannel, 00243 PChannel * writeChannel, 00244 PBoolean autoDeleteRead = true, 00245 PBoolean autoDeleteWrite = true 00246 ); 00247 00253 PChannel * GetReadChannel() const; 00254 00260 PBoolean SetReadChannel( 00261 PChannel * channel, 00262 PBoolean autoDelete = true 00263 ); 00264 00270 PChannel * GetWriteChannel() const; 00271 00277 PBoolean SetWriteChannel( 00278 PChannel * channel, 00279 PBoolean autoDelete = true 00280 ); 00282 00283 00284 protected: 00294 virtual PBoolean OnOpen(); 00295 00296 00297 // Member variables 00299 PChannel * readChannel; 00300 00302 PBoolean readAutoDelete; 00303 00305 PChannel * writeChannel; 00306 00308 PBoolean writeAutoDelete; 00309 00311 PReadWriteMutex channelPointerMutex; 00312 }; 00313 00314 00315 #endif // PTLIB_INDIRECTCHANNEL_H 00316 00317 00318 // End Of File ///////////////////////////////////////////////////////////////