ssl.hpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //
  2. // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // Official repository: https://github.com/boostorg/beast
  8. //
  9. #ifndef BOOST_BEAST_WEBSOCKET_SSL_HPP
  10. #define BOOST_BEAST_WEBSOCKET_SSL_HPP
  11. #include <boost/beast/core/detail/config.hpp>
  12. #include <boost/beast/websocket/teardown.hpp>
  13. #include <boost/asio/ip/tcp.hpp>
  14. #include <boost/asio/ssl/stream.hpp>
  15. namespace boost {
  16. namespace beast {
  17. /** Tear down a `net::ssl::stream`.
  18. This tears down a connection. The implementation will call
  19. the overload of this function based on the `Stream` parameter
  20. used to consruct the socket. When `Stream` is a user defined
  21. type, and not a `net::ip::tcp::socket` or any
  22. `net::ssl::stream`, callers are responsible for
  23. providing a suitable overload of this function.
  24. @param role The role of the local endpoint
  25. @param stream The stream to tear down.
  26. @param ec Set to the error if any occurred.
  27. */
  28. template<class SyncStream>
  29. void
  30. teardown(
  31. role_type role,
  32. net::ssl::stream<SyncStream>& stream,
  33. error_code& ec);
  34. /** Start tearing down a `net::ssl::stream`.
  35. This begins tearing down a connection asynchronously.
  36. The implementation will call the overload of this function
  37. based on the `Stream` parameter used to consruct the socket.
  38. When `Stream` is a user defined type, and not a
  39. `net::ip::tcp::socket` or any `net::ssl::stream`,
  40. callers are responsible for providing a suitable overload
  41. of this function.
  42. @param role The role of the local endpoint
  43. @param stream The stream to tear down.
  44. @param handler The completion handler to invoke when the operation
  45. completes. The implementation takes ownership of the handler by
  46. performing a decay-copy. The equivalent function signature of
  47. the handler must be:
  48. @code
  49. void handler(
  50. error_code const& error // result of operation
  51. );
  52. @endcode
  53. Regardless of whether the asynchronous operation completes
  54. immediately or not, the handler will not be invoked from within
  55. this function. Invocation of the handler will be performed in a
  56. manner equivalent to using `net::post`.
  57. */
  58. template<class AsyncStream, class TeardownHandler>
  59. void
  60. async_teardown(
  61. role_type role,
  62. net::ssl::stream<AsyncStream>& stream,
  63. TeardownHandler&& handler);
  64. } // beast
  65. } // boost
  66. #include <boost/beast/websocket/impl/ssl.hpp>
  67. #endif