Add the asio::spawn() function, a high-level wrapper for running
stackful coroutines. It is based on the Boost.Coroutine library.

Here is an example of its use:

  asio::spawn(my_strand, do_echo);

  // ...

  void do_echo(asio::yield_context yield)
  {
    try
    {
      char data[128];
      for (;;)
      {
        std::size_t length =
          my_socket.async_read_some(
            asio::buffer(data), yield);

        asio::async_write(my_socket,
            asio::buffer(data, length), yield);
      }
    }
    catch (std::exception& e)
    {
      // ...
    }
  }

The first argument to asio::spawn() may be a strand, io_service or
completion handler. This argument determines the context in which the
coroutine is permitted to execute. For example, a server's per-client
object may consist of multiple coroutines; they should all run on the
same strand so that no explicit synchronisation is required.

The second argument is a function object with signature (**):

  void coroutine(asio::yield_context yield);

that specifies the code to be run as part of the coroutine. The
parameter yield may be passed to an asynchronous operation in place of
the completion handler, as in:

  std::size_t length =
    my_socket.async_read_some(
      asio::buffer(data), yield);

This starts the asynchronous operation and suspends the coroutine. The
coroutine will be resumed automatically when the asynchronous operation
completes.

Where a completion handler signature has the form:

  void handler(error_code ec, result_type result);

the initiating function returns the result_type. In the async_read_some
example above, this is std::size_t. If the asynchronous operation fails,
the error_code is converted into a system_error exception and thrown.

Where a completion handler signature has the form:

  void handler(error_code ec);

the initiating function returns void. As above, an error is passed back
to the coroutine as a system_error exception.

To collect the error_code from an operation, rather than have it throw
an exception, associate the output variable with the yield_context as
follows:

  error_code ec;
  std::size_t length =
    my_socket.async_read_some(
      asio::buffer(data), yield[ec]);

**Note: if asio::spawn() is used with a custom completion handler of
type Handler, the function object signature is actually:
  
  void coroutine(asio::basic_yield_context<Handler> yield);


git-svn-id: http://svn.boost.org/svn/boost/trunk@84311 b8fc166d-592f-0410-95f2-cb63ce0dd405
Move existing examples into a C++03-specific directory, and add a new
directory for C++11-specific examples. A limited subset of the C++03
examples have been converted to their C++11 equivalents.


git-svn-id: http://svn.boost.org/svn/boost/trunk@84312 b8fc166d-592f-0410-95f2-cb63ce0dd405
Add the asio::use_future special value, which adds first-class support
for returning a C++11 std::future from an asynchronous operation's
initiating function.

To use asio::use_future, pass it to an asynchronous operation instead of
a normal completion handler. For example:

  std::future<std::size_t> length =
    my_socket.async_read_some(my_buffer, asio::use_future);

Where a completion handler signature has the form:

  void handler(error_code ec, result_type result);

the initiating function returns a std::future templated on result_type.
In the above example, this is std::size_t. If the asynchronous operation
fails, the error_code is converted into a system_error exception and
passed back to the caller through the future.

Where a completion handler signature has the form:

  void handler(error_code ec);

the initiating function returns std::future<void>. As above, an error
is passed back in the future as a system_error exception.


git-svn-id: http://svn.boost.org/svn/boost/trunk@84313 b8fc166d-592f-0410-95f2-cb63ce0dd405
Add a new handler hook called asio_handler_is_continuation.

Asynchronous operations may represent a continuation of the asynchronous
control flow associated with the current handler. Asio's implementation
can use this knowledge to optimise scheduling of the handler.

The asio_handler_is_continuation hook returns true to indicate whether a
completion handler represents a continuation of the current call
context. The default implementation of the hook returns false, and
applications may customise the hook when necessary. The hook has already
been customised within Asio to return true for the following cases:

- Handlers returned by strand.wrap(), when the corresponding
  asynchronous operation is being initiated from within the strand.

- The internal handlers used to implement the asio::spawn() function's
  stackful coroutines.

- When an intermediate handler of a composed operation (e.g.
  asio::async_read(), asio::async_write(), asio::async_connect(),
  ssl::stream<>, etc.) starts a new asynchronous operation due to the
  composed operation not being complete.

To support this optimisation, a new running_in_this_thread() member
function has been added to the io_service::strand class. This function
returns true when called from within a strand.


git-svn-id: http://svn.boost.org/svn/boost/trunk@84314 b8fc166d-592f-0410-95f2-cb63ce0dd405
Partially decouple Asio from other boost components via an extra level
of indirection.


git-svn-id: http://svn.boost.org/svn/boost/trunk@84315 b8fc166d-592f-0410-95f2-cb63ce0dd405
Minor cleanup.


git-svn-id: http://svn.boost.org/svn/boost/trunk@84316 b8fc166d-592f-0410-95f2-cb63ce0dd405
New def links added

git-svn-id: http://svn.boost.org/svn/boost/trunk@84317 b8fc166d-592f-0410-95f2-cb63ce0dd405
Cosmetic changes.

git-svn-id: http://svn.boost.org/svn/boost/trunk@84318 b8fc166d-592f-0410-95f2-cb63ce0dd405
Support handshake with re-use of data already read from the wire.

Add new overloads of the SSL stream's handshake() and async_handshake()
functions, that accepts a ConstBufferSequence to be used as initial
input to the ssl engine for the handshake procedure.

Thanks go to Nick Jones <nick dot fa dot jones at gmail dot com>, on
whose work this commit is partially based.


git-svn-id: http://svn.boost.org/svn/boost/trunk@84319 b8fc166d-592f-0410-95f2-cb63ce0dd405
Support for creation of TLSv1.1 and TLSv1.2 contexts.

Thanks go to Alvin Cheung <alvin dot cheung at alumni dot ust dot hk>
and Nick Jones <nick dot fa dot jones at gmail dot com>, on whose work
this is based.


git-svn-id: http://svn.boost.org/svn/boost/trunk@84320 b8fc166d-592f-0410-95f2-cb63ce0dd405
Changed links in examples to use def __ style links

git-svn-id: http://svn.boost.org/svn/boost/trunk@84321 b8fc166d-592f-0410-95f2-cb63ce0dd405
Add set_verify_depth function to SSL context and stream.

Thanks go to Nick Jones <nick dot fa dot jones at gmail dot com>, on
whose work this commit is based.


git-svn-id: http://svn.boost.org/svn/boost/trunk@84322 b8fc166d-592f-0410-95f2-cb63ce0dd405
Changed links in examples to use def __ style links

git-svn-id: http://svn.boost.org/svn/boost/trunk@84323 b8fc166d-592f-0410-95f2-cb63ce0dd405
Changed links in examples to use def __ style links

git-svn-id: http://svn.boost.org/svn/boost/trunk@84324 b8fc166d-592f-0410-95f2-cb63ce0dd405
Allow loading of SSL certificate and key data from memory buffers.

Added new buffer-based interfaces:
add_certificate_authority, use_certificate, use_certificate_chain,
use_private_key, use_rsa_private_key, use_tmp_dh.

Thanks go to Nick Jones <nick dot fa dot jones at gmail dot com>, on
whose work this commit is based.


git-svn-id: http://svn.boost.org/svn/boost/trunk@84325 b8fc166d-592f-0410-95f2-cb63ce0dd405
Final commit of all my changes.

git-svn-id: http://svn.boost.org/svn/boost/trunk@84326 b8fc166d-592f-0410-95f2-cb63ce0dd405
Regenerate docs with updated stylesheet.

git-svn-id: http://svn.boost.org/svn/boost/trunk@84327 b8fc166d-592f-0410-95f2-cb63ce0dd405
Update links to new Math lib docs.

git-svn-id: http://svn.boost.org/svn/boost/trunk@84328 b8fc166d-592f-0410-95f2-cb63ce0dd405
Thread: fix inspection report.

git-svn-id: http://svn.boost.org/svn/boost/trunk@84329 b8fc166d-592f-0410-95f2-cb63ce0dd405
Thread: fix inspection report.

git-svn-id: http://svn.boost.org/svn/boost/trunk@84330 b8fc166d-592f-0410-95f2-cb63ce0dd405