Panda3D

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