Realistic 3D camera system
3D camera system components
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
asio-1.10.6
include
asio
ssl
detail
openssl_init.hpp
Go to the documentation of this file.
1
//
2
// ssl/detail/openssl_init.hpp
3
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
//
5
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6
//
7
// Distributed under the Boost Software License, Version 1.0. (See accompanying
8
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9
//
10
11
#ifndef ASIO_SSL_DETAIL_OPENSSL_INIT_HPP
12
#define ASIO_SSL_DETAIL_OPENSSL_INIT_HPP
13
14
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
15
# pragma once
16
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17
18
#include "
asio/detail/config.hpp
"
19
#include <cstring>
20
#include "
asio/detail/noncopyable.hpp
"
21
#include "
asio/detail/shared_ptr.hpp
"
22
#include "
asio/ssl/detail/openssl_types.hpp
"
23
24
#include "
asio/detail/push_options.hpp
"
25
26
namespace
asio
{
27
namespace
ssl {
28
namespace
detail {
29
30
class
openssl_init_base
31
:
private
noncopyable
32
{
33
protected
:
34
// Class that performs the actual initialisation.
35
class
do_init
;
36
37
// Helper function to manage a do_init singleton. The static instance of the
38
// openssl_init object ensures that this function is always called before
39
// main, and therefore before any other threads can get started. The do_init
40
// instance must be static in this function to ensure that it gets
41
// initialised before any other global objects try to use it.
42
ASIO_DECL
static
asio::detail::shared_ptr<do_init>
instance
();
43
44
#if !defined(SSL_OP_NO_COMPRESSION) \
45
&& (OPENSSL_VERSION_NUMBER >= 0x00908000L)
46
// Get an empty stack of compression methods, to be used when disabling
47
// compression.
48
ASIO_DECL
static
STACK_OF(SSL_COMP)* get_null_compression_methods();
49
#endif // !defined(SSL_OP_NO_COMPRESSION)
50
// && (OPENSSL_VERSION_NUMBER >= 0x00908000L)
51
};
52
53
template
<
bool
Do_Init = true>
54
class
openssl_init
:
private
openssl_init_base
55
{
56
public
:
57
// Constructor.
58
openssl_init
()
59
: ref_(
instance
())
60
{
61
using namespace
std
;
// For memmove.
62
63
// Ensure openssl_init::instance_ is linked in.
64
openssl_init
* tmp = &instance_;
65
memmove(&tmp, &tmp,
sizeof
(
openssl_init
*));
66
}
67
68
// Destructor.
69
~openssl_init
()
70
{
71
}
72
73
#if !defined(SSL_OP_NO_COMPRESSION) \
74
&& (OPENSSL_VERSION_NUMBER >= 0x00908000L)
75
using
openssl_init_base::get_null_compression_methods;
76
#endif // !defined(SSL_OP_NO_COMPRESSION)
77
// && (OPENSSL_VERSION_NUMBER >= 0x00908000L)
78
79
private
:
80
// Instance to force initialisation of openssl at global scope.
81
static
openssl_init
instance_;
82
83
// Reference to singleton do_init object to ensure that openssl does not get
84
// cleaned up until the last user has finished with it.
85
asio::detail::shared_ptr<do_init> ref_;
86
};
87
88
template
<
bool
Do_Init>
89
openssl_init<Do_Init>
openssl_init<Do_Init>::instance_
;
90
91
}
// namespace detail
92
}
// namespace ssl
93
}
// namespace asio
94
95
#include "
asio/detail/pop_options.hpp
"
96
97
#if defined(ASIO_HEADER_ONLY)
98
# include "
asio/ssl/detail/impl/openssl_init.ipp
"
99
#endif // defined(ASIO_HEADER_ONLY)
100
101
#endif // ASIO_SSL_DETAIL_OPENSSL_INIT_HPP
asio::ssl::detail::openssl_init_base
Definition:
openssl_init.hpp:30
asio::ssl::detail::openssl_init_base::instance
static ASIO_DECL asio::detail::shared_ptr< do_init > instance()
Definition:
openssl_init.ipp:128
std
STL namespace.
config.hpp
asio::detail::noncopyable
Definition:
noncopyable.hpp:25
push_options.hpp
openssl_types.hpp
shared_ptr.hpp
asio::ssl::detail::openssl_init_base::do_init
Definition:
openssl_init.ipp:33
pop_options.hpp
noncopyable.hpp
asio::ssl::detail::openssl_init::openssl_init
openssl_init()
Definition:
openssl_init.hpp:58
asio::ssl::detail::openssl_init
Definition:
openssl_init.hpp:54
openssl_init.ipp
ASIO_DECL
#define ASIO_DECL
Definition:
config.hpp:43
asio::ssl::detail::openssl_init::~openssl_init
~openssl_init()
Definition:
openssl_init.hpp:69
asio
Definition:
async_result.hpp:23
Generated by
1.8.11