From bdb44d8e35a8ee503d653cf6cdf649da2fb2d94f Mon Sep 17 00:00:00 2001 From: Rene Meusel Date: Wed, 25 Oct 2023 15:54:59 +0200 Subject: [PATCH] Mention `boost_compat.h` in the documentation --- doc/api_ref/tls.rst | 8 +++++++- src/examples/tls_stream_client.cpp | 28 ++++++++++++++++++++-------- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/doc/api_ref/tls.rst b/doc/api_ref/tls.rst index 1c47fc338ff..a8d4c819942 100644 --- a/doc/api_ref/tls.rst +++ b/doc/api_ref/tls.rst @@ -1191,7 +1191,13 @@ TLS Stream :cpp:class:`TLS::Stream` offers a Boost.Asio compatible wrapper around :cpp:class:`TLS::Client` and :cpp:class:`TLS::Server`. It can be used as an alternative to Boost.Asio's `ssl::stream `_ with minor adjustments to the using code. -It offers the following interface: + +To use the asio stream wrapper, a relatively recent version of boost is required. +Include ``botan/boost_compat.h`` and check that ``BOTAN_FOUND_COMPATIBLE_BOOST_VERSION`` +is defined before including ``botan/asio_stream.h`` to be ensure compatibility at +compile time of your application. + +The asio Stream offers the following interface: .. cpp:class:: template TLS::Stream diff --git a/src/examples/tls_stream_client.cpp b/src/examples/tls_stream_client.cpp index f617f5063e6..e880ec401eb 100644 --- a/src/examples/tls_stream_client.cpp +++ b/src/examples/tls_stream_client.cpp @@ -1,14 +1,17 @@ #include -#include -#include -#include -#include +#include +#if defined(BOTAN_FOUND_COMPATIBLE_BOOST_VERSION) -#include -#include -#include -#include + #include + #include + #include + #include + + #include + #include + #include + #include namespace http = boost::beast::http; namespace ap = boost::asio::placeholders; @@ -113,3 +116,12 @@ int main() { return 0; } + +#else + +int main() { + std::cout << "Your boost version is too old, sorry.\n"; + return 1; +} + +#endif