Panda3D
 All Classes Functions Variables Enumerations
identityStream.cxx
00001 // Filename: identityStream.cxx
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 #include "identityStream.h"
00016 
00017 // This module is not compiled if OpenSSL is not available.
00018 #ifdef HAVE_OPENSSL
00019 
00020 ////////////////////////////////////////////////////////////////////
00021 //     Function: IIdentityStream::Destructor
00022 //       Access: Published, Virtual
00023 //  Description: 
00024 ////////////////////////////////////////////////////////////////////
00025 IIdentityStream::
00026 ~IIdentityStream() {
00027   if (_channel != (HTTPChannel *)NULL) {
00028     _channel->body_stream_destructs(this);
00029     _channel = NULL;
00030   }
00031 }
00032 
00033 ////////////////////////////////////////////////////////////////////
00034 //     Function: IIdentityStream::is_closed
00035 //       Access: Public, Virtual
00036 //  Description: Returns true if the last eof condition was triggered
00037 //               because the socket has genuinely closed, or false if
00038 //               we can expect more data to come along shortly.
00039 ////////////////////////////////////////////////////////////////////
00040 bool IIdentityStream::
00041 is_closed() {
00042   if ((_buf._has_content_length && _buf._bytes_remaining == 0) || 
00043       _buf.is_closed()) {
00044     return true;
00045   }
00046   clear();
00047   return false;
00048 }
00049 
00050 ////////////////////////////////////////////////////////////////////
00051 //     Function: IIdentityStream::close
00052 //       Access: Public, Virtual
00053 //  Description: Resets the IdentityStream to empty, but does not actually
00054 //               close the source BIO unless owns_source was true.
00055 ////////////////////////////////////////////////////////////////////
00056 void IIdentityStream::
00057 close() {
00058   _buf.close_read();
00059 }
00060 
00061 ////////////////////////////////////////////////////////////////////
00062 //     Function: IIdentityStream::get_read_state
00063 //       Access: Public, Virtual
00064 //  Description: Returns an enum indicating how we are coming along in
00065 //               reading the document.
00066 ////////////////////////////////////////////////////////////////////
00067 INLINE IIdentityStream::ReadState IIdentityStream::
00068 get_read_state() {
00069   return _buf.get_read_state();
00070 }
00071 
00072 #endif  // HAVE_OPENSSL
 All Classes Functions Variables Enumerations