2
0
mirror of https://github.com/boostorg/asio.git synced 2026-01-26 18:22:09 +00:00
Commit Graph

48 Commits

Author SHA1 Message Date
Christopher Kohlhoff
495e6367af Add experimental support for channels.
This adds experimental::channel and experimental::concurrent_channel.
Channels may be used to send completions as messages. For example:

  // Create a channel with no buffer space.
  channel<void(error_code, size_t)> ch(ctx);

  // The call to try_send fails as there is no buffer
  // space and no waiting receive operations.
  bool ok = ch.try_send(asio::error::eof, 123);
  assert(!ok);

  // The async_send operation blocks until a receive
  // operation consumes the message.
  ch.async_send(asio::error::eof, 123,
      [](error_code ec)
      {
        // ...
      });

  // The async_receive consumes the message. Both the
  // async_send and async_receive operations complete
  // immediately.
  ch.async_receive(
      [](error_code ec, size_t n)
      {
        // ...
      });
2021-11-04 01:56:32 +11:00
Christopher Kohlhoff
d8359719e1 Add support for registered buffers.
The mutable_registered_buffer and const_registered_buffer classes are
buffer sequence types that represented registered buffers. These buffers
are obtained by first performing a buffer registration:

  auto my_registration =
    asio::register_buffers(
        my_execution_context,
        my_buffer_sequence);

The registration object must be maintained for as long as the buffer
registration is required. The supplied buffer sequence represents the
memory location or locations that will be registered, and the caller
must ensure they remain valid for as long as they are registered. The
registration is automatically removed when the registration object is
destroyed. There can be at most one active registration per execution
context.

The registration object is a container of registered buffers. Buffers
may be obtained from it by iterating over the container, or via direct
index access:

  asio::mutable_registered_buffer my_buffer
    = my_registration[i];

The registered buffers may then be passed directly to operations:

  asio::async_read(my_socket, my_buffer,
      [](error_code ec, size_t n)
      {
        // ...
      });

Buffer registration supports the io_uring backend when used with read
and write operations on descriptors, files, pipes, and sockets.
2021-10-29 20:54:56 +11:00
Christopher Kohlhoff
b4fb33ec64 Add files and pipes to quick reference. 2021-10-27 13:50:20 +11:00
Christopher Kohlhoff
17ef2577d8 Fix this_coro::throw_if_cancelled link in reference index. 2021-07-07 23:52:08 +10:00
Christopher Kohlhoff
15b4f0eee2 Add new experimental facilities to the quick reference. 2021-07-07 22:47:10 +10:00
Christopher Kohlhoff
aa52f655e7 Add cancellation-related type requirements to quick reference. 2021-07-01 10:10:41 +10:00
Christopher Kohlhoff
0b0c4664d0 Add cancellation to reference documentation. 2021-06-28 10:14:54 +10:00
Christopher Kohlhoff
723982b867 Update copyright notices. 2021-02-25 08:29:05 +11:00
Christopher Kohlhoff
311d355ab4 Add experimental::as_single completion token adapter.
The as_single completion token adapter can be used to specify that the
completion handler arguments should be combined into a single argument.
For completion signatures with a single parameter, the argument is
passed through as-is. For signatures with two or more parameters, the
arguments are combined into a tuple.

The as_single adapter may be used in conjunction with use_awaitable and
structured bindings as follows:

    auto [e, n] = co_await socket.async_read_some(
        boost::asio::buffer(data), as_single(use_awaitable));

Alternatively, it may be used as a default completion token like so:

    using default_token = as_single_t<use_awaitable_t<>>;
    using tcp_socket = default_token::as_default_on_t<tcp::socket>;
    // ...
    awaitable<void> do_read(tcp_socket socket)
    {
      // ...
      auto [e, n] = co_await socket.async_read_some(boost::asio::buffer(data));
      // ...
    }
2020-11-02 14:03:09 +11:00
Christopher Kohlhoff
d8af4e6287 Add new execution facilities to quick reference. 2020-07-06 23:53:55 +10:00
Christopher Kohlhoff
93eb961014 Add new execution facilities to quick reference. 2020-06-23 11:08:25 +10:00
Christopher Kohlhoff
62dad58386 Add ssl::host_name_verification.
The ssl::host_name_verification class is a drop-in replacement for
ssl::rfc2818_verification, which it supersedes. The
ssl::rfc2818_verification class has been marked as deprecated.

Thanks to Arvid Norberg for providing the implementation.
2020-04-07 11:44:28 +10:00
Christopher Kohlhoff
4b552cfd5b Update copyright notices. 2020-04-07 11:15:42 +10:00
Christopher Kohlhoff
81dc9a91c2 Documentation for default completion tokens. 2019-12-04 23:40:58 +11:00
Christopher Kohlhoff
2e19dc524b Add more missing entries to quick reference. 2019-03-31 22:20:48 +11:00
Christopher Kohlhoff
b85528b585 Add new entities to quick reference. 2019-03-06 20:22:23 +11:00
Christopher Kohlhoff
688ea91d69 Fix cross references. 2019-03-03 19:58:48 +11:00
Christopher Kohlhoff
83278307e1 Add ip::resolver_base to quick reference and cross reference it from ip::basic_resolver. 2019-03-02 16:09:08 +11:00
Christopher Kohlhoff
ae04c26689 Update copyright notices. 2019-02-17 19:59:39 -10:00
Christopher Kohlhoff
4d7a656b66 Add experimental features to documentation. 2018-03-04 23:09:04 +11:00
Christopher Kohlhoff
886839cf55 Update copyright notices. 2018-03-04 21:59:30 +11:00
Christopher Kohlhoff
a1b83428b7 Update quick reference table. 2017-10-24 07:32:54 +11:00
Christopher Kohlhoff
f7fa336c91 Update copyright notices. 2017-03-05 22:43:47 +11:00
Christopher Kohlhoff
36eef63a9c Update copyright notices. 2016-09-11 11:35:40 +10:00
Christopher Kohlhoff
41bf42b8da Update copyright notices. 2015-03-20 00:14:19 +11:00
Christopher Kohlhoff
28f690f504 Update copyright notices. 2014-05-03 09:25:39 +10:00
Christopher Kohlhoff
f97171acc9 Add documentation for new features.
[SVN r84529]
2013-05-27 12:17:19 +00:00
Christopher Kohlhoff
95d16d75b7 Update copyright notices.
[SVN r84345]
2013-05-18 11:24:59 +00:00
Christopher Kohlhoff
5777189dc8 Add missing class.
[SVN r76512]
2012-01-15 12:52:58 +00:00
Christopher Kohlhoff
c8098f25eb Update documentation.
[SVN r76511]
2012-01-15 12:51:20 +00:00
Christopher Kohlhoff
30f3e430a7 Update copyright notices.
[SVN r76420]
2012-01-11 23:04:08 +00:00
Christopher Kohlhoff
06747ea7c9 * Add documentation for new asio::buffer() overloads for std::array.
* Improve backward compatibility of the new SSL implementation.

* Add wrapper for SSL_CTX_set_default_verify_paths().

* Document which OpenSSL functions the ssl::context member functions use.

* Add SSL certificate verification callbacks, and add a new
  ssl::rfc2818_verification function object for simple peer certificate
  verification based on the host name.

* Use std::atomic<> when available.

* Prefer to use std::array when it is available.

* Use std::shared_ptr and std::weak_ptr when available.

* Use a lightweight scoped smart pointer.

* Fix some shadow variable warnings with g++ 4.6.


[SVN r70384]
2011-03-22 01:21:50 +00:00
Christopher Kohlhoff
ad1c100832 New SSL implementation.
[SVN r70096]
2011-03-18 00:25:54 +00:00
Christopher Kohlhoff
f064021b6d Changes for asio version 1.5.1:
* Added support for signal handling, using a new class called
  signal_set. Programs may add one or more signals to the set, and then
  perform an async_wait() operation. The specified handler will be
  called when one of the signals occurs. The same signal number may
  registered with multiple signal_set objects, however the signal number
  must be used only with Asio.

* Added handler tracking, a new debugging aid. When enabled by defining
  BOOST_ASIO_ENABLE_HANDLER_TRACKING, Asio writes debugging output to
  the standard error stream. The output records asynchronous operations
  and the relationships between their handlers. It may be post-processed
  using the included [^handlerviz.pl] tool to create a visual
  representation of the handlers (requires GraphViz).

* Fixed a bug in asio::streambuf where the consume() function did not
  always update the internal buffer pointers correctly. The problem may
  occur when the asio::streambuf is filled with data using the standard
  C++ member functions such as sputn(). (Note: the problem does not
  manifest when the streambuf is populated by the Asio free functions
  read(), async_read(), read_until() or async_read_until().)

* Fixed a bug on kqueue-based platforms, where reactor read operations
  that return false from their perform() function are not correctly
  re-registered with kqueue.

* Modified the buffers_iterator<> and ip::basic_resolver_iterator
  classes so that the value_type typedefs are non-const byte types.


[SVN r69198]
2011-02-23 01:42:40 +00:00
Christopher Kohlhoff
7139b456d2 Changes for asio version 1.5.0:
* Added support for timeouts on socket iostreams, such as
  ip::tcp::iostream. A timeout is set by calling expires_at() or
  expires_from_now() to establish a deadline. Any socket operations
  which occur past the deadline will put the iostream into a bad state.

* Added a new error() member function to socket iostreams, for
  retrieving the error code from the most recent system call.

* Added a new basic_deadline_timer::cancel_one() function. This function
  lets you cancel a single waiting handler on a timer. Handlers are
  cancelled in FIFO order.

* Added a new transfer_exactly() completion condition. This can be used
  to send or receive a specified number of bytes even if the total size
  of the buffer (or buffer sequence) is larger.

* Added new free functions connect() and async_connect(). These
  operations try each endpoint in a list until the socket is
  successfully connected.

* Extended the buffer_size() function so that it works for buffer
  sequences in addition to individual buffers.

* Added a new buffer_copy() function that can be used to copy the raw
  bytes between individual buffers and buffer sequences.

* Added new non-throwing overloads of read(), read_at(), write() and
  write_at() that do not require a completion condition.

* Added friendlier compiler errors for when a completion handler does
  not meet the necessary type requirements. When C++0x is available
  (currently supported for g++ 4.5 or later, and MSVC 10), static_assert
  is also used to generate an informative error message. Checking may be
  disabled by defining BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS.

* Made the is_loopback(), is_unspecified() and is_multicast() functions
  consistently available across the ip::address, ip::address_v4 and
  ip::address_v6 classes. Refs #3939.

* Added new non_blocking() functions for managing the non-blocking
  behaviour of a socket or descriptor. The io_control() commands named
  non_blocking_io are now deprecated in favour of these new functions.

* Added new native_non_blocking() functions for managing the
  non-blocking mode of the underlying socket or descriptor. These
  functions are intended to allow the encapsulation of arbitrary
  non-blocking system calls as asynchronous operations, in a way that is
  transparent to the user of the socket object. The functions have no
  effect on the behaviour of the synchronous operations of the socket or
  descriptor. Refs #3307.

* Added the io_control() member function for socket acceptors.
  Refs #3297.

* For consistency with the C++0x standard library, deprecated the
  native_type typedefs in favour of native_handle_type, and the native()
  member functions in favour of native_handle().

* Added a release() member function to posix descriptors. This function
  releases ownership of the underlying native descriptor to the caller.
  Refs #3900.

* Added support for sequenced packet sockets (SOCK_SEQPACKET).

* Added a new io_service::stopped() function that can be used to
  determine whether the io_service has stopped (i.e. a reset() call is
  needed prior to any further calls to run(), run_one(), poll() or
  poll_one()).

* Reduced the copying of handler function objects.

* Added support for C++0x move construction to further reduce copying of
  handler objects. Move support is enabled when compiling in -std=c++0x
  mode on g++ 4.5 or higher, or when using MSVC10.

* Removed the dependency on OS-provided macros for the well-known IPv4
  and IPv6 addresses. This should eliminate the annoying "missing braces
  around initializer" warnings. Refs #3741.

* Reduced the size of ip::basic_endpoint<> objects (such as
  ip::tcp::endpoint and ip::udp::endpoint).

* Changed the reactor backends to assume that any descriptors or sockets
  added using assign() may have been dup()-ed, and so require explicit
  deregistration from the reactor. Refs #4971.

* Changed the SSL error category to return error strings from the
  OpenSSL library.

* Changed the separate compilation support such that, to use Asio's SSL
  capabilities, you should also include 'asio/ssl/impl/src.hpp in one
  source file in your program.

* Removed the deprecated member functions named io_service(). The
  get_io_service() member functions should be used instead.

* Removed the deprecated typedefs resolver_query and resolver_iterator
  from the ip::tcp, ip::udp and ip::icmp classes.

* Fixed a compile error on some versions of g++ due to anonymous enums.
  Refs #4883.

* Added an explicit cast to the FIONBIO constant to int to suppress a
  compiler warning on some platforms. Refs #5128.

* Fixed warnings reported by g++'s -Wshadow compiler option. Refs #3905.


[SVN r69194]
2011-02-23 01:04:16 +00:00
Christopher Kohlhoff
b1dced94c8 Update copyright notice.
[SVN r68086]
2011-01-13 08:14:05 +00:00
Christopher Kohlhoff
20a822c591 Update copyright notices.
[SVN r58623]
2010-01-02 01:24:52 +00:00
Christopher Kohlhoff
167fd03ef4 Add windows::overlapped_ptr to the reference index page.
[SVN r48564]
2008-09-03 11:54:06 +00:00
Christopher Kohlhoff
3fded3b5c8 Merge in new reference index page.
[SVN r46947]
2008-07-01 11:59:25 +00:00
Christopher Kohlhoff
be84a0a75a Add requirements for handle and descriptor services. Add new classes to the
quickref index page.


[SVN r44685]
2008-04-21 07:59:21 +00:00
Christopher Kohlhoff
02e47999fa Update copyright notices.
[SVN r43473]
2008-03-03 14:13:01 +00:00
Christopher Kohlhoff
9f319db484 Clean up documentation.
[SVN r40356]
2007-10-23 13:31:12 +00:00
Christopher Kohlhoff
7b6b09d2a2 Fix documentation generation.
[SVN r39436]
2007-09-21 05:42:55 +00:00
Christopher Kohlhoff
b98a841fa6 Improve documentation for completion condition objects.
[SVN r38323]
2007-07-31 11:39:30 +00:00
Christopher Kohlhoff
d569fc2abc Documentation updates.
[SVN r37700]
2007-05-16 14:35:09 +00:00
Christopher Kohlhoff
9e97501354 Add copyright notice.
[SVN r37489]
2007-04-22 22:26:40 +00:00
Christopher Kohlhoff
c91ed951ef Fix broken links.
[SVN r37488]
2007-04-22 14:21:09 +00:00
Christopher Kohlhoff
a1014798a1 Add quick reference index table.
[SVN r37485]
2007-04-22 09:34:13 +00:00