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