Realistic 3D camera system
3D camera system components
stream_service.hpp
Go to the documentation of this file.
1 //
2 // ssl/old/stream_service.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_STREAM_SERVICE_HPP
13 #define ASIO_SSL_OLD_STREAM_SERVICE_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 <cstddef>
21 #include <boost/noncopyable.hpp>
22 #include "asio/io_service.hpp"
25 #include "asio/ssl/stream_base.hpp"
26 
28 
29 namespace asio {
30 namespace ssl {
31 namespace old {
32 
35 #if defined(GENERATING_DOCUMENTATION)
37 #else
38  : public asio::detail::service_base<stream_service>
39 #endif
40 {
41 private:
42  // The type of the platform-specific implementation.
44 
45 public:
46 #if defined(GENERATING_DOCUMENTATION)
47  static asio::io_service::id id;
49 #endif
50 
52 #if defined(GENERATING_DOCUMENTATION)
53  typedef implementation_defined impl_type;
54 #else
56 #endif
57 
60  : asio::detail::service_base<stream_service>(io_service),
61  service_impl_(asio::use_service<service_impl_type>(io_service))
62  {
63  }
64 
66  impl_type null() const
67  {
68  return service_impl_.null();
69  }
70 
72  template <typename Stream, typename Context_Service>
73  void create(impl_type& impl, Stream& next_layer,
75  {
76  service_impl_.create(impl, next_layer, context);
77  }
78 
80  template <typename Stream>
81  void destroy(impl_type& impl, Stream& next_layer)
82  {
83  service_impl_.destroy(impl, next_layer);
84  }
85 
87  template <typename Stream>
88  asio::error_code handshake(impl_type& impl, Stream& next_layer,
90  {
91  return service_impl_.handshake(impl, next_layer, type, ec);
92  }
93 
95  template <typename Stream, typename HandshakeHandler>
96  void async_handshake(impl_type& impl, Stream& next_layer,
97  stream_base::handshake_type type, HandshakeHandler handler)
98  {
99  service_impl_.async_handshake(impl, next_layer, type, handler);
100  }
101 
103  template <typename Stream>
104  asio::error_code shutdown(impl_type& impl, Stream& next_layer,
105  asio::error_code& ec)
106  {
107  return service_impl_.shutdown(impl, next_layer, ec);
108  }
109 
111  template <typename Stream, typename ShutdownHandler>
112  void async_shutdown(impl_type& impl, Stream& next_layer,
113  ShutdownHandler handler)
114  {
115  service_impl_.async_shutdown(impl, next_layer, handler);
116  }
117 
119  template <typename Stream, typename ConstBufferSequence>
120  std::size_t write_some(impl_type& impl, Stream& next_layer,
121  const ConstBufferSequence& buffers, asio::error_code& ec)
122  {
123  return service_impl_.write_some(impl, next_layer, buffers, ec);
124  }
125 
127  template <typename Stream, typename ConstBufferSequence,
128  typename WriteHandler>
129  void async_write_some(impl_type& impl, Stream& next_layer,
130  const ConstBufferSequence& buffers, WriteHandler handler)
131  {
132  service_impl_.async_write_some(impl, next_layer, buffers, handler);
133  }
134 
136  template <typename Stream, typename MutableBufferSequence>
137  std::size_t read_some(impl_type& impl, Stream& next_layer,
138  const MutableBufferSequence& buffers, asio::error_code& ec)
139  {
140  return service_impl_.read_some(impl, next_layer, buffers, ec);
141  }
142 
144  template <typename Stream, typename MutableBufferSequence,
145  typename ReadHandler>
146  void async_read_some(impl_type& impl, Stream& next_layer,
147  const MutableBufferSequence& buffers, ReadHandler handler)
148  {
149  service_impl_.async_read_some(impl, next_layer, buffers, handler);
150  }
151 
153  template <typename Stream, typename MutableBufferSequence>
154  std::size_t peek(impl_type& impl, Stream& next_layer,
155  const MutableBufferSequence& buffers, asio::error_code& ec)
156  {
157  return service_impl_.peek(impl, next_layer, buffers, ec);
158  }
159 
161  template <typename Stream>
162  std::size_t in_avail(impl_type& impl, Stream& next_layer,
163  asio::error_code& ec)
164  {
165  return service_impl_.in_avail(impl, next_layer, ec);
166  }
167 
168 private:
169  // Destroy all user-defined handler objects owned by the service.
170  void shutdown_service()
171  {
172  }
173 
174  // The service that provides the platform-specific implementation.
175  service_impl_type& service_impl_;
176 };
177 
178 } // namespace old
179 } // namespace ssl
180 } // namespace asio
181 
183 
184 #endif // ASIO_SSL_OLD_STREAM_SERVICE_HPP
impl_type null() const
Return a null stream implementation.
asio::error_code handshake(impl_type &impl, Stream &next_layer, stream_base::handshake_type type, asio::error_code &ec)
Class used to uniquely identify a service.
Definition: io_service.hpp:665
Provides core I/O functionality.
Definition: io_service.hpp:184
void async_shutdown(impl_type &impl, Stream &next_layer, Handler handler)
Service & use_service(io_service &ios)
Definition: io_service.hpp:26
void async_shutdown(impl_type &impl, Stream &next_layer, ShutdownHandler handler)
Asynchronously shut down SSL on the stream.
std::size_t in_avail(impl_type &impl, Stream &next_layer, asio::error_code &ec)
Determine the amount of data that may be read without blocking.
asio::error_code handshake(impl_type &impl, Stream &next_layer, stream_base::handshake_type type, asio::error_code &ec)
Perform SSL handshaking.
asio::error_code shutdown(impl_type &impl, Stream &next_layer, asio::error_code &ec)
Shut down SSL on the stream.
handshake_type
Different handshake types.
Definition: stream_base.hpp:31
void async_handshake(impl_type &impl, Stream &next_layer, stream_base::handshake_type type, HandshakeHandler handler)
Start an asynchronous SSL handshake.
const MutableBufferSequence & buffers
Definition: read.hpp:521
std::size_t peek(impl_type &, Stream &, const Mutable_Buffers &, asio::error_code &ec)
void async_write_some(impl_type &impl, Stream &next_layer, const Const_Buffers &buffers, Handler handler)
service_impl_type::impl_type impl_type
The type of a stream implementation.
std::size_t write_some(impl_type &impl, Stream &next_layer, const Const_Buffers &buffers, asio::error_code &ec)
std::size_t read_some(impl_type &impl, Stream &next_layer, const MutableBufferSequence &buffers, asio::error_code &ec)
Read some data from the stream.
std::size_t peek(impl_type &impl, Stream &next_layer, const MutableBufferSequence &buffers, asio::error_code &ec)
Peek at the incoming data on the stream.
void async_write_some(impl_type &impl, Stream &next_layer, const ConstBufferSequence &buffers, WriteHandler handler)
Start an asynchronous write.
std::size_t write_some(impl_type &impl, Stream &next_layer, const ConstBufferSequence &buffers, asio::error_code &ec)
Write some data to the stream.
std::size_t read_some(impl_type &impl, Stream &next_layer, const Mutable_Buffers &buffers, asio::error_code &ec)
Class to represent an error code value.
Definition: error_code.hpp:80
void async_read_some(impl_type &impl, Stream &next_layer, const MutableBufferSequence &buffers, ReadHandler handler)
Start an asynchronous read.
static asio::detail::service_id< stream_service > id
Definition: io_service.hpp:748
void async_read_some(impl_type &impl, Stream &next_layer, const Mutable_Buffers &buffers, Handler handler)
void destroy(impl_type &impl, Stream &next_layer)
Destroy a stream implementation.
std::size_t in_avail(impl_type &, Stream &, asio::error_code &ec)
asio::error_code shutdown(impl_type &impl, Stream &next_layer, asio::error_code &ec)
service_base(asio::io_service &io_service)
Definition: io_service.hpp:751
Base class for all io_service services.
Definition: io_service.hpp:674
void create(impl_type &impl, Stream &next_layer, basic_context< Context_Service > &context)
Create a new stream implementation.
void create(impl_type &impl, Stream &, basic_context< Context_Service > &context)
stream_service(asio::io_service &io_service)
Construct a new stream service for the specified io_service.
void async_handshake(impl_type &impl, Stream &next_layer, stream_base::handshake_type type, Handler handler)
Default service implementation for an SSL stream.