Panda3D
 All Classes Functions Variables Enumerations
bioStreamBuf.h
00001 // Filename: bioStreamBuf.h
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 #ifndef BIOSTREAMBUF_H
00016 #define BIOSTREAMBUF_H
00017 
00018 #include "pandabase.h"
00019 
00020 // This module is not compiled if OpenSSL is not available.
00021 #ifdef HAVE_OPENSSL
00022 #define OPENSSL_NO_KRB5
00023 
00024 #include "bioPtr.h"
00025 #include "pointerTo.h"
00026 #include "openSSLWrapper.h"  // must be included before any other openssl.
00027 #include "openssl/ssl.h"
00028 
00029 ////////////////////////////////////////////////////////////////////
00030 //       Class : BioStreamBuf
00031 // Description : The streambuf object that implements
00032 //               IBioStream.
00033 ////////////////////////////////////////////////////////////////////
00034 class EXPCL_PANDAEXPRESS BioStreamBuf : public streambuf {
00035 public:
00036   BioStreamBuf();
00037   virtual ~BioStreamBuf();
00038 
00039   void open(BioPtr *source);
00040   void close();
00041 
00042 protected:
00043   virtual int overflow(int c);
00044   virtual int sync();
00045   virtual int underflow();
00046 
00047 private:
00048   size_t write_chars(const char *start, size_t length);
00049 
00050   PT(BioPtr) _source;
00051   bool _read_open;
00052   bool _write_open;
00053   char *_buffer;
00054 
00055   friend class IBioStream;
00056   friend class OBioStream;
00057   friend class BioStream;
00058 };
00059 
00060 #endif  // HAVE_OPENSSL
00061 
00062 #endif
 All Classes Functions Variables Enumerations