Panda3D
bioStream.cxx
1 // Filename: bioStream.cxx
2 // Created by: drose (25Sep02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "bioStream.h"
16 
17 
18 #ifdef HAVE_OPENSSL
19 
20 ////////////////////////////////////////////////////////////////////
21 // Function: IBioStream::is_closed
22 // Access: Public, Virtual
23 // Description: Returns true if the last eof condition was triggered
24 // because the socket has genuinely closed, or false if
25 // we can expect more data to come along shortly.
26 ////////////////////////////////////////////////////////////////////
27 bool IBioStream::
28 is_closed() {
29  if (!_buf._read_open) {
30  return true;
31  }
32  clear();
33  return false;
34 }
35 
36 ////////////////////////////////////////////////////////////////////
37 // Function: IBioStream::close
38 // Access: Public, Virtual
39 // Description: Resets the BioStream to empty, but does not actually
40 // close the source BIO unless owns_source was true.
41 ////////////////////////////////////////////////////////////////////
42 void IBioStream::
43 close() {
44  _buf.close();
45 }
46 
47 ////////////////////////////////////////////////////////////////////
48 // Function: OBioStream::is_closed
49 // Access: Public, Virtual
50 // Description: Returns true if the last write fail condition was
51 // triggered because the socket has genuinely closed, or
52 // false if we can expect to send more data along
53 // shortly.
54 ////////////////////////////////////////////////////////////////////
55 bool OBioStream::
56 is_closed() {
57  if (!_buf._write_open) {
58  return true;
59  }
60  clear();
61  return false;
62 }
63 
64 ////////////////////////////////////////////////////////////////////
65 // Function: OBioStream::close
66 // Access: Public, Virtual
67 // Description: Resets the BioStream to empty, but does not actually
68 // close the source BIO unless owns_source was true.
69 ////////////////////////////////////////////////////////////////////
70 void OBioStream::
71 close() {
72  _buf.close();
73 }
74 
75 ////////////////////////////////////////////////////////////////////
76 // Function: BioStream::is_closed
77 // Access: Public, Virtual
78 // Description: Returns true if the last eof or failure condition was
79 // triggered because the socket has genuinely closed, or
80 // false if we can expect to read or send more data
81 // shortly.
82 ////////////////////////////////////////////////////////////////////
83 bool BioStream::
84 is_closed() {
85  if (!_buf._read_open) {
86  return true;
87  }
88  clear();
89  return false;
90 }
91 
92 ////////////////////////////////////////////////////////////////////
93 // Function: BioStream::close
94 // Access: Public, Virtual
95 // Description: Resets the BioStream to empty, but does not actually
96 // close the source BIO unless owns_source was true.
97 ////////////////////////////////////////////////////////////////////
98 void BioStream::
99 close() {
100  _buf.close();
101 }
102 
103 ////////////////////////////////////////////////////////////////////
104 // Function: IBioStream::get_read_state
105 // Access: Public, Virtual
106 // Description: Returns an enum indicating how we are coming along in
107 // reading the document.
108 ////////////////////////////////////////////////////////////////////
109 IBioStream::ReadState IBioStream::
110 get_read_state() {
111  // For an IBioStream, this method is meaningless, and always returns
112  // RS_error.
113 
114  // This method is intended for those specialized streams that scan
115  // through an HTTP document.
116  return RS_error;
117 }
118 
119 #endif // HAVE_OPENSSL