Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

sslbuffer.h

Go to the documentation of this file.
00001 # ifndef SSLBUFFER_HPP
00002 # define SSLBUFFER_HPP
00003 
00004 #include        <dvutil/fdstreambuf.h>
00005 #include        <dvssl/sslcontext.h>
00006 
00007 /*! \file
00008     This file defined Dv::Ssl::SslBuffer, which is derived from
00009     Dv::Ssl::fdstreambuf.
00010 */
00011 namespace Dv {
00012 namespace Ssl {
00013 
00014 //! A streambuf class for use with Dv::Ssl::SslSocket iostream objects.
00015 class SslBuffer: public Dv::Util::fdstreambuf {
00016 public:
00017   //! Constructor. Msecs is max timeout value in millisecs.
00018   SslBuffer(SslContext& context,int fd,size_t intbufsize=1024,
00019             size_t outbufsize=1024, int msecs = 0);
00020   //! Destructor.
00021   ~SslBuffer();
00022 
00023   //! Return pointer to SSL object. 
00024   /*! Return type is declared as void* to avoid inclusion of openssl 
00025       header files.
00026   */
00027   void*         ssl() const     { return ssl_; }
00028   //! Return string representation of cypher.
00029   const char*   cipher() const;
00030 protected:
00031   //! Raw read implementation, see Dv::Util::fdstreambuf.
00032   virtual int   rread(char* buf, size_t len);
00033   //! Raw write implementation, see Dv::Util::fdstreambuf.
00034   virtual int   rwrite(char* buf, size_t len);
00035 private:
00036   //! Opaque, really a SSL* pointer.
00037   void          *ssl_; // opaque, really a SSL*
00038 };
00039 
00040 }}
00041 #endif

dvssl-0.5.4 [19 September, 2003]