mirror of
https://github.com/boostorg/asio.git
synced 2026-01-27 18:42:07 +00:00
........
r48414 | chris_kohlhoff | 2008-08-28 22:03:46 +1000 (Thu, 28 Aug 2008) | 2 lines
Fix uninitialised event handles in asio::detail::thread in external mode.
........
r48415 | chris_kohlhoff | 2008-08-28 22:04:21 +1000 (Thu, 28 Aug 2008) | 2 lines
Fix duplicate variable warning.
........
r48416 | chris_kohlhoff | 2008-08-28 22:06:42 +1000 (Thu, 28 Aug 2008) | 3 lines
Fix duplicate variable warning. Use get_io_service() rather than
deprecated io_service() function.
........
r48417 | chris_kohlhoff | 2008-08-28 22:09:09 +1000 (Thu, 28 Aug 2008) | 2 lines
Use get_io_service() rather than deprecated io_service() function.
........
r48418 | chris_kohlhoff | 2008-08-28 22:11:47 +1000 (Thu, 28 Aug 2008) | 9 lines
Change the CompletionCondition concept so that:
- It is now evaluated before the first call to the underlying
*_some() operation, as well as after every operation.
- The return value is a number of bytes, which indicates the maximum
length to be transferred on the subsequent *_some() operation. If
the return value is 0 then the composed operation completes.
Add missing unit tests for read_at and write_at.
........
r48490 | chris_kohlhoff | 2008-08-31 18:58:49 +1000 (Sun, 31 Aug 2008) | 2 lines
Don't build serial port test code when serial ports are not available.
........
r48491 | chris_kohlhoff | 2008-08-31 19:01:59 +1000 (Sun, 31 Aug 2008) | 3 lines
Refactor reactive socket implementation so that synchronous read, write,
accept and connect operations don't modify data associated with the socket.
........
r48495 | chris_kohlhoff | 2008-08-31 21:38:52 +1000 (Sun, 31 Aug 2008) | 2 lines
Add class to allow use of arbitrary Windows overlapped I/O operations.
........
r48524 | chris_kohlhoff | 2008-09-02 09:04:35 +1000 (Tue, 02 Sep 2008) | 3 lines
Add support for using an eventfd descriptor on linux to interrupt a blocked
epoll/select reactor.
........
r48525 | chris_kohlhoff | 2008-09-02 09:05:05 +1000 (Tue, 02 Sep 2008) | 3 lines
Use templates to handle iovec structures that have an iov_base member of
type char*.
........
r48526 | chris_kohlhoff | 2008-09-02 09:07:29 +1000 (Tue, 02 Sep 2008) | 2 lines
Fix error in comment.
........
r48527 | chris_kohlhoff | 2008-09-02 18:46:46 +1000 (Tue, 02 Sep 2008) | 2 lines
Fix to compile with MSVC 7.1.
........
r48535 | chris_kohlhoff | 2008-09-02 21:34:18 +1000 (Tue, 02 Sep 2008) | 2 lines
Add const overloads of the lowest_layer member functions.
........
r48558 | chris_kohlhoff | 2008-09-03 18:56:43 +1000 (Wed, 03 Sep 2008) | 2 lines
Oops, changeset 48535 accidentally reverted 48527's fix.
........
r48559 | chris_kohlhoff | 2008-09-03 18:57:48 +1000 (Wed, 03 Sep 2008) | 2 lines
Add a workaround for a possible gcc 4.3 optimiser bug.
........
r48560 | chris_kohlhoff | 2008-09-03 19:06:10 +1000 (Wed, 03 Sep 2008) | 2 lines
Explicitly specify return type with bind to keep some compilers happy.
........
r48561 | chris_kohlhoff | 2008-09-03 19:08:04 +1000 (Wed, 03 Sep 2008) | 2 lines
Update completion_condition documentation to match new signature.
........
r48562 | chris_kohlhoff | 2008-09-03 21:36:43 +1000 (Wed, 03 Sep 2008) | 2 lines
Add windows/transmit_file example.
........
r48563 | chris_kohlhoff | 2008-09-03 21:46:02 +1000 (Wed, 03 Sep 2008) | 2 lines
Document BOOST_ASIO_DISABLE_EVENTFD macro.
........
r48564 | chris_kohlhoff | 2008-09-03 21:54:06 +1000 (Wed, 03 Sep 2008) | 2 lines
Add windows::overlapped_ptr to the reference index page.
........
r48565 | chris_kohlhoff | 2008-09-03 22:28:07 +1000 (Wed, 03 Sep 2008) | 2 lines
Regenerate documentation.
........
r48683 | chris_kohlhoff | 2008-09-09 22:59:43 +1000 (Tue, 09 Sep 2008) | 2 lines
Add windows example directory.
........
r48684 | chris_kohlhoff | 2008-09-09 23:00:07 +1000 (Tue, 09 Sep 2008) | 2 lines
Remove generated tags file.
........
r48685 | chris_kohlhoff | 2008-09-09 23:01:16 +1000 (Tue, 09 Sep 2008) | 2 lines
Version bump.
........
r48686 | chris_kohlhoff | 2008-09-09 23:02:22 +1000 (Tue, 09 Sep 2008) | 2 lines
Handle SSL library errors.
........
r48715 | chris_kohlhoff | 2008-09-11 10:05:57 +1000 (Thu, 11 Sep 2008) | 2 lines
Clarify which resolve functions perform forward or reverse resolution.
........
[SVN r49194]
132 lines
3.6 KiB
C++
132 lines
3.6 KiB
C++
//
|
|
// stream.cpp
|
|
// ~~~~~~~~~~
|
|
//
|
|
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
|
//
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
//
|
|
|
|
// Disable autolinking for unit tests.
|
|
#if !defined(BOOST_ALL_NO_LIB)
|
|
#define BOOST_ALL_NO_LIB 1
|
|
#endif // !defined(BOOST_ALL_NO_LIB)
|
|
|
|
// Test that header file is self-contained.
|
|
#include <boost/asio/ssl/stream.hpp>
|
|
|
|
#include <boost/asio.hpp>
|
|
#include <boost/asio/ssl.hpp>
|
|
#include "../unit_test.hpp"
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// ssl_stream_compile test
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~
|
|
// The following test checks that all public member functions on the class
|
|
// ssl::stream::socket compile and link correctly. Runtime failures are ignored.
|
|
|
|
namespace ssl_stream_compile {
|
|
|
|
void handshake_handler(const boost::system::error_code&)
|
|
{
|
|
}
|
|
|
|
void shutdown_handler(const boost::system::error_code&)
|
|
{
|
|
}
|
|
|
|
void write_some_handler(const boost::system::error_code&, std::size_t)
|
|
{
|
|
}
|
|
|
|
void read_some_handler(const boost::system::error_code&, std::size_t)
|
|
{
|
|
}
|
|
|
|
void test()
|
|
{
|
|
using namespace boost::asio;
|
|
namespace ip = boost::asio::ip;
|
|
|
|
try
|
|
{
|
|
io_service ios;
|
|
char mutable_char_buffer[128] = "";
|
|
const char const_char_buffer[128] = "";
|
|
boost::asio::ssl::context context(ios, boost::asio::ssl::context::sslv23);
|
|
boost::system::error_code ec;
|
|
|
|
// ssl::stream constructors.
|
|
|
|
ssl::stream<ip::tcp::socket> stream1(ios, context);
|
|
ip::tcp::socket socket1(ios, ip::tcp::v4());
|
|
ssl::stream<ip::tcp::socket&> stream2(socket1, context);
|
|
|
|
// basic_io_object functions.
|
|
|
|
io_service& ios_ref = stream1.io_service();
|
|
(void)ios_ref;
|
|
|
|
// ssl::stream functions.
|
|
|
|
ssl::stream<ip::tcp::socket>::lowest_layer_type& lowest_layer
|
|
= stream1.lowest_layer();
|
|
(void)lowest_layer;
|
|
|
|
const ssl::stream<ip::tcp::socket>& stream3 = stream1;
|
|
const ssl::stream<ip::tcp::socket>::lowest_layer_type& lowest_layer2
|
|
= stream3.lowest_layer();
|
|
(void)lowest_layer2;
|
|
|
|
stream1.handshake(ssl::stream_base::client);
|
|
stream1.handshake(ssl::stream_base::server);
|
|
stream1.handshake(ssl::stream_base::client, ec);
|
|
stream1.handshake(ssl::stream_base::server, ec);
|
|
|
|
stream1.async_handshake(ssl::stream_base::client, handshake_handler);
|
|
stream1.async_handshake(ssl::stream_base::server, handshake_handler);
|
|
|
|
stream1.shutdown();
|
|
stream1.shutdown(ec);
|
|
|
|
stream1.async_shutdown(shutdown_handler);
|
|
|
|
stream1.write_some(buffer(mutable_char_buffer));
|
|
stream1.write_some(buffer(const_char_buffer));
|
|
stream1.write_some(buffer(mutable_char_buffer), ec);
|
|
stream1.write_some(buffer(const_char_buffer), ec);
|
|
|
|
stream1.async_write_some(buffer(mutable_char_buffer), write_some_handler);
|
|
stream1.async_write_some(buffer(const_char_buffer), write_some_handler);
|
|
|
|
stream1.read_some(buffer(mutable_char_buffer));
|
|
stream1.read_some(buffer(mutable_char_buffer), ec);
|
|
|
|
stream1.async_read_some(buffer(mutable_char_buffer), read_some_handler);
|
|
|
|
stream1.peek(buffer(mutable_char_buffer));
|
|
stream1.peek(buffer(mutable_char_buffer), ec);
|
|
|
|
std::size_t in_avail1 = stream1.in_avail();
|
|
(void)in_avail1;
|
|
std::size_t in_avail2 = stream1.in_avail(ec);
|
|
(void)in_avail2;
|
|
}
|
|
catch (std::exception&)
|
|
{
|
|
}
|
|
}
|
|
|
|
} // namespace ssl_stream_compile
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
test_suite* init_unit_test_suite(int, char*[])
|
|
{
|
|
test_suite* test = BOOST_TEST_SUITE("ssl/stream");
|
|
test->add(BOOST_TEST_CASE(&ssl_stream_compile::test));
|
|
return test;
|
|
}
|