Panda3D
identityStream.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file identityStream.h
10  * @author drose
11  * @date 2002-10-09
12  */
13 
14 #ifndef IDENTITYSTREAM_H
15 #define IDENTITYSTREAM_H
16 
17 #include "pandabase.h"
18 
19 // This module is not compiled if OpenSSL is not available.
20 #ifdef HAVE_OPENSSL
21 
22 #include "socketStream.h"
23 #include "identityStreamBuf.h"
24 
25 class HTTPChannel;
26 class BioStreamPtr;
27 
28 /**
29  * An input stream object that reads data from a source istream, but
30  * automatically decodes the "identity" transfer-coding specified by an HTTP
31  * server.
32  *
33  * In practice, this just means it reads from the sub stream (like a
34  * SubStreamBuf) up to but not past the specified content-length. (If the
35  * content-length was unspecified, this class cannot be used.) It also
36  * updates the HTTPChannel when the stream is completely read. No need to
37  * export from DLL.
38  */
39 class IIdentityStream : public ISocketStream {
40 public:
41  INLINE IIdentityStream();
42  INLINE IIdentityStream(BioStreamPtr *source, HTTPChannel *doc,
43  bool has_content_length, size_t content_length);
44 
45  INLINE IIdentityStream &open(BioStreamPtr *source, HTTPChannel *doc,
46  bool has_content_length, size_t content_length);
47  virtual ~IIdentityStream();
48 
49  virtual bool is_closed();
50  virtual void close();
51  virtual ReadState get_read_state();
52 
53 private:
54  IdentityStreamBuf _buf;
55 };
56 
57 #include "identityStream.I"
58 
59 #endif // HAVE_OPENSSL
60 
61 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.