Use a variable on the stack to not have a temporary in the call
[ACE_TAO.git] / ACE / protocols / ace / INet / HTTPS_Context.inl
blobce68777488a95a2bae6a3a1ba13df7ec6967f340
1 // -*- C++ -*-
2 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
4 namespace ACE
6   namespace HTTPS
7   {
9     ACE_INLINE
10     Context::operator bool () const
11       {
12         return this->ssl_ctx_ != 0;
13       }
15     ACE_INLINE
16     bool Context::operator ! () const
17       {
18         return this->ssl_ctx_ == 0;
19       }
21     ACE_INLINE
22     ACE_SSL_Context& Context::ssl_context ()
23       {
24         return *this->ssl_ctx_;
25       }
27     ACE_INLINE
28     const ACE_SSL_Context& Context::ssl_context () const
29       {
30         return *this->ssl_ctx_;
31       }
33     ACE_INLINE
34     bool Context::use_default_ca ()
35       {
36         if (::SSL_CTX_set_default_verify_paths(this->ssl_ctx_->context ()) != 1)
37           {
38             ACE_SSL_Context::report_error ();
39             return false;
40           }
41         return true;
42       }
44     ACE_INLINE
45     bool Context::set_key_files (const char* certificate_filename,
46                                  const char* private_key_filename,
47                                  int file_type)
48       {
49         if (this->ssl_ctx_->certificate (certificate_filename, file_type) == 0)
50           {
51             if (this->ssl_ctx_->private_key (private_key_filename, file_type) == 0)
52               {
53                 return true;
54               }
55           }
56         return false;
57       }
59     ACE_INLINE
60     int Context::has_trusted_ca ()
61       {
62         return this->ssl_ctx_->have_trusted_ca ();
63       }
65     ACE_INLINE
66     void Context::set_default_ssl_mode (int ssl_mode)
67       {
68         Context::ssl_mode_ = ssl_mode;
69       }
71     ACE_INLINE
72     void Context::set_default_verify_mode (bool verify_peer)
73       {
74         Context::ssl_verify_peer_ = verify_peer;
75       }
77     ACE_INLINE
78     void Context::set_default_verify_settings (bool strict,
79                                                 bool once,
80                                                 int depth)
81       {
82         Context::ssl_strict_ = strict;
83         Context::ssl_once_ = once;
84         Context::ssl_depth_ = depth;
85       }
88   }
91 ACE_END_VERSIONED_NAMESPACE_DECL