00001 // Filename: identityStream.h 00002 // Created by: drose (09Oct02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef IDENTITYSTREAM_H 00020 #define IDENTITYSTREAM_H 00021 00022 #include "pandabase.h" 00023 00024 // This module is not compiled if OpenSSL is not available. 00025 #ifdef HAVE_SSL 00026 00027 #include "socketStream.h" 00028 #include "identityStreamBuf.h" 00029 00030 class HTTPChannel; 00031 class BioStreamPtr; 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Class : IIdentityStream 00035 // Description : An input stream object that reads data from a source 00036 // istream, but automatically decodes the "identity" 00037 // transfer-coding specified by an HTTP server. 00038 // 00039 // In practice, this just means it reads from the sub 00040 // stream (like a SubStreamBuf) up to but not past the 00041 // specified content-length. (If the content-length was 00042 // unspecified, this class cannot be used.) It also 00043 // updates the HTTPChannel when the stream is 00044 // completely read. 00045 //////////////////////////////////////////////////////////////////// 00046 // No need to export from DLL. 00047 class IIdentityStream : public ISocketStream { 00048 public: 00049 INLINE IIdentityStream(); 00050 INLINE IIdentityStream(BioStreamPtr *source, HTTPChannel *doc, 00051 bool has_content_length, size_t content_length); 00052 00053 INLINE IIdentityStream &open(BioStreamPtr *source, HTTPChannel *doc, 00054 bool has_content_length, size_t content_length); 00055 INLINE IIdentityStream &close(); 00056 00057 virtual bool is_closed(); 00058 00059 private: 00060 IdentityStreamBuf _buf; 00061 }; 00062 00063 #include "identityStream.I" 00064 00065 #endif // HAVE_SSL 00066 00067 #endif 00068 00069