Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / beast / doc / html / beast / ref / boost__beast__async_detect_ssl.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>async_detect_ssl</title>
5 <link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="../../index.html" title="Chapter&#160;1.&#160;Boost.Beast">
8 <link rel="up" href="../ref.html" title="This Page Intentionally Left Blank 2/2">
9 <link rel="prev" href="boost__beast__async_base/async_base_dtor_.html" title="async_base::~async_base">
10 <link rel="next" href="boost__beast__async_teardown.html" title="async_teardown">
11 </head>
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../../more/index.htm">More</a></td>
20 </tr></table>
21 <hr>
22 <div class="spirit-nav">
23 <a accesskey="p" href="boost__beast__async_base/async_base_dtor_.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost__beast__async_teardown.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="section">
26 <div class="titlepage"><div><div><h4 class="title">
27 <a name="beast.ref.boost__beast__async_detect_ssl"></a><a class="link" href="boost__beast__async_detect_ssl.html" title="async_detect_ssl">async_detect_ssl</a>
28 </h4></div></div></div>
29 <p>
30         <a class="indexterm" name="idm45873520036896"></a>
31 Detect a TLS/SSL handshake asynchronously on a stream.
32       </p>
33 <h5>
34 <a name="beast.ref.boost__beast__async_detect_ssl.h0"></a>
35         <span class="phrase"><a name="beast.ref.boost__beast__async_detect_ssl.synopsis"></a></span><a class="link" href="boost__beast__async_detect_ssl.html#beast.ref.boost__beast__async_detect_ssl.synopsis">Synopsis</a>
36       </h5>
37 <p>
38         Defined in header <code class="literal">&lt;<a href="../../../../../../boost/beast/core/detect_ssl.hpp" target="_top">boost/beast/core/detect_ssl.hpp</a>&gt;</code>
39       </p>
40 <pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span>
41     <span class="keyword">class</span> <a href="../../../../../../doc/html/boost_asio/reference/AsyncReadStream.html" target="_top"><span class="emphasis"><em>AsyncReadStream</em></span></a><span class="special">,</span>
42     <span class="keyword">class</span> <a class="link" href="../concepts/DynamicBuffer.html" title="DynamicBuffer"><span class="emphasis"><em>DynamicBuffer</em></span></a><span class="special">,</span>
43     <span class="keyword">class</span> <a href="../../../../../../doc/html/boost_asio/reference/asynchronous_operations.html#boost_asio.reference.asynchronous_operations.completion_tokens_and_handlers" target="_top"><span class="emphasis"><em>CompletionToken</em></span></a> <span class="special">=</span> <span class="identifier">net</span><span class="special">::</span><span class="identifier">default_completion_token_t</span><span class="special">&lt;</span><span class="identifier">beast</span><span class="special">::</span><span class="identifier">executor_type</span><span class="special">&lt;</span><span class="identifier">AsyncReadStream</span><span class="special">&gt;&gt;&gt;</span>
44 <a href="../../../../../../doc/html/boost_asio/reference/asynchronous_operations.html#boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type" target="_top"><span class="emphasis"><em>DEDUCED</em></span></a>
45 <span class="identifier">async_detect_ssl</span><span class="special">(</span>
46     <span class="identifier">AsyncReadStream</span><span class="special">&amp;</span> <span class="identifier">stream</span><span class="special">,</span>
47     <span class="identifier">DynamicBuffer</span><span class="special">&amp;</span> <span class="identifier">buffer</span><span class="special">,</span>
48     <span class="identifier">CompletionToken</span><span class="special">&amp;&amp;</span> <span class="identifier">token</span> <span class="special">=</span> <span class="identifier">net</span><span class="special">::</span><span class="identifier">default_completion_token_t</span><span class="special">&lt;</span> <span class="identifier">beast</span><span class="special">::</span><span class="identifier">executor_type</span><span class="special">&lt;</span> <span class="identifier">AsyncReadStream</span> <span class="special">&gt;&gt;{});</span>
49 </pre>
50 <h5>
51 <a name="beast.ref.boost__beast__async_detect_ssl.h1"></a>
52         <span class="phrase"><a name="beast.ref.boost__beast__async_detect_ssl.description"></a></span><a class="link" href="boost__beast__async_detect_ssl.html#beast.ref.boost__beast__async_detect_ssl.description">Description</a>
53       </h5>
54 <p>
55         This function reads asynchronously from a stream to determine if a client
56         handshake message is being received. This call always returns immediately.
57         The asynchronous operation will continue until one of the following conditions
58         is true:
59       </p>
60 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
61 <li class="listitem">
62             A TLS client opening handshake is detected,
63           </li>
64 <li class="listitem">
65             The received data is invalid for a TLS client handshake, or
66           </li>
67 <li class="listitem">
68             An error occurs.
69           </li>
70 </ul></div>
71 <p>
72         The algorithm, known as a <span class="emphasis"><em>composed asynchronous operation</em></span>,
73         is implemented in terms of calls to the next layer's <code class="computeroutput"><span class="identifier">async_read_some</span></code>
74         function. The program must ensure that no other calls to <code class="computeroutput"><span class="identifier">async_read_some</span></code>
75         are performed until this operation completes. Bytes read from the stream
76         will be stored in the passed dynamic buffer, which may be used to perform
77         the TLS handshake if the detector returns true, or be otherwise consumed
78         by the caller based on the expected protocol.
79       </p>
80 <h5>
81 <a name="beast.ref.boost__beast__async_detect_ssl.h2"></a>
82         <span class="phrase"><a name="beast.ref.boost__beast__async_detect_ssl.parameters"></a></span><a class="link" href="boost__beast__async_detect_ssl.html#beast.ref.boost__beast__async_detect_ssl.parameters">Parameters</a>
83       </h5>
84 <div class="informaltable"><table class="table">
85 <colgroup>
86 <col>
87 <col>
88 </colgroup>
89 <thead><tr>
90 <th>
91                 <p>
92                   Name
93                 </p>
94               </th>
95 <th>
96                 <p>
97                   Description
98                 </p>
99               </th>
100 </tr></thead>
101 <tbody>
102 <tr>
103 <td>
104                 <p>
105                   <code class="computeroutput"><span class="identifier">stream</span></code>
106                 </p>
107               </td>
108 <td>
109                 <p>
110                   The stream to read from. This type must meet the requirements of
111                   <span class="emphasis"><em>AsyncReadStream</em></span>.
112                 </p>
113               </td>
114 </tr>
115 <tr>
116 <td>
117                 <p>
118                   <code class="computeroutput"><span class="identifier">buffer</span></code>
119                 </p>
120               </td>
121 <td>
122                 <p>
123                   The dynamic buffer to use. This type must meet the requirements
124                   of <span class="emphasis"><em>DynamicBuffer</em></span>.
125                 </p>
126               </td>
127 </tr>
128 <tr>
129 <td>
130                 <p>
131                   <code class="computeroutput"><span class="identifier">token</span></code>
132                 </p>
133               </td>
134 <td>
135                 <p>
136                   The completion token used to determine the method used to provide
137                   the result of the asynchronous operation. If this is a completion
138                   handler, the implementation takes ownership of the handler by performing
139                   a decay-copy, and the equivalent function signature of the handler
140                   must be:
141                 </p>
142 <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="keyword">void</span> <span class="identifier">handler</span><span class="special">(</span>
143     <span class="identifier">error_code</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">error</span><span class="special">,</span>    <span class="comment">// Set to the error, if any</span>
144     <span class="keyword">bool</span> <span class="identifier">result</span>                 <span class="comment">// The result of the detector</span>
145 <span class="special">);</span>
146 </pre>
147                 <p>
148                   Regardless of whether the asynchronous operation completes immediately
149                   or not, the handler will not be invoked from within this function.
150                   Invocation of the handler will be performed in a manner equivalent
151                   to using <code class="computeroutput"><span class="identifier">net</span><span class="special">::</span><span class="identifier">post</span></code>.
152                 </p>
153               </td>
154 </tr>
155 </tbody>
156 </table></div>
157 <p>
158         Convenience header <code class="literal">&lt;<a href="../../../../../../boost/beast/core.hpp" target="_top">boost/beast/core.hpp</a>&gt;</code>
159       </p>
160 </div>
161 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
162 <td align="left"></td>
163 <td align="right"><div class="copyright-footer">Copyright &#169; 2016-2019 Vinnie
164       Falco<p>
165         Distributed under the Boost Software License, Version 1.0. (See accompanying
166         file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
167       </p>
168 </div></td>
169 </tr></table>
170 <hr>
171 <div class="spirit-nav">
172 <a accesskey="p" href="boost__beast__async_base/async_base_dtor_.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost__beast__async_teardown.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
173 </div>
174 </body>
175 </html>