Panda3D
 All Classes Functions Variables Enumerations
bioPtr.h
1 // Filename: bioPtr.h
2 // Created by: drose (15Oct02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef BIOPTR_H
16 #define BIOPTR_H
17 
18 #include "pandabase.h"
19 
20 // This module is not compiled if OpenSSL is not available.
21 #ifdef HAVE_OPENSSL
22 #define OPENSSL_NO_KRB5
23 
24 #include "referenceCount.h"
25 #include "openSSLWrapper.h" // must be included before any other openssl.
26 #include "openssl/ssl.h"
27 
28 class URLSpec;
29 
30 ////////////////////////////////////////////////////////////////////
31 // Class : BioPtr
32 // Description : A wrapper around an OpenSSL BIO object to make a
33 // reference-counting pointer to it. It appears that
34 // the OpenSSL library already uses reference counts on
35 // these things internally, but the interface doesn't
36 // appear to be public; so we might as well wrap the
37 // whole thing at the high level.
38 ////////////////////////////////////////////////////////////////////
39 class EXPCL_PANDAEXPRESS BioPtr : public ReferenceCount {
40 public:
41  INLINE BioPtr(BIO *bio);
42  BioPtr(const URLSpec &url);
43  virtual ~BioPtr();
44 
45  INLINE BIO &operator *() const;
46  INLINE BIO *operator -> () const;
47  INLINE operator BIO * () const;
48 
49  INLINE void set_bio(BIO *bio);
50  INLINE BIO *get_bio() const;
51 
52  INLINE const string &get_server_name() const;
53  INLINE int get_port() const;
54 
55 private:
56  BIO *_bio;
57  string _server_name;
58  int _port;
59 };
60 
61 #include "bioPtr.I"
62 
63 #endif // HAVE_OPENSSL
64 
65 
66 #endif
67 
68 
A container for a URL, e.g.
Definition: urlSpec.h:29
A base class for all things that want to be reference-counted.