00001 // Filename: bioPtr.h 00002 // Created by: drose (15Oct02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef BIOPTR_H 00020 #define BIOPTR_H 00021 00022 #include "pandabase.h" 00023 00024 // This module is not compiled if OpenSSL is not available. 00025 #ifdef HAVE_SSL 00026 00027 #include "referenceCount.h" 00028 #include <openssl/ssl.h> 00029 00030 class URLSpec; 00031 00032 //////////////////////////////////////////////////////////////////// 00033 // Class : BioPtr 00034 // Description : A wrapper around an OpenSSL BIO object to make a 00035 // reference-counting pointer to it. It appears that 00036 // the OpenSSL library already uses reference counts on 00037 // these things internally, but the interface doesn't 00038 // appear to be public; so we might as well wrap the 00039 // whole thing at the high level. 00040 //////////////////////////////////////////////////////////////////// 00041 class EXPCL_PANDAEXPRESS BioPtr : public ReferenceCount { 00042 public: 00043 INLINE BioPtr(BIO *bio); 00044 BioPtr(const URLSpec &url); 00045 virtual ~BioPtr(); 00046 00047 INLINE BIO &operator *() const; 00048 INLINE BIO *operator -> () const; 00049 INLINE operator BIO * () const; 00050 00051 INLINE void set_bio(BIO *bio); 00052 INLINE BIO *get_bio() const; 00053 00054 INLINE const string &get_server_name() const; 00055 INLINE int get_port() const; 00056 00057 private: 00058 BIO *_bio; 00059 string _server_name; 00060 int _port; 00061 }; 00062 00063 #include "bioPtr.I" 00064 00065 #endif // HAVE_SSL 00066 00067 00068 #endif 00069 00070