00001 // Filename: bioStream.cxx 00002 // Created by: drose (25Sep02) 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 #include "bioStream.h" 00016 00017 00018 #ifdef HAVE_OPENSSL 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: IBioStream::is_closed 00022 // Access: Public, Virtual 00023 // Description: Returns true if the last eof condition was triggered 00024 // because the socket has genuinely closed, or false if 00025 // we can expect more data to come along shortly. 00026 //////////////////////////////////////////////////////////////////// 00027 bool IBioStream:: 00028 is_closed() { 00029 if (!_buf._read_open) { 00030 return true; 00031 } 00032 clear(); 00033 return false; 00034 } 00035 00036 //////////////////////////////////////////////////////////////////// 00037 // Function: IBioStream::close 00038 // Access: Public, Virtual 00039 // Description: Resets the BioStream to empty, but does not actually 00040 // close the source BIO unless owns_source was true. 00041 //////////////////////////////////////////////////////////////////// 00042 void IBioStream:: 00043 close() { 00044 _buf.close(); 00045 } 00046 00047 //////////////////////////////////////////////////////////////////// 00048 // Function: OBioStream::is_closed 00049 // Access: Public, Virtual 00050 // Description: Returns true if the last write fail condition was 00051 // triggered because the socket has genuinely closed, or 00052 // false if we can expect to send more data along 00053 // shortly. 00054 //////////////////////////////////////////////////////////////////// 00055 bool OBioStream:: 00056 is_closed() { 00057 if (!_buf._write_open) { 00058 return true; 00059 } 00060 clear(); 00061 return false; 00062 } 00063 00064 //////////////////////////////////////////////////////////////////// 00065 // Function: OBioStream::close 00066 // Access: Public, Virtual 00067 // Description: Resets the BioStream to empty, but does not actually 00068 // close the source BIO unless owns_source was true. 00069 //////////////////////////////////////////////////////////////////// 00070 void OBioStream:: 00071 close() { 00072 _buf.close(); 00073 } 00074 00075 //////////////////////////////////////////////////////////////////// 00076 // Function: BioStream::is_closed 00077 // Access: Public, Virtual 00078 // Description: Returns true if the last eof or failure condition was 00079 // triggered because the socket has genuinely closed, or 00080 // false if we can expect to read or send more data 00081 // shortly. 00082 //////////////////////////////////////////////////////////////////// 00083 bool BioStream:: 00084 is_closed() { 00085 if (!_buf._read_open) { 00086 return true; 00087 } 00088 clear(); 00089 return false; 00090 } 00091 00092 //////////////////////////////////////////////////////////////////// 00093 // Function: BioStream::close 00094 // Access: Public, Virtual 00095 // Description: Resets the BioStream to empty, but does not actually 00096 // close the source BIO unless owns_source was true. 00097 //////////////////////////////////////////////////////////////////// 00098 void BioStream:: 00099 close() { 00100 _buf.close(); 00101 } 00102 00103 //////////////////////////////////////////////////////////////////// 00104 // Function: IBioStream::get_read_state 00105 // Access: Public, Virtual 00106 // Description: Returns an enum indicating how we are coming along in 00107 // reading the document. 00108 //////////////////////////////////////////////////////////////////// 00109 IBioStream::ReadState IBioStream:: 00110 get_read_state() { 00111 // For an IBioStream, this method is meaningless, and always returns 00112 // RS_error. 00113 00114 // This method is intended for those specialized streams that scan 00115 // through an HTTP document. 00116 return RS_error; 00117 } 00118 00119 #endif // HAVE_OPENSSL