Panda3D

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 "openssl/ssl.h"
00027 
00028 ////////////////////////////////////////////////////////////////////
00029 //       Class : BioStreamBuf
00030 // Description : The streambuf object that implements
00031 //               IBioStream.
00032 ////////////////////////////////////////////////////////////////////
00033 class EXPCL_PANDAEXPRESS BioStreamBuf : public streambuf {
00034 public:
00035   BioStreamBuf();
00036   virtual ~BioStreamBuf();
00037 
00038   void open(BioPtr *source);
00039   void close();
00040 
00041 protected:
00042   virtual int overflow(int c);
00043   virtual int sync();
00044   virtual int underflow();
00045 
00046 private:
00047   size_t write_chars(const char *start, size_t length);
00048 
00049   PT(BioPtr) _source;
00050   bool _read_open;
00051   bool _write_open;
00052   char *_buffer;
00053 
00054   friend class IBioStream;
00055   friend class OBioStream;
00056   friend class BioStream;
00057 };
00058 
00059 #endif  // HAVE_OPENSSL
00060 
00061 #endif
 All Classes Functions Variables Enumerations