Panda3D
 All Classes Functions Variables Enumerations
bioPtr.h
00001 // Filename: bioPtr.h
00002 // Created by:  drose (15Oct02)
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 BIOPTR_H
00016 #define BIOPTR_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 "referenceCount.h"
00025 #include "openSSLWrapper.h"  // must be included before any other openssl.
00026 #include "openssl/ssl.h"
00027 
00028 class URLSpec;
00029 
00030 ////////////////////////////////////////////////////////////////////
00031 //       Class : BioPtr
00032 // Description : A wrapper around an OpenSSL BIO object to make a
00033 //               reference-counting pointer to it.  It appears that
00034 //               the OpenSSL library already uses reference counts on
00035 //               these things internally, but the interface doesn't
00036 //               appear to be public; so we might as well wrap the
00037 //               whole thing at the high level.
00038 ////////////////////////////////////////////////////////////////////
00039 class EXPCL_PANDAEXPRESS BioPtr : public ReferenceCount {
00040 public:
00041   INLINE BioPtr(BIO *bio);
00042   BioPtr(const URLSpec &url);
00043   virtual ~BioPtr();
00044 
00045   INLINE BIO &operator *() const;
00046   INLINE BIO *operator -> () const;
00047   INLINE operator BIO * () const;
00048 
00049   INLINE void set_bio(BIO *bio);
00050   INLINE BIO *get_bio() const;
00051 
00052   INLINE const string &get_server_name() const;
00053   INLINE int get_port() const;
00054   
00055 private:
00056   BIO *_bio;
00057   string _server_name;
00058   int _port;
00059 };
00060 
00061 #include "bioPtr.I"
00062 
00063 #endif  // HAVE_OPENSSL
00064 
00065 
00066 #endif
00067 
00068 
 All Classes Functions Variables Enumerations