Realistic 3D camera system
3D camera system components
basic_context.hpp
Go to the documentation of this file.
1 //
2 // ssl/old/basic_context.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
6 // Copyright (c) 2005-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7 //
8 // Distributed under the Boost Software License, Version 1.0. (See accompanying
9 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
10 //
11 
12 #ifndef ASIO_SSL_OLD_BASIC_CONTEXT_HPP
13 #define ASIO_SSL_OLD_BASIC_CONTEXT_HPP
14 
15 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 # pragma once
17 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 
19 #include "asio/detail/config.hpp"
20 #include <string>
21 #include <boost/noncopyable.hpp>
23 #include "asio/error.hpp"
24 #include "asio/io_service.hpp"
26 
28 
29 namespace asio {
30 namespace ssl {
31 namespace old {
32 
34 template <typename Service>
36  : public context_base,
37  private boost::noncopyable
38 {
39 public:
41  typedef Service service_type;
42 
44  typedef typename service_type::impl_type impl_type;
45 
48  : service_(asio::use_service<Service>(io_service)),
49  impl_(service_.null())
50  {
51  service_.create(impl_, m);
52  }
53 
56  {
57  service_.destroy(impl_);
58  }
59 
61 
66  impl_type impl()
67  {
68  return impl_;
69  }
70 
72 
82  {
84  service_.set_options(impl_, o, ec);
86  }
87 
89 
99  asio::error_code& ec)
100  {
101  return service_.set_options(impl_, o, ec);
102  }
103 
105 
115  {
116  asio::error_code ec;
117  service_.set_verify_mode(impl_, v, ec);
119  }
120 
122 
132  asio::error_code& ec)
133  {
134  return service_.set_verify_mode(impl_, v, ec);
135  }
136 
138 
147  void load_verify_file(const std::string& filename)
148  {
149  asio::error_code ec;
150  service_.load_verify_file(impl_, filename, ec);
152  }
153 
155 
164  asio::error_code load_verify_file(const std::string& filename,
165  asio::error_code& ec)
166  {
167  return service_.load_verify_file(impl_, filename, ec);
168  }
169 
172 
182  void add_verify_path(const std::string& path)
183  {
184  asio::error_code ec;
185  service_.add_verify_path(impl_, path, ec);
187  }
188 
191 
201  asio::error_code add_verify_path(const std::string& path,
202  asio::error_code& ec)
203  {
204  return service_.add_verify_path(impl_, path, ec);
205  }
206 
208 
217  void use_certificate_file(const std::string& filename, file_format format)
218  {
219  asio::error_code ec;
220  service_.use_certificate_file(impl_, filename, format, ec);
222  }
223 
225 
234  asio::error_code use_certificate_file(const std::string& filename,
235  file_format format, asio::error_code& ec)
236  {
237  return service_.use_certificate_file(impl_, filename, format, ec);
238  }
239 
241 
250  void use_certificate_chain_file(const std::string& filename)
251  {
252  asio::error_code ec;
253  service_.use_certificate_chain_file(impl_, filename, ec);
255  }
256 
258 
268  const std::string& filename, asio::error_code& ec)
269  {
270  return service_.use_certificate_chain_file(impl_, filename, ec);
271  }
272 
274 
283  void use_private_key_file(const std::string& filename, file_format format)
284  {
285  asio::error_code ec;
286  service_.use_private_key_file(impl_, filename, format, ec);
288  }
289 
291 
300  asio::error_code use_private_key_file(const std::string& filename,
301  file_format format, asio::error_code& ec)
302  {
303  return service_.use_private_key_file(impl_, filename, format, ec);
304  }
305 
307 
317  void use_rsa_private_key_file(const std::string& filename, file_format format)
318  {
319  asio::error_code ec;
320  service_.use_rsa_private_key_file(impl_, filename, format, ec);
322  }
323 
325 
336  const std::string& filename, file_format format,
337  asio::error_code& ec)
338  {
339  return service_.use_rsa_private_key_file(impl_, filename, format, ec);
340  }
341 
343 
352  void use_tmp_dh_file(const std::string& filename)
353  {
354  asio::error_code ec;
355  service_.use_tmp_dh_file(impl_, filename, ec);
357  }
358 
360 
369  asio::error_code use_tmp_dh_file(const std::string& filename,
370  asio::error_code& ec)
371  {
372  return service_.use_tmp_dh_file(impl_, filename, ec);
373  }
374 
376 
390  template <typename PasswordCallback>
391  void set_password_callback(PasswordCallback callback)
392  {
393  asio::error_code ec;
394  service_.set_password_callback(impl_, callback, ec);
396  }
397 
399 
413  template <typename PasswordCallback>
414  asio::error_code set_password_callback(PasswordCallback callback,
415  asio::error_code& ec)
416  {
417  return service_.set_password_callback(impl_, callback, ec);
418  }
419 
420 private:
422  service_type& service_;
423 
425  impl_type impl_;
426 };
427 
428 } // namespace old
429 } // namespace ssl
430 } // namespace asio
431 
433 
434 #endif // ASIO_SSL_OLD_BASIC_CONTEXT_HPP
void throw_error(const asio::error_code &err)
Definition: throw_error.hpp:31
void load_verify_file(const std::string &filename)
Load a certification authority file for performing verification.
void add_verify_path(const std::string &path)
Provides core I/O functionality.
Definition: io_service.hpp:184
asio::error_code use_private_key_file(const std::string &filename, file_format format, asio::error_code &ec)
Use a private key from a file.
asio::error_code set_verify_mode(verify_mode v, asio::error_code &ec)
Set the peer verification mode.
service_type::impl_type impl_type
The native implementation type of the SSL context.
asio::error_code use_certificate_chain_file(const std::string &filename, asio::error_code &ec)
Use a certificate chain from a file.
asio::error_code set_options(options o, asio::error_code &ec)
Set options on the context.
void use_rsa_private_key_file(const std::string &filename, file_format format)
Use an RSA private key from a file.
asio::error_code use_certificate_file(const std::string &filename, file_format format, asio::error_code &ec)
Use a certificate from a file.
asio::error_code use_tmp_dh_file(const std::string &filename, asio::error_code &ec)
Use the specified file to obtain the temporary Diffie-Hellman parameters.
Service & use_service(io_service &ios)
Definition: io_service.hpp:26
asio::error_code set_password_callback(PasswordCallback callback, asio::error_code &ec)
Set the password callback.
Service service_type
The type of the service that will be used to provide context operations.
void use_certificate_file(const std::string &filename, file_format format)
Use a certificate from a file.
void set_options(options o)
Set options on the context.
void set_password_callback(PasswordCallback callback)
Set the password callback.
method
Different methods supported by a context.
asio::error_code use_rsa_private_key_file(const std::string &filename, file_format format, asio::error_code &ec)
Use an RSA private key from a file.
basic_context(asio::io_service &io_service, method m)
Constructor.
asio::error_code add_verify_path(const std::string &path, asio::error_code &ec)
Class to represent an error code value.
Definition: error_code.hpp:80
long options
Bitmask type for SSL options.
void use_private_key_file(const std::string &filename, file_format format)
Use a private key from a file.
void use_certificate_chain_file(const std::string &filename)
Use a certificate chain from a file.
asio::error_code load_verify_file(const std::string &filename, asio::error_code &ec)
Load a certification authority file for performing verification.
void use_tmp_dh_file(const std::string &filename)
Use the specified file to obtain the temporary Diffie-Hellman parameters.
impl_type impl()
Get the underlying implementation in the native type.
void set_verify_mode(verify_mode v)
Set the peer verification mode.
file_format
File format types.