Lesson 35 - Get Compute Auth Token Working

This commit is contained in:
Norman Lansing
2026-02-28 12:32:28 -05:00
parent 1d477ee42a
commit 4fde462bce
7743 changed files with 1397833 additions and 18 deletions

View File

@@ -0,0 +1,11 @@
Makefile
Makefile.in
.deps
*.a
*.o
*.obj
*.lib
*.pdb
*.log
*.trs
*.dirstamp

View File

@@ -0,0 +1,29 @@
if !STANDALONE
EXAMPLES_CPP03 = examples/cpp03
endif
if HAVE_CXX11
EXAMPLES_CPP11 = examples/cpp11
endif
if HAVE_CXX14
EXAMPLES_CPP14 = examples/cpp14
endif
if HAVE_CXX17
EXAMPLES_CPP17 = examples/cpp17
endif
SUBDIRS = $(EXAMPLES_CPP03) $(EXAMPLES_CPP11) $(EXAMPLES_CPP14) $(EXAMPLES_CPP17) tests
DIST_SUBDIRS = examples/cpp03 examples/cpp11 examples/cpp14 examples/cpp17 tests
EXTRA_DIST = \
Makefile.mgw \
Makefile.msc \
tools/handlerlive.pl \
tools/handlertree.pl \
tools/handlerviz.pl
MAINTAINERCLEANFILES = \
$(srcdir)/Makefile.in

View File

@@ -0,0 +1,301 @@
SHELL=cmd
ifndef BOOSTDIR
BOOSTDIR = ../../boost_1_73_0
endif
ifdef OPTIMISED
OPTIM_CXXFLAGS = -O2
OPTIM_LDFLAGS = -O2
else
OPTIM_CXXFLAGS = -fno-inline
OPTIM_LDFLAGS =
endif
ifndef STANDALONE
BOOST_CXXFLAGS = -I$(BOOSTDIR) -DASIO_ENABLE_BOOST
endif
ifdef SEPARATE_COMPILATION
SEPARATE_COMPILATION_LIB = libasio.a
SEPARATE_COMPILATION_CXXFLAGS = \
-DASIO_SEPARATE_COMPILATION \
-DASIO_ENABLE_CANCELIO
endif
CXXFLAGS = -g -Wall -Wextra -mthreads -I../include \
$(OPTIM_CXXFLAGS) \
$(BOOST_CXXFLAGS) \
$(SEPARATE_COMPILATION_CXXFLAGS)
LDFLAGS = -g -mthreads $(OPTIM_LDFLAGS)
LIBS = $(SEPARATE_COMPILATION_LIB) -lws2_32 -lmswsock
DEFINES = -D_WIN32_WINNT=0x0501
PERFORMANCE_TEST_EXES = \
tests/performance/client.exe \
tests/performance/server.exe
UNIT_TEST_EXES = \
tests/unit/associated_allocator.exe \
tests/unit/associated_executor.exe \
tests/unit/async_result.exe \
tests/unit/awaitable.exe \
tests/unit/basic_datagram_socket.exe \
tests/unit/basic_deadline_timer.exe \
tests/unit/basic_raw_socket.exe \
tests/unit/basic_seq_packet_socket.exe \
tests/unit/basic_serial_port.exe \
tests/unit/basic_signal_set.exe \
tests/unit/basic_socket.exe \
tests/unit/basic_socket_acceptor.exe \
tests/unit/basic_stream_socket.exe \
tests/unit/basic_streambuf.exe \
tests/unit/basic_waitable_timer.exe \
tests/unit/bind_cancellation_slot.exe \
tests/unit/bind_executor.exe \
tests/unit/buffered_read_stream.exe \
tests/unit/buffered_stream.exe \
tests/unit/buffered_write_stream.exe \
tests/unit/buffer.exe \
tests/unit/buffers_iterator.exe \
tests/unit/co_spawn.exe \
tests/unit/completion_condition.exe \
tests/unit/compose.exe \
tests/unit/connect.exe \
tests/unit/coroutine.exe \
tests/unit/deadline_timer.exe \
tests/unit/defer.exe \
tests/unit/detached.exe \
tests/unit/dispatch.exe \
tests/unit/error.exe \
tests/unit/execution_context.exe \
tests/unit/execution/any_executor.exe \
tests/unit/execution/blocking.exe \
tests/unit/execution/blocking_adaptation.exe \
tests/unit/execution/bulk_execute.exe \
tests/unit/execution/bulk_guarantee.exe \
tests/unit/execution/connect.exe \
tests/unit/execution/context_as.exe \
tests/unit/execution/execute.exe \
tests/unit/execution/executor.exe \
tests/unit/execution/invocable_archetype.exe \
tests/unit/execution/mapping.exe \
tests/unit/execution/operation_state.exe \
tests/unit/execution/outstanding_work.exe \
tests/unit/execution/prefer_only.exe \
tests/unit/execution/receiver.exe \
tests/unit/execution/relationship.exe \
tests/unit/execution/schedule.exe \
tests/unit/execution/scheduler.exe \
tests/unit/execution/sender.exe \
tests/unit/execution/set_done.exe \
tests/unit/execution/set_error.exe \
tests/unit/execution/set_value.exe \
tests/unit/execution/start.exe \
tests/unit/execution/submit.exe \
tests/unit/executor.exe \
tests/unit/executor_work_guard.exe \
tests/unit/generic/basic_endpoint.exe \
tests/unit/generic/datagram_protocol.exe \
tests/unit/generic/raw_protocol.exe \
tests/unit/generic/seq_packet_protocol.exe \
tests/unit/generic/stream_protocol.exe \
tests/unit/high_resolution_timer.exe \
tests/unit/io_context.exe \
tests/unit/io_context_strand.exe \
tests/unit/ip/address.exe \
tests/unit/ip/address_v4.exe \
tests/unit/ip/address_v4_iterator.exe \
tests/unit/ip/address_v4_range.exe \
tests/unit/ip/address_v6.exe \
tests/unit/ip/address_v6_iterator.exe \
tests/unit/ip/address_v6_range.exe \
tests/unit/ip/basic_endpoint.exe \
tests/unit/ip/basic_resolver.exe \
tests/unit/ip/basic_resolver_entry.exe \
tests/unit/ip/basic_resolver_iterator.exe \
tests/unit/ip/basic_resolver_query.exe \
tests/unit/ip/host_name.exe \
tests/unit/ip/icmp.exe \
tests/unit/ip/multicast.exe \
tests/unit/ip/network_v4.exe \
tests/unit/ip/network_v6.exe \
tests/unit/ip/resolver_query_base.exe \
tests/unit/ip/tcp.exe \
tests/unit/ip/udp.exe \
tests/unit/ip/unicast.exe \
tests/unit/ip/v6_only.exe \
tests/unit/is_read_buffered.exe \
tests/unit/is_write_buffered.exe \
tests/unit/packaged_task.exe \
tests/unit/placeholders.exe \
tests/unit/post.exe \
tests/unit/read.exe \
tests/unit/read_at.exe \
tests/unit/read_until.exe \
tests/unit/redirect_error.exe \
tests/unit/serial_port.exe \
tests/unit/serial_port_base.exe \
tests/unit/signal_set.exe \
tests/unit/socket_base.exe \
tests/unit/static_thread_pool.exe \
tests/unit/steady_timer.exe \
tests/unit/strand.exe \
tests/unit/streambuf.exe \
tests/unit/system_context.exe \
tests/unit/system_executor.exe \
tests/unit/system_timer.exe \
tests/unit/this_coro.exe \
tests/unit/thread.exe \
tests/unit/thread_pool.exe \
tests/unit/time_traits.exe \
tests/unit/ts/buffer.exe \
tests/unit/ts/executor.exe \
tests/unit/ts/internet.exe \
tests/unit/ts/io_context.exe \
tests/unit/ts/net.exe \
tests/unit/ts/netfwd.exe \
tests/unit/ts/socket.exe \
tests/unit/ts/timer.exe \
tests/unit/use_awaitable.exe \
tests/unit/use_future.exe \
tests/unit/uses_executor.exe \
tests/unit/wait_traits.exe \
tests/unit/windows/basic_object_handle.exe \
tests/unit/windows/basic_overlapped_handle.exe \
tests/unit/windows/basic_random_access_handle.exe \
tests/unit/windows/basic_stream_handle.exe \
tests/unit/windows/object_handle.exe \
tests/unit/windows/overlapped_handle.exe \
tests/unit/windows/overlapped_ptr.exe \
tests/unit/windows/random_access_handle.exe \
tests/unit/windows/stream_handle.exe \
tests/unit/write.exe \
tests/unit/write_at.exe
CPP03_EXAMPLE_EXES = \
examples/cpp03/allocation/server.exe \
examples/cpp03/buffers/reference_counted.exe \
examples/cpp03/chat/chat_client.exe \
examples/cpp03/chat/chat_server.exe \
examples/cpp03/echo/async_tcp_echo_server.exe \
examples/cpp03/echo/async_udp_echo_server.exe \
examples/cpp03/echo/blocking_tcp_echo_client.exe \
examples/cpp03/echo/blocking_tcp_echo_server.exe \
examples/cpp03/echo/blocking_udp_echo_client.exe \
examples/cpp03/echo/blocking_udp_echo_server.exe \
examples/cpp03/http/client/async_client.exe \
examples/cpp03/http/client/sync_client.exe \
examples/cpp03/http/server/http_server.exe \
examples/cpp03/http/server2/http_server.exe \
examples/cpp03/http/server3/http_server.exe \
examples/cpp03/http/server4/http_server.exe \
examples/cpp03/icmp/ping.exe \
examples/cpp03/invocation/prioritised_handlers.exe \
examples/cpp03/iostreams/daytime_client.exe \
examples/cpp03/iostreams/daytime_server.exe \
examples/cpp03/iostreams/http_client.exe \
examples/cpp03/multicast/receiver.exe \
examples/cpp03/multicast/sender.exe \
examples/cpp03/nonblocking/third_party_lib.exe \
examples/cpp03/porthopper/client.exe \
examples/cpp03/porthopper/server.exe \
examples/cpp03/services/daytime_client.exe \
examples/cpp03/socks4/sync_client.exe \
examples/cpp03/timeouts/async_tcp_client.exe \
examples/cpp03/timeouts/blocking_tcp_client.exe \
examples/cpp03/timeouts/blocking_token_tcp_client.exe \
examples/cpp03/timeouts/blocking_udp_client.exe \
examples/cpp03/timeouts/server.exe \
examples/cpp03/timers/time_t_timer.exe \
examples/cpp03/tutorial/timer1/timer.exe \
examples/cpp03/tutorial/timer2/timer.exe \
examples/cpp03/tutorial/timer3/timer.exe \
examples/cpp03/tutorial/timer4/timer.exe \
examples/cpp03/tutorial/timer5/timer.exe \
examples/cpp03/tutorial/daytime1/client.exe \
examples/cpp03/tutorial/daytime2/server.exe \
examples/cpp03/tutorial/daytime3/server.exe \
examples/cpp03/tutorial/daytime4/client.exe \
examples/cpp03/tutorial/daytime5/server.exe \
examples/cpp03/tutorial/daytime6/server.exe \
examples/cpp03/tutorial/daytime7/server.exe \
examples/cpp03/windows/transmit_file.exe
ifdef STANDALONE
all: \
$(SEPARATE_COMPILATION_LIB) \
$(UNIT_TEST_EXES)
else
all: \
$(SEPARATE_COMPILATION_LIB) \
$(PERFORMANCE_TEST_EXES) \
$(UNIT_TEST_EXES) \
$(EXAMPLE_EXES) \
$(OTHER_EXAMPLE_EXES)
endif
ifdef SEPARATE_COMPILATION
libasio.a: asio.o
ar ru libasio.a asio.o
endif
check: $(UNIT_TEST_EXES) $(addprefix run.,$(UNIT_TEST_EXES))
$(addprefix run.,$(UNIT_TEST_EXES))::
@echo === Running $(@:run.%=%) ===
@$(@:run.%=%)
@echo.
clean:
-del libasio.a asio.o
-del /q /s tests\*.exe
-del /q /s tests\*.o
-del /q /s examples\*.exe
-del /q /s examples\*.o
$(UNIT_TEST_EXES): %.exe: %.o
g++ -o$@ $(LDFLAGS) $< $(LIBS)
$(PERFORMANCE_TEST_EXES) $(EXAMPLE_EXES): %.exe: %.o
g++ -o$@ $(LDFLAGS) $< $(LIBS)
examples/cpp03/http/server/http_server.exe: \
examples/cpp03/http/server/connection.o \
examples/cpp03/http/server/connection_manager.o \
examples/cpp03/http/server/main.o \
examples/cpp03/http/server/mime_types.o \
examples/cpp03/http/server/reply.o \
examples/cpp03/http/server/request_handler.o \
examples/cpp03/http/server/request_parser.o \
examples/cpp03/http/server/server.o
g++ -o$@ $(LDFLAGS) $^ $(LIBS)
examples/cpp03/http/server2/http_server.exe: \
examples/cpp03/http/server2/connection.o \
examples/cpp03/http/server2/io_context_pool.o \
examples/cpp03/http/server2/main.o \
examples/cpp03/http/server2/mime_types.o \
examples/cpp03/http/server2/reply.o \
examples/cpp03/http/server2/request_handler.o \
examples/cpp03/http/server2/request_parser.o \
examples/cpp03/http/server2/server.o
g++ -o$@ $(LDFLAGS) $^ $(LIBS)
examples/cpp03/http/server3/http_server.exe: \
examples/cpp03/http/server3/connection.o \
examples/cpp03/http/server3/main.o \
examples/cpp03/http/server3/mime_types.o \
examples/cpp03/http/server3/reply.o \
examples/cpp03/http/server3/request_handler.o \
examples/cpp03/http/server3/request_parser.o \
examples/cpp03/http/server3/server.o
g++ -o$@ $(LDFLAGS) $^ $(LIBS)
examples/cpp03/services/daytime_client.exe: \
examples/cpp03/services/daytime_client.o \
examples/cpp03/services/logger_service.o
g++ -o$@ $(LDFLAGS) $^ $(LIBS)
.cpp.o:
g++ -o$@ -c $(CXXFLAGS) $(DEFINES) $<

View File

@@ -0,0 +1,539 @@
!ifndef BOOSTDIR
BOOSTDIR = ../../boost_1_34_1
!endif
COMMON_CXXFLAGS = -nologo -EHac -GR -I. -I../include
!ifdef CXXLATEST
STD_CXXFLAGS = -std:c++latest -permissive-
!endif
!ifdef WARNINGS
WARNINGS_CXXFLAGS = -W4 -wd4512 -wd4447
!endif
!ifdef STATICRTL
! ifdef DEBUG
DEBUG_CXXFLAGS = -Zi -MTd
! else
DEBUG_CXXFLAGS = -O2 -MT
! endif
!else
! ifdef DEBUG
DEBUG_CXXFLAGS = -Zi -MDd
! else
DEBUG_CXXFLAGS = -O2 -MD
! endif
!endif
!ifdef UNICODE
UNICODE_CXXFLAGS = -DUNICODE -D_UNICODE
!endif
!ifdef TRACKING
TRACKING_CXXFLAGS = -DASIO_ENABLE_HANDLER_TRACKING
!endif
!ifndef _WIN32_WINNT
! ifdef STORE
_WIN32_WINNT=0x0603
! else
_WIN32_WINNT=0x0601
! endif
!endif
!ifdef WIN9X
DEFINES = \
-DASIO_DISABLE_IOCP \
-D_WIN32_WINNT=$(_WIN32_WINNT) \
-DBOOST_ALL_NO_LIB \
-DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
!else
! ifdef STORE
DEFINES = \
-DWINAPI_FAMILY=WINAPI_FAMILY_PC_APP \
-DBOOST_ALL_NO_LIB -D_WIN32_WINNT=$(_WIN32_WINNT) \
-DUNICODE -D_UNICODE \
-DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
! else
! ifdef WINRT
DEFINES = \
-ZW -FI SDKDDKVer.h -FI winapifamily.h -DWINAPI_FAMILY=WINAPI_PARTITION_APP \
-DBOOST_ALL_NO_LIB \
-DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
! else
DEFINES = \
-D_WIN32_WINNT=$(_WIN32_WINNT) \
-DBOOST_ALL_NO_LIB \
-DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
! endif
! endif
!endif
!ifdef SEPARATE_COMPILATION
LIBS = asio.lib
SEPARATE_COMPILATION_CXXFLAGS = \
-DASIO_SEPARATE_COMPILATION \
-DASIO_ENABLE_CANCELIO
!endif
!ifdef STANDALONE
STANDALONE_CXXFLAGS = -DASIO_STANDALONE
!else
STANDALONE_CXXFLAGS = -I$(BOOSTDIR) -DASIO_ENABLE_BOOST
!endif
CXXFLAGS = \
$(COMMON_CXXFLAGS) \
$(STD_CXXFLAGS) \
$(WARNINGS_CXXFLAGS) \
$(DEBUG_CXXFLAGS) \
$(UNICODE_CXXFLAGS) \
$(TRACKING_CXXFLAGS) \
$(SEPARATE_COMPILATION_CXXFLAGS) \
$(STANDALONE_CXXFLAGS)
!ifndef SSLDIR
SSLDIR = ../../openssl-0.9.8g
!endif
SSL_CXXFLAGS = -I$(SSLDIR)/inc32
SSL_LIBS = \
$(SSLDIR)/out32/libeay32.lib \
$(SSLDIR)/out32/ssleay32.lib \
user32.lib advapi32.lib gdi32.lib
LATENCY_TEST_EXES = \
tests\latency\tcp_client.exe \
tests\latency\tcp_server.exe \
tests\latency\udp_client.exe \
tests\latency\udp_server.exe
PERFORMANCE_TEST_EXES = \
tests\performance\client.exe \
tests\performance\server.exe
UNIT_TEST_EXES = \
tests\unit\associated_allocator.exe \
tests\unit\associated_cancellation_slot.exe \
tests\unit\associated_executor.exe \
tests\unit\associator.exe \
tests\unit\async_result.exe \
tests\unit\awaitable.exe \
tests\unit\basic_datagram_socket.exe \
tests\unit\basic_deadline_timer.exe \
tests\unit\basic_raw_socket.exe \
tests\unit\basic_seq_packet_socket.exe \
tests\unit\basic_serial_port.exe \
tests\unit\basic_signal_set.exe \
tests\unit\basic_socket.exe \
tests\unit\basic_socket_acceptor.exe \
tests\unit\basic_stream_socket.exe \
tests\unit\basic_streambuf.exe \
tests\unit\basic_waitable_timer.exe \
tests\unit\bind_cancellation_slot.exe \
tests\unit\bind_executor.exe \
tests\unit\buffered_read_stream.exe \
tests\unit\buffered_stream.exe \
tests\unit\buffered_write_stream.exe \
tests\unit\buffer.exe \
tests\unit\buffers_iterator.exe \
tests\unit\cancellation_signal.exe \
tests\unit\cancellation_state.exe \
tests\unit\cancellation_type.exe \
tests\unit\co_spawn.exe \
tests\unit\completion_condition.exe \
tests\unit\compose.exe \
tests\unit\connect.exe \
tests\unit\coroutine.exe \
tests\unit\deadline_timer.exe \
tests\unit\defer.exe \
tests\unit\detached.exe \
tests\unit\dispatch.exe \
tests\unit\error.exe \
tests\unit\execution_context.exe \
tests\unit\execution\any_executor.exe \
tests\unit\execution\blocking.exe \
tests\unit\execution\blocking_adaptation.exe \
tests\unit\execution\bulk_execute.exe \
tests\unit\execution\bulk_guarantee.exe \
tests\unit\execution\connect.exe \
tests\unit\execution\context_as.exe \
tests\unit\execution\execute.exe \
tests\unit\execution\executor.exe \
tests\unit\execution\invocable_archetype.exe \
tests\unit\execution\mapping.exe \
tests\unit\execution\operation_state.exe \
tests\unit\execution\outstanding_work.exe \
tests\unit\execution\prefer_only.exe \
tests\unit\execution\receiver.exe \
tests\unit\execution\relationship.exe \
tests\unit\execution\schedule.exe \
tests\unit\execution\scheduler.exe \
tests\unit\execution\sender.exe \
tests\unit\execution\set_done.exe \
tests\unit\execution\set_error.exe \
tests\unit\execution\set_value.exe \
tests\unit\execution\start.exe \
tests\unit\execution\submit.exe \
tests\unit\executor.exe \
tests\unit\executor_work_guard.exe \
tests\unit\generic\basic_endpoint.exe \
tests\unit\generic\datagram_protocol.exe \
tests\unit\generic\raw_protocol.exe \
tests\unit\generic\seq_packet_protocol.exe \
tests\unit\generic\stream_protocol.exe \
tests\unit\high_resolution_timer.exe \
tests\unit\io_context.exe \
tests\unit\io_context_strand.exe \
tests\unit\ip\address.exe \
tests\unit\ip\address_v4.exe \
tests\unit\ip\address_v4_iterator.exe \
tests\unit\ip\address_v4_range.exe \
tests\unit\ip\address_v6.exe \
tests\unit\ip\address_v6_iterator.exe \
tests\unit\ip\address_v6_range.exe \
tests\unit\ip\basic_endpoint.exe \
tests\unit\ip\basic_resolver.exe \
tests\unit\ip\basic_resolver_entry.exe \
tests\unit\ip\basic_resolver_iterator.exe \
tests\unit\ip\basic_resolver_query.exe \
tests\unit\ip\host_name.exe \
tests\unit\ip\icmp.exe \
tests\unit\ip\multicast.exe \
tests\unit\ip\network_v4.exe \
tests\unit\ip\network_v6.exe \
tests\unit\ip\resolver_query_base.exe \
tests\unit\ip\tcp.exe \
tests\unit\ip\udp.exe \
tests\unit\ip\unicast.exe \
tests\unit\ip\v6_only.exe \
tests\unit\local\basic_endpoint.exe \
tests\unit\local\connect_pair.exe \
tests\unit\local\datagram_protocol.exe \
tests\unit\local\stream_protocol.exe \
tests\unit\is_read_buffered.exe \
tests\unit\is_write_buffered.exe \
tests\unit\packaged_task.exe \
tests\unit\placeholders.exe \
tests\unit\post.exe \
tests\unit\read.exe \
tests\unit\read_at.exe \
tests\unit\read_until.exe \
tests\unit\redirect_error.exe \
tests\unit\serial_port.exe \
tests\unit\serial_port_base.exe \
tests\unit\signal_set.exe \
tests\unit\socket_base.exe \
tests\unit\static_thread_pool.exe \
tests\unit\steady_timer.exe \
tests\unit\strand.exe \
tests\unit\streambuf.exe \
tests\unit\system_context.exe \
tests\unit\system_executor.exe \
tests\unit\system_timer.exe \
tests\unit\this_coro.exe \
tests\unit\thread.exe \
tests\unit\thread_pool.exe \
tests\unit\time_traits.exe \
tests\unit\ts\buffer.exe \
tests\unit\ts\executor.exe \
tests\unit\ts\internet.exe \
tests\unit\ts\io_context.exe \
tests\unit\ts\net.exe \
tests\unit\ts\netfwd.exe \
tests\unit\ts\socket.exe \
tests\unit\ts\timer.exe \
tests\unit\use_awaitable.exe \
tests\unit\use_future.exe \
tests\unit\uses_executor.exe \
tests\unit\wait_traits.exe \
tests\unit\windows\basic_object_handle.exe \
tests\unit\windows\basic_overlapped_handle.exe \
tests\unit\windows\basic_random_access_handle.exe \
tests\unit\windows\basic_stream_handle.exe \
tests\unit\windows\object_handle.exe \
tests\unit\windows\overlapped_handle.exe \
tests\unit\windows\overlapped_ptr.exe \
tests\unit\windows\random_access_handle.exe \
tests\unit\windows\stream_handle.exe \
tests\unit\write.exe \
tests\unit\write_at.exe
CPP03_EXAMPLE_EXES = \
examples\cpp03\allocation\server.exe \
examples\cpp03\buffers\reference_counted.exe \
examples\cpp03\chat\chat_client.exe \
examples\cpp03\chat\chat_server.exe \
examples\cpp03\echo\async_tcp_echo_server.exe \
examples\cpp03\echo\async_udp_echo_server.exe \
examples\cpp03\echo\blocking_tcp_echo_client.exe \
examples\cpp03\echo\blocking_tcp_echo_server.exe \
examples\cpp03\echo\blocking_udp_echo_client.exe \
examples\cpp03\echo\blocking_udp_echo_server.exe \
examples\cpp03\http\client\async_client.exe \
examples\cpp03\http\client\sync_client.exe \
examples\cpp03\http\server\http_server.exe \
examples\cpp03\http\server2\http_server.exe \
examples\cpp03\http\server3\http_server.exe \
examples\cpp03\http\server4\http_server.exe \
examples\cpp03\icmp\ping.exe \
examples\cpp03\invocation\prioritised_handlers.exe \
examples\cpp03\iostreams\daytime_client.exe \
examples\cpp03\iostreams\daytime_server.exe \
examples\cpp03\iostreams\http_client.exe \
examples\cpp03\multicast\receiver.exe \
examples\cpp03\multicast\sender.exe \
examples\cpp03\nonblocking\third_party_lib.exe \
examples\cpp03\porthopper\client.exe \
examples\cpp03\porthopper\server.exe \
examples\cpp03\services\daytime_client.exe \
examples\cpp03\socks4\sync_client.exe \
examples\cpp03\timeouts\async_tcp_client.exe \
examples\cpp03\timeouts\blocking_tcp_client.exe \
examples\cpp03\timeouts\blocking_token_tcp_client.exe \
examples\cpp03\timeouts\blocking_udp_client.exe \
examples\cpp03\timeouts\server.exe \
examples\cpp03\timers\time_t_timer.exe \
examples\cpp03\tutorial\timer1\timer.exe \
examples\cpp03\tutorial\timer2\timer.exe \
examples\cpp03\tutorial\timer3\timer.exe \
examples\cpp03\tutorial\timer4\timer.exe \
examples\cpp03\tutorial\timer5\timer.exe \
examples\cpp03\tutorial\daytime1\client.exe \
examples\cpp03\tutorial\daytime2\server.exe \
examples\cpp03\tutorial\daytime3\server.exe \
examples\cpp03\tutorial\daytime4\client.exe \
examples\cpp03\tutorial\daytime5\server.exe \
examples\cpp03\tutorial\daytime6\server.exe \
examples\cpp03\tutorial\daytime7\server.exe \
examples\cpp03\windows\transmit_file.exe
SSL_UNIT_TEST_EXES = \
tests\unit\ssl\basic_context.exe \
tests\unit\ssl\context.exe \
tests\unit\ssl\context_base.exe \
tests\unit\ssl\context_service.exe \
tests\unit\ssl\rfc2818_verification.exe \
tests\unit\ssl\stream.exe \
tests\unit\ssl\stream_base.exe \
tests\unit\ssl\stream_service.exe
SSL_EXAMPLE_EXES = \
examples\cpp03\ssl\client.exe \
examples\cpp03\ssl\server.exe
!ifdef SEPARATE_COMPILATION
all: asio.lib
asio.lib: asio.cpp
cl -Fe$@ -Foasio.obj $(CXXFLAGS) $(DEFINES) -c asio.cpp
lib -name:asio.lib asio.obj
!endif
!ifdef STANDALONE
all: \
$(UNIT_TEST_EXES)
!else
all: \
$(LATENCY_TEST_EXES) \
$(PERFORMANCE_TEST_EXES) \
$(UNIT_TEST_EXES) \
$(CPP03_EXAMPLE_EXES)
!endif
ssl: \
$(SSL_UNIT_TEST_EXES) \
$(SSL_EXAMPLE_EXES)
check: $(UNIT_TEST_EXES)
!@echo === Running $** === && $** && echo.
{tests\latency}.cpp{tests\latency}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{tests\performance}.cpp{tests\performance}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
tests\unit\unit_test.obj: tests\unit\unit_test.cpp
cl -Fe$@ -Fotests\unit\unit_test.obj $(CXXFLAGS) $(DEFINES) -c tests\unit\unit_test.cpp
{tests\unit}.cpp{tests\unit}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{tests\unit\execution}.cpp{tests\unit\execution}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{tests\unit\generic}.cpp{tests\unit\generic}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{tests\unit\ip}.cpp{tests\unit\ip}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{tests\unit\local}.cpp{tests\unit\local}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{tests\unit\ssl}.cpp{tests\unit\ssl}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(SSL_CXXFLAGS) $(DEFINES) $< $(SSL_LIBS) $(LIBS) -link -opt:ref
{tests\unit\ts}.cpp{tests\unit\ts}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{tests\unit\windows}.cpp{tests\unit\windows}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\allocation}.cpp{examples\cpp03\allocation}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\buffers}.cpp{examples\cpp03\buffers}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\chat}.cpp{examples\cpp03\chat}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\echo}.cpp{examples\cpp03\echo}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\http\client}.cpp{examples\cpp03\http\client}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\icmp}.cpp{examples\cpp03\icmp}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\invocation}.cpp{examples\cpp03\invocation}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\iostreams}.cpp{examples\cpp03\iostreams}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\multicast}.cpp{examples\cpp03\multicast}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\nonblocking}.cpp{examples\cpp03\nonblocking}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\porthopper}.cpp{examples\cpp03\porthopper}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\socks4}.cpp{examples\cpp03\socks4}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\ssl}.cpp{examples\cpp03\ssl}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(SSL_CXXFLAGS) $(DEFINES) $< $(SSL_LIBS) $(LIBS) -link -opt:ref
{examples\cpp03\timeouts}.cpp{examples\cpp03\timeouts}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\timers}.cpp{examples\cpp03\timers}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\tutorial\timer1}.cpp{examples\cpp03\tutorial\timer1}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\tutorial\timer2}.cpp{examples\cpp03\tutorial\timer2}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\tutorial\timer3}.cpp{examples\cpp03\tutorial\timer3}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\tutorial\timer4}.cpp{examples\cpp03\tutorial\timer4}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\tutorial\timer5}.cpp{examples\cpp03\tutorial\timer5}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\tutorial\daytime1}.cpp{examples\cpp03\tutorial\daytime1}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\tutorial\daytime2}.cpp{examples\cpp03\tutorial\daytime2}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\tutorial\daytime3}.cpp{examples\cpp03\tutorial\daytime3}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\tutorial\daytime4}.cpp{examples\cpp03\tutorial\daytime4}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\tutorial\daytime5}.cpp{examples\cpp03\tutorial\daytime5}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\tutorial\daytime6}.cpp{examples\cpp03\tutorial\daytime6}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\tutorial\daytime7}.cpp{examples\cpp03\tutorial\daytime7}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp03\windows}.cpp{examples\cpp03\windows}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp11\executors}.cpp{examples\cpp11\executors}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp11\operations}.cpp{examples\cpp11\operations}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
{examples\cpp14\operations}.cpp{examples\cpp14\operations}.exe:
cl -Fe$@ -Fo$(<:.cpp=.obj) $(CXXFLAGS) $(DEFINES) $< $(LIBS) -link -opt:ref
examples\cpp03\http\server\http_server.exe: \
examples\cpp03\http\server\connection.cpp \
examples\cpp03\http\server\connection_manager.cpp \
examples\cpp03\http\server\main.cpp \
examples\cpp03\http\server\mime_types.cpp \
examples\cpp03\http\server\reply.cpp \
examples\cpp03\http\server\request_handler.cpp \
examples\cpp03\http\server\request_parser.cpp \
examples\cpp03\http\server\server.cpp
cl -Fe$@ -Foexamples\cpp03\http\server\ $(CXXFLAGS) $(DEFINES) $** $(LIBS) -link -opt:ref
examples\cpp03\http\server2\http_server.exe: \
examples\cpp03\http\server2\connection.cpp \
examples\cpp03\http\server2\io_context_pool.cpp \
examples\cpp03\http\server2\main.cpp \
examples\cpp03\http\server2\mime_types.cpp \
examples\cpp03\http\server2\reply.cpp \
examples\cpp03\http\server2\request_handler.cpp \
examples\cpp03\http\server2\request_parser.cpp \
examples\cpp03\http\server2\server.cpp
cl -Fe$@ -Foexamples\cpp03\http\server2\ $(CXXFLAGS) $(DEFINES) $** $(LIBS) -link -opt:ref
examples\cpp03\http\server3\http_server.exe: \
examples\cpp03\http\server3\connection.cpp \
examples\cpp03\http\server3\main.cpp \
examples\cpp03\http\server3\mime_types.cpp \
examples\cpp03\http\server3\reply.cpp \
examples\cpp03\http\server3\request_handler.cpp \
examples\cpp03\http\server3\request_parser.cpp \
examples\cpp03\http\server3\server.cpp
cl -Fe$@ -Foexamples\cpp03\http\server3\ $(CXXFLAGS) $(DEFINES) $** $(LIBS) -link -opt:ref
examples\cpp03\http\server4\http_server.exe: \
examples\cpp03\http\server4\file_handler.cpp \
examples\cpp03\http\server4\main.cpp \
examples\cpp03\http\server4\mime_types.cpp \
examples\cpp03\http\server4\reply.cpp \
examples\cpp03\http\server4\request_parser.cpp \
examples\cpp03\http\server4\server.cpp
cl -Fe$@ -Foexamples\cpp03\http\server4\ $(CXXFLAGS) $(DEFINES) $** $(LIBS) -link -opt:ref
examples\cpp03\services\daytime_client.exe: \
examples\cpp03\services\daytime_client.cpp \
examples\cpp03\services\logger_service.cpp
cl -Fe$@ -Foexamples\cpp03\services\ $(CXXFLAGS) $(DEFINES) $** $(LIBS) -link -opt:ref
clean:
-del /q /s asio.lib
-del /q /s asio.obj
-del /q /s tests\*.exe
-del /q /s tests\*.exe.manifest
-del /q /s tests\*.exp
-del /q /s tests\*.ilk
-del /q /s tests\*.pdb
-del /q /s tests\*.obj
-del /q /s examples\*.exe
-del /q /s examples\*.exe.manifest
-del /q /s examples\*.exp
-del /q /s examples\*.ilk
-del /q /s examples\*.pdb
-del /q /s examples\*.obj
-del /q /s *.pdb

View File

@@ -0,0 +1,11 @@
//
// asio.cpp
// ~~~~~~~~
//
// Copyright (c) 2003-2021 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)
//
#include "asio/impl/src.hpp"

View File

@@ -0,0 +1,11 @@
//
// asio_ssl.cpp
// ~~~~~~~~~~~~
//
// Copyright (c) 2003-2021 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)
//
#include "asio/ssl/impl/src.hpp"

View File

@@ -0,0 +1,5 @@
bin
html
reference.tags
asio.docbook
*.pdf

View File

@@ -0,0 +1,62 @@
#
# Copyright (c) 2003-2021 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)
#
project asio-doc ;
import os ;
local boost = [ os.environ BOOST_ROOT ] ;
using quickbook ;
xml asio : asio.qbk ;
boostbook standalone
:
asio
:
<xsl:param>boost.image.src=asio.png
<xsl:param>boost.image.alt="asio C++ library"
<xsl:param>boost.image.w=250
<xsl:param>boost.image.h=60
<xsl:param>nav.layout=none
<xsl:param>navig.graphics.path=""
<xsl:param>admon.graphics.path=""
<xsl:param>chapter.autolabel=0
<xsl:param>chunk.section.depth=8
<xsl:param>chunk.first.sections=1
<xsl:param>toc.section.depth=2
<xsl:param>toc.max.depth=1
<xsl:param>generate.section.toc.level=1
<xsl:param>generate.toc="chapter nop section nop"
;
install html
:
$(boost)/doc/src/boostbook.css
$(boost)/doc/src/images/blank.png
$(boost)/doc/src/images/caution.png
$(boost)/doc/src/images/draft.png
$(boost)/doc/src/images/home.png
$(boost)/doc/src/images/important.png
$(boost)/doc/src/images/next_disabled.png
$(boost)/doc/src/images/next.png
$(boost)/doc/src/images/note.png
$(boost)/doc/src/images/prev_disabled.png
$(boost)/doc/src/images/prev.png
$(boost)/doc/src/images/tip.png
$(boost)/doc/src/images/up_disabled.png
$(boost)/doc/src/images/up.png
$(boost)/doc/src/images/warning.png
overview/proactor.png
overview/sync_op.png
overview/async_op1.png
overview/async_op2.png
asio.png
;
install asioref : standalone : <location>. <format>docbook ;
explicit asioref ;

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -0,0 +1,140 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[library Asio
[quickbook 1.4]
[copyright 2003 - 2021 Christopher M. Kohlhoff]
[purpose Networking library]
[license
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])
]
[category template]
[category generic]
]
[template mdash[] '''&mdash; ''']
[template hr[] [br]'''<phrase role="silver">'''[mdash]'''</phrase>'''[br]]
[template half_open_range[text] '''&#91;'''[text])]
[template indexterm1[id term1] '''<indexterm id="'''[id]'''"><primary>'''[term1]'''</primary></indexterm>''']
[template indexterm2[id term1 term2] '''<indexterm id="'''[id]'''"><primary>'''[term1]'''</primary><secondary>'''[term2]'''</secondary></indexterm>''']
[template inline_note[text] \[['Note:] [text] '''&mdash;'''['end note]\] ]
[template ticket[number]'''<ulink url="https://svn.boost.org/trac/boost/ticket/'''[number]'''">'''#[number]'''</ulink>''']
[template static[] '''<phrase role="silver">'''\[static\]'''</phrase>''']
[template constructor[] '''<phrase role="silver">'''\[constructor\]'''</phrase>''']
[template destructor[] '''<phrase role="silver">'''\[destructor\]'''</phrase>''']
[def __POSIX__ /POSIX/]
[def __Windows__ /Windows/]
[def __accept__ [@http://www.opengroup.org/onlinepubs/9699919799/functions/accept.html `accept()`]]
[def __connect__ [@http://www.opengroup.org/onlinepubs/9699919799/functions/connect.html `connect()`]]
[def __getpeername__ [@http://www.opengroup.org/onlinepubs/9699919799/functions/getpeername.html `getpeername()`]]
[def __getsockname__ [@http://www.opengroup.org/onlinepubs/9699919799/functions/getsockname.html `getsockname()`]]
[def __getsockopt__ [@http://www.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html `getsockopt()`]]
[def __ioctl__ [@http://www.opengroup.org/onlinepubs/9699919799/functions/ioctl.html `ioctl()`]]
[def __poll__ [@http://www.opengroup.org/onlinepubs/9699919799/functions/poll.html `poll()`]]
[def __recvfrom__ [@http://www.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html `recvfrom()`]]
[def __sendto__ [@http://www.opengroup.org/onlinepubs/9699919799/functions/sendto.html `sendto()`]]
[def __setsockopt__ [@http://www.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html `setsockopt()`]]
[def __shutdown__ [@http://www.opengroup.org/onlinepubs/9699919799/functions/shutdown.html `shutdown()`]]
[def __socket__ [@http://www.opengroup.org/onlinepubs/9699919799/functions/socket.html `socket()`]]
[/=============================================================================]
Asio is a cross-platform C++ library for network and low-level I/O programming
that provides developers with a consistent asynchronous model using a modern
C++ approach.
[variablelist
[
[
[link asio.overview Overview]
]
[
An overview of the features included in Asio, plus rationale and design information.
]
]
[
[
[link asio.using Using, Building, and Configuring Asio]
]
[
How to use Asio in your applications. Includes information on
library dependencies and supported platforms.
]
]
[
[
[link asio.tutorial Tutorial]
]
[
A tutorial that introduces the fundamental concepts required to use
Asio, and shows how to use Asio to develop simple client and
server programs.
]
]
[
[
[link asio.examples Examples]
]
[
Examples that illustrate the use of Asio in more complex applications.
]
]
[
[
[link asio.reference Reference]
]
[
Detailed class and function reference.
]
]
[
[
[link asio.net_ts Networking TS Compatibility]
]
[
Description of changes to provide compatibility with the "C++ Extensions
for Networking" Technical Specification.
]
]
[
[
[link asio.std_executors Proposed Standard Executors]
]
[
Description of Asio's support for the proposed standard executors
library.
]
]
[
[
[link asio.history Revision History]
]
[
Log of Asio changes made in each release.
]
]
[
[
[link asio.index Index]
]
[
Book-style text index of Asio documentation.
]
]
]
[include overview.qbk]
[include using.qbk]
[include tutorial.qbk]
[include examples.qbk]
[include reference.qbk]
[include net_ts.qbk]
[include std_executors.qbk]
[include history.qbk]
[xinclude index.xml]

View File

@@ -0,0 +1,90 @@
%%
%% This is a DocBook LaTeX style for Asio
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mybook}[2008/11/11 Asio DocBook Style]
% The defined options
\DeclareOption{hyperlink}{ \def\DBKhyperlink{yes} }
\DeclareOption{nohyperlink}{ \def\DBKhyperlink{no} }
% Default values
\ExecuteOptions{nohyperlink}
% If defined, process the options
\ProcessOptions\relax
% Needed packages
\usepackage[top=2cm,bottom=2cm,left=1.5cm,right=1.5cm]{geometry}
\usepackage{float}
\usepackage{dbk_core}
\usepackage{dbk_admonition}
\usepackage{fancyvrb}
% Text layout
\setlength\parskip{\medskipamount}
\setlength\parindent{0pt}
\raggedbottom
% Stuff we don't need
\def\DBKinditem#1#2{}
\newenvironment{DBKindtable}{}{}
\newenvironment{DBKrevtable}{}{}
\newenvironment{DBKlegalnotice}{}{}
% Admonitions
\floatstyle{boxed}
\newfloat{DBKadmonition}{h}{lop}
\newfloat{sidebar}{h}{lop}
% Page break before sections
\let\orig@section\section
\renewcommand\section{
\clearpage\orig@section
}
% Ensure line break after paragraph heading
\renewcommand\paragraph{%
\@startsection{paragraph}{4}{\z@}%
{-2.25ex\@plus -1ex \@minus -.2ex}%
{0.5ex \@plus .2ex}%
{\normalfont\normalsize\bfseries}%
}
% Add page numbers to hyperlinks
%\let\orig@hyperlink\hyperlink
%\renewcommand{\hyperlink}[2]{
% \orig@hyperlink{#1}{#2} (page \pageref{#1})
%}
% Extra indent on TOC section numbers
\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{3.3em}}
\renewcommand*\l@subsubsection{\@dottedtocline{3}{3.8em}{4.2em}}
\renewcommand*\l@paragraph{\@dottedtocline{4}{7.0em}{5.1em}}
% Title page
\renewcommand\maketitle{
\null
\thispagestyle{empty}
\begin{center}
\null\vskip 7cm
\begin{LARGE}
asio C++ library
\end{LARGE}
\null\vskip 1cm
\begin{large}
\DBKsubtitle{}
\end{large}
\null\vskip 1cm
\begin{Large}
Reference Manual
\end{Large}
\null\vskip 5cm
\begin{small}
\DBKcopyright{}
\end{small}
\end{center}
\vfill
\null
\cleardoublepage
}

View File

@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!--
Copyright (c) 2003-2021 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)
-->
<xsl:output method="xml"/>
<xsl:strip-space elements="title"/>
<xsl:param name="asio.version">X.Y.Z</xsl:param>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="blockquote/para">
<xsl:apply-templates select="para"/>
</xsl:template>
<xsl:template match="title/link">
<xsl:value-of select="normalize-space(.)"/>
</xsl:template>
<xsl:template match="bridgehead[count(link) &gt; 0]">
<xsl:element name="bridgehead">
<xsl:attribute name="renderas">
<xsl:value-of select="@renderas"/>
</xsl:attribute>
<xsl:value-of select="normalize-space(link)"/>
</xsl:element>
</xsl:template>
<xsl:template match="chapter">
<article id="asio" name="Asio Reference Manual" dirname="asio">
<xsl:apply-templates select="chapterinfo"/>
<title>Asio Reference Manual</title>
<xsl:apply-templates select="section"/>
</article>
</xsl:template>
<xsl:template match="chapterinfo">
<articleinfo>
<xsl:apply-templates select="*"/>
<subtitle><xsl:value-of select="$asio.version"/></subtitle>
</articleinfo>
</xsl:template>
<xsl:template match="section[@id='asio.reference']/informaltable">
<xsl:element name="informaltable">
<xsl:attribute name="role">scriptsize</xsl:attribute>
<xsl:apply-templates select="*"/>
</xsl:element>
</xsl:template>
<xsl:template match="section[@id='asio.examples']/*/listitem">
<xsl:element name="listitem">
<xsl:value-of select="substring-after(normalize-space(ulink), '../')"/>
</xsl:element>
</xsl:template>
<xsl:template match="imagedata">
<xsl:element name="imagedata">
<xsl:attribute name="fileref">
<xsl:value-of select="@fileref"/>
</xsl:attribute>
<xsl:attribute name="scale">75</xsl:attribute>
<xsl:attribute name="align">center</xsl:attribute>
</xsl:element>
</xsl:template>
<xsl:template match="programlisting/phrase">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="programlisting/link">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="programlisting/emphasis">
<xsl:if test="not(contains(., 'more...'))">
<emphasis><xsl:apply-templates/></emphasis>
</xsl:if>
</xsl:template>
<xsl:template match="section[@id='asio.index']"></xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,5 @@
/**
\page boost_bind boost::bind
See the <a href="http://www.boost.org/libs/bind/bind.html">Boost: bind.hpp
documentation</a> for more information on how to use <tt>boost::bind</tt>.
*/

View File

@@ -0,0 +1,22 @@
#!/usr/bin/perl -w
# Copyright (c) 2003-2021 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)
use strict;
system("doxygen reference.dox");
chdir("xml");
system("xsltproc combine.xslt index.xml > all.xml");
chdir("..");
system("xsltproc reference.xsl xml/all.xml > reference.qbk");
system("rm -rf xml");
system("doxygen tutorial.dox");
chdir("xml");
system("xsltproc combine.xslt index.xml > all.xml");
chdir("..");
system("xsltproc tutorial.xsl xml/all.xml > tutorial.qbk");
system("rm -rf xml reference.tags");

View File

@@ -0,0 +1,631 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:examples Examples]
* [link asio.examples.cpp03_examples C++03 Examples]: Illustrates the use of
Asio using only C++03 language and library features. Where necessary, the
examples make use of selected Boost C++ libraries.
* [link asio.examples.cpp11_examples C++11 Examples]: Contains a limited set of
the C++03 Asio examples, updated to use only C++11 library and language
facilities. These examples do not make direct use of Boost C++ libraries.
[/boostify: non-boost docs start here]
To show the changes between C++03 and C++11, these examples include a diff
between the C++03 and C++11 versions.
[/boostify: non-boost docs end here]
* [link asio.examples.cpp14_examples C++14 Examples]: Contains a limited set of
the C++03 Asio examples, updated to use only C++14 library and language
facilities. These examples do not make direct use of Boost C++ libraries.
* [link asio.examples.cpp17_examples C++17 Examples]: Selected examples
illustrating C++17 usage in conjunction with Technical Specifications.
[section:cpp03_examples C++03 Examples]
[heading Allocation]
This example shows how to customise the allocation of memory associated with
asynchronous operations.
* [@../src/examples/cpp03/allocation/server.cpp]
[heading Buffers]
This example demonstrates how to create reference counted buffers that can be
used with socket read and write operations.
* [@../src/examples/cpp03/buffers/reference_counted.cpp]
[heading Chat]
This example implements a chat server and client. The programs use a custom
protocol with a fixed length message header and variable length message body.
* [@../src/examples/cpp03/chat/chat_message.hpp]
* [@../src/examples/cpp03/chat/chat_client.cpp]
* [@../src/examples/cpp03/chat/chat_server.cpp]
The following POSIX-specific chat client demonstrates how to use the
[link asio.reference.posix__stream_descriptor posix::stream_descriptor] class to
perform console input and output.
* [@../src/examples/cpp03/chat/posix_chat_client.cpp]
[heading Echo]
A collection of simple clients and servers, showing the use of both synchronous
and asynchronous operations.
* [@../src/examples/cpp03/echo/async_tcp_echo_server.cpp]
* [@../src/examples/cpp03/echo/async_udp_echo_server.cpp]
* [@../src/examples/cpp03/echo/blocking_tcp_echo_client.cpp]
* [@../src/examples/cpp03/echo/blocking_tcp_echo_server.cpp]
* [@../src/examples/cpp03/echo/blocking_udp_echo_client.cpp]
* [@../src/examples/cpp03/echo/blocking_udp_echo_server.cpp]
[heading Fork]
These POSIX-specific examples show how to use Asio in conjunction with the
`fork()` system call. The first example illustrates the steps required to start
a daemon process:
* [@../src/examples/cpp03/fork/daemon.cpp]
The second example demonstrates how it is possible to fork a process from
within a completion handler.
* [@../src/examples/cpp03/fork/process_per_connection.cpp]
[heading HTTP Client]
Example programs implementing simple HTTP 1.0 clients. These examples show how
to use the [link asio.reference.read_until read_until] and [link
asio.reference.async_read_until async_read_until] functions.
* [@../src/examples/cpp03/http/client/sync_client.cpp]
* [@../src/examples/cpp03/http/client/async_client.cpp]
[heading HTTP Server]
This example illustrates the use of asio in a simple single-threaded server
implementation of HTTP 1.0. It demonstrates how to perform a clean shutdown by
cancelling all outstanding asynchronous operations.
* [@../src/examples/cpp03/http/server/connection.cpp]
* [@../src/examples/cpp03/http/server/connection.hpp]
* [@../src/examples/cpp03/http/server/connection_manager.cpp]
* [@../src/examples/cpp03/http/server/connection_manager.hpp]
* [@../src/examples/cpp03/http/server/header.hpp]
* [@../src/examples/cpp03/http/server/main.cpp]
* [@../src/examples/cpp03/http/server/mime_types.cpp]
* [@../src/examples/cpp03/http/server/mime_types.hpp]
* [@../src/examples/cpp03/http/server/reply.cpp]
* [@../src/examples/cpp03/http/server/reply.hpp]
* [@../src/examples/cpp03/http/server/request.hpp]
* [@../src/examples/cpp03/http/server/request_handler.cpp]
* [@../src/examples/cpp03/http/server/request_handler.hpp]
* [@../src/examples/cpp03/http/server/request_parser.cpp]
* [@../src/examples/cpp03/http/server/request_parser.hpp]
* [@../src/examples/cpp03/http/server/server.cpp]
* [@../src/examples/cpp03/http/server/server.hpp]
[heading HTTP Server 2]
An HTTP server using an io_context-per-CPU design.
* [@../src/examples/cpp03/http/server2/connection.cpp]
* [@../src/examples/cpp03/http/server2/connection.hpp]
* [@../src/examples/cpp03/http/server2/header.hpp]
* [@../src/examples/cpp03/http/server2/io_context_pool.cpp]
* [@../src/examples/cpp03/http/server2/io_context_pool.hpp]
* [@../src/examples/cpp03/http/server2/main.cpp]
* [@../src/examples/cpp03/http/server2/mime_types.cpp]
* [@../src/examples/cpp03/http/server2/mime_types.hpp]
* [@../src/examples/cpp03/http/server2/reply.cpp]
* [@../src/examples/cpp03/http/server2/reply.hpp]
* [@../src/examples/cpp03/http/server2/request.hpp]
* [@../src/examples/cpp03/http/server2/request_handler.cpp]
* [@../src/examples/cpp03/http/server2/request_handler.hpp]
* [@../src/examples/cpp03/http/server2/request_parser.cpp]
* [@../src/examples/cpp03/http/server2/request_parser.hpp]
* [@../src/examples/cpp03/http/server2/server.cpp]
* [@../src/examples/cpp03/http/server2/server.hpp]
[heading HTTP Server 3]
An HTTP server using a single io_context and a thread pool calling `io_context::run()`.
* [@../src/examples/cpp03/http/server3/connection.cpp]
* [@../src/examples/cpp03/http/server3/connection.hpp]
* [@../src/examples/cpp03/http/server3/header.hpp]
* [@../src/examples/cpp03/http/server3/main.cpp]
* [@../src/examples/cpp03/http/server3/mime_types.cpp]
* [@../src/examples/cpp03/http/server3/mime_types.hpp]
* [@../src/examples/cpp03/http/server3/reply.cpp]
* [@../src/examples/cpp03/http/server3/reply.hpp]
* [@../src/examples/cpp03/http/server3/request.hpp]
* [@../src/examples/cpp03/http/server3/request_handler.cpp]
* [@../src/examples/cpp03/http/server3/request_handler.hpp]
* [@../src/examples/cpp03/http/server3/request_parser.cpp]
* [@../src/examples/cpp03/http/server3/request_parser.hpp]
* [@../src/examples/cpp03/http/server3/server.cpp]
* [@../src/examples/cpp03/http/server3/server.hpp]
[heading HTTP Server 4]
A single-threaded HTTP server implemented using stackless coroutines.
* [@../src/examples/cpp03/http/server4/file_handler.cpp]
* [@../src/examples/cpp03/http/server4/file_handler.hpp]
* [@../src/examples/cpp03/http/server4/header.hpp]
* [@../src/examples/cpp03/http/server4/main.cpp]
* [@../src/examples/cpp03/http/server4/mime_types.cpp]
* [@../src/examples/cpp03/http/server4/mime_types.hpp]
* [@../src/examples/cpp03/http/server4/reply.cpp]
* [@../src/examples/cpp03/http/server4/reply.hpp]
* [@../src/examples/cpp03/http/server4/request.hpp]
* [@../src/examples/cpp03/http/server4/request_parser.cpp]
* [@../src/examples/cpp03/http/server4/request_parser.hpp]
* [@../src/examples/cpp03/http/server4/server.cpp]
* [@../src/examples/cpp03/http/server4/server.hpp]
[heading ICMP]
This example shows how to use raw sockets with ICMP to ping a remote host.
* [@../src/examples/cpp03/icmp/ping.cpp]
* [@../src/examples/cpp03/icmp/ipv4_header.hpp]
* [@../src/examples/cpp03/icmp/icmp_header.hpp]
[heading Invocation]
This example shows how to customise handler invocation. Completion handlers are
added to a priority queue rather than executed immediately.
* [@../src/examples/cpp03/invocation/prioritised_handlers.cpp]
[heading Iostreams]
Two examples showing how to use [link asio.reference.ip__tcp.iostream
ip::tcp::iostream].
* [@../src/examples/cpp03/iostreams/daytime_client.cpp]
* [@../src/examples/cpp03/iostreams/daytime_server.cpp]
* [@../src/examples/cpp03/iostreams/http_client.cpp]
[heading Multicast]
An example showing the use of multicast to transmit packets to a group of
subscribers.
* [@../src/examples/cpp03/multicast/receiver.cpp]
* [@../src/examples/cpp03/multicast/sender.cpp]
[heading Serialization]
This example shows how Boost.Serialization can be used with asio to encode and
decode structures for transmission over a socket.
* [@../src/examples/cpp03/serialization/client.cpp]
* [@../src/examples/cpp03/serialization/connection.hpp]
* [@../src/examples/cpp03/serialization/server.cpp]
* [@../src/examples/cpp03/serialization/stock.hpp]
[heading Services]
This example demonstrates how to integrate custom functionality (in this case,
for logging) into asio's [link asio.reference.io_context io_context], and
how to use a custom service with [link
asio.reference.basic_stream_socket basic_stream_socket<>].
* [@../src/examples/cpp03/services/basic_logger.hpp]
* [@../src/examples/cpp03/services/daytime_client.cpp]
* [@../src/examples/cpp03/services/logger.hpp]
* [@../src/examples/cpp03/services/logger_service.cpp]
* [@../src/examples/cpp03/services/logger_service.hpp]
* [@../src/examples/cpp03/services/stream_socket_service.hpp]
[heading SOCKS 4]
Example client program implementing the SOCKS 4 protocol for communication via
a proxy.
* [@../src/examples/cpp03/socks4/sync_client.cpp]
* [@../src/examples/cpp03/socks4/socks4.hpp]
[heading SSL]
Example client and server programs showing the use of the [link
asio.reference.ssl__stream ssl::stream<>] template with asynchronous operations.
* [@../src/examples/cpp03/ssl/client.cpp]
* [@../src/examples/cpp03/ssl/server.cpp]
[heading Timeouts]
A collection of examples showing how to cancel long running asynchronous
operations after a period of time.
* [@../src/examples/cpp03/timeouts/async_tcp_client.cpp]
* [@../src/examples/cpp03/timeouts/blocking_tcp_client.cpp]
* [@../src/examples/cpp03/timeouts/blocking_token_tcp_client.cpp]
* [@../src/examples/cpp03/timeouts/blocking_udp_client.cpp]
* [@../src/examples/cpp03/timeouts/server.cpp]
[heading Timers]
Example showing how to customise basic_waitable_timer using a different clock type.
* [@../src/examples/cpp03/timers/time_t_timer.cpp]
[heading Porthopper]
Example illustrating mixed synchronous and asynchronous operations, and how to
use Boost.Lambda with Asio.
* [@../src/examples/cpp03/porthopper/protocol.hpp]
* [@../src/examples/cpp03/porthopper/client.cpp]
* [@../src/examples/cpp03/porthopper/server.cpp]
[heading Nonblocking]
Example demonstrating reactor-style operations for integrating a third-party
library that wants to perform the I/O operations itself.
* [@../src/examples/cpp03/nonblocking/third_party_lib.cpp]
[heading Spawn]
Example of using the asio::spawn() function, a wrapper around the
[@http://www.boost.org/doc/libs/release/libs/coroutine/index.html Boost.Coroutine]
library, to implement a chain of asynchronous operations using stackful
coroutines.
* [@../src/examples/cpp03/spawn/echo_server.cpp]
[heading UNIX Domain Sockets]
Examples showing how to use UNIX domain (local) sockets.
* [@../src/examples/cpp03/local/connect_pair.cpp]
* [@../src/examples/cpp03/local/iostream_client.cpp]
* [@../src/examples/cpp03/local/stream_server.cpp]
* [@../src/examples/cpp03/local/stream_client.cpp]
[heading Windows]
An example showing how to use the Windows-specific function `TransmitFile`
with Asio.
* [@../src/examples/cpp03/windows/transmit_file.cpp]
[endsect]
[section:cpp11_examples C++11 Examples]
[heading Allocation]
This example shows how to customise the allocation of memory associated with
asynchronous operations.
* [@../src/examples/cpp11/allocation/server.cpp] ([@examples/diffs/allocation/server.cpp.html diff to C++03])
[heading Buffers]
This example demonstrates how to create reference counted buffers that can be
used with socket read and write operations.
* [@../src/examples/cpp11/buffers/reference_counted.cpp] ([@examples/diffs/buffers/reference_counted.cpp.html diff to C++03])
[heading Chat]
This example implements a chat server and client. The programs use a custom
protocol with a fixed length message header and variable length message body.
* [@../src/examples/cpp11/chat/chat_message.hpp] ([@examples/diffs/chat/chat_message.hpp.html diff to C++03])
* [@../src/examples/cpp11/chat/chat_client.cpp] ([@examples/diffs/chat/chat_client.cpp.html diff to C++03])
* [@../src/examples/cpp11/chat/chat_server.cpp] ([@examples/diffs/chat/chat_server.cpp.html diff to C++03])
[heading Echo]
A collection of simple clients and servers, showing the use of both synchronous
and asynchronous operations.
* [@../src/examples/cpp11/echo/async_tcp_echo_server.cpp] ([@examples/diffs/echo/async_tcp_echo_server.cpp.html diff to C++03])
* [@../src/examples/cpp11/echo/async_udp_echo_server.cpp] ([@examples/diffs/echo/async_udp_echo_server.cpp.html diff to C++03])
* [@../src/examples/cpp11/echo/blocking_tcp_echo_client.cpp] ([@examples/diffs/echo/blocking_tcp_echo_client.cpp.html diff to C++03])
* [@../src/examples/cpp11/echo/blocking_tcp_echo_server.cpp] ([@examples/diffs/echo/blocking_tcp_echo_server.cpp.html diff to C++03])
* [@../src/examples/cpp11/echo/blocking_udp_echo_client.cpp] ([@examples/diffs/echo/blocking_udp_echo_client.cpp.html diff to C++03])
* [@../src/examples/cpp11/echo/blocking_udp_echo_server.cpp] ([@examples/diffs/echo/blocking_udp_echo_server.cpp.html diff to C++03])
[heading Fork]
These POSIX-specific examples show how to use Asio in conjunction with the
`fork()` system call. The first example illustrates the steps required to start
a daemon process:
* [@../src/examples/cpp11/fork/daemon.cpp] ([@examples/diffs/fork/daemon.cpp.html diff to C++03])
The second example demonstrates how it is possible to fork a process from
within a completion handler.
* [@../src/examples/cpp11/fork/process_per_connection.cpp] ([@examples/diffs/fork/process_per_connection.cpp.html diff to C++03])
[heading Futures]
This example demonstrates how to use std::future in conjunction with
Asio's asynchronous operations.
* [@../src/examples/cpp11/futures/daytime_client.cpp]
[heading Handler Tracking]
This example header file shows how to implement custom handler tracking.
* [@../src/examples/cpp11/handler_tracking/custom_tracking.hpp]
This example program shows how to include source location information in
the handler tracking output.
* [@../src/examples/cpp11/handler_tracking/async_tcp_echo_server.cpp]
[heading HTTP Server]
This example illustrates the use of asio in a simple single-threaded server
implementation of HTTP 1.0. It demonstrates how to perform a clean shutdown by
cancelling all outstanding asynchronous operations.
* [@../src/examples/cpp11/http/server/connection.cpp] ([@examples/diffs/http/server/connection.cpp.html diff to C++03])
* [@../src/examples/cpp11/http/server/connection.hpp] ([@examples/diffs/http/server/connection.hpp.html diff to C++03])
* [@../src/examples/cpp11/http/server/connection_manager.cpp] ([@examples/diffs/http/server/connection_manager.cpp.html diff to C++03])
* [@../src/examples/cpp11/http/server/connection_manager.hpp] ([@examples/diffs/http/server/connection_manager.hpp.html diff to C++03])
* [@../src/examples/cpp11/http/server/header.hpp] ([@examples/diffs/http/server/header.hpp.html diff to C++03])
* [@../src/examples/cpp11/http/server/main.cpp] ([@examples/diffs/http/server/main.cpp.html diff to C++03])
* [@../src/examples/cpp11/http/server/mime_types.cpp] ([@examples/diffs/http/server/mime_types.cpp.html diff to C++03])
* [@../src/examples/cpp11/http/server/mime_types.hpp] ([@examples/diffs/http/server/mime_types.hpp.html diff to C++03])
* [@../src/examples/cpp11/http/server/reply.cpp] ([@examples/diffs/http/server/reply.cpp.html diff to C++03])
* [@../src/examples/cpp11/http/server/reply.hpp] ([@examples/diffs/http/server/reply.hpp.html diff to C++03])
* [@../src/examples/cpp11/http/server/request.hpp] ([@examples/diffs/http/server/request.hpp.html diff to C++03])
* [@../src/examples/cpp11/http/server/request_handler.cpp] ([@examples/diffs/http/server/request_handler.cpp.html diff to C++03])
* [@../src/examples/cpp11/http/server/request_handler.hpp] ([@examples/diffs/http/server/request_handler.hpp.html diff to C++03])
* [@../src/examples/cpp11/http/server/request_parser.cpp] ([@examples/diffs/http/server/request_parser.cpp.html diff to C++03])
* [@../src/examples/cpp11/http/server/request_parser.hpp] ([@examples/diffs/http/server/request_parser.hpp.html diff to C++03])
* [@../src/examples/cpp11/http/server/server.cpp] ([@examples/diffs/http/server/server.cpp.html diff to C++03])
* [@../src/examples/cpp11/http/server/server.hpp] ([@examples/diffs/http/server/server.hpp.html diff to C++03])
[heading Multicast]
An example showing the use of multicast to transmit packets to a group of
subscribers.
* [@../src/examples/cpp11/multicast/receiver.cpp] ([@examples/diffs/multicast/receiver.cpp.html diff to C++03])
* [@../src/examples/cpp11/multicast/sender.cpp] ([@examples/diffs/multicast/sender.cpp.html diff to C++03])
[heading Nonblocking]
Example demonstrating reactor-style operations for integrating a third-party
library that wants to perform the I/O operations itself.
* [@../src/examples/cpp11/nonblocking/third_party_lib.cpp] ([@examples/diffs/nonblocking/third_party_lib.cpp.html diff to C++03])
[heading Operations]
Examples showing how to implement composed asynchronous operations as reusable library functions.
* [@../src/examples/cpp11/operations/composed_1.cpp]
* [@../src/examples/cpp11/operations/composed_2.cpp]
* [@../src/examples/cpp11/operations/composed_3.cpp]
* [@../src/examples/cpp11/operations/composed_4.cpp]
* [@../src/examples/cpp11/operations/composed_5.cpp]
* [@../src/examples/cpp11/operations/composed_6.cpp]
* [@../src/examples/cpp11/operations/composed_7.cpp]
* [@../src/examples/cpp11/operations/composed_8.cpp]
[heading SOCKS 4]
Example client program implementing the SOCKS 4 protocol for communication via
a proxy.
* [@../src/examples/cpp11/socks4/sync_client.cpp] ([@examples/diffs/socks4/sync_client.cpp.html diff to C++03])
* [@../src/examples/cpp11/socks4/socks4.hpp] ([@examples/diffs/socks4/socks4.hpp.html diff to C++03])
[heading Spawn]
Example of using the asio::spawn() function, a wrapper around the
[@http://www.boost.org/doc/libs/release/libs/coroutine/index.html Boost.Coroutine]
library, to implement a chain of asynchronous operations using stackful
coroutines.
* [@../src/examples/cpp11/spawn/echo_server.cpp] ([@examples/diffs/spawn/echo_server.cpp.html diff to C++03])
[heading SSL]
Example client and server programs showing the use of the [link
asio.reference.ssl__stream ssl::stream<>] template with asynchronous operations.
* [@../src/examples/cpp11/ssl/client.cpp] ([@examples/diffs/ssl/client.cpp.html diff to C++03])
* [@../src/examples/cpp11/ssl/server.cpp] ([@examples/diffs/ssl/server.cpp.html diff to C++03])
[heading Timeouts]
A collection of examples showing how to cancel long running asynchronous
operations after a period of time.
* [@../src/examples/cpp11/timeouts/async_tcp_client.cpp] ([@examples/diffs/timeouts/async_tcp_client.cpp.html diff to C++03])
* [@../src/examples/cpp11/timeouts/blocking_tcp_client.cpp] ([@examples/diffs/timeouts/blocking_tcp_client.cpp.html diff to C++03])
* [@../src/examples/cpp11/timeouts/blocking_token_tcp_client.cpp] ([@examples/diffs/timeouts/blocking_token_tcp_client.cpp.html diff to C++03])
* [@../src/examples/cpp11/timeouts/blocking_udp_client.cpp] ([@examples/diffs/timeouts/blocking_udp_client.cpp.html diff to C++03])
* [@../src/examples/cpp11/timeouts/server.cpp] ([@examples/diffs/timeouts/server.cpp.html diff to C++03])
[heading Timers]
Example showing how to customise basic_waitable_timer using a different clock type.
* [@../src/examples/cpp11/timers/time_t_timer.cpp] ([@examples/diffs/timers/time_t_timer.cpp.html diff to C++03])
[heading UNIX Domain Sockets]
Examples showing how to use UNIX domain (local) sockets.
* [@../src/examples/cpp11/local/connect_pair.cpp] ([@examples/diffs/local/connect_pair.cpp.html diff to C++03])
* [@../src/examples/cpp11/local/iostream_client.cpp] ([@examples/diffs/local/iostream_client.cpp.html diff to C++03])
* [@../src/examples/cpp11/local/stream_server.cpp] ([@examples/diffs/local/stream_server.cpp.html diff to C++03])
* [@../src/examples/cpp11/local/stream_client.cpp] ([@examples/diffs/local/stream_client.cpp.html diff to C++03])
[endsect]
[section:cpp14_examples C++14 Examples]
[heading Deferred]
Examples showing how to use the [link asio.reference.experimental__deferred
`experimental::deferred`] completion token.
* [@../src/examples/cpp14/deferred/deferred_1.cpp]
* [@../src/examples/cpp14/deferred/deferred_2.cpp]
* [@../src/examples/cpp14/deferred/deferred_3.cpp]
* [@../src/examples/cpp14/deferred/deferred_4.cpp]
* [@../src/examples/cpp14/deferred/deferred_5.cpp]
* [@../src/examples/cpp14/deferred/deferred_6.cpp]
* [@../src/examples/cpp14/deferred/deferred_7.cpp]
[heading Echo]
A collection of simple clients and servers, showing the use of both synchronous
and asynchronous operations.
* [@../src/examples/cpp14/echo/async_tcp_echo_server.cpp]
* [@../src/examples/cpp14/echo/async_udp_echo_server.cpp]
* [@../src/examples/cpp14/echo/blocking_tcp_echo_client.cpp]
* [@../src/examples/cpp14/echo/blocking_tcp_echo_server.cpp]
* [@../src/examples/cpp14/echo/blocking_udp_echo_client.cpp]
* [@../src/examples/cpp14/echo/blocking_udp_echo_server.cpp]
[heading Executors]
Examples showing how to use the executor-related facilities.
* [@../src/examples/cpp14/executors/actor.cpp]
* [@../src/examples/cpp14/executors/async_1.cpp]
* [@../src/examples/cpp14/executors/async_2.cpp]
* [@../src/examples/cpp14/executors/bank_account_1.cpp]
* [@../src/examples/cpp14/executors/bank_account_2.cpp]
* [@../src/examples/cpp14/executors/fork_join.cpp]
* [@../src/examples/cpp14/executors/pipeline.cpp]
* [@../src/examples/cpp14/executors/priority_scheduler.cpp]
[heading Iostreams]
Two examples showing how to use [link asio.reference.ip__tcp.iostream
ip::tcp::iostream].
* [@../src/examples/cpp14/iostreams/http_client.cpp]
[heading Operations]
Examples showing how to implement composed asynchronous operations as reusable library functions.
* [@../src/examples/cpp14/operations/composed_1.cpp]
* [@../src/examples/cpp14/operations/composed_2.cpp]
* [@../src/examples/cpp14/operations/composed_3.cpp]
* [@../src/examples/cpp14/operations/composed_4.cpp]
* [@../src/examples/cpp14/operations/composed_5.cpp]
* [@../src/examples/cpp14/operations/composed_6.cpp]
* [@../src/examples/cpp14/operations/composed_7.cpp]
* [@../src/examples/cpp14/operations/composed_8.cpp]
[heading Parallel Groups]
Examples showing how to use the [link
asio.reference.experimental__make_parallel_group
`experimental::make_parallel_group`] operation.
* [@../src/examples/cpp14/parallel_group/parallel_sort.cpp]
* [@../src/examples/cpp14/parallel_group/wait_for_all.cpp]
* [@../src/examples/cpp14/parallel_group/wait_for_one.cpp]
* [@../src/examples/cpp14/parallel_group/wait_for_one_error.cpp]
* [@../src/examples/cpp14/parallel_group/wait_for_one_success.cpp]
[endsect]
[section:cpp17_examples C++17 Examples]
[heading Coroutines TS Support]
Examples showing how to implement a chain of asynchronous operations using the
Coroutines TS.
* [@../src/examples/cpp17/coroutines_ts/echo_server.cpp]
* [@../src/examples/cpp17/coroutines_ts/refactored_echo_server.cpp]
* [@../src/examples/cpp17/coroutines_ts/chat_server.cpp]
* [@../src/examples/cpp17/coroutines_ts/range_based_for.cpp]
[endsect]
[endsect]

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "../../../boost/tools/boostbook/dtd/boostbook.dtd">
<!--
Copyright (c) 2003-2021 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)
-->
<section id="asio.index">
<index id="asio.index.index"/>
</section>

View File

@@ -0,0 +1,26 @@
#!/usr/bin/perl -w
# Copyright (c) 2003-2021 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)
use strict;
# Determine version number
my $version = "X.Y.Z";
open(VERSION, "../../include/asio/version.hpp") or die("Can't open version.hpp");
while (my $line = <VERSION>)
{
if ($line =~ /^#define ASIO_VERSION .* \/\/ (.*)$/)
{
$version = $1;
}
}
close(VERSION);
# Generate PDF output
system("bjam asioref");
system("xsltproc --stringparam asio.version $version asioref.xsl asio.docbook > asioref.docbook");
system("dblatex -I overview -s asioref.sty -P table.in.float=0 -o asioref-$version.pdf asioref.docbook");
system("rm asioref.docbook");

View File

@@ -0,0 +1,479 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:net_ts Networking TS compatibility]
Asio now provides the interfaces and functionality specified by the "C++
Extensions for Networking" Technical Specification. In addition to access via
the usual Asio header files, this functionality may be accessed through special
headers that correspond to the header files defined in the TS. These are listed
in the table below:
[table
[[Networking TS header][Asio header]]
[[`#include <buffer>`][`#include <asio/ts/buffer.hpp>`]]
[[`#include <executor>`][`#include <asio/ts/executor.hpp>`]]
[[`#include <internet>`][`#include <asio/ts/internet.hpp>`]]
[[`#include <io_context>`][`#include <asio/ts/io_context.hpp>`]]
[[`#include <net>`][`#include <asio/ts/net.hpp>`]]
[[`#include <netfwd>`][`#include <asio/ts/netfwd.hpp>`]]
[[`#include <socket>`][`#include <asio/ts/socket.hpp>`]]
[[`#include <timer>`][`#include <asio/ts/timer.hpp>`]]
]
In some cases the new Networking TS compatible interfaces supersede older Asio
facilities. In these cases the older interfaces have been deprecated. The table
below shows the new Networking TS interfaces and the facilities they replace:
[table
[[New interface][Old interface][Notes]]
[
[[link asio.reference.io_context `io_context`]]
[[link asio.reference.io_service `io_service`]]
[The name `io_service` is retained as a typedef.]
]
[
[[link asio.reference.dispatch `dispatch`]]
[[link asio.reference.io_context.dispatch `io_service::dispatch`]]
[The `dispatch` free function can be used to submit functions to any [link
asio.reference.Executor1 Executor] or [link asio.reference.ExecutionContext
ExecutionContext].]
]
[
[[link asio.reference.post `post`]]
[[link asio.reference.io_context.post `io_service::post`]]
[The `post` free function can be used to submit functions to any [link
asio.reference.Executor1 Executor] or [link asio.reference.ExecutionContext
ExecutionContext].]
]
[
[[link asio.reference.defer `defer`]]
[[link asio.reference.io_context.post `io_service::post`] when the [link
asio.reference.asio_handler_is_continuation `asio_handler_is_continuation`]
hook returns true]
[The `defer` free function can be used to submit functions to any [link
asio.reference.Executor1 Executor] or [link asio.reference.ExecutionContext
ExecutionContext].]
]
[
[[link asio.reference.io_context.poll `io_context::poll`]]
[[link asio.reference.io_context.poll `io_service::poll`] overload that
takes `error_code&`]
[The `error_code` overload is not required.]
]
[
[[link asio.reference.io_context.poll_one `io_context::poll_one`]]
[[link asio.reference.io_context.poll_one `io_service::poll_one`] overload
that takes `error_code&`]
[The `error_code` overload is not required.]
]
[
[[link asio.reference.io_context.run `io_context::run`]]
[[link asio.reference.io_context.run `io_service::run`] overload that takes
`error_code&`]
[The `error_code` overload is not required.]
]
[
[[link asio.reference.io_context.run_one `io_context::run_one`]]
[[link asio.reference.io_context.run_one `io_service::run_one`] overload
that takes `error_code&`]
[The `error_code` overload is not required.]
]
[
[[link asio.reference.io_context.run_for `io_context::run_for`],
[link asio.reference.io_context.run_until `io_context::run_until`],
[link asio.reference.io_context.run_one_for `io_context::run_one_for`], and
[link asio.reference.io_context.run_one_until `io_context::run_one_until`]]
[]
[These functions add the ability to run an `io_context` for a limited time.]
]
[
[[link asio.reference.io_context.restart `io_context::restart`]]
[[link asio.reference.io_context.reset `io_service::reset`]]
[]
]
[
[[link asio.reference.io_context.io_context `io_context`] constructor
`concurrency_hint` parameter is type `int`]
[[link asio.reference.io_context.io_context `io_context`] constructor
`concurrency_hint` parameter is type `std::size_t`]
[The old constructor has not been retained as a deprecated overload.]
]
[
[[link asio.reference.execution_context `execution_context`], [link
asio.reference.execution_context__service `execution_context::service`],
and [link asio.reference.execution_context__id `execution_context::id`]]
[[link asio.reference.io_context `io_service`], [link
asio.reference.io_context__service `io_service::service`], and [link
asio.reference.execution_context__id `io_service::id`]]
[The service-related functionality has been moved to the
`execution_context` base class. This may also be used as a base for
creating custom execution contexts.]
]
[
[[link asio.reference.execution_context.make_service `make_service`]]
[[link asio.reference.execution_context.add_service `add_service`]]
[]
]
[
[[link asio.reference.strand `strand`]]
[[link asio.reference.io_context__strand `io_service::strand`]]
[This template works with any valid executor, and is itself a valid
executor.]
]
[
[[link asio.reference.executor_work_guard `executor_work_guard`] and [link
asio.reference.make_work_guard `make_work_guard`]]
[[link asio.reference.io_context__work `io_service::work`]]
[Work tracking is now covered by the [link asio.reference.Executor1
Executor] requirements. These templates work with any valid executor.]
]
[
[[link asio.reference.executor_binder `executor_binder`] and [link
asio.reference.bind_executor `bind_executor`]]
[[link asio.reference.io_context.wrap `io_service::wrap`] and
[link asio.reference.io_context__strand.wrap `io_service::strand::wrap`]]
[These templates work with any valid executor.]
]
[
[[link asio.reference.async_result `async_result`] with `CompletionToken`
and `Signature` template parameters]
[`handler_type` and single parameter `async_result`]
[The `async_result` trait is now the single point of customisation for
asynchronous operation completion handlers and return type.]
]
[
[[link asio.reference.associated_executor `associated_executor`] and [link
asio.reference.get_associated_executor `get_associated_executor`]]
[[link asio.reference.asio_handler_invoke `asio_handler_invoke`]]
[The handler invocation hook has been replaced by the new [link
asio.reference.Executor1 Executor] requirements and the associated executor
traits.]
]
[
[[link asio.reference.associated_allocator `associated_allocator`] and
[link asio.reference.get_associated_allocator `get_associated_allocator`]]
[[link asio.reference.asio_handler_allocate `asio_handler_allocate`] and
[link asio.reference.asio_handler_deallocate `asio_handler_deallocate`]]
[The handler allocation hooks have been replaced by the standard Allocator
requirements and the associated allocator traits.]
]
[
[[link asio.reference.const_buffer.data `const_buffer::data`] and [link
asio.reference.mutable_buffer.data `mutable_buffer::data`]]
[[link asio.reference.buffer_cast `buffer_cast`]]
[]
]
[
[[link asio.reference.const_buffer.size `const_buffer::size`] and [link
asio.reference.mutable_buffer.size `mutable_buffer::size`]]
[[link asio.reference.buffer_size `buffer_size`] for single buffers]
[`buffer_size` is not deprecated for single buffers as `const_buffer` and
`mutable_buffer` now satisfy the buffer sequence requirements]
]
[
[[link asio.reference.const_buffer `const_buffer`]]
[[link asio.reference.const_buffers_1 `const_buffers_1`]]
[The [link asio.reference.ConstBufferSequence ConstBufferSequence]
requirements have been modified such that `const_buffer` now satisfies
them.]
]
[
[[link asio.reference.mutable_buffer `mutable_buffer`]]
[[link asio.reference.mutable_buffers_1 `mutable_buffers_1`]]
[The [link asio.reference.MutableBufferSequence MutableBufferSequence]
requirements have been modified such that `mutable_buffer` now satisfies
them.]
]
[
[[link asio.reference.basic_socket.get_executor
`basic_socket::get_executor`] (and corresponding member for I/O objects
such as timers, serial ports, etc.)]
[[link asio.reference.basic_io_object.get_io_service
`basic_io_object::get_io_service`]]
[Use `get_executor().context()` to obtain the associated `io_context`.]
]
[
[[link asio.reference.socket_base.max_listen_connections
`socket_base::max_listen_connections`]]
[[link asio.reference.socket_base.max_connections
`socket_base::max_connections`]]
[]
]
[
[[link asio.reference.socket_base.wait_type `socket_base::wait_type`],
[link asio.reference.basic_socket.wait `basic_socket::wait`], [link
asio.reference.basic_socket.async_wait `basic_socket::async_wait`], [link
asio.reference.basic_socket_acceptor.wait `basic_socket_acceptor::wait`],
and [link asio.reference.basic_socket_acceptor.async_wait
`basic_socket_acceptor::async_wait`]]
[[link asio.reference.null_buffers `null_buffers`]]
[Operations for reactive I/O.]
]
[
[[link asio.reference.basic_socket_acceptor.accept
`basic_socket_acceptor::accept`] returns a socket]
[[link asio.reference.basic_socket_acceptor.accept
`basic_socket_acceptor::accept`] takes a socket by reference]
[Uses move support so requires C++11 or later. To accept a connection into
a socket object on a different `io_context`, pass the destination context
to `accept`.]
]
[
[[link asio.reference.basic_socket_acceptor.async_accept
`basic_socket_acceptor::async_accept`] passes socket to handler]
[[link asio.reference.basic_socket_acceptor.async_accept
`basic_socket_acceptor::async_accept`] takes a socket by reference]
[Uses move support so requires C++11 or later. To accept a connection into
a socket object on a different `io_context`, pass the destination context
to `async_accept`.]
]
[
[[link asio.reference.connect `connect`] overloads that take a range]
[[link asio.reference.connect `connect`] overloads that take a single
iterator]
[The [link asio.reference.ip__basic_resolver.resolve
`ip::basic_resolver::resolve`] function now returns a range. When the
`resolve` function's result is passed directly to `connect`, the range
overload will be selected.]
]
[
[[link asio.reference.async_connect `async_connect`] overloads that take a
range]
[[link asio.reference.async_connect `async_connect`] overloads that take a
single iterator]
[The [link asio.reference.ip__basic_resolver.resolve
`ip::basic_resolver::resolve`] function now returns a range. When the
`resolve` function's result is passed directly to `async_connect`, the
range overload will be selected.]
]
[
[[link asio.reference.basic_socket_streambuf.duration
`basic_socket_streambuf::duration`]]
[[link asio.reference.basic_socket_streambuf.duration_type
`basic_socket_streambuf::duration_type`]]
[]
]
[
[[link asio.reference.basic_socket_streambuf.time_point
`basic_socket_streambuf::time_point`]]
[[link asio.reference.basic_socket_streambuf.time_type
`basic_socket_streambuf::time_type`]]
[]
]
[
[[link asio.reference.basic_socket_streambuf.expiry
`basic_socket_streambuf::expiry`]]
[[link asio.reference.basic_socket_streambuf.expires_at
`basic_socket_streambuf::expires_at`] and [link
asio.reference.basic_socket_streambuf.expires_from_now
`basic_socket_streambuf::expires_from_now`] getters]
[]
]
[
[[link asio.reference.basic_socket_streambuf.expires_after
`basic_socket_streambuf::expires_after`]]
[[link asio.reference.basic_socket_streambuf.expires_from_now
`basic_socket_streambuf::expires_from_now`] setter]
[]
]
[
[[link asio.reference.basic_socket_streambuf.error
`basic_socket_streambuf::error`]]
[[link asio.reference.basic_socket_streambuf.puberror
`basic_socket_streambuf::puberror`]]
[]
]
[
[[link asio.reference.basic_socket_iostream.duration
`basic_socket_iostream::duration`]]
[[link asio.reference.basic_socket_iostream.duration_type
`basic_socket_iostream::duration_type`]]
[]
]
[
[[link asio.reference.basic_socket_iostream.time_point
`basic_socket_iostream::time_point`]]
[[link asio.reference.basic_socket_iostream.time_type
`basic_socket_iostream::time_type`]]
[]
]
[
[[link asio.reference.basic_socket_iostream.expiry
`basic_socket_iostream::expiry`]]
[[link asio.reference.basic_socket_iostream.expires_at
`basic_socket_iostream::expires_at`] and [link
asio.reference.basic_socket_iostream.expires_from_now
`basic_socket_iostream::expires_from_now`] getters]
[]
]
[
[[link asio.reference.basic_socket_iostream.expires_after
`basic_socket_iostream::expires_after`]]
[[link asio.reference.basic_socket_iostream.expires_from_now
`basic_socket_iostream::expires_from_now`] setter]
[]
]
[
[[link asio.reference.basic_waitable_timer.cancel
`basic_waitable_timer::cancel`]]
[[link asio.reference.basic_waitable_timer.cancel
`basic_waitable_timer::cancel`] overload that takes `error_code&`]
[The `error_code` overload is not required.]
]
[
[[link asio.reference.basic_waitable_timer.cancel_one
`basic_waitable_timer::cancel_one`]]
[[link asio.reference.basic_waitable_timer.cancel_one
`basic_waitable_timer::cancel_one`] overload that takes `error_code&`]
[The `error_code` overload is not required.]
]
[
[[link asio.reference.basic_waitable_timer.expires_at
`basic_waitable_timer::expires_at`] setter]
[[link asio.reference.basic_waitable_timer.expires_at
`basic_waitable_timer::expires_at`] setter that takes `error_code&`]
[The `error_code` overload is not required.]
]
[
[[link asio.reference.basic_waitable_timer.expiry
`basic_waitable_timer::expiry`]]
[[link asio.reference.basic_waitable_timer.expires_at
`basic_waitable_timer::expires_at`] and [link
asio.reference.basic_waitable_timer.expires_from_now
`basic_waitable_timer::expires_from_now`] getters]
[]
]
[
[[link asio.reference.basic_waitable_timer.expires_after
`basic_waitable_timer::expires_after`]]
[[link asio.reference.basic_waitable_timer.expires_from_now
`basic_waitable_timer::expires_from_now`] setter]
[]
]
[
[[link asio.reference.ip__address.make_address `ip::make_address`]]
[[link asio.reference.ip__address.from_string `ip::address::from_string`]]
[]
]
[
[[link asio.reference.ip__address_v4.make_address_v4 `ip::make_address_v4`]]
[[link asio.reference.ip__address_v4.from_string
`ip::address_v4::from_string`] and [link
asio.reference.ip__address_v6.to_v4 `ip::address_v6::to_v4`]]
[]
]
[
[[link asio.reference.ip__address_v6.make_address_v6 `ip::make_address_v6`]]
[[link asio.reference.ip__address_v6.from_string
`ip::address_v6::from_string`] and [link
asio.reference.ip__address_v6.v4_mapped `ip::address_v6::v4_mapped`]]
[]
]
[
[[link asio.reference.ip__address.to_string `ip::address::to_string`]]
[[link asio.reference.ip__address.to_string `ip::address::to_string`] that
takes `error_code&`]
[The `error_code` overload is not required.]
]
[
[[link asio.reference.ip__address_v4.to_string `ip::address_v4::to_string`]]
[[link asio.reference.ip__address_v4.to_string `ip::address_v4::to_string`]
that takes `error_code&`]
[The `error_code` overload is not required.]
]
[
[[link asio.reference.ip__address_v6.to_string `ip::address_v6::to_string`]]
[[link asio.reference.ip__address_v6.to_string `ip::address_v6::to_string`]
that takes `error_code&`]
[The `error_code` overload is not required.]
]
[
[No replacement]
[[link asio.reference.ip__address_v6.is_v4_compatible
`ip::address_v6::is_v4_compatible`] and [link
asio.reference.ip__address_v6.v4_compatible
`ip::address_v6::v4_compatible`]]
[]
]
[
[[link asio.reference.ip__network_v4 `ip::network_v4`]]
[[link asio.reference.ip__address_v4.broadcast `ip::address_v4::broadcast`],
[link asio.reference.ip__address_v4.is_class_a `ip::address_v4::is_class_a`],
[link asio.reference.ip__address_v4.is_class_b `ip::address_v4::is_class_b`],
[link asio.reference.ip__address_v4.is_class_c `ip::address_v4::is_class_c`],
and [link asio.reference.ip__address_v4.netmask `ip::address_v4::netmask`]]
[The `network_v4` class adds the ability to manipulate IPv4 network
addresses using CIDR notation.]
]
[
[[link asio.reference.ip__network_v6 `ip::network_v6`]]
[]
[The `network_v6` class adds the ability to manipulate IPv6 network
addresses using CIDR notation.]
]
[
[[link asio.reference.ip__basic_address_iterator_lt__address_v4__gt_
`ip::address_v4_iterator`] and [link
asio.reference.ip__basic_address_range_lt__address_v4__gt_
`ip::address_v4_range`]]
[]
[The `ip::address_v4_iterator` and `address_v4_range` classes add the
ability to iterate over all, or a subset of, IPv4 addresses.]
]
[
[[link asio.reference.ip__basic_address_iterator_lt__address_v6__gt_
`ip::address_v6_iterator`] and [link
asio.reference.ip__basic_address_range_lt__address_v6__gt_
`ip::address_v6_range`]]
[]
[The `ip::address_v6_iterator` and `address_v6_range` classes add the
ability to iterate over all, or a subset of, IPv6 addresses.]
]
[
[[link asio.reference.ip__basic_resolver.results_type
`ip::basic_resolver::results_type`]]
[[link asio.reference.ip__basic_resolver.iterator
`ip::basic_resolver::iterator`]]
[Resolvers now produce ranges rather than single iterators.]
]
[
[[link asio.reference.ip__basic_resolver.resolve
`ip::basic_resolver::resolve`] overloads taking hostname and service as
arguments]
[[link asio.reference.ip__basic_resolver.resolve
`ip::basic_resolver::resolve`] overloads taking a [link
asio.reference.ip__basic_resolver.query `ip::basic_resolver::query`]]
[]
]
[
[[link asio.reference.ip__basic_resolver.resolve
`ip::basic_resolver::resolve`] returns a range]
[[link asio.reference.ip__basic_resolver.resolve
`ip::basic_resolver::resolve`] returns a single iterator]
[]
]
[
[[link asio.reference.ip__basic_resolver.async_resolve
`ip::basic_resolver::async_resolve`] overloads taking hostname and service
as arguments]
[[link asio.reference.ip__basic_resolver.async_resolve
`ip::basic_resolver::async_resolve`] overloads taking a [link
asio.reference.ip__basic_resolver.query `ip::basic_resolver::query`]]
[]
]
[
[[link asio.reference.ip__basic_resolver.async_resolve
`ip::basic_resolver::async_resolve`] calls the handler with a range]
[[link asio.reference.ip__basic_resolver.async_resolve
`ip::basic_resolver::async_resolve`] calls the handler with a single
iterator]
[]
]
]
[endsect]

View File

@@ -0,0 +1,3 @@
/**
\class noncopyable
*/

View File

@@ -0,0 +1,116 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:overview Overview]
* [link asio.overview.rationale Rationale]
* [link asio.overview.core Core Concepts and Functionality]
* [link asio.overview.core.basics Basic Asio Anatomy]
* [link asio.overview.core.async The Proactor Design Pattern: Concurrency Without Threads]
* [link asio.overview.core.threads Threads and Asio]
* [link asio.overview.core.strands Strands: Use Threads Without Explicit Locking]
* [link asio.overview.core.buffers Buffers]
* [link asio.overview.core.streams Streams, Short Reads and Short Writes]
* [link asio.overview.core.reactor Reactor-Style Operations]
* [link asio.overview.core.line_based Line-Based Operations]
* [link asio.overview.core.allocation Custom Memory Allocation]
* [link asio.overview.core.cancellation Per-Operation Cancellation]
* [link asio.overview.core.handler_tracking Handler Tracking]
* [link asio.overview.core.concurrency_hint Concurrency Hints]
* [link asio.overview.core.coroutine Stackless Coroutines]
* [link asio.overview.core.spawn Stackful Coroutines]
* [link asio.overview.core.cpp20_coroutines C++20 Coroutines Support]
* [link asio.overview.networking Networking]
* [link asio.overview.networking.protocols TCP, UDP and ICMP]
* [link asio.overview.networking.other_protocols Support for Other Protocols]
* [link asio.overview.networking.iostreams Socket Iostreams]
* [link asio.overview.networking.bsd_sockets The BSD Socket API and Asio]
* [link asio.overview.timers Timers]
* [link asio.overview.serial_ports Serial Ports]
* [link asio.overview.signals Signal Handling]
* [link asio.overview.posix POSIX-Specific Functionality]
* [link asio.overview.posix.local UNIX Domain Sockets]
* [link asio.overview.posix.stream_descriptor Stream-Oriented File Descriptors]
* [link asio.overview.posix.fork Fork]
* [link asio.overview.windows Windows-Specific Functionality]
* [link asio.overview.windows.stream_handle Stream-Oriented HANDLEs]
* [link asio.overview.windows.random_access_handle Random-Access HANDLEs]
* [link asio.overview.windows.object_handle Object HANDLEs]
* [link asio.overview.ssl SSL]
* [link asio.overview.cpp2011 C++ 2011 Support]
* [link asio.overview.cpp2011.move_objects Movable I/O Objects]
* [link asio.overview.cpp2011.move_handlers Movable Handlers]
* [link asio.overview.cpp2011.variadic Variadic Templates]
* [link asio.overview.cpp2011.array Array Container]
* [link asio.overview.cpp2011.atomic Atomics]
* [link asio.overview.cpp2011.shared_ptr Shared Pointers]
* [link asio.overview.cpp2011.chrono Chrono]
* [link asio.overview.cpp2011.futures Futures]
* [link asio.overview.implementation Platform-Specific Implementation Notes]
[include overview/rationale.qbk]
[section:core Core Concepts and Functionality]
* [link asio.overview.core.basics Basic Asio Anatomy]
* [link asio.overview.core.async The Proactor Design Pattern: Concurrency Without Threads]
* [link asio.overview.core.threads Threads and Asio]
* [link asio.overview.core.strands Strands: Use Threads Without Explicit Locking]
* [link asio.overview.core.buffers Buffers]
* [link asio.overview.core.streams Streams, Short Reads and Short Writes]
* [link asio.overview.core.reactor Reactor-Style Operations]
* [link asio.overview.core.line_based Line-Based Operations]
* [link asio.overview.core.allocation Custom Memory Allocation]
* [link asio.overview.core.cancellation Per-Operation Cancellation]
* [link asio.overview.core.handler_tracking Handler Tracking]
* [link asio.overview.core.concurrency_hint Concurrency Hints]
* [link asio.overview.core.coroutine Stackless Coroutines]
* [link asio.overview.core.spawn Stackful Coroutines]
* [link asio.overview.core.cpp20_coroutines C++20 Coroutines Support]
[include overview/basics.qbk]
[include overview/async.qbk]
[include overview/threads.qbk]
[include overview/strands.qbk]
[include overview/buffers.qbk]
[include overview/streams.qbk]
[include overview/reactor.qbk]
[include overview/line_based.qbk]
[include overview/allocation.qbk]
[include overview/cancellation.qbk]
[include overview/handler_tracking.qbk]
[include overview/concurrency_hint.qbk]
[include overview/coroutine.qbk]
[include overview/spawn.qbk]
[include overview/cpp20_coroutines.qbk]
[endsect]
[section:networking Networking]
* [link asio.overview.networking.protocols TCP, UDP and ICMP]
* [link asio.overview.networking.other_protocols Support for Other Protocols]
* [link asio.overview.networking.iostreams Socket Iostreams]
* [link asio.overview.networking.bsd_sockets The BSD Socket API and Asio]
[include overview/protocols.qbk]
[include overview/other_protocols.qbk]
[include overview/iostreams.qbk]
[include overview/bsd_sockets.qbk]
[endsect]
[include overview/timers.qbk]
[include overview/serial_ports.qbk]
[include overview/signals.qbk]
[include overview/posix.qbk]
[include overview/windows.qbk]
[include overview/ssl.qbk]
[include overview/cpp2011.qbk]
[include overview/implementation.qbk]
[endsect]

View File

@@ -0,0 +1,89 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:allocation Custom Memory Allocation]
Many asynchronous operations need to allocate an object to store state
associated with the operation. For example, a Win32 implementation needs
`OVERLAPPED`-derived objects to pass to Win32 API functions.
Furthermore, programs typically contain easily identifiable chains of
asynchronous operations. A half duplex protocol implementation (e.g. an HTTP
server) would have a single chain of operations per client (receives followed
by sends). A full duplex protocol implementation would have two chains
executing in parallel. Programs should be able to leverage this knowledge to
reuse memory for all asynchronous operations in a chain.
Given a copy of a user-defined `Handler` object `h`, if the implementation
needs to allocate memory associated with that handler it will obtain an
allocator using the `get_associated_allocator` function. For example:
asio::associated_allocator_t<Handler> a = asio::get_associated_allocator(h);
The associated allocator must satisfy the standard Allocator requirements.
By default, handlers use the standard allocator (which is implemented in terms
of `::operator new()` and `::operator delete()`). The allocator may be
customised for a particular handler type by specifying a nested type
`allocator_type` and member function `get_allocator()`:
class my_handler
{
public:
// Custom implementation of Allocator type requirements.
typedef my_allocator allocator_type;
// Return a custom allocator implementation.
allocator_type get_allocator() const noexcept
{
return my_allocator();
}
void operator()() { ... }
};
In more complex cases, the `associated_allocator` template may be partially
specialised directly:
namespace asio {
template <typename Allocator>
struct associated_allocator<my_handler, Allocator>
{
// Custom implementation of Allocator type requirements.
typedef my_allocator type;
// Return a custom allocator implementation.
static type get(const my_handler&,
const Allocator& a = Allocator()) noexcept
{
return my_allocator();
}
};
} // namespace asio
The implementation guarantees that the deallocation will occur before the
associated handler is invoked, which means the memory is ready to be reused for
any new asynchronous operations started by the handler.
The custom memory allocation functions may be called from any user-created
thread that is calling a library function. The implementation guarantees that,
for the asynchronous operations included the library, the implementation will
not make concurrent calls to the memory allocation functions for that handler.
The implementation will insert appropriate memory barriers to ensure correct
memory visibility should allocation functions need to be called from different
threads.
[heading See Also]
[link asio.reference.associated_allocator associated_allocator],
[link asio.reference.get_associated_allocator get_associated_allocator],
[link asio.examples.cpp03_examples.allocation custom memory allocation example (C++03)],
[link asio.examples.cpp11_examples.allocation custom memory allocation example (C++11)].
[endsect]

View File

@@ -0,0 +1,185 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:async The Proactor Design Pattern: Concurrency Without Threads]
The Asio library offers side-by-side support for synchronous and asynchronous
operations. The asynchronous support is based on the Proactor design pattern
[link asio.overview.core.async.references \[POSA2\]]. The advantages and
disadvantages of this approach, when compared to a synchronous-only or Reactor
approach, are outlined below.
[heading Proactor and Asio]
Let us examine how the Proactor design pattern is implemented in Asio,
without reference to platform-specific details.
[$proactor.png]
[*Proactor design pattern (adapted from \[POSA2\])]
[mdash] Asynchronous Operation
[:Defines an operation that is executed asynchronously, such as an asynchronous
read or write on a socket.]
[mdash] Asynchronous Operation Processor
[:Executes asynchronous operations and queues events on a completion event
queue when operations complete. From a high-level point of view, internal
services like `reactive_socket_service` are asynchronous operation processors.]
[mdash] Completion Event Queue
[:Buffers completion events until they are dequeued by an asynchronous event
demultiplexer.]
[mdash] Completion Handler
[:Processes the result of an asynchronous operation. These are function
objects, often created using `boost::bind`.]
[mdash] Asynchronous Event Demultiplexer
[:Blocks waiting for events to occur on the completion event queue, and returns
a completed event to its caller.]
[mdash] Proactor
[:Calls the asynchronous event demultiplexer to dequeue events, and dispatches
the completion handler (i.e. invokes the function object) associated with the
event. This abstraction is represented by the `io_context` class.]
[mdash] Initiator
[:Application-specific code that starts asynchronous operations. The initiator
interacts with an asynchronous operation processor via a high-level interface
such as `basic_stream_socket`, which in turn delegates to a service like
`reactive_socket_service`.]
[heading Implementation Using Reactor]
On many platforms, Asio implements the Proactor design pattern in terms
of a Reactor, such as `select`, `epoll` or `kqueue`. This implementation
approach corresponds to the Proactor design pattern as follows:
[mdash] Asynchronous Operation Processor
[:A reactor implemented using `select`, `epoll` or `kqueue`. When the reactor
indicates that the resource is ready to perform the operation, the processor
executes the asynchronous operation and enqueues the associated completion
handler on the completion event queue.]
[mdash] Completion Event Queue
[:A linked list of completion handlers (i.e. function objects).]
[mdash] Asynchronous Event Demultiplexer
[:This is implemented by waiting on an event or condition variable until a
completion handler is available in the completion event queue.]
[heading Implementation Using Windows Overlapped I/O]
On Windows NT, 2000 and XP, Asio takes advantage of overlapped I/O to
provide an efficient implementation of the Proactor design pattern. This
implementation approach corresponds to the Proactor design pattern as follows:
[mdash] Asynchronous Operation Processor
[:This is implemented by the operating system. Operations are initiated by
calling an overlapped function such as `AcceptEx`.]
[mdash] Completion Event Queue
[:This is implemented by the operating system, and is associated with an I/O
completion port. There is one I/O completion port for each `io_context`
instance.]
[mdash] Asynchronous Event Demultiplexer
[:Called by Asio to dequeue events and their associated completion
handlers.]
[heading Advantages]
[mdash] Portability.
[:Many operating systems offer a native asynchronous I/O API (such as
overlapped I/O on __Windows__) as the preferred option for developing high
performance network applications. The library may be implemented in terms of
native asynchronous I/O. However, if native support is not available, the
library may also be implemented using synchronous event demultiplexors that
typify the Reactor pattern, such as __POSIX__ `select()`.]
[mdash] Decoupling threading from concurrency.
[:Long-duration operations are performed asynchronously by the implementation
on behalf of the application. Consequently applications do not need to spawn
many threads in order to increase concurrency.]
[mdash] Performance and scalability.
[:Implementation strategies such as thread-per-connection (which a
synchronous-only approach would require) can degrade system performance, due to
increased context switching, synchronisation and data movement among CPUs. With
asynchronous operations it is possible to avoid the cost of context switching
by minimising the number of operating system threads [mdash] typically a
limited resource [mdash] and only activating the logical threads of control
that have events to process.]
[mdash] Simplified application synchronisation.
[:Asynchronous operation completion handlers can be written as though they
exist in a single-threaded environment, and so application logic can be
developed with little or no concern for synchronisation issues.]
[mdash] Function composition.
[:Function composition refers to the implementation of functions to provide a
higher-level operation, such as sending a message in a particular format. Each
function is implemented in terms of multiple calls to lower-level read or write
operations.]
[:For example, consider a protocol where each message consists of a
fixed-length header followed by a variable length body, where the length of the
body is specified in the header. A hypothetical read_message operation could be
implemented using two lower-level reads, the first to receive the header and,
once the length is known, the second to receive the body.]
[:To compose functions in an asynchronous model, asynchronous operations can be
chained together. That is, a completion handler for one operation can initiate
the next. Starting the first call in the chain can be encapsulated so that the
caller need not be aware that the higher-level operation is implemented as a
chain of asynchronous operations.]
[:The ability to compose new operations in this way simplifies the development
of higher levels of abstraction above a networking library, such as functions
to support a specific protocol.]
[heading Disadvantages]
[mdash] Program complexity.
[:It is more difficult to develop applications using asynchronous mechanisms
due to the separation in time and space between operation initiation and
completion. Applications may also be harder to debug due to the inverted flow
of control.]
[mdash] Memory usage.
[:Buffer space must be committed for the duration of a read or write operation,
which may continue indefinitely, and a separate buffer is required for each
concurrent operation. The Reactor pattern, on the other hand, does not require
buffer space until a socket is ready for reading or writing.]
[heading References]
\[POSA2\] D. Schmidt et al, ['Pattern Oriented Software Architecture, Volume
2]. Wiley, 2000.
[endsect]

View File

@@ -0,0 +1,78 @@
digraph g
{
graph
[
nodesep="0.2"
];
edge
[
fontname="Helvetica",
fontsize=10,
labelfontname="Helvetica",
labelfontsize=10
];
node
[
fontname="Helvetica",
fontsize=10,
shape=box
];
edge
[
arrowhead="open"
]
// Program elements.
{
operating_system [ label="Operating System", shape=ellipse ];
io_context [ label="I/O Execution Context\ne.g. io_context" ];
io_object [ label="I/O Object\ne.g. socket" ];
your_program [ label="Your Program" ];
your_completion_handler [ label="Your Completion Handler" ];
}
// Owning relationships.
{
edge [ arrowtail="diamond" ];
your_program:e -> your_completion_handler:n;
your_program:w -> io_object:nw;
your_program:se -> io_context:ne;
}
// Non-owning relationships;
{
io_object:sw -> io_context:w;
}
// Visible actions.
{
edge [ style="dashed", color="#808080" ];
// Forward actions.
{
your_program:sw -> io_object:n [ label="1" ];
io_object:s -> io_context:nw [ label="2" ];
io_context:s -> operating_system:n [ label="3" ];
}
}
// Invisible actions.
{
edge [ style="invis" ];
// Forward actions.
{
your_program:s -> io_context:n [ label="5" ];
}
// Reverse actions.
{
edge [ arrowhead="none", arrowtail="open" ];
//io_context:s -> operating_system:n [ label="4" ];
your_completion_handler:s -> io_context:e [ label="6" ];
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@@ -0,0 +1,78 @@
digraph g
{
graph
[
nodesep="0.2"
];
edge
[
fontname="Helvetica",
fontsize=10,
labelfontname="Helvetica",
labelfontsize=10
];
node
[
fontname="Helvetica",
fontsize=10,
shape=box
];
edge
[
arrowhead="open"
]
// Program elements.
{
operating_system [ label="Operating System", shape=ellipse ];
io_context [ label="I/O Execution Context\ne.g. io_context" ];
io_object [ label="I/O Object\ne.g. socket" ];
your_program [ label="Your Program" ];
your_completion_handler [ label="Your Completion Handler" ];
}
// Owning relationships.
{
edge [ arrowtail="diamond" ];
your_program:e -> your_completion_handler:n;
your_program:w -> io_object:nw;
your_program:se -> io_context:ne;
}
// Non-owning relationships;
{
io_object:sw -> io_context:w;
}
// Visible actions.
{
edge [ style="dashed", color="#808080" ];
// Forward actions.
{
your_program:s -> io_context:n [ label="5" ];
}
// Reverse actions.
{
edge [ arrowhead="none", arrowtail="open" ];
io_context:s -> operating_system:n [ label="4" ];
your_completion_handler:s -> io_context:e [ label="6" ];
}
}
// Invisible actions.
{
edge [ style="invis" ];
// Forward actions.
{
your_program:sw -> io_object:n [ label="1" ];
io_object:s -> io_context:nw [ label="2" ];
//io_context:s -> operating_system:n [ label="3" ];
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@@ -0,0 +1,111 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:basics Basic Asio Anatomy]
Asio may be used to perform both synchronous and asynchronous operations on I/O
objects such as sockets. Before using Asio it may be useful to get a conceptual
picture of the various parts of Asio, your program, and how they work together.
As an introductory example, let's consider what happens when you perform a
connect operation on a socket. We shall start by examining synchronous
operations.
[$sync_op.png]
[*Your program] will have at least one [*I/O execution context], such as an
`asio::io_context` object, `asio::thread_pool` object, or
`asio::system_context`. This [*I/O execution context] represents [*your
program]'s link to the [*operating system]'s I/O services.
asio::io_context io_context;
To perform I/O operations [*your program] will need an [*I/O object] such as a
TCP socket:
asio::ip::tcp::socket socket(io_context);
When a synchronous connect operation is performed, the following sequence of
events occurs:
1. [*Your program] initiates the connect operation by calling the [*I/O
object]:
socket.connect(server_endpoint);
2. The [*I/O object] forwards the request to the [*I/O execution context].
3. The [*I/O execution context] calls on the [*operating system] to perform the
connect operation.
4. The [*operating system] returns the result of the operation to the
[*I/O execution context].
5. The [*I/O execution context] translates any error resulting from the
operation into an object of type `asio::error_code`. An `error_code` may be
compared with specific values, or tested as a boolean (where a `false` result
means that no error occurred). The result is then forwarded back up to the
[*I/O object].
6. The [*I/O object] throws an exception of type `asio::system_error` if the
operation failed. If the code to initiate the operation had instead been
written as:
asio::error_code ec;
socket.connect(server_endpoint, ec);
then the `error_code` variable `ec` would be set to the result of the
operation, and no exception would be thrown.
When an asynchronous operation is used, a different sequence of events occurs.
[$async_op1.png]
1. [*Your program] initiates the connect operation by calling the [*I/O
object]:
socket.async_connect(server_endpoint, your_completion_handler);
where `your_completion_handler` is a function or function object with the
signature:
void your_completion_handler(const asio::error_code& ec);
The exact signature required depends on the asynchronous operation being
performed. The reference documentation indicates the appropriate form for each
operation.
2. The [*I/O object] forwards the request to the [*I/O execution context].
3. The [*I/O execution context] signals to the [*operating system] that it
should start an asynchronous connect.
Time passes. (In the synchronous case this wait would have been contained
entirely within the duration of the connect operation.)
[$async_op2.png]
4. The [*operating system] indicates that the connect operation has completed
by placing the result on a queue, ready to be picked up by the [*I/O execution
context].
5. When using an `io_context` as the [*I/O execution context], [*your program]
must make a call to `io_context::run()` (or to one of the similar `io_context`
member functions) in order for the result to be retrieved. A call to
`io_context::run()` blocks while there are unfinished asynchronous operations,
so you would typically call it as soon as you have started your first
asynchronous operation.
6. While inside the call to `io_context::run()`, the [*I/O execution context]
dequeues the result of the operation, translates it into an `error_code`, and
then passes it to [*your completion handler].
This is a simplified picture of how Asio operates. You will want to delve
further into the documentation if your needs are more advanced, such as
extending Asio to perform other types of asynchronous operations.
[endsect]

View File

@@ -0,0 +1,270 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:bsd_sockets The BSD Socket API and Asio]
The Asio library includes a low-level socket interface based on the BSD socket
API, which is widely implemented and supported by extensive literature. It is
also used as the basis for networking APIs in other languages, like Java. This
low-level interface is designed to support the development of efficient and
scalable applications. For example, it permits programmers to exert finer
control over the number of system calls, avoid redundant data copying, minimise
the use of resources like threads, and so on.
Unsafe and error prone aspects of the BSD socket API are not included. For
example, the use of `int` to represent all sockets lacks type safety. The
socket representation in Asio uses a distinct type for each protocol, e.g. for
TCP one would use `ip::tcp::socket`, and for UDP one uses `ip::udp::socket`.
The following table shows the mapping between the BSD socket API and Asio:
[table
[
[BSD Socket API Elements]
[Equivalents in Asio]
]
[
[socket descriptor - `int` (POSIX) or `SOCKET` (Windows)]
[ For TCP: [link asio.reference.ip__tcp.socket ip::tcp::socket],
[link asio.reference.ip__tcp.acceptor ip::tcp::acceptor]
For UDP: [link asio.reference.ip__udp.socket ip::udp::socket]
[link asio.reference.basic_socket basic_socket],
[link asio.reference.basic_stream_socket basic_stream_socket],
[link asio.reference.basic_datagram_socket basic_datagram_socket],
[link asio.reference.basic_raw_socket basic_raw_socket] ]
]
[
[`in_addr`,
`in6_addr`]
[ [link asio.reference.ip__address ip::address],
[link asio.reference.ip__address ip::address_v4],
[link asio.reference.ip__address ip::address_v6] ]
]
[
[`sockaddr_in`,
`sockaddr_in6`]
[ For TCP: [link asio.reference.ip__tcp.endpoint ip::tcp::endpoint]
For UDP: [link asio.reference.ip__udp.endpoint ip::udp::endpoint]
[link asio.reference.ip__basic_endpoint ip::basic_endpoint] ]
]
[
[`accept()`]
[ For TCP: [link asio.reference.basic_socket_acceptor.accept ip::tcp::acceptor::accept()]
[link asio.reference.basic_socket_acceptor.accept basic_socket_acceptor::accept()] ]
]
[
[`bind()`]
[ For TCP: [link asio.reference.basic_socket.bind ip::tcp::acceptor::bind()],
[link asio.reference.basic_socket.bind ip::tcp::socket::bind()]
For UDP: [link asio.reference.basic_socket.bind ip::udp::socket::bind()]
[link asio.reference.basic_socket.bind basic_socket::bind()] ]
]
[
[`close()`]
[ For TCP: [link asio.reference.basic_socket.close ip::tcp::acceptor::close()],
[link asio.reference.basic_socket.close ip::tcp::socket::close()]
For UDP: [link asio.reference.basic_socket.close ip::udp::socket::close()]
[link asio.reference.basic_socket.close basic_socket::close()] ]
]
[
[`connect()`]
[ For TCP: [link asio.reference.basic_socket.connect ip::tcp::socket::connect()]
For UDP: [link asio.reference.basic_socket.connect ip::udp::socket::connect()]
[link asio.reference.basic_socket.connect basic_socket::connect()] ]
]
[
[`getaddrinfo()`,
`gethostbyaddr()`,
`gethostbyname()`,
`getnameinfo()`,
`getservbyname()`,
`getservbyport()`]
[ For TCP: [link asio.reference.ip__basic_resolver.resolve ip::tcp::resolver::resolve()],
[link asio.reference.ip__basic_resolver.async_resolve ip::tcp::resolver::async_resolve()]
For UDP: [link asio.reference.ip__basic_resolver.resolve ip::udp::resolver::resolve()],
[link asio.reference.ip__basic_resolver.async_resolve ip::udp::resolver::async_resolve()]
[link asio.reference.ip__basic_resolver.resolve ip::basic_resolver::resolve()],
[link asio.reference.ip__basic_resolver.async_resolve ip::basic_resolver::async_resolve()] ]
]
[
[`gethostname()`]
[ [link asio.reference.ip__host_name ip::host_name()] ]
]
[
[`getpeername()`]
[ For TCP: [link asio.reference.basic_socket.remote_endpoint ip::tcp::socket::remote_endpoint()]
For UDP: [link asio.reference.basic_socket.remote_endpoint ip::udp::socket::remote_endpoint()]
[link asio.reference.basic_socket.remote_endpoint basic_socket::remote_endpoint()] ]
]
[
[`getsockname()`]
[ For TCP: [link asio.reference.basic_socket.local_endpoint ip::tcp::acceptor::local_endpoint()],
[link asio.reference.basic_socket.local_endpoint ip::tcp::socket::local_endpoint()]
For UDP: [link asio.reference.basic_socket.local_endpoint ip::udp::socket::local_endpoint()]
[link asio.reference.basic_socket.local_endpoint basic_socket::local_endpoint()] ]
]
[
[`getsockopt()`]
[ For TCP: [link asio.reference.basic_socket.get_option ip::tcp::acceptor::get_option()],
[link asio.reference.basic_socket.get_option ip::tcp::socket::get_option()]
For UDP: [link asio.reference.basic_socket.get_option ip::udp::socket::get_option()]
[link asio.reference.basic_socket.get_option basic_socket::get_option()] ]
]
[
[`inet_addr()`,
`inet_aton()`,
`inet_pton()`]
[ [link asio.reference.ip__address.from_string ip::address::from_string()],
[link asio.reference.ip__address.from_string ip::address_v4::from_string()],
[link asio.reference.ip__address.from_string ip_address_v6::from_string()] ]
]
[
[`inet_ntoa()`,
`inet_ntop()`]
[ [link asio.reference.ip__address.to_string ip::address::to_string()],
[link asio.reference.ip__address.to_string ip::address_v4::to_string()],
[link asio.reference.ip__address.to_string ip_address_v6::to_string()] ]
]
[
[`ioctl()`]
[ For TCP: [link asio.reference.basic_socket.io_control ip::tcp::socket::io_control()]
For UDP: [link asio.reference.basic_socket.io_control ip::udp::socket::io_control()]
[link asio.reference.basic_socket.io_control basic_socket::io_control()] ]
]
[
[`listen()`]
[ For TCP: [link asio.reference.basic_socket_acceptor.listen ip::tcp::acceptor::listen()]
[link asio.reference.basic_socket_acceptor.listen basic_socket_acceptor::listen()] ]
]
[
[`poll()`,
`select()`,
`pselect()`]
[ [link asio.reference.io_context.run io_context::run()],
[link asio.reference.io_context.run_one io_context::run_one()],
[link asio.reference.io_context.poll io_context::poll()],
[link asio.reference.io_context.poll_one io_context::poll_one()]
Note: in conjunction with asynchronous operations. ]
]
[
[`readv()`,
`recv()`,
`read()`]
[ For TCP: [link asio.reference.basic_stream_socket.read_some ip::tcp::socket::read_some()],
[link asio.reference.basic_stream_socket.async_read_some ip::tcp::socket::async_read_some()],
[link asio.reference.basic_stream_socket.receive ip::tcp::socket::receive()],
[link asio.reference.basic_stream_socket.async_receive ip::tcp::socket::async_receive()]
For UDP: [link asio.reference.basic_datagram_socket.receive ip::udp::socket::receive()],
[link asio.reference.basic_datagram_socket.async_receive ip::udp::socket::async_receive()]
[link asio.reference.basic_stream_socket.read_some basic_stream_socket::read_some()],
[link asio.reference.basic_stream_socket.async_read_some basic_stream_socket::async_read_some()],
[link asio.reference.basic_stream_socket.receive basic_stream_socket::receive()],
[link asio.reference.basic_stream_socket.async_receive basic_stream_socket::async_receive()],
[link asio.reference.basic_datagram_socket.receive basic_datagram_socket::receive()],
[link asio.reference.basic_datagram_socket.async_receive basic_datagram_socket::async_receive()] ]
]
[
[`recvfrom()`]
[ For UDP: [link asio.reference.basic_datagram_socket.receive_from ip::udp::socket::receive_from()],
[link asio.reference.basic_datagram_socket.async_receive_from ip::udp::socket::async_receive_from()]
[link asio.reference.basic_datagram_socket.receive_from basic_datagram_socket::receive_from()],
[link asio.reference.basic_datagram_socket.async_receive_from basic_datagram_socket::async_receive_from()] ]
]
[
[`send()`,
`write()`,
`writev()`]
[ For TCP: [link asio.reference.basic_stream_socket.write_some ip::tcp::socket::write_some()],
[link asio.reference.basic_stream_socket.async_write_some ip::tcp::socket::async_write_some()],
[link asio.reference.basic_stream_socket.send ip::tcp::socket::send()],
[link asio.reference.basic_stream_socket.async_send ip::tcp::socket::async_send()]
For UDP: [link asio.reference.basic_datagram_socket.send ip::udp::socket::send()],
[link asio.reference.basic_datagram_socket.async_send ip::udp::socket::async_send()]
[link asio.reference.basic_stream_socket.write_some basic_stream_socket::write_some()],
[link asio.reference.basic_stream_socket.async_write_some basic_stream_socket::async_write_some()],
[link asio.reference.basic_stream_socket.send basic_stream_socket::send()],
[link asio.reference.basic_stream_socket.async_send basic_stream_socket::async_send()],
[link asio.reference.basic_datagram_socket.send basic_datagram_socket::send()],
[link asio.reference.basic_datagram_socket.async_send basic_datagram_socket::async_send()] ]
]
[
[`sendto()`]
[ For UDP: [link asio.reference.basic_datagram_socket.send_to ip::udp::socket::send_to()],
[link asio.reference.basic_datagram_socket.async_send_to ip::udp::socket::async_send_to()]
[link asio.reference.basic_datagram_socket.send_to basic_datagram_socket::send_to()],
[link asio.reference.basic_datagram_socket.async_send_to basic_datagram_socket::async_send_to()] ]
]
[
[`setsockopt()`]
[ For TCP: [link asio.reference.basic_socket.set_option ip::tcp::acceptor::set_option()],
[link asio.reference.basic_socket.set_option ip::tcp::socket::set_option()]
For UDP: [link asio.reference.basic_socket.set_option ip::udp::socket::set_option()]
[link asio.reference.basic_socket.set_option basic_socket::set_option()] ]
]
[
[`shutdown()`]
[ For TCP: [link asio.reference.basic_socket.shutdown ip::tcp::socket::shutdown()]
For UDP: [link asio.reference.basic_socket.shutdown ip::udp::socket::shutdown()]
[link asio.reference.basic_socket.shutdown basic_socket::shutdown()] ]
]
[
[`sockatmark()`]
[ For TCP: [link asio.reference.basic_socket.at_mark ip::tcp::socket::at_mark()]
[link asio.reference.basic_socket.at_mark basic_socket::at_mark()] ]
]
[
[`socket()`]
[ For TCP: [link asio.reference.basic_socket.open ip::tcp::acceptor::open()],
[link asio.reference.basic_socket.open ip::tcp::socket::open()]
For UDP: [link asio.reference.basic_socket.open ip::udp::socket::open()]
[link asio.reference.basic_socket.open basic_socket::open()] ]
]
[
[`socketpair()`]
[ [link asio.reference.local__connect_pair local::connect_pair()]
Note: POSIX operating systems only. ]
]
]
[endsect]

View File

@@ -0,0 +1,163 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:buffers Buffers]
Fundamentally, I/O involves the transfer of data to and from contiguous regions
of memory, called buffers. These buffers can be simply expressed as a tuple
consisting of a pointer and a size in bytes. However, to allow the development
of efficient network applications, Asio includes support for scatter-gather
operations. These operations involve one or more buffers:
* A scatter-read receives data into multiple buffers.
* A gather-write transmits multiple buffers.
Therefore we require an abstraction to represent a collection of buffers. The
approach used in Asio is to define a type (actually two types) to
represent a single buffer. These can be stored in a container, which may be
passed to the scatter-gather operations.
In addition to specifying buffers as a pointer and size in bytes, Asio makes a
distinction between modifiable memory (called mutable) and non-modifiable
memory (where the latter is created from the storage for a const-qualified
variable). These two types could therefore be defined as follows:
typedef std::pair<void*, std::size_t> mutable_buffer;
typedef std::pair<const void*, std::size_t> const_buffer;
Here, a mutable_buffer would be convertible to a const_buffer, but conversion
in the opposite direction is not valid.
However, Asio does not use the above definitions as-is, but instead defines two
classes: `mutable_buffer` and `const_buffer`. The goal of these is to provide
an opaque representation of contiguous memory, where:
* Types behave as std::pair would in conversions. That is, a `mutable_buffer` is
convertible to a `const_buffer`, but the opposite conversion is disallowed.
* There is protection against buffer overruns. Given a buffer instance, a user
can only create another buffer representing the same range of memory or a
sub-range of it. To provide further safety, the library also includes
mechanisms for automatically determining the size of a buffer from an array,
`boost::array` or `std::vector` of POD elements, or from a `std::string`.
* The underlying memory is explicitly accessed using the `data()` member
function. In general an application should never need to do this, but it is
required by the library implementation to pass the raw memory to the
underlying operating system functions.
Finally, multiple buffers can be passed to scatter-gather operations (such as
[link asio.reference.read read()] or [link asio.reference.write write()]) by
putting the buffer objects into a container. The `MutableBufferSequence` and
`ConstBufferSequence` concepts have been defined so that containers such as
`std::vector`, `std::list`, `std::array` or `boost::array` can be used.
[heading Streambuf for Integration with Iostreams]
The class `asio::basic_streambuf` is derived from `std::basic_streambuf` to
associate the input sequence and output sequence with one or more objects of
some character array type, whose elements store arbitrary values. These
character array objects are internal to the streambuf object, but direct access
to the array elements is provided to permit them to be used with I/O
operations, such as the send or receive operations of a socket:
* The input sequence of the streambuf is accessible via the [link
asio.reference.basic_streambuf.data data()] member function. The return type
of this function meets the `ConstBufferSequence` requirements.
* The output sequence of the streambuf is accessible via the [link
asio.reference.basic_streambuf.prepare prepare()] member function. The return
type of this function meets the `MutableBufferSequence` requirements.
* Data is transferred from the front of the output sequence to the back of the
input sequence by calling the [link asio.reference.basic_streambuf.commit
commit()] member function.
* Data is removed from the front of the input sequence by calling the [link
asio.reference.basic_streambuf.consume consume()] member function.
The streambuf constructor accepts a `size_t` argument specifying the maximum of
the sum of the sizes of the input sequence and output sequence. Any operation
that would, if successful, grow the internal data beyond this limit will throw
a `std::length_error` exception.
[heading Bytewise Traversal of Buffer Sequences]
The `buffers_iterator<>` class template allows buffer sequences (i.e. types
meeting `MutableBufferSequence` or `ConstBufferSequence` requirements) to be
traversed as though they were a contiguous sequence of bytes. Helper functions
called buffers_begin() and buffers_end() are also provided, where the
buffers_iterator<> template parameter is automatically deduced.
As an example, to read a single line from a socket and into a `std::string`,
you may write:
asio::streambuf sb;
...
std::size_t n = asio::read_until(sock, sb, '\n');
asio::streambuf::const_buffers_type bufs = sb.data();
std::string line(
asio::buffers_begin(bufs),
asio::buffers_begin(bufs) + n);
[heading Buffer Debugging]
Some standard library implementations, such as the one that ships with
Microsoft Visual C++ 8.0 and later, provide a feature called iterator
debugging. What this means is that the validity of iterators is checked at
runtime. If a program tries to use an iterator that has been invalidated, an
assertion will be triggered. For example:
std::vector<int> v(1)
std::vector<int>::iterator i = v.begin();
v.clear(); // invalidates iterators
*i = 0; // assertion!
Asio takes advantage of this feature to add buffer debugging. Consider the
following code:
void dont_do_this()
{
std::string msg = "Hello, world!";
asio::async_write(sock, asio::buffer(msg), my_handler);
}
When you call an asynchronous read or write you need to ensure that the buffers
for the operation are valid until the completion handler is called. In the
above example, the buffer is the `std::string` variable `msg`. This variable is
on the stack, and so it goes out of scope before the asynchronous operation
completes. If you're lucky then the application will crash, but random failures
are more likely.
When buffer debugging is enabled, Asio stores an iterator into the string until
the asynchronous operation completes, and then dereferences it to check its
validity. In the above example you would observe an assertion failure just
before Asio tries to call the completion handler.
This feature is automatically made available for Microsoft Visual Studio 8.0 or
later and for GCC when `_GLIBCXX_DEBUG` is defined. There is a performance cost
to this checking, so buffer debugging is only enabled in debug builds. For
other compilers it may be enabled by defining `ASIO_ENABLE_BUFFER_DEBUGGING`.
It can also be explicitly disabled by defining `ASIO_DISABLE_BUFFER_DEBUGGING`.
[heading See Also]
[link asio.reference.buffer buffer],
[link asio.reference.buffers_begin buffers_begin],
[link asio.reference.buffers_end buffers_end],
[link asio.reference.buffers_iterator buffers_iterator],
[link asio.reference.const_buffer const_buffer],
[link asio.reference.const_buffers_1 const_buffers_1],
[link asio.reference.mutable_buffer mutable_buffer],
[link asio.reference.mutable_buffers_1 mutable_buffers_1],
[link asio.reference.streambuf streambuf],
[link asio.reference.ConstBufferSequence ConstBufferSequence],
[link asio.reference.MutableBufferSequence MutableBufferSequence],
[link asio.examples.cpp03_examples.buffers buffers example (C++03)],
[link asio.examples.cpp11_examples.buffers buffers example (c++11)].
[endsect]

View File

@@ -0,0 +1,253 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:cancellation Per-Operation Cancellation]
[note These type requirements and classes are the low level building blocks of
cancellation. For most use cases, consider using a higher level abstraction,
such as [link asio.reference.experimental__make_parallel_group
experimental::make_parallel_group] or the [link
asio.overview.core.cpp20_coroutines.co_ordinating_parallel_coroutines logical
operators] for `awaitable`.]
I/O objects, such as sockets and timers, support object-wide cancellation of
outstanding asynchronous operations via their `close` or `cancel` member
functions. However, certain asynchronous operations also support individual,
targeted cancellation. This per-operation cancellation is enabled by
specifying that a completion handler has an [link
asio.reference.associated_cancellation_slot associated cancellation slot]
which satisfies the [link asio.reference.CancellationSlot CancellationSlot]
type requirements. A cancellation slot is a lightweight channel used for
delivering a cancellation request.
Given a copy of a user-defined `Handler` object `h`, if an asynchronous
operation supports cancellation it will obtain a cancellation slot using the
`get_associated_cancellation_slot` function. For example:
asio::associated_cancellation_slot_t<Handler> s
= asio::get_associated_cancellation_slot(h);
The associated cancellation slot must satisfy the CancellationSlot type
requirements.
By default, handlers use a default-constructed [link
asio.reference.cancellation_slot `cancellation_slot`], which means that
per-operation cancellation is disabled. The cancellation slot may be customised
for a particular handler type by specifying a nested type
`cancellation_slot_type` and member function `get_cancellation_slot()`:
class my_handler
{
public:
// Custom implementation of CancellationSlot type requirements.
typedef my_cancellation_slot cancellation_slot_type;
// Return a custom cancellation slot implementation.
cancellation_slot_type get_cancellation_slot() const noexcept
{
return my_cancellation_slot(...);
}
void operator()() { ... }
};
In more complex cases, the `associated_cancellation_slot` template may be
partially specialised directly:
namespace asio {
template <typename CancellationSlot>
struct associated_cancellation_slot<my_handler, CancellationSlot>
{
// Custom implementation of CancellationSlot type requirements.
typedef my_cancellation_slot type;
// Return a custom cancellation_slot implementation.
static type get(const my_handler&,
const CancellationSlot& a = CancellationSlot()) noexcept
{
return my_cancellation_slot(...);
}
};
} // namespace asio
For convenience, a cancellation slot may be associated with a handler by using
the [link asio.reference.bind_cancellation_slot `bind_cancellation_slot`]
function. This is particularly useful when associating a cancellation slot with
a lambda:
asio::async_read(my_socket, my_buffer,
asio::bind_cancellation_slot(
my_cancellation_slot,
[](asio::error_code e, std::size_t n)
{
...
}
)
);
Asio provides a ready-to-use cancellation slot in the form of [link
asio.reference.cancellation_slot `cancellation_slot`] and its counterpart [link
asio.reference.cancellation_signal `cancellation_signal`]. These two classes
implement a one-to-one pairing of producer (signal) and consumer (slot)
interfaces. The following example shows its use:
class session
: public std::enable_shared_from_this<proxy>
{
...
void do_read()
{
auto self = shared_from_this();
socket_.async_read_some(
buffer(data_),
asio::bind_cancellation_slot(
cancel_signal_.slot(),
[self](std::error_code error, std::size_t n)
{
...
}
)
);
}
...
void request_cancel()
{
cancel_signal_.emit(asio::cancellation_type::total);
}
...
asio::cancellation_signal cancel_signal_;
};
A `cancellation_signal` contains a single slot, and consequently a cancellation
signal/slot pair may be used with at most one operation at a time. However,
the same slot may be reused for subsequent operations.
To support cancellation, an asynchronous operation installs a cancellation
handler into the slot by calling the slot's `assign` or `emplace` functions.
This handler will be invoked when a cancellation signal is emitted. A slot
holds exactly one handler at a time, and installing a new handler will overwrite
any previously installed handler.
When emitting a cancellation signal, the caller must specify a [link
asio.reference.cancellation_type cancellation type]. This value is a bitmask
that dictates what guarantees the cancellation target must make if
successful cancellation occurs. The possible bit values are, from weakest
to strongest guarantee, are:
[table cancellation types
[
[Bit]
[Guarantee if cancellation is successful]
[Examples where this is the strongest supported guarantee]
]
[
[`terminal`]
[
The operation had unspecified side effects, and it is only safe to close
or destroy the I/O object.
]
[
A stateful implementation of a message framing protocol, where an
asynchronous operation sends or receives a complete message. If
cancellation occurs part-way through the message body, it is not possible
to report a sensible state to the completion handler.
]
]
[
[`partial`]
[
The operation had well-defined side effects, and the completion
handler for the operation indicates what these side effects were.
]
[
Composed operations such as `async_read` and `async_write`. If cancellation
occurs before all bytes are transferred, the completion handler is passed
the total bytes transferred so far. The caller may use this information
to start another operation to transfer the remaining bytes.
]
]
[
[`total`]
[
The operation had no side effects that are observable through the API.
]
[
Low level system calls that transfer either zero or non-zero bytes.[br]
[br]
Wait-for-readiness operations that have no side effects, even when
successful.[br]
[br]
A fully buffered message framing protocol implementation, where partial
messages are stored so that they may be reused on the next operation.
]
]
]
For example, if application logic requires that an operation complete with
all-or-nothing side effects, it should emit only the `total` cancellation type.
If this type is unsupported by the target operation, no cancellation will
occur.
Furthermore, a stronger guarantee always satisfies the requirements of a weaker
guarantee. The `partial` guarantee still satisfies the `terminal` guarantee.
The `total` guarantee satisfies both `partial` and `total`. This means that
when an operation supports a given cancellation type as its strongest
guarantee, it should honour cancellation requests for any of the weaker
guarantees.
Cancellation requests should not be emitted during an asynchronous operation's
initiating function. Cancellation requests that are emitted before an operation
starts have no effect. Similarly, cancellation requests made after completion
have no effect.
When emitting a cancellation signal, the thread safety rules apply as if
calling a member function on the target operation's I/O object. For
non-composed operations, this means that it is safe to emit the cancellation
signal from any thread provided there are no other concurrent calls to the I/O
object, and no other concurrent cancellation signal requests. For composed
operations, care must be taken to ensure the cancellation request does not
occur concurrently with the operation's intermediate completion handlers.
[heading Supported Operations]
Consult the documentation for individual asynchronous operations for their
supported cancellation types, if any. The ability to cancel individual
operations, or composed operations, is currently supported by:
* timers
* sockets on POSIX and Windows
* POSIX descriptors
* Windows HANDLEs
* SSL streams
* all Asio-provided composed operations such as `async_read` and `async_write`
* compositions based on `async_compose`
* C++20 coroutines that use `awaitable`
* C++20 coroutines that use `experimental::coro`
* the `experimental::parallel_group` operation
* the `experimental::promise` class
[heading See Also]
[link asio.reference.CancellationSlot CancellationSlot],
[link asio.reference.associated_cancellation_slot associated_cancellation_slot],
[link asio.reference.bind_cancellation_slot bind_cancellation_slot],
[link asio.reference.cancellation_signal cancellation_signal],
[link asio.reference.cancellation_slot cancellation_slot],
[link asio.reference.cancellation_state cancellation_state],
[link asio.reference.cancellation_type cancellation_type],
[link asio.reference.get_associated_cancellation_slot get_associated_cancellation_slot],
[link asio.reference.experimental__parallel_group experimental::parallel_group],
[link asio.reference.experimental__make_parallel_group experimental::make_parallel_group]
[endsect]

View File

@@ -0,0 +1,88 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:concurrency_hint Concurrency Hints]
The [link asio.reference.io_context.io_context `io_context` constructor]
allows programs to specify a concurrency hint. This is a suggestion to the
`io_context` implementation as to the number of active threads that should be
used for running completion handlers.
When the Windows I/O completion port backend is in use, this value is passed
to [^CreateIoCompletionPort].
When a reactor-based backend is used, the implementation recognises the
following special concurrency hint values:
[table
[[Value][Description]]
[
[`1`]
[
The implementation assumes that the `io_context` will be run from a
single thread, and applies several optimisations based on this
assumption.
For example, when a handler is posted from within another handler, the
new handler is added to a fast thread-local queue (with the consequence
that the new handler is held back until the currently executing handler
finishes).
]
]
[
[`ASIO_CONCURRENCY_HINT_UNSAFE`]
[
This special concurrency hint disables locking in both the scheduler and
reactor I/O. This hint has the following restrictions:
[mdash] Care must be taken to ensure that all operations on the
`io_context` and any of its associated I/O objects (such as sockets and
timers) occur in only one thread at a time.
[mdash] Asynchronous resolve operations fail with `operation_not_supported`.
[mdash] If a `signal_set` is used with the `io_context`, `signal_set`
objects cannot be used with any other io_context in the program.
]
]
[
[`ASIO_CONCURRENCY_HINT_UNSAFE_IO`]
[
This special concurrency hint disables locking in the reactor I/O. This
hint has the following restrictions:
[mdash] Care must be taken to ensure that run functions on the
`io_context`, and all operations on the context's associated I/O objects
(such as sockets and timers), occur in only one thread at a time.
]
]
[
[`ASIO_CONCURRENCY_HINT_SAFE`]
[
The default. The `io_context` provides full thread safety, and distinct
I/O objects may be used from any thread.
]
]
]
[teletype]
The concurrency hint used by default-constructed `io_context` objects can be
overridden at compile time by defining the `ASIO_CONCURRENCY_HINT_DEFAULT`
macro. For example, specifying
-DASIO_CONCURRENCY_HINT_DEFAULT=1
on the compiler command line means that a concurrency hint of `1` is used for
all default-constructed `io_context` objects in the program. Similarly, the
concurrency hint used by `io_context` objects constructed with `1` can be
overridden by defining `ASIO_CONCURRENCY_HINT_1`. For example, passing
-DASIO_CONCURRENCY_HINT_1=ASIO_CONCURRENCY_HINT_UNSAFE
to the compiler will disable thread safety for all of these objects.
[endsect]

View File

@@ -0,0 +1,51 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:coroutine Stackless Coroutines]
The [link asio.reference.coroutine `coroutine`] class provides support for
stackless coroutines. Stackless coroutines enable programs to implement
asynchronous logic in a synchronous manner, with minimal overhead, as shown in
the following example:
struct session : asio::coroutine
{
boost::shared_ptr<tcp::socket> socket_;
boost::shared_ptr<std::vector<char> > buffer_;
session(boost::shared_ptr<tcp::socket> socket)
: socket_(socket),
buffer_(new std::vector<char>(1024))
{
}
void operator()(asio::error_code ec = asio::error_code(), std::size_t n = 0)
{
if (!ec) reenter (this)
{
for (;;)
{
yield socket_->async_read_some(asio::buffer(*buffer_), *this);
yield asio::async_write(*socket_, asio::buffer(*buffer_, n), *this);
}
}
}
};
The `coroutine` class is used in conjunction with the pseudo-keywords
`reenter`, `yield` and `fork`. These are preprocessor macros, and are
implemented in terms of a `switch` statement using a technique similar to
Duff's Device. The [link asio.reference.coroutine `coroutine`] class's
documentation provides a complete description of these pseudo-keywords.
[heading See Also]
[link asio.reference.coroutine coroutine],
[link asio.examples.cpp03_examples.http_server_4 HTTP Server 4 example],
[link asio.overview.core.spawn Stackful Coroutines].
[endsect]

View File

@@ -0,0 +1,271 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:cpp2011 C++ 2011 Support]
[/boostify: non-boost docs start here]
[link asio.overview.cpp2011.system_error System Errors and Error Codes]
[/boostify: non-boost docs end here]
[link asio.overview.cpp2011.move_objects Movable I/O Objects]
[link asio.overview.cpp2011.move_handlers Movable Handlers]
[link asio.overview.cpp2011.variadic Variadic Templates]
[link asio.overview.cpp2011.array Array Container]
[link asio.overview.cpp2011.atomic Atomics]
[link asio.overview.cpp2011.shared_ptr Shared Pointers]
[link asio.overview.cpp2011.chrono Chrono]
[link asio.overview.cpp2011.futures Futures]
[/boostify: non-boost docs start here]
[section:system_error System Errors and Error Codes]
When available, Asio can use the `std::error_code` and `std::system_error`
classes for reporting errors. In this case, the names `asio::error_code` and
`asio::system_error` will be typedefs for these standard classes.
System error support is automatically enabled for [^g++] 4.6 and later, when
the [^-std=c++0x] or [^-std=gnu++0x] compiler options are used. It may be
disabled by defining `ASIO_DISABLE_STD_SYSTEM_ERROR`, or explicitly enabled for
other compilers by defining `ASIO_HAS_STD_SYSTEM_ERROR`.
[endsect]
[/boostify: non-boost docs end here]
[section:move_objects Movable I/O Objects]
When move support is available (via rvalue references), Asio allows move
construction and assignment of sockets, serial ports, POSIX descriptors and
Windows handles.
Move support allows you to write code like:
tcp::socket make_socket(io_context& i)
{
tcp::socket s(i);
...
std::move(s);
}
or:
class connection : public enable_shared_from_this<connection>
{
private:
tcp::socket socket_;
...
public:
connection(tcp::socket&& s) : socket_(std::move(s)) {}
...
};
...
class server
{
private:
tcp::acceptor acceptor_;
...
void handle_accept(error_code ec, tcp::socket socket)
{
if (!ec)
std::make_shared<connection>(std::move(socket))->go();
acceptor_.async_accept(...);
}
...
};
as well as:
std::vector<tcp::socket> sockets;
sockets.push_back(tcp::socket(...));
A word of warning: There is nothing stopping you from moving these objects
while there are pending asynchronous operations, but it is unlikely to be a
good idea to do so. In particular, composed operations like [link
asio.reference.async_read async_read()] store a reference to the stream object.
Moving during the composed operation means that the composed operation may
attempt to access a moved-from object.
Move support is automatically enabled for [^g++] 4.5 and later, when the
[^-std=c++0x] or [^-std=gnu++0x] compiler options are used. It may be disabled
by defining `ASIO_DISABLE_MOVE`, or explicitly enabled for other compilers by
defining `ASIO_HAS_MOVE`. Note that these macros also affect the availability
of [link asio.overview.cpp2011.move_handlers movable handlers].
[endsect]
[section:move_handlers Movable Handlers]
With C++11 and later, user-defined completion handlers are only required to be
move constructible, and are not required to be copy constructible.
When move support is enabled, asynchronous that are documented as follows:
template <typename Handler>
void async_XYZ(..., Handler handler);
are actually declared as:
template <typename Handler>
void async_XYZ(..., Handler&& handler);
The handler argument is perfectly forwarded and the move construction occurs
within the body of `async_XYZ()`. This ensures that all other function
arguments are evaluated prior to the move. This is critical when the other
arguments to `async_XYZ()` are members of the handler. For example:
struct my_operation
{
unique_ptr<tcp::socket> socket;
unique_ptr<vector<char>> buffer;
...
void operator(error_code ec, size_t length)
{
...
socket->async_read_some(asio::buffer(*buffer), std::move(*this));
...
}
};
Move support is automatically enabled for [^g++] 4.5 and later, when the
[^-std=c++0x] or [^-std=gnu++0x] compiler options are used. It may be disabled
by defining `ASIO_DISABLE_MOVE`, or explicitly enabled for other compilers by
defining `ASIO_HAS_MOVE`. Note that these macros also affect the availability
of [link asio.overview.cpp2011.move_objects movable I/O objects].
[endsect]
[section:variadic Variadic Templates]
When supported by a compiler, Asio can use variadic templates to implement the
[link asio.reference.basic_socket_streambuf.connect
basic_socket_streambuf::connect()] and [link
asio.reference.basic_socket_iostream.connect basic_socket_iostream::connect()]
functions.
Support for variadic templates is automatically enabled for [^g++] 4.3 and
later, when the [^-std=c++0x] or [^-std=gnu++0x] compiler options are used. It
may be disabled by defining `ASIO_DISABLE_VARIADIC_TEMPLATES`, or explicitly
enabled for other compilers by defining `ASIO_HAS_VARIADIC_TEMPLATES`.
[endsect]
[section:array Array Container]
Where the standard library provides `std::array<>`, Asio:
* Provides overloads for the [link asio.reference.buffer buffer()] function.
* Uses it in preference to `boost::array<>` for the
[link asio.reference.ip__address_v4.bytes_type ip::address_v4::bytes_type] and
[link asio.reference.ip__address_v6.bytes_type ip::address_v6::bytes_type]
types.
* Uses it in preference to `boost::array<>` where a fixed size array type is
needed in the implementation.
Support for `std::array<>` is automatically enabled for [^g++] 4.3 and later,
when the [^-std=c++0x] or [^-std=gnu++0x] compiler options are used, as well as
for Microsoft Visual C++ 10. It may be disabled by defining
`ASIO_DISABLE_STD_ARRAY`, or explicitly enabled for other compilers by
defining `ASIO_HAS_STD_ARRAY`.
[endsect]
[section:atomic Atomics]
Asio's implementation can use `std::atomic<>` in preference to
`boost::detail::atomic_count`.
Support for the standard atomic integer template is automatically enabled for
[^g++] 4.5 and later, when the [^-std=c++0x] or [^-std=gnu++0x] compiler
options are used. It may be disabled by defining `ASIO_DISABLE_STD_ATOMIC`, or
explicitly enabled for other compilers by defining `ASIO_HAS_STD_ATOMIC`.
[endsect]
[section:shared_ptr Shared Pointers]
Asio's implementation can use `std::shared_ptr<>` and `std::weak_ptr<>` in
preference to the Boost equivalents.
Support for the standard smart pointers is automatically enabled for [^g++] 4.3
and later, when the [^-std=c++0x] or [^-std=gnu++0x] compiler options are used,
as well as for Microsoft Visual C++ 10. It may be disabled by defining
`ASIO_DISABLE_STD_SHARED_PTR`, or explicitly enabled for other compilers by
defining `ASIO_HAS_STD_SHARED_PTR`.
[endsect]
[section:chrono Chrono]
Asio provides timers based on the `std::chrono` facilities via the [link
asio.reference.basic_waitable_timer basic_waitable_timer] class template.
The typedefs [link asio.reference.system_timer system_timer], [link
asio.reference.steady_timer steady_timer] and [link
asio.reference.high_resolution_timer high_resolution_timer] utilise the
standard clocks `system_clock`, `steady_clock` and `high_resolution_clock`
respectively.
Support for the `std::chrono` facilities is automatically enabled for [^g++]
4.6 and later, when the [^-std=c++0x] or [^-std=gnu++0x] compiler options are
used. (Note that, for [^g++], the draft-standard `monotonic_clock` is used in
place of `steady_clock`.) Support may be disabled by defining
`ASIO_DISABLE_STD_CHRONO`, or explicitly enabled for other compilers by
defining `ASIO_HAS_STD_CHRONO`.
When standard `chrono` is unavailable, Asio will otherwise use the Boost.Chrono
library. The [link asio.reference.basic_waitable_timer basic_waitable_timer]
class template may be used with either.
[endsect]
[section:futures Futures]
The `asio::use_future` special value provides 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 handler signature has the form:
void handler(asio::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 handler signature has the form:
void handler(asio::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.
[link asio.reference.use_future use_future],
[link asio.reference.use_future_t use_future_t],
[link asio.examples.cpp11_examples.futures Futures example (C++11)].
[endsect]
[endsect]

View File

@@ -0,0 +1,227 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:cpp20_coroutines C++20 Coroutines Support]
Support for C++20 Coroutines is provided via the [link asio.reference.awaitable
`awaitable`] class template, the [link asio.reference.use_awaitable_t
`use_awaitable`] completion token, and the [link asio.reference.co_spawn
`co_spawn()`] function. These facilities allow programs to implement
asynchronous logic in a synchronous manner, in conjunction with the `co_await`
keyword, as shown in the following example:
asio::co_spawn(executor, echo(std::move(socket)), asio::detached);
// ...
asio::awaitable<void> echo(tcp::socket socket)
{
try
{
char data[1024];
for (;;)
{
std::size_t n = co_await socket.async_read_some(asio::buffer(data), asio::use_awaitable);
co_await async_write(socket, asio::buffer(data, n), asio::use_awaitable);
}
}
catch (std::exception& e)
{
std::printf("echo Exception: %s\n", e.what());
}
}
The first argument to `co_spawn()` is an [link asio.reference.Executor1
executor] that 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 an [link asio.reference.awaitable `awaitable<R>`],
that is the result of the coroutine's entry point function, and in the above
example is the result of the call to `echo`. (Alternatively, this argument can
be a function object that returns the [link asio.reference.awaitable
`awaitable<R>`].) The template parameter `R` is the type of return value
produced by the coroutine. In the above example, the coroutine returns `void`.
The third argument is a completion token, and this is used by `co_spawn()` to
produce a completion handler with signature `void(std::exception_ptr, R)`. This
completion handler is invoked with the result of the coroutine once it has
finished. In the above example we pass a completion token type, [link
asio.reference.detached `asio::detached`], which is used to explicitly ignore
the result of an asynchronous operation.
In this example the body of the coroutine is implemented in the `echo`
function. When the `use_awaitable` completion token is passed to an
asynchronous operation, the operation's initiating function returns an
`awaitable` that may be used with the `co_await` keyword:
std::size_t n = co_await socket.async_read_some(asio::buffer(data), asio::use_awaitable);
Where an asynchronous operation's handler signature has the form:
void handler(asio::error_code ec, result_type result);
the resulting type of the `co_await` expression is `result_type`. In the
`async_read_some` example above, this is `size_t`. If the asynchronous
operation fails, the `error_code` is converted into a `system_error` exception
and thrown.
Where a handler signature has the form:
void handler(asio::error_code ec);
the `co_await` expression produces a `void` result. As above, an error is
passed back to the coroutine as a `system_error` exception.
[heading Coroutines and Per-Operation Cancellation]
All threads of execution created by `co_spawn` have a cancellation state that
records the current state of any cancellation requests made to the coroutine.
To access this state, use [link asio.reference.this_coro__cancellation_state
`this_coro::cancellation_state`] as follows:
asio::awaitable<void> my_coroutine()
{
asio::cancellation_state cs
= co_await asio::this_coro::cancellation_state;
// ...
if (cs.cancelled() != asio::cancellation_type::none)
// ...
}
When first created by `co_spawn`, the thread of execution has a cancellation
state that supports `cancellation_type::terminal` values only. To change the
cancellation state, call [link
asio.reference.this_coro__reset_cancellation_state
`this_coro::reset_cancellation_state`].
By default, continued execution of a cancelled coroutine will trigger an
exception from any subsequent `co_await` of an `awaitable<>` object. This
behaviour can be changed by using [link
asio.reference.this_coro__throw_if_cancelled `this_coro::throw_if_cancelled`].
[heading Co-ordinating Parallel Coroutines]
[note This is an experimental feature.]
The logical operators `||` and `&&` have been overloaded for `awaitable<>`, to
allow coroutines to be trivially awaited in parallel.
When awaited using `&&`, the `co_await` expression waits until both operations
have completed successfully. As a "short-circuit" evaluation, if one
operation fails with an exception, the other is immediately cancelled.
For example:
std::tuple<std::size_t, std::size_t> results =
co_await (
async_read(socket, input_buffer, use_awaitable)
&& async_write(socket, output_buffer, use_awaitable)
);
Following completion of a `&&` operation, the results of all operations are
concatenated into a tuple. In the above example, the first `size_t` represents
the non-exceptional component of the `async_read` result, and the second
`size_t` is the result of the `async_write`.
When awaited using `||`, the `co_await` expression waits until either
operation succeeds. As a "short-circuit" evaluation, if one operation
succeeds without throwing an exception, the other is immediately cancelled.
For example:
std::variant<std::size_t, std::monostate> results =
co_await (
async_read(socket, input_buffer, use_awaitable)
|| timer.async_wait(use_awaitable)
);
Following completion of a `||` operation, the result of the first operation to
complete non-exceptionally is placed into a `std::variant`. The active index
of the variant reflects which of the operations completed first.
In the above example, index `0` corresponds to the `async_read` operation.
These operators may be enabled by adding the `#include`:
#include <asio/experimental/awaitable_operators.hpp>
and then bringing the contents of the `experimental::awaitable_operators`
namespace into scope:
using namespace asio::experimental::awaitable_operators;
[heading Coroutines that Await and Yield]
[note This is an experimental feature.]
The [link asio.reference.experimental__coro `coro`] type is a C++20 coroutine
primitive for resumable functions, with the ability to combine both
asynchronous waiting (`co_await`) and yielding (`co_yield`) into a single,
stateful control flow. For example:
#include <asio.hpp>
#include <asio/experimental/coro.hpp>
using asio::ip::tcp;
asio::experimental::coro<std::string> reader(tcp::socket& sock)
{
std::string buf;
while (sock.is_open())
{
std::size_t n = co_await asio::async_read_until(
sock, asio::dynamic_buffer(buf), '\n',
asio::experimental::use_coro);
co_yield buf.substr(0, n);
buf.erase(0, n);
}
}
asio::awaitable<void> consumer(tcp::socket sock)
{
auto r = reader(sock);
auto msg1 = co_await r.async_resume(asio::use_awaitable);
std::cout << "Message 1: " << msg1.value_or("\n");
auto msg2 = co_await r.async_resume(asio::use_awaitable);
std::cout << "Message 2: " << msg2.value_or("\n");
}
asio::awaitable<void> listen(tcp::acceptor& acceptor)
{
for (;;)
{
co_spawn(
acceptor.get_executor(),
consumer(co_await acceptor.async_accept(asio::use_awaitable)),
asio::detached);
}
}
int main()
{
asio::io_context ctx;
tcp::acceptor acceptor(ctx, {tcp::v4(), 54321});
co_spawn(ctx, listen(acceptor), asio::detached);
ctx.run();
}
[heading See Also]
[link asio.reference.co_spawn co_spawn],
[link asio.reference.detached detached],
[link asio.reference.redirect_error redirect_error],
[link asio.reference.awaitable awaitable],
[link asio.reference.use_awaitable_t use_awaitable_t],
[link asio.reference.use_awaitable use_awaitable],
[link asio.reference.this_coro__executor this_coro::executor],
[link asio.reference.experimental__coro experimental::coro],
[link asio.examples.cpp17_examples.coroutines_ts_support Coroutines examples],
[link asio.overview.core.spawn Stackful Coroutines],
[link asio.overview.core.coroutine Stackless Coroutines].
[endsect]

View File

@@ -0,0 +1,281 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:handler_tracking Handler Tracking]
To aid in debugging asynchronous programs, Asio provides support for handler
tracking. When enabled by defining `ASIO_ENABLE_HANDLER_TRACKING`, Asio
writes debugging output to the standard error stream. The output records
asynchronous operations and the relationships between their handlers.
[teletype]
This feature is useful when debugging and you need to know how your
asynchronous operations are chained together, or what the pending asynchronous
operations are. As an illustration, here is the output when you run the HTTP
Server example, handle a single request, then shut down via Ctrl+C:
@asio|1589424178.741850|0*1|signal_set@0x7ffee977d878.async_wait
@asio|1589424178.742593|0*2|socket@0x7ffee977d8a8.async_accept
@asio|1589424178.742619|.2|non_blocking_accept,ec=asio.system:11
@asio|1589424178.742625|0|resolver@0x7ffee977d760.cancel
@asio|1589424195.830382|.2|non_blocking_accept,ec=system:0
@asio|1589424195.830413|>2|ec=system:0
@asio|1589424195.830473|2*3|socket@0x7fa71d808230.async_receive
@asio|1589424195.830496|.3|non_blocking_recv,ec=system:0,bytes_transferred=151
@asio|1589424195.830503|2*4|socket@0x7ffee977d8a8.async_accept
@asio|1589424195.830507|.4|non_blocking_accept,ec=asio.system:11
@asio|1589424195.830510|<2|
@asio|1589424195.830529|>3|ec=system:0,bytes_transferred=151
@asio|1589424195.831143|3^5|in 'async_write' (./../../../include/asio/impl/write.hpp:330)
@asio|1589424195.831143|3*5|socket@0x7fa71d808230.async_send
@asio|1589424195.831186|.5|non_blocking_send,ec=system:0,bytes_transferred=1090
@asio|1589424195.831194|<3|
@asio|1589424195.831218|>5|ec=system:0,bytes_transferred=1090
@asio|1589424195.831263|5|socket@0x7fa71d808230.close
@asio|1589424195.831298|<5|
@asio|1589424199.793770|>1|ec=system:0,signal_number=2
@asio|1589424199.793781|1|socket@0x7ffee977d8a8.close
@asio|1589424199.793809|<1|
@asio|1589424199.793840|>4|ec=asio.system:125
@asio|1589424199.793854|<4|
@asio|1589424199.793883|0|signal_set@0x7ffee977d878.cancel
Each line is of the form:
<tag>|<timestamp>|<action>|<description>
The `<tag>` is always `@asio`, and is used to identify and extract the handler
tracking messages from the program output.
The `<timestamp>` is seconds and microseconds from 1 Jan 1970 UTC.
The `<action>` takes one of the following forms:
[variablelist
[
[>n]
[The program entered the handler number `n`. The `<description>` shows the
arguments to the handler.]
]
[
[<n]
[The program left handler number `n`.]
]
[
[!n]
[The program left handler number n due to an exception.]
]
[
[~n]
[The handler number `n` was destroyed without having been invoked. This is
usually the case for any unfinished asynchronous operations when the
`io_context` is destroyed.]
]
[
[n^m]
[The handler number `n` is about to create a new asynchronous operation with
completion handler number `m`. The `<description>` contains source location
information to help identify where in the program the asynchronous operation
is being started.]
]
[
[n*m]
[The handler number `n` created a new asynchronous operation with completion
handler number `m`. The `<description>` shows what asynchronous operation
was started.]
]
[
[n]
[The handler number `n` performed some other operation. The `<description>`
shows what function was called. Currently only `close()` and `cancel()`
operations are logged, as these may affect the state of pending
asynchronous operations.]
]
[
[.n]
[The implementation performed a system call as part of the asynchronous
operation for which handler number `n` is the completion handler. The
`<description>` shows what function was called and its results. These
tracking events are only emitted when using a reactor-based
implementation.]
]
]
Where the `<description>` shows a synchronous or asynchronous operation, the
format is `<object-type>@<pointer>.<operation>`. For handler entry, it shows a
comma-separated list of arguments and their values.
As shown above, Each handler is assigned a numeric identifier. Where the
handler tracking output shows a handler number of 0, it means that the action
was performed outside of any handler.
[heading Adding Location Information]
[c++]
Programs may augment the handler tracking output's location information by
using the macro `ASIO_HANDLER_LOCATION` in the source code. For example:
#define HANDLER_LOCATION \
ASIO_HANDLER_LOCATION((__FILE__, __LINE__, __func__))
// ...
void do_read()
{
HANDLER_LOCATION;
auto self(shared_from_this());
socket_.async_read_some(asio::buffer(data_, max_length),
[this, self](std::error_code ec, std::size_t length)
{
HANDLER_LOCATION;
if (!ec)
{
do_write(length);
}
});
}
[teletype]
With the additional location information available, the handler tracking output
may include a call stack of source locations:
@asio|1589423304.861944|>7|ec=system:0,bytes_transferred=5
@asio|1589423304.861952|7^8|in 'async_write' (./../../../include/asio/impl/write.hpp:330)
@asio|1589423304.861952|7^8|called from 'do_write' (handler_tracking/async_tcp_echo_server.cpp:62)
@asio|1589423304.861952|7^8|called from 'operator()' (handler_tracking/async_tcp_echo_server.cpp:51)
@asio|1589423304.861952|7*8|socket@0x7ff61c008230.async_send
@asio|1589423304.861975|.8|non_blocking_send,ec=system:0,bytes_transferred=5
@asio|1589423304.861980|<7|
Furthermore, if `std::source_location` or `std::experimental::source_location`
are available, the [link asio.reference.use_awaitable_t `use_awaitable_t`]
token (when default-constructed or used as a default completion token) will
also cause handler tracking to output a source location for each newly created
asynchronous operation. A `use_awaitable_t` object may also be explicitly
constructed with location information.
[heading Visual Representations]
The handler tracking output may be post-processed using the included
[^handlerviz.pl] tool to create a visual representation of the handlers
(requires the GraphViz tool [^dot]).
[c++]
[heading Custom Tracking]
Handling tracking may be customised by defining the
`ASIO_CUSTOM_HANDLER_TRACKING` macro to the name of a header file
(enclosed in `""` or `<>`). This header file must implement the following
preprocessor macros:
[table
[[Macro] [Description]]
[
[`ASIO_INHERIT_TRACKED_HANDLER`]
[Specifies a base class for classes that implement asynchronous operations.
When used, the macro immediately follows the class name, so it must have
the form `: public my_class`.]
]
[
[`ASIO_ALSO_INHERIT_TRACKED_HANDLER`]
[Specifies a base class for classes that implement asynchronous operations.
When used, the macro follows other base classes, so it must have the form
`, public my_class`.]
]
[
[`ASIO_HANDLER_TRACKING_INIT(args)`]
[An expression that is used to initialise the tracking mechanism.]
]
[
[`ASIO_HANDLER_LOCATION(args)`]
[A variable declaration that is used to define a source code location.
`args` is a parenthesised function argument list containing the file
name, line number, and function name.]
]
[
[`ASIO_HANDLER_CREATION(args)`]
[An expression that is called on creation of an asynchronous operation.
`args` is a parenthesised function argument list containing the owning
execution context, the tracked handler, the name of the object type, a
pointer to the object, the object's native handle, and the operation name.]
]
[
[`ASIO_HANDLER_COMPLETION(args)`]
[An expression that is called on completion of an asynchronous operation.
`args` is a parenthesised function argument list containing the tracked
handler.]
]
[
[`ASIO_HANDLER_INVOCATION_BEGIN(args)`]
[An expression that is called immediately before a completion handler is
invoked. `args` is a parenthesised function argument list containing the
arguments to the completion handler.]
]
[
[`ASIO_HANDLER_INVOCATION_END`]
[An expression that is called immediately after a completion handler is
invoked.]
]
[
[`ASIO_HANDLER_OPERATION(args)`]
[An expression that is called when some synchronous object operation is
called (such as `close()` or `cancel()`). `args` is a parenthesised
function argument list containing the owning execution context, the name
of the object type, a pointer to the object, the object's native handle,
and the operation name.]
]
[
[`ASIO_HANDLER_REACTOR_REGISTRATION(args)`]
[An expression that is called when an object is registered with the
reactor. `args` is a parenthesised function argument list containing the
owning execution context, the object's native handle, and a unique
registration key.]
]
[
[`ASIO_HANDLER_REACTOR_DEREGISTRATION(args)`]
[An expression that is called when an object is deregistered from the
reactor. `args` is a parenthesised function argument list containing the
owning execution context, the object's native handle, and a unique
registration key.]
]
[
[`ASIO_HANDLER_REACTOR_READ_EVENT`]
[A bitmask constant used to identify reactor read readiness events.]
]
[
[`ASIO_HANDLER_REACTOR_WRITE_EVENT`]
[A bitmask constant used to identify reactor write readiness events.]
]
[
[`ASIO_HANDLER_REACTOR_ERROR_EVENT`]
[A bitmask constant used to identify reactor error readiness events.]
]
[
[`ASIO_HANDLER_REACTOR_EVENTS(args)`]
[An expression that is called when an object registered with the reactor
becomes ready. `args` is a parenthesised function argument list containing
the owning execution context, the unique registration key, and a bitmask of
the ready events.]
]
[
[`ASIO_HANDLER_REACTOR_OPERATION(args)`]
[An expression that is called when the implementation performs a system
call as part of a reactor-based asynchronous operation. `args` is a
parenthesised function argument list containing the tracked handler, the
operation name, the error code produced by the operation, and (optionally)
the number of bytes transferred.]
]
]
[heading See Also]
[link asio.examples.cpp11_examples.handler_tracking Handler tracking
examples].
[endsect]

View File

@@ -0,0 +1,314 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:implementation Platform-Specific Implementation Notes]
This section lists platform-specific implementation details, such as the
default demultiplexing mechanism, the number of threads created internally, and
when threads are created.
[heading Linux Kernel 2.4]
Demultiplexing mechanism:
* Uses `select` for demultiplexing. This means that the number of file
descriptors in the process cannot be permitted to exceed `FD_SETSIZE`.
Threads:
* Demultiplexing using `select` is performed in one of the threads that calls
`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
`io_context::poll_one()`.
* An additional thread per `io_context` is used to emulate asynchronous host
resolution. This thread is created on the first call to either
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
Scatter-Gather:
* At most `min(64,IOV_MAX)` buffers may be transferred in a single operation.
[heading Linux Kernel 2.6]
Demultiplexing mechanism:
* Uses `epoll` for demultiplexing.
Threads:
* Demultiplexing using `epoll` is performed in one of the threads that calls
`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
`io_context::poll_one()`.
* An additional thread per `io_context` is used to emulate asynchronous host
resolution. This thread is created on the first call to either
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
Scatter-Gather:
* At most `min(64,IOV_MAX)` buffers may be transferred in a single operation.
[heading Solaris]
Demultiplexing mechanism:
* Uses [^/dev/poll] for demultiplexing.
Threads:
* Demultiplexing using [^/dev/poll] is performed in one of the threads that
calls `io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
`io_context::poll_one()`.
* An additional thread per `io_context` is used to emulate asynchronous host
resolution. This thread is created on the first call to either
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
Scatter-Gather:
* At most `min(64,IOV_MAX)` buffers may be transferred in a single operation.
[heading QNX Neutrino]
Demultiplexing mechanism:
* Uses `select` for demultiplexing. This means that the number of file
descriptors in the process cannot be permitted to exceed `FD_SETSIZE`.
Threads:
* Demultiplexing using `select` is performed in one of the threads that calls
`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
`io_context::poll_one()`.
* An additional thread per `io_context` is used to emulate asynchronous host
resolution. This thread is created on the first call to either
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
Scatter-Gather:
* At most `min(64,IOV_MAX)` buffers may be transferred in a single operation.
[heading Mac OS X]
Demultiplexing mechanism:
* Uses `kqueue` for demultiplexing.
Threads:
* Demultiplexing using `kqueue` is performed in one of the threads that calls
`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
`io_context::poll_one()`.
* An additional thread per `io_context` is used to emulate asynchronous host
resolution. This thread is created on the first call to either
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
Scatter-Gather:
* At most `min(64,IOV_MAX)` buffers may be transferred in a single operation.
[heading FreeBSD]
Demultiplexing mechanism:
* Uses `kqueue` for demultiplexing.
Threads:
* Demultiplexing using `kqueue` is performed in one of the threads that calls
`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
`io_context::poll_one()`.
* An additional thread per `io_context` is used to emulate asynchronous host
resolution. This thread is created on the first call to either
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
Scatter-Gather:
* At most `min(64,IOV_MAX)` buffers may be transferred in a single operation.
[heading AIX]
Demultiplexing mechanism:
* Uses `select` for demultiplexing. This means that the number of file
descriptors in the process cannot be permitted to exceed `FD_SETSIZE`.
Threads:
* Demultiplexing using `select` is performed in one of the threads that calls
`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
`io_context::poll_one()`.
* An additional thread per `io_context` is used to emulate asynchronous host
resolution. This thread is created on the first call to either
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
Scatter-Gather:
* At most `min(64,IOV_MAX)` buffers may be transferred in a single operation.
[heading HP-UX]
Demultiplexing mechanism:
* Uses `select` for demultiplexing. This means that the number of file
descriptors in the process cannot be permitted to exceed `FD_SETSIZE`.
Threads:
* Demultiplexing using `select` is performed in one of the threads that calls
`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
`io_context::poll_one()`.
* An additional thread per `io_context` is used to emulate asynchronous host
resolution. This thread is created on the first call to either
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
Scatter-Gather:
* At most `min(64,IOV_MAX)` buffers may be transferred in a single operation.
[heading Tru64]
Demultiplexing mechanism:
* Uses `select` for demultiplexing. This means that the number of file
descriptors in the process cannot be permitted to exceed `FD_SETSIZE`.
Threads:
* Demultiplexing using `select` is performed in one of the threads that calls
`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
`io_context::poll_one()`.
* An additional thread per `io_context` is used to emulate asynchronous host
resolution. This thread is created on the first call to either
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
Scatter-Gather:
* At most `min(64,IOV_MAX)` buffers may be transferred in a single operation.
[heading Windows 95, 98 and Me]
Demultiplexing mechanism:
* Uses `select` for demultiplexing.
Threads:
* Demultiplexing using `select` is performed in one of the threads that calls
`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
`io_context::poll_one()`.
* An additional thread per `io_context` is used to emulate asynchronous host
resolution. This thread is created on the first call to either
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
Scatter-Gather:
* For sockets, at most 16 buffers may be transferred in a single operation.
[heading Windows NT, 2000, XP, 2003, Vista, 7 and 8]
Demultiplexing mechanism:
* Uses overlapped I/O and I/O completion ports for all asynchronous socket
operations except for asynchronous connect.
* Uses `select` for emulating asynchronous connect.
Threads:
* Demultiplexing using I/O completion ports is performed in all threads that call
`io_context::run()`, `io_context::run_one()`, `io_context::poll()` or
`io_context::poll_one()`.
* An additional thread per `io_context` is used to trigger timers. This thread
is created on construction of the first `basic_deadline_timer` or
`basic_waitable_timer` objects.
* An additional thread per `io_context` may be used for `select`
demultiplexing. This thread is created on the first call to:
* A socket `async_wait()` function, except when using `wait_read` on
a stream-oriented socket. (For `wait_read` on a stream-oriented socket,
the overlapped I/O operation `WSARecv` is used and no additional thread
is required.)
* A socket `async_connect()` operation, if the overlapped I/O
operation `ConnectEx` is unavailable. (On recent versions of Windows,
`ConnectEx` is used and no additional thread is required.)
* An additional thread per `io_context` is used to emulate asynchronous host
resolution. This thread is created on the first call to either
`ip::tcp::resolver::async_resolve()` or `ip::udp::resolver::async_resolve()`.
Scatter-Gather:
* For sockets, at most 64 buffers may be transferred in a single operation.
* For stream-oriented handles, only one buffer may be transferred in a single
operation.
[heading Windows Runtime]
Asio provides limited support for the Windows Runtime. It requires that the
language extensions be enabled. Due to the restricted facilities exposed by the
Windows Runtime API, the support comes with the following caveats:
* The core facilities such as the `io_context`, `strand`, buffers, composed
operations, timers, etc., should all work as normal.
* For sockets, only client-side TCP is supported.
* Explicit binding of a client-side TCP socket is not supported.
* The `cancel()` function is not supported for sockets. Asynchronous
operations may only be cancelled by closing the socket.
* Operations that use `null_buffers` are not supported.
* Only `tcp::no_delay` and `socket_base::keep_alive` options are supported.
* Resolvers do not support service names, only numbers. I.e. you must
use "80" rather than "http".
* Most resolver query flags have no effect.
Demultiplexing mechanism:
* Uses the `Windows::Networking::Sockets::StreamSocket` class to implement
asynchronous TCP socket operations.
Threads:
* Event completions are delivered to the Windows thread pool and posted to the
`io_context` for the handler to be executed.
* An additional thread per `io_context` is used to trigger timers. This thread
is created on construction of the first timer objects.
Scatter-Gather:
* For sockets, at most one buffer may be transferred in a single operation.
[endsect]

View File

@@ -0,0 +1,72 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:iostreams Socket Iostreams]
Asio includes classes that implement iostreams on top of sockets. These hide
away the complexities associated with endpoint resolution, protocol
independence, etc. To create a connection one might simply write:
ip::tcp::iostream stream("www.boost.org", "http");
if (!stream)
{
// Can't connect.
}
The iostream class can also be used in conjunction with an acceptor to create
simple servers. For example:
io_context ioc;
ip::tcp::endpoint endpoint(tcp::v4(), 80);
ip::tcp::acceptor acceptor(ios, endpoint);
for (;;)
{
ip::tcp::iostream stream;
acceptor.accept(stream.socket());
...
}
Timeouts may be set by calling `expires_at()` or `expires_from_now()` to
establish a deadline. Any socket operations that occur past the deadline will
put the iostream into a "bad" state.
For example, a simple client program like this:
ip::tcp::iostream stream;
stream.expires_from_now(boost::posix_time::seconds(60));
stream.connect("www.boost.org", "http");
stream << "GET /LICENSE_1_0.txt HTTP/1.0\r\n";
stream << "Host: www.boost.org\r\n";
stream << "Accept: */*\r\n";
stream << "Connection: close\r\n\r\n";
stream.flush();
std::cout << stream.rdbuf();
will fail if all the socket operations combined take longer than 60 seconds.
If an error does occur, the iostream's `error()` member function may be used to
retrieve the error code from the most recent system call:
if (!stream)
{
std::cout << "Error: " << stream.error().message() << "\n";
}
[heading See Also]
[link asio.reference.ip__tcp.iostream ip::tcp::iostream],
[link asio.reference.basic_socket_iostream basic_socket_iostream],
[link asio.examples.cpp03_examples.iostreams iostreams examples].
[heading Notes]
These iostream templates only support `char`, not `wchar_t`, and do not perform
any code conversion.
[endsect]

View File

@@ -0,0 +1,118 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:line_based Line-Based Operations]
Many commonly-used internet protocols are line-based, which means that they
have protocol elements that are delimited by the character sequence `"\r\n"`.
Examples include HTTP, SMTP and FTP. To more easily permit the implementation
of line-based protocols, as well as other protocols that use delimiters, Asio
includes the functions `read_until()` and `async_read_until()`.
The following example illustrates the use of `async_read_until()` in an HTTP
server, to receive the first line of an HTTP request from a client:
class http_connection
{
...
void start()
{
asio::async_read_until(socket_, data_, "\r\n",
boost::bind(&http_connection::handle_request_line, this, _1));
}
void handle_request_line(asio::error_code ec)
{
if (!ec)
{
std::string method, uri, version;
char sp1, sp2, cr, lf;
std::istream is(&data_);
is.unsetf(std::ios_base::skipws);
is >> method >> sp1 >> uri >> sp2 >> version >> cr >> lf;
...
}
}
...
asio::ip::tcp::socket socket_;
asio::streambuf data_;
};
The `streambuf` data member serves as a place to store the data that has been
read from the socket before it is searched for the delimiter. It is important
to remember that there may be additional data ['after] the delimiter. This
surplus data should be left in the `streambuf` so that it may be inspected by a
subsequent call to `read_until()` or `async_read_until()`.
The delimiters may be specified as a single `char`, a `std::string` or a
`boost::regex`. The `read_until()` and `async_read_until()` functions also
include overloads that accept a user-defined function object called a match
condition. For example, to read data into a streambuf until whitespace is
encountered:
typedef asio::buffers_iterator<
asio::streambuf::const_buffers_type> iterator;
std::pair<iterator, bool>
match_whitespace(iterator begin, iterator end)
{
iterator i = begin;
while (i != end)
if (std::isspace(*i++))
return std::make_pair(i, true);
return std::make_pair(i, false);
}
...
asio::streambuf b;
asio::read_until(s, b, match_whitespace);
To read data into a streambuf until a matching character is found:
class match_char
{
public:
explicit match_char(char c) : c_(c) {}
template <typename Iterator>
std::pair<Iterator, bool> operator()(
Iterator begin, Iterator end) const
{
Iterator i = begin;
while (i != end)
if (c_ == *i++)
return std::make_pair(i, true);
return std::make_pair(i, false);
}
private:
char c_;
};
namespace asio {
template <> struct is_match_condition<match_char>
: public boost::true_type {};
} // namespace asio
...
asio::streambuf b;
asio::read_until(s, b, match_char('a'));
The `is_match_condition<>` type trait automatically evaluates to true for
functions, and for function objects with a nested `result_type` typedef. For
other types the trait must be explicitly specialised, as shown above.
[heading See Also]
[link asio.reference.async_read_until async_read_until()],
[link asio.reference.is_match_condition is_match_condition],
[link asio.reference.read_until read_until()],
[link asio.reference.streambuf streambuf],
[link asio.examples.cpp03_examples.http_client HTTP client example].
[endsect]

View File

@@ -0,0 +1,94 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:other_protocols Support for Other Protocols]
Support for other socket protocols (such as Bluetooth or IRCOMM sockets) can be
added by implementing the [link asio.reference.Protocol protocol type
requirements]. However, in many cases these protocols may also be used with
Asio's generic protocol support. For this, Asio provides the following four
classes:
* [link asio.reference.generic__datagram_protocol `generic::datagram_protocol`]
* [link asio.reference.generic__raw_protocol `generic::raw_protocol`]
* [link asio.reference.generic__seq_packet_protocol `generic::seq_packet_protocol`]
* [link asio.reference.generic__stream_protocol `generic::stream_protocol`]
These classes implement the [link asio.reference.Protocol protocol type
requirements], but allow the user to specify the address family (e.g. `AF_INET`)
and protocol type (e.g. `IPPROTO_TCP`) at runtime. For example:
asio::generic::stream_protocol::socket my_socket(my_io_context);
my_socket.open(asio::generic::stream_protocol(AF_INET, IPPROTO_TCP));
...
An endpoint class template, [link asio.reference.generic__basic_endpoint
`asio::generic::basic_endpoint`], is included to support these protocol
classes. This endpoint can hold any other endpoint type, provided its native
representation fits into a `sockaddr_storage` object. This class will also
convert from other types that implement the [link asio.reference.Endpoint
endpoint] type requirements:
asio::ip::tcp::endpoint my_endpoint1 = ...;
asio::generic::stream_protocol::endpoint my_endpoint2(my_endpoint1);
The conversion is implicit, so as to support the following use cases:
asio::generic::stream_protocol::socket my_socket(my_io_context);
asio::ip::tcp::endpoint my_endpoint = ...;
my_socket.connect(my_endpoint);
[heading C++11 Move Construction]
When using C++11, it is possible to perform move construction from a socket (or
acceptor) object to convert to the more generic protocol's socket (or acceptor)
type. If the protocol conversion is valid:
Protocol1 p1 = ...;
Protocol2 p2(p1);
then the corresponding socket conversion is allowed:
Protocol1::socket my_socket1(my_io_context);
...
Protocol2::socket my_socket2(std::move(my_socket1));
For example, one possible conversion is from a TCP socket to a generic
stream-oriented socket:
asio::ip::tcp::socket my_socket1(my_io_context);
...
asio::generic::stream_protocol::socket my_socket2(std::move(my_socket1));
These conversions are also available for move-assignment.
These conversions are not limited to the above generic protocol classes.
User-defined protocols may take advantage of this feature by similarly ensuring
the conversion from `Protocol1` to `Protocol2` is valid, as above.
[heading Accepting Generic Sockets]
As a convenience, a socket acceptor's `accept()` and `async_accept()` functions
can directly accept into a different protocol's socket type, provided the
corresponding protocol conversion is valid. For example, the following is
supported because the protocol `asio::ip::tcp` is convertible to
`asio::generic::stream_protocol`:
asio::ip::tcp::acceptor my_acceptor(my_io_context);
...
asio::generic::stream_protocol::socket my_socket(my_io_context);
my_acceptor.accept(my_socket);
[heading See Also]
[link asio.reference.generic__datagram_protocol `generic::datagram_protocol`],
[link asio.reference.generic__raw_protocol `generic::raw_protocol`],
[link asio.reference.generic__seq_packet_protocol `generic::seq_packet_protocol`],
[link asio.reference.generic__stream_protocol `generic::stream_protocol`],
[link asio.reference.Protocol protocol type requirements].
[endsect]

View File

@@ -0,0 +1,152 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:posix POSIX-Specific Functionality]
[link asio.overview.posix.local UNIX Domain Sockets]
[link asio.overview.posix.stream_descriptor Stream-Oriented File Descriptors]
[link asio.overview.posix.fork Fork]
[section:local UNIX Domain Sockets]
Asio provides basic support for UNIX domain sockets (also known as local
sockets). The simplest use involves creating a pair of connected sockets.
The following code:
local::stream_protocol::socket socket1(my_io_context);
local::stream_protocol::socket socket2(my_io_context);
local::connect_pair(socket1, socket2);
will create a pair of stream-oriented sockets. To do the same for
datagram-oriented sockets, use:
local::datagram_protocol::socket socket1(my_io_context);
local::datagram_protocol::socket socket2(my_io_context);
local::connect_pair(socket1, socket2);
A UNIX domain socket server may be created by binding an acceptor to an
endpoint, in much the same way as one does for a TCP server:
::unlink("/tmp/foobar"); // Remove previous binding.
local::stream_protocol::endpoint ep("/tmp/foobar");
local::stream_protocol::acceptor acceptor(my_io_context, ep);
local::stream_protocol::socket socket(my_io_context);
acceptor.accept(socket);
A client that connects to this server might look like:
local::stream_protocol::endpoint ep("/tmp/foobar");
local::stream_protocol::socket socket(my_io_context);
socket.connect(ep);
Transmission of file descriptors or credentials across UNIX domain sockets is
not directly supported within Asio, but may be achieved by accessing the
socket's underlying descriptor using the [link
asio.reference.basic_socket.native_handle native_handle()] member function.
[heading See Also]
[link asio.reference.local__connect_pair local::connect_pair],
[link asio.reference.local__datagram_protocol local::datagram_protocol],
[link asio.reference.local__datagram_protocol.endpoint local::datagram_protocol::endpoint],
[link asio.reference.local__datagram_protocol.socket local::datagram_protocol::socket],
[link asio.reference.local__stream_protocol local::stream_protocol],
[link asio.reference.local__stream_protocol.acceptor local::stream_protocol::acceptor],
[link asio.reference.local__stream_protocol.endpoint local::stream_protocol::endpoint],
[link asio.reference.local__stream_protocol.iostream local::stream_protocol::iostream],
[link asio.reference.local__stream_protocol.socket local::stream_protocol::socket],
[link asio.examples.cpp03_examples.unix_domain_sockets UNIX domain sockets examples].
[heading Notes]
UNIX domain sockets are only available at compile time if supported by the
target operating system. A program may test for the macro
`ASIO_HAS_LOCAL_SOCKETS` to determine whether they are supported.
[endsect]
[section:stream_descriptor Stream-Oriented File Descriptors]
Asio includes classes added to permit synchronous and asynchronous read and
write operations to be performed on POSIX file descriptors, such as pipes,
standard input and output, and various devices.
These classes also provide limited support for regular files. This support
assumes that the underlying read and write operations provided by the operating
system never fail with `EAGAIN` or `EWOULDBLOCK`. (This assumption normally
holds for buffered file I/O.) Synchronous and asynchronous read and write
operations on file descriptors will succeed but the I/O will always be
performed immediately. Wait operations, and operations involving
`asio::null_buffers`, are not portably supported.
For example, to perform read and write operations on standard input
and output, the following objects may be created:
posix::stream_descriptor in(my_io_context, ::dup(STDIN_FILENO));
posix::stream_descriptor out(my_io_context, ::dup(STDOUT_FILENO));
These are then used as synchronous or asynchronous read and write streams. This
means the objects can be used with any of the [link asio.reference.read
read()], [link asio.reference.async_read async_read()], [link
asio.reference.write write()], [link asio.reference.async_write async_write()],
[link asio.reference.read_until read_until()] or [link
asio.reference.async_read_until async_read_until()] free functions.
[heading See Also]
[link asio.reference.posix__stream_descriptor posix::stream_descriptor],
[link asio.examples.cpp03_examples.chat Chat example (C++03)],
[link asio.examples.cpp11_examples.chat Chat example (C++11)].
[heading Notes]
POSIX stream descriptors are only available at compile time if supported by the
target operating system. A program may test for the macro
`ASIO_HAS_POSIX_STREAM_DESCRIPTOR` to determine whether they are supported.
[endsect]
[section:fork Fork]
Asio supports programs that utilise the `fork()` system call. Provided the
program calls `io_context.notify_fork()` at the appropriate times, Asio will
recreate any internal file descriptors (such as the "self-pipe trick"
descriptor used for waking up a reactor). The notification is usually performed
as follows:
io_context_.notify_fork(asio::io_context::fork_prepare);
if (fork() == 0)
{
io_context_.notify_fork(asio::io_context::fork_child);
...
}
else
{
io_context_.notify_fork(asio::io_context::fork_parent);
...
}
User-defined services can also be made fork-aware by overriding the
`io_context::service::notify_fork()` virtual function.
Note that any file descriptors accessible via Asio's public API (e.g. the
descriptors underlying `basic_socket<>`, `posix::stream_descriptor`, etc.) are
not altered during a fork. It is the program's responsibility to manage these
as required.
[heading See Also]
[link asio.reference.io_context.notify_fork io_context::notify_fork()],
[link asio.reference.io_context.fork_event io_context::fork_event],
[link asio.reference.execution_context__service.notify_fork io_context::service::notify_fork()],
[link asio.examples.cpp03_examples.fork Fork examples].
[endsect]
[endsect]

View File

@@ -0,0 +1,100 @@
digraph g
{
edge
[
fontname="Helvetica",
fontsize=10,
labelfontname="Helvetica",
labelfontsize=10
];
node
[
fontname="Helvetica",
fontsize=10,
shape=record
];
initiator
[
label="Initiator"
];
async_processor
[
label="Asynchronous\nOperation Processor"
];
async_op
[
label="Asynchronous\nOperation"
];
completion_queue
[
label="Completion\nEvent Queue"
];
async_event_demuxer
[
label="Asynchronous\nEvent Demultiplexer"
];
proactor
[
label="Proactor"
];
handler
[
label="Completion\nHandler"
];
initiator -> async_processor
[
label="uses",
style="dashed"
];
initiator -> async_op
[
label="starts",
style="dashed"
];
initiator -> handler
[
label="creates",
style="dashed"
];
async_processor -> async_op
[
label="executes",
style="dashed"
];
async_processor -> completion_queue
[
label="enqueues",
style="dashed"
];
async_op -> handler;
async_event_demuxer -> completion_queue
[
label="dequeues",
style="dashed"
];
proactor -> async_event_demuxer
[
];
proactor -> handler
[
label="demultiplexes\n& dispatches"
style="dashed"
];
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -0,0 +1,149 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:protocols TCP, UDP and ICMP]
Asio provides off-the-shelf support for the internet protocols TCP, UDP and
ICMP.
[heading TCP Clients]
Hostname resolution is performed using a resolver, where host and service names
are looked up and converted into one or more endpoints:
ip::tcp::resolver resolver(my_io_context);
ip::tcp::resolver::query query("www.boost.org", "http");
ip::tcp::resolver::iterator iter = resolver.resolve(query);
ip::tcp::resolver::iterator end; // End marker.
while (iter != end)
{
ip::tcp::endpoint endpoint = *iter++;
std::cout << endpoint << std::endl;
}
The list of endpoints obtained above could contain both IPv4 and IPv6 endpoints,
so a program should try each of them until it finds one that works. This keeps the
client program independent of a specific IP version.
To simplify the development of protocol-independent programs, TCP clients may
establish connections using the free functions [link asio.reference.connect
connect()] and [link asio.reference.async_connect async_connect()]. These
operations try each endpoint in a list until the socket is successfully
connected. For example, a single call:
ip::tcp::socket socket(my_io_context);
asio::connect(socket, resolver.resolve(query));
will synchronously try all endpoints until one is successfully connected.
Similarly, an asynchronous connect may be performed by writing:
asio::async_connect(socket_, iter,
boost::bind(&client::handle_connect, this,
asio::placeholders::error));
// ...
void handle_connect(const error_code& error)
{
if (!error)
{
// Start read or write operations.
}
else
{
// Handle error.
}
}
When a specific endpoint is available, a socket can be created and connected:
ip::tcp::socket socket(my_io_context);
socket.connect(endpoint);
Data may be read from or written to a connected TCP socket using the [link
asio.reference.basic_stream_socket.receive receive()], [link
asio.reference.basic_stream_socket.async_receive async_receive()], [link
asio.reference.basic_stream_socket.send send()] or [link
asio.reference.basic_stream_socket.async_send async_send()] member functions.
However, as these could result in [link asio.overview.core.streams short writes
or reads], an application will typically use the following operations instead:
[link asio.reference.read read()], [link asio.reference.async_read
async_read()], [link asio.reference.write write()] and [link
asio.reference.async_write async_write()].
[heading TCP Servers]
A program uses an acceptor to accept incoming TCP connections:
ip::tcp::acceptor acceptor(my_io_context, my_endpoint);
...
ip::tcp::socket socket(my_io_context);
acceptor.accept(socket);
After a socket has been successfully accepted, it may be read from or written
to as illustrated for TCP clients above.
[heading UDP]
UDP hostname resolution is also performed using a resolver:
ip::udp::resolver resolver(my_io_context);
ip::udp::resolver::query query("localhost", "daytime");
ip::udp::resolver::iterator iter = resolver.resolve(query);
...
A UDP socket is typically bound to a local endpoint. The following code will
create an IP version 4 UDP socket and bind it to the "any" address on port
`12345`:
ip::udp::endpoint endpoint(ip::udp::v4(), 12345);
ip::udp::socket socket(my_io_context, endpoint);
Data may be read from or written to an unconnected UDP socket using the [link
asio.reference.basic_datagram_socket.receive_from receive_from()], [link
asio.reference.basic_datagram_socket.async_receive_from async_receive_from()],
[link asio.reference.basic_datagram_socket.send_to send_to()] or [link
asio.reference.basic_datagram_socket.async_send_to async_send_to()] member
functions. For a connected UDP socket, use the [link
asio.reference.basic_datagram_socket.receive receive()], [link
asio.reference.basic_datagram_socket.async_receive async_receive()], [link
asio.reference.basic_datagram_socket.send send()] or [link
asio.reference.basic_datagram_socket.async_send async_send()] member functions.
[heading ICMP]
As with TCP and UDP, ICMP hostname resolution is performed using a resolver:
ip::icmp::resolver resolver(my_io_context);
ip::icmp::resolver::query query("localhost", "");
ip::icmp::resolver::iterator iter = resolver.resolve(query);
...
An ICMP socket may be bound to a local endpoint. The following code will create
an IP version 6 ICMP socket and bind it to the "any" address:
ip::icmp::endpoint endpoint(ip::icmp::v6(), 0);
ip::icmp::socket socket(my_io_context, endpoint);
The port number is not used for ICMP.
Data may be read from or written to an unconnected ICMP socket using the [link
asio.reference.basic_raw_socket.receive_from receive_from()], [link
asio.reference.basic_raw_socket.async_receive_from async_receive_from()],
[link asio.reference.basic_raw_socket.send_to send_to()] or [link
asio.reference.basic_raw_socket.async_send_to async_send_to()] member
functions.
[heading See Also]
[link asio.reference.ip__tcp ip::tcp],
[link asio.reference.ip__udp ip::udp],
[link asio.reference.ip__icmp ip::icmp],
[link asio.tutorial.tutdaytime1 daytime protocol tutorials],
[link asio.examples.cpp03_examples.icmp ICMP ping example].
[endsect]

View File

@@ -0,0 +1,54 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:rationale Rationale]
Most programs interact with the outside world in some way, whether it be via a
file, a network, a serial cable, or the console. Sometimes, as is the case with
networking, individual I/O operations can take a long time to complete. This
poses particular challenges to application development.
Asio provides the tools to manage these long running operations, without
requiring programs to use concurrency models based on threads and explicit
locking.
The Asio library is intended for programmers using C++ for systems programming,
where access to operating system functionality such as networking is often
required. In particular, Asio addresses the following goals:
* [*Portability.] The library should support a range of commonly used operating
systems, and provide consistent behaviour across these operating systems.
* [*Scalability.] The library should facilitate the development of network
applications that scale to thousands of concurrent connections. The library
implementation for each operating system should use the mechanism that best
enables this scalability.
* [*Efficiency.] The library should support techniques such as scatter-gather
I/O, and allow programs to minimise data copying.
* [*Model concepts from established APIs, such as BSD sockets.] The
BSD socket API is widely implemented and understood, and is covered in much
literature. Other programming languages often use a similar interface for
networking APIs. As far as is reasonable, Asio should leverage existing
practice.
* [*Ease of use.] The library should provide a lower entry barrier for new
users by taking a toolkit, rather than framework, approach. That is, it should
try to minimise the up-front investment in time to just learning a few basic
rules and guidelines. After that, a library user should only need to understand
the specific functions that are being used.
* [*Basis for further abstraction.] The library should permit the development
of other libraries that provide higher levels of abstraction. For example,
implementations of commonly used protocols such as HTTP.
Although Asio started life focused primarily on networking, its concepts of
asynchronous I/O have been extended to include other operating system resources
such as serial ports, file descriptors, and so on.
[endsect]

View File

@@ -0,0 +1,44 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:reactor Reactor-Style Operations]
Sometimes a program must be integrated with a third-party library that wants to
perform the I/O operations itself. To facilitate this, Asio includes
synchronous and asynchronous operations that may be used to wait for a socket
to become ready to read, ready to write, or to have a pending error condition.
As an example, to perform a non-blocking read something like the following may
be used:
ip::tcp::socket socket(my_io_context);
...
socket.non_blocking(true);
...
socket.async_wait(ip::tcp::socket::wait_read, read_handler);
...
void read_handler(asio::error_code ec)
{
if (!ec)
{
std::vector<char> buf(socket.available());
socket.read_some(buffer(buf));
}
}
These operations are supported for sockets on all platforms, and for the POSIX
stream-oriented descriptor classes.
[heading See Also]
[link asio.reference.basic_socket.wait basic_socket::wait()],
[link asio.reference.basic_socket.async_wait basic_socket::async_wait()],
[link asio.reference.basic_socket.non_blocking basic_socket::non_blocking()],
[link asio.reference.basic_socket.native_non_blocking basic_socket::native_non_blocking()],
[link asio.examples.cpp03_examples.nonblocking nonblocking example].
[endsect]

View File

@@ -0,0 +1,45 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:serial_ports Serial Ports]
Asio includes classes for creating and manipulating serial ports in a portable
manner. For example, a serial port may be opened using:
serial_port port(my_io_context, name);
where name is something like `"COM1"` on Windows, and `"/dev/ttyS0"` on POSIX
platforms.
Once opened, the serial port may be used as a [link asio.overview.core.streams
stream]. This means the objects can be used with any of the [link
asio.reference.read read()], [link asio.reference.async_read async_read()],
[link asio.reference.write write()], [link asio.reference.async_write
async_write()], [link asio.reference.read_until read_until()] or [link
asio.reference.async_read_until async_read_until()] free functions.
The serial port implementation also includes option classes for configuring the
port's baud rate, flow control type, parity, stop bits and character size.
[heading See Also]
[link asio.reference.serial_port serial_port],
[link asio.reference.serial_port_base serial_port_base],
[link asio.reference.serial_port_base__baud_rate serial_port_base::baud_rate],
[link asio.reference.serial_port_base__flow_control serial_port_base::flow_control],
[link asio.reference.serial_port_base__parity serial_port_base::parity],
[link asio.reference.serial_port_base__stop_bits serial_port_base::stop_bits],
[link asio.reference.serial_port_base__character_size serial_port_base::character_size].
[heading Notes]
Serial ports are available on all POSIX platforms. For Windows, serial ports
are only available at compile time when the I/O completion port backend is used
(which is the default). A program may test for the macro
`ASIO_HAS_SERIAL_PORT` to determine whether they are supported.
[endsect]

View File

@@ -0,0 +1,44 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:signals Signal Handling]
Asio supports signal handling using a class called [link
asio.reference.signal_set 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 be
registered with multiple [link asio.reference.signal_set signal_set] objects,
however the signal number must be used only with Asio.
void handler(
const asio::error_code& error,
int signal_number)
{
if (!error)
{
// A signal occurred.
}
}
...
// Construct a signal set registered for process termination.
asio::signal_set signals(io_context, SIGINT, SIGTERM);
// Start an asynchronous wait for one of the signals to occur.
signals.async_wait(handler);
Signal handling also works on Windows, as the Microsoft Visual C++ runtime
library maps console events like Ctrl+C to the equivalent signal.
[heading See Also]
[link asio.reference.signal_set signal_set],
[link asio.examples.cpp03_examples.http_server HTTP server example (C++03)],
[link asio.examples.cpp11_examples.http_server HTTP server example (C++11)].
[endsect]

View File

@@ -0,0 +1,102 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:spawn Stackful Coroutines]
The [link asio.reference.spawn `spawn()`] function is a high-level wrapper for
running stackful coroutines. It is based on the Boost.Coroutine library. The
`spawn()` function enables programs to implement asynchronous logic in a
synchronous manner, as shown in the following example:
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 `spawn()` may be a
[link asio.reference.io_context__strand `strand`],
[link asio.reference.io_context `io_context`], or
[link asio.reference.CompletionHandler 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 an asynchronous operation's handler signature has the form:
void handler(asio::error_code ec, result_type result);
the initiating function returns the result_type. In the `async_read_some`
example above, this is `size_t`. If the asynchronous operation fails, the
`error_code` is converted into a `system_error` exception and thrown.
Where a handler signature has the form:
void handler(asio::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:
asio::error_code ec;
std::size_t length =
my_socket.async_read_some(
asio::buffer(data), yield[ec]);
[*Note:] if `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);
[heading See Also]
[link asio.reference.spawn spawn],
[link asio.reference.yield_context yield_context],
[link asio.reference.basic_yield_context basic_yield_context],
[link asio.examples.cpp03_examples.spawn Spawn example (C++03)],
[link asio.examples.cpp11_examples.spawn Spawn example (C++11)],
[link asio.overview.core.coroutine Stackless Coroutines].
[endsect]

View File

@@ -0,0 +1,124 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:ssl SSL]
Asio contains classes and class templates for basic SSL support. These classes
allow encrypted communication to be layered on top of an existing stream, such
as a TCP socket.
Before creating an encrypted stream, an application must construct an SSL
context object. This object is used to set SSL options such as verification
mode, certificate files, and so on. As an illustration, client-side
initialisation may look something like:
ssl::context ctx(ssl::context::sslv23);
ctx.set_verify_mode(ssl::verify_peer);
ctx.load_verify_file("ca.pem");
To use SSL with a TCP socket, one may write:
ssl::stream<ip::tcp::socket> ssl_sock(my_io_context, ctx);
To perform socket-specific operations, such as establishing an outbound
connection or accepting an incoming one, the underlying socket must first be
obtained using the `ssl::stream` template's [link
asio.reference.ssl__stream.lowest_layer `lowest_layer()`] member function:
ip::tcp::socket::lowest_layer_type& sock = ssl_sock.lowest_layer();
sock.connect(my_endpoint);
In some use cases the underlying stream object will need to have a longer
lifetime than the SSL stream, in which case the template parameter should be a
reference to the stream type:
ip::tcp::socket sock(my_io_context);
ssl::stream<ip::tcp::socket&> ssl_sock(sock, ctx);
SSL handshaking must be performed prior to transmitting or receiving data over
an encrypted connection. This is accomplished using the `ssl::stream`
template's [link asio.reference.ssl__stream.handshake handshake()] or [link
asio.reference.ssl__stream.async_handshake async_handshake()] member functions.
Once connected, SSL stream objects are used as synchronous or asynchronous read
and write streams. This means the objects can be used with any of the [link
asio.reference.read read()], [link asio.reference.async_read async_read()],
[link asio.reference.write write()], [link asio.reference.async_write
async_write()], [link asio.reference.read_until read_until()] or [link
asio.reference.async_read_until async_read_until()] free functions.
[heading Certificate Verification]
Asio provides various methods for configuring the way SSL certificates are
verified:
* [link asio.reference.ssl__context.set_default_verify_paths ssl::context::set_default_verify_paths()]
* [link asio.reference.ssl__context.set_verify_mode ssl::context::set_verify_mode()]
* [link asio.reference.ssl__context.set_verify_callback ssl::context::set_verify_callback()]
* [link asio.reference.ssl__context.load_verify_file ssl::context::load_verify_file()]
* [link asio.reference.ssl__stream.set_verify_mode ssl::stream::set_verify_mode()]
* [link asio.reference.ssl__stream.set_verify_callback ssl::stream::set_verify_callback()]
To simplify use cases where certificates are verified according to the rules in
RFC 6125 (identity verification in the context of Transport Layer Security),
Asio provides a reusable verification callback as a function object:
* [link asio.reference.ssl__host_name_verification ssl::host_name_verification]
The following example shows verification of a remote host's certificate
according to the rules used by HTTPS:
using asio::ip::tcp;
namespace ssl = asio::ssl;
typedef ssl::stream<tcp::socket> ssl_socket;
// Create a context that uses the default paths for
// finding CA certificates.
ssl::context ctx(ssl::context::sslv23);
ctx.set_default_verify_paths();
// Open a socket and connect it to the remote host.
asio::io_context io_context;
ssl_socket sock(io_context, ctx);
tcp::resolver resolver(io_context);
tcp::resolver::query query("host.name", "https");
asio::connect(sock.lowest_layer(), resolver.resolve(query));
sock.lowest_layer().set_option(tcp::no_delay(true));
// Perform SSL handshake and verify the remote host's
// certificate.
sock.set_verify_mode(ssl::verify_peer);
sock.set_verify_callback(ssl::host_name_verification("host.name"));
sock.handshake(ssl_socket::client);
// ... read and write as normal ...
[heading SSL and Threads]
SSL stream objects perform no locking of their own. Therefore, it is essential
that all asynchronous SSL operations are performed in an implicit or explicit
[link asio.overview.core.strands strand]. Note that this means that no
synchronisation is required (and so no locking overhead is incurred) in single
threaded programs.
[heading See Also]
[link asio.reference.ssl__context ssl::context],
[link asio.reference.ssl__host_name_verification ssl::host_name_verification],
[link asio.reference.ssl__stream ssl::stream],
[link asio.examples.cpp03_examples.ssl SSL example (C++03)],
[link asio.examples.cpp11_examples.ssl SSL example (C++11)].
[heading Notes]
[@http://www.openssl.org OpenSSL] is required to make use of Asio's SSL
support. When an application needs to use OpenSSL functionality that is not
wrapped by Asio, the underlying OpenSSL types may be obtained by calling [link
asio.reference.ssl__context.native_handle `ssl::context::native_handle()`] or
[link asio.reference.ssl__stream.native_handle `ssl::stream::native_handle()`].
[endsect]

View File

@@ -0,0 +1,114 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:strands Strands: Use Threads Without Explicit Locking]
A strand is defined as a strictly sequential invocation of event handlers (i.e.
no concurrent invocation). Use of strands allows execution of code in a
multithreaded program without the need for explicit locking (e.g. using
mutexes).
Strands may be either implicit or explicit, as illustrated by the following
alternative approaches:
* Calling io_context::run() from only one thread means all event handlers
execute in an implicit strand, due to the io_context's guarantee that handlers
are only invoked from inside run().
* Where there is a single chain of asynchronous operations associated with a
connection (e.g. in a half duplex protocol implementation like HTTP) there is
no possibility of concurrent execution of the handlers. This is an implicit
strand.
* An explicit strand is an instance of `strand<>` or `io_context::strand`. All
event handler function objects need to be bound to the strand using
`asio::bind_executor()` or otherwise posted/dispatched through the strand
object.
In the case of composed asynchronous operations, such as `async_read()` or
`async_read_until()`, if a completion handler goes through a strand, then all
intermediate handlers should also go through the same strand. This is needed to
ensure thread safe access for any objects that are shared between the caller
and the composed operation (in the case of `async_read()` it's the socket,
which the caller can `close()` to cancel the operation).
To achieve this, all asynchronous operations obtain the handler's associated
executor by using the `get_associated_executor` function. For example:
asio::associated_executor_t<Handler> a = asio::get_associated_executor(h);
The associated executor must satisfy the Executor requirements. It will be used
by the asynchronous operation to submit both intermediate and final handlers
for execution.
The executor may be customised for a particular handler type by specifying a
nested type `executor_type` and member function `get_executor()`:
class my_handler
{
public:
// Custom implementation of Executor type requirements.
typedef my_executor executor_type;
// Return a custom executor implementation.
executor_type get_executor() const noexcept
{
return my_executor();
}
void operator()() { ... }
};
In more complex cases, the `associated_executor` template may be partially
specialised directly:
struct my_handler
{
void operator()() { ... }
};
namespace asio {
template <class Executor>
struct associated_executor<my_handler, Executor>
{
// Custom implementation of Executor type requirements.
typedef my_executor type;
// Return a custom executor implementation.
static type get(const my_handler&,
const Executor& = Executor()) noexcept
{
return my_executor();
}
};
} // namespace asio
The `asio::bind_executor()` function is a helper to bind a specific executor
object, such as a strand, to a completion handler. This binding automatically
associates an executor as shown above. For example, to bind a strand to a
completion handler we would simply write:
my_socket.async_read_some(my_buffer,
asio::bind_executor(my_strand,
[](error_code ec, size_t length)
{
// ...
}));
[heading See Also]
[link asio.reference.associated_executor associated_executor],
[link asio.reference.get_associated_executor get_associated_executor],
[link asio.reference.bind_executor bind_executor],
[link asio.reference.strand strand],
[link asio.reference.io_context__strand io_context::strand],
[link asio.tutorial.tuttimer5 tutorial Timer.5],
[link asio.examples.cpp03_examples.http_server_3 HTTP server 3 example].
[endsect]

View File

@@ -0,0 +1,62 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:streams Streams, Short Reads and Short Writes]
Many I/O objects in Asio are stream-oriented. This means that:
* There are no message boundaries. The data being transferred is a continuous
sequence of bytes.
* Read or write operations may transfer fewer bytes than requested. This is
referred to as a short read or short write.
Objects that provide stream-oriented I/O model one or more of the following
type requirements:
* `SyncReadStream`, where synchronous read operations are performed using a
member function called `read_some()`.
* `AsyncReadStream`, where asynchronous read operations are performed using a
member function called `async_read_some()`.
* `SyncWriteStream`, where synchronous write operations are performed using a
member function called `write_some()`.
* `AsyncWriteStream`, where asynchronous write operations are performed using a
member function called `async_write_some()`.
Examples of stream-oriented I/O objects include `ip::tcp::socket`,
`ssl::stream<>`, `posix::stream_descriptor`, `windows::stream_handle`, etc.
Programs typically want to transfer an exact number of bytes. When a short read
or short write occurs the program must restart the operation, and continue to
do so until the required number of bytes has been transferred. Asio provides
generic functions that do this automatically: `read()`, `async_read()`,
`write()` and `async_write()`.
[heading Why EOF is an Error]
* The end of a stream can cause `read`, `async_read`, `read_until` or
`async_read_until` functions to violate their contract. E.g.
a read of N bytes may finish early due to EOF.
* An EOF error may be used to distinguish the end of a stream from a successful
read of size 0.
[heading See Also]
[link asio.reference.async_read async_read()],
[link asio.reference.async_write async_write()],
[link asio.reference.read read()],
[link asio.reference.write write()],
[link asio.reference.AsyncReadStream AsyncReadStream],
[link asio.reference.AsyncWriteStream AsyncWriteStream],
[link asio.reference.SyncReadStream SyncReadStream],
[link asio.reference.SyncWriteStream SyncWriteStream].
[endsect]

View File

@@ -0,0 +1,67 @@
digraph g
{
graph
[
nodesep="0.6"
];
edge
[
fontname="Helvetica",
fontsize=10,
labelfontname="Helvetica",
labelfontsize=10
];
node
[
fontname="Helvetica",
fontsize=10,
shape=box
];
edge
[
arrowhead="open"
]
// Program elements.
{
operating_system [ label="Operating System", shape=ellipse ];
io_context [ label="I/O Execution Context\ne.g. io_context" ];
io_object [ label="I/O Object\ne.g. socket" ];
your_program [ label="Your Program" ];
}
// Owning relationships.
{
edge [ arrowtail="diamond" ];
your_program:w -> io_object:nw;
your_program:se -> io_context:ne;
}
// Non-owning relationships;
{
io_object:sw -> io_context:w;
}
// Actions.
{
edge [ style="dashed", color="#808080" ];
// Forward actions.
{
your_program:sw -> io_object:n [ label="1" ];
io_object:s -> io_context:nw [ label="2" ];
io_context:sw -> operating_system:nw [ label="3" ];
}
// Reverse actions.
{
edge [ arrowhead="none", arrowtail="open" ];
io_context:se -> operating_system:ne [ label="4" ];
io_object:se -> io_context:n [ label="5" ];
your_program:s -> io_object:ne [ label="6" ];
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -0,0 +1,67 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:threads Threads and Asio]
[heading Thread Safety]
In general, it is safe to make concurrent use of distinct objects, but unsafe
to make concurrent use of a single object. However, types such as `io_context`
provide a stronger guarantee that it is safe to use a single object
concurrently.
[heading Thread Pools]
Multiple threads may call `io_context::run()` to set up a pool of threads from
which completion handlers may be invoked. This approach may also be used with
`post()` as a means to perform arbitrary computational tasks across a thread
pool.
Note that all threads that have joined an `io_context`'s pool are considered
equivalent, and the `io_context` may distribute work across them in an
arbitrary fashion.
[heading Internal Threads]
The implementation of this library for a particular platform may make use of
one or more internal threads to emulate asynchronicity. As far as possible,
these threads must be invisible to the library user. In particular, the threads:
* must not call the user's code directly; and
* must block all signals.
This approach is complemented by the following guarantee:
* Asynchronous completion handlers will only be called from threads that are
currently calling `io_context::run()`.
Consequently, it is the library user's responsibility to create and manage all
threads to which the notifications will be delivered.
The reasons for this approach include:
* By only calling `io_context::run()` from a single thread, the user's code can
avoid the development complexity associated with synchronisation. For
example, a library user can implement scalable servers that are
single-threaded (from the user's point of view).
* A library user may need to perform initialisation in a thread shortly after
the thread starts and before any other application code is executed. For
example, users of Microsoft's COM must call `CoInitializeEx` before any other
COM operations can be called from that thread.
* The library interface is decoupled from interfaces for thread creation and
management, and permits implementations on platforms where threads are not
available.
[heading See Also]
[link asio.reference.io_context io_context],
[link asio.reference.post post].
[endsect]

View File

@@ -0,0 +1,52 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:timers Timers]
Long running I/O operations will often have a deadline by which they must have
completed. These deadlines may be expressed as absolute times, but are often
calculated relative to the current time.
As a simple example, to perform a synchronous wait operation on a timer using a
relative time one may write:
io_context i;
...
deadline_timer t(i);
t.expires_from_now(boost::posix_time::seconds(5));
t.wait();
More commonly, a program will perform an asynchronous wait operation on a
timer:
void handler(asio::error_code ec) { ... }
...
io_context i;
...
deadline_timer t(i);
t.expires_from_now(boost::posix_time::milliseconds(400));
t.async_wait(handler);
...
i.run();
The deadline associated with a timer may also be obtained as a relative time:
boost::posix_time::time_duration time_until_expiry
= t.expires_from_now();
or as an absolute time to allow composition of timers:
deadline_timer t2(i);
t2.expires_at(t.expires_at() + boost::posix_time::seconds(30));
[heading See Also]
[link asio.reference.basic_deadline_timer basic_deadline_timer],
[link asio.reference.deadline_timer deadline_timer],
[link asio.tutorial.tuttimer1 timer tutorials].
[endsect]

View File

@@ -0,0 +1,126 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:windows Windows-Specific Functionality]
[link asio.overview.windows.stream_handle Stream-Oriented HANDLEs]
[link asio.overview.windows.random_access_handle Random-Access HANDLEs]
[link asio.overview.windows.object_handle Object HANDLEs]
[section:stream_handle Stream-Oriented HANDLEs]
Asio contains classes to allow asynchronous read and write operations to be
performed on Windows `HANDLE`s, such as named pipes.
For example, to perform asynchronous operations on a named pipe, the following
object may be created:
HANDLE handle = ::CreateFile(...);
windows::stream_handle pipe(my_io_context, handle);
These are then used as synchronous or asynchronous read and write streams. This
means the objects can be used with any of the [link asio.reference.read
read()], [link asio.reference.async_read async_read()], [link
asio.reference.write write()], [link asio.reference.async_write
async_write()], [link asio.reference.read_until read_until()] or [link
asio.reference.async_read_until async_read_until()] free functions.
The kernel object referred to by the `HANDLE` must support use with I/O
completion ports (which means that named pipes are supported, but anonymous
pipes and console streams are not).
[heading See Also]
[link asio.reference.windows__stream_handle windows::stream_handle].
[heading Notes]
Windows stream `HANDLE`s are only available at compile time when targeting
Windows and only when the I/O completion port backend is used (which is the
default). A program may test for the macro `ASIO_HAS_WINDOWS_STREAM_HANDLE` to
determine whether they are supported.
[endsect]
[/-----------------------------------------------------------------------------]
[section:random_access_handle Random-Access HANDLEs]
Asio provides Windows-specific classes that permit asynchronous read and write
operations to be performed on HANDLEs that refer to regular files.
For example, to perform asynchronous operations on a file the following object
may be created:
HANDLE handle = ::CreateFile(...);
windows::random_access_handle file(my_io_context, handle);
Data may be read from or written to the handle using one of the
`read_some_at()`, `async_read_some_at()`, `write_some_at()` or
`async_write_some_at()` member functions. However, like the equivalent
functions (`read_some()`, etc.) on streams, these functions are only required
to transfer one or more bytes in a single operation. Therefore free functions
called [link asio.reference.read_at read_at()], [link
asio.reference.async_read_at async_read_at()], [link asio.reference.write_at
write_at()] and [link asio.reference.async_write_at async_write_at()] have been
created to repeatedly call the corresponding [^[**]_some_at()] function until
all data has been transferred.
[heading See Also]
[link asio.reference.windows__random_access_handle windows::random_access_handle].
[heading Notes]
Windows random-access `HANDLE`s are only available at compile time when
targeting Windows and only when the I/O completion port backend is used (which
is the default). A program may test for the macro
`ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE` to determine whether they are
supported.
[endsect]
[/-----------------------------------------------------------------------------]
[section:object_handle Object HANDLEs]
Asio provides Windows-specific classes that permit asynchronous wait operations
to be performed on HANDLEs to kernel objects of the following types:
* Change notification
* Console input
* Event
* Memory resource notification
* Process
* Semaphore
* Thread
* Waitable timer
For example, to perform asynchronous operations on an event, the following
object may be created:
HANDLE handle = ::CreateEvent(...);
windows::object_handle file(my_io_context, handle);
The `wait()` and `async_wait()` member functions may then be used to wait until
the kernel object is signalled.
[heading See Also]
[link asio.reference.windows__object_handle windows::object_handle].
[heading Notes]
Windows object `HANDLE`s are only available at compile time when targeting
Windows. Programs may test for the macro `ASIO_HAS_WINDOWS_OBJECT_HANDLE` to
determine whether they are supported.
[endsect]
[endsect]

View File

@@ -0,0 +1,88 @@
#!/usr/bin/perl -w
# Copyright (c) 2003-2021 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)
use strict;
open(my $fh, "<../../include/asio/detail/config.hpp") or die("can't open config.hpp");
my $current_comment = "";
my %has_macros = ();
my %disable_macros = ();
while (my $line = <$fh>)
{
chomp($line);
if ($line =~ /^$/)
{
$current_comment = "";
}
elsif ($line =~ /^\/\/ (.*)$/)
{
$current_comment = $current_comment . $1 . "\n";
}
elsif ($line =~ /^# *define *ASIO_HAS_([A-Z-0-9_]*) 1/)
{
if (not defined($has_macros{$1}))
{
$has_macros{$1} = $current_comment;
}
}
elsif ($line =~ /ASIO_DISABLE_([A-Z-0-9_]*)/)
{
$disable_macros{$1} = 1;
}
}
my $intro = <<EOF;
[/
/ Copyright (c) 2003-2021 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)
/]
[heading Compiler/platform feature detection macros]
Asio automatically defines preprocessor macros corresponding to the detected
available features on a particular compiler and target platform. These macros
are named with the prefix `ASIO_HAS_`, and are listed in the table below.
Many of these macros also have a corresponding `ASIO_DISABLE_` macro that may
be used to explicitly disable the feature.
In general, `ASIO_HAS_` macros should not be explicitly defined by the user,
except when absolutely required as a workaround for the latest version of a
compiler or platform. For older compiler/platform combinations where a specific
`ASIO_HAS_` macro is not automatically defined, testing may have shown that a
claimed feature isn't sufficiently conformant to be compatible with Asio's
needs.
EOF
print("$intro\n");
print("[table\n");
print(" [[Macro][Description][Macro to disable feature]]\n");
for my $macro (sort keys %has_macros)
{
print(" [\n");
print(" [`ASIO_HAS_$macro`]\n");
print(" [\n");
my $description = $has_macros{$macro};
chomp($description);
$description =~ s/\n/\n /g;
print(" $description\n");
print(" ]\n");
if (defined $disable_macros{$macro})
{
print(" [`ASIO_DISABLE_$macro`]\n");
}
else
{
print(" []\n");
}
print(" ]\n");
}
print("]\n");

View File

@@ -0,0 +1,620 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[heading Compiler/platform feature detection macros]
Asio automatically defines preprocessor macros corresponding to the detected
available features on a particular compiler and target platform. These macros
are named with the prefix `ASIO_HAS_`, and are listed in the table below.
Many of these macros also have a corresponding `ASIO_DISABLE_` macro that may
be used to explicitly disable the feature.
In general, `ASIO_HAS_` macros should not be explicitly defined by the user,
except when absolutely required as a workaround for the latest version of a
compiler or platform. For older compiler/platform combinations where a specific
`ASIO_HAS_` macro is not automatically defined, testing may have shown that a
claimed feature isn't sufficiently conformant to be compatible with Asio's
needs.
[table
[[Macro][Description][Macro to disable feature]]
[
[`ASIO_HAS_ALIAS_TEMPLATES`]
[
Support alias templates on compilers known to allow it.
]
[`ASIO_DISABLE_ALIAS_TEMPLATES`]
]
[
[`ASIO_HAS_ALIGNED_NEW`]
[
Support for operator new with alignment argument.
]
[`ASIO_DISABLE_ALIGNED_NEW`]
]
[
[`ASIO_HAS_ALIGNOF`]
[
Support for the alignof operator.
]
[`ASIO_DISABLE_ALIGNOF`]
]
[
[`ASIO_HAS_BOOST_ALIGN`]
[
Boost align library.
]
[`ASIO_DISABLE_BOOST_ALIGN`]
]
[
[`ASIO_HAS_BOOST_ARRAY`]
[
Boost array library.
]
[`ASIO_DISABLE_BOOST_ARRAY`]
]
[
[`ASIO_HAS_BOOST_ASSERT`]
[
Boost assert macro.
]
[`ASIO_DISABLE_BOOST_ASSERT`]
]
[
[`ASIO_HAS_BOOST_BIND`]
[
Boost bind function.
]
[`ASIO_DISABLE_BOOST_BIND`]
]
[
[`ASIO_HAS_BOOST_CHRONO`]
[
Boost support for chrono.
]
[`ASIO_DISABLE_BOOST_CHRONO`]
]
[
[`ASIO_HAS_BOOST_CONFIG`]
[
boostify: non-boost code ends here
]
[]
]
[
[`ASIO_HAS_BOOST_DATE_TIME`]
[
Boost support for the DateTime library.
]
[`ASIO_DISABLE_BOOST_DATE_TIME`]
]
[
[`ASIO_HAS_BOOST_LIMITS`]
[
Boost limits header.
]
[`ASIO_DISABLE_BOOST_LIMITS`]
]
[
[`ASIO_HAS_BOOST_REGEX`]
[
Boost regex library.
]
[`ASIO_DISABLE_BOOST_REGEX`]
]
[
[`ASIO_HAS_BOOST_THROW_EXCEPTION`]
[
Boost throw_exception function.
]
[`ASIO_DISABLE_BOOST_THROW_EXCEPTION`]
]
[
[`ASIO_HAS_BOOST_WORKAROUND`]
[
Boost's BOOST_WORKAROUND macro.
]
[`ASIO_DISABLE_BOOST_WORKAROUND`]
]
[
[`ASIO_HAS_CHRONO`]
[
Some form of chrono library is available.
]
[]
]
[
[`ASIO_HAS_CLANG_LIBCXX`]
[
Clang / libc++ detection.
]
[]
]
[
[`ASIO_HAS_CONCEPTS`]
[
Support concepts on compilers known to allow them.
]
[`ASIO_DISABLE_CONCEPTS`]
]
[
[`ASIO_HAS_CONSTANT_EXPRESSION_SFINAE`]
[
Support SFINAE use of constant expressions on compilers known to allow it.
]
[`ASIO_DISABLE_CONSTANT_EXPRESSION_SFINAE`]
]
[
[`ASIO_HAS_CONSTEXPR`]
[
Support constexpr on compilers known to allow it.
]
[`ASIO_DISABLE_CONSTEXPR`]
]
[
[`ASIO_HAS_CO_AWAIT`]
[
Support the co_await keyword on compilers known to allow it.
]
[`ASIO_DISABLE_CO_AWAIT`]
]
[
[`ASIO_HAS_CSTDINT`]
[
Standard library support for the cstdint header.
]
[`ASIO_DISABLE_CSTDINT`]
]
[
[`ASIO_HAS_CXX11_ALLOCATORS`]
[
Standard library support for the C++11 allocator additions.
]
[`ASIO_DISABLE_CXX11_ALLOCATORS`]
]
[
[`ASIO_HAS_DECLTYPE`]
[
Support automatic type deduction on compilers known to support it.
]
[`ASIO_DISABLE_DECLTYPE`]
]
[
[`ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS`]
[
Support default function template arguments on compilers known to allow it.
]
[`ASIO_DISABLE_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS`]
]
[
[`ASIO_HAS_DEV_POLL`]
[
Solaris: /dev/poll.
]
[`ASIO_DISABLE_DEV_POLL`]
]
[
[`ASIO_HAS_EPOLL`]
[
Linux: epoll, eventfd and timerfd.
]
[`ASIO_DISABLE_EPOLL`]
]
[
[`ASIO_HAS_EVENTFD`]
[
Linux: epoll, eventfd and timerfd.
]
[`ASIO_DISABLE_EVENTFD`]
]
[
[`ASIO_HAS_GETADDRINFO`]
[
Can use getaddrinfo() and getnameinfo().
]
[`ASIO_DISABLE_GETADDRINFO`]
]
[
[`ASIO_HAS_HANDLER_HOOKS`]
[
Handler hooking. Disabled for ancient Borland C++ and gcc compilers.
]
[`ASIO_DISABLE_HANDLER_HOOKS`]
]
[
[`ASIO_HAS_IOCP`]
[
Windows: IO Completion Ports.
]
[`ASIO_DISABLE_IOCP`]
]
[
[`ASIO_HAS_KQUEUE`]
[
Mac OS X, FreeBSD, NetBSD, OpenBSD: kqueue.
]
[`ASIO_DISABLE_KQUEUE`]
]
[
[`ASIO_HAS_LOCAL_SOCKETS`]
[
UNIX domain sockets.
]
[`ASIO_DISABLE_LOCAL_SOCKETS`]
]
[
[`ASIO_HAS_MOVE`]
[
Support move construction and assignment on compilers known to allow it.
]
[`ASIO_DISABLE_MOVE`]
]
[
[`ASIO_HAS_MSG_NOSIGNAL`]
[
Kernel support for MSG_NOSIGNAL.
]
[]
]
[
[`ASIO_HAS_NOEXCEPT`]
[
Support noexcept on compilers known to allow it.
]
[`ASIO_DISABLE_NOEXCEPT`]
]
[
[`ASIO_HAS_NULLPTR`]
[
Standard library support for the nullptr_t type.
]
[`ASIO_DISABLE_NULLPTR`]
]
[
[`ASIO_HAS_POSIX_STREAM_DESCRIPTOR`]
[
POSIX: stream-oriented file descriptors.
]
[`ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR`]
]
[
[`ASIO_HAS_PTHREADS`]
[
POSIX threads.
]
[]
]
[
[`ASIO_HAS_REF_QUALIFIED_FUNCTIONS`]
[
Support ref-qualified functions on compilers known to allow it.
]
[`ASIO_DISABLE_REF_QUALIFIED_FUNCTIONS`]
]
[
[`ASIO_HAS_RETURN_TYPE_DEDUCTION`]
[
Support return type deduction on compilers known to allow it.
]
[`ASIO_DISABLE_RETURN_TYPE_DEDUCTION`]
]
[
[`ASIO_HAS_SECURE_RTL`]
[
Microsoft Visual C++'s secure C runtime library.
]
[`ASIO_DISABLE_SECURE_RTL`]
]
[
[`ASIO_HAS_SERIAL_PORT`]
[
Serial ports.
]
[`ASIO_DISABLE_SERIAL_PORT`]
]
[
[`ASIO_HAS_SFINAE_VARIABLE_TEMPLATES`]
[
Support SFINAEd template variables on compilers known to allow it.
]
[`ASIO_DISABLE_SFINAE_VARIABLE_TEMPLATES`]
]
[
[`ASIO_HAS_SIGACTION`]
[
Can use sigaction() instead of signal().
]
[`ASIO_DISABLE_SIGACTION`]
]
[
[`ASIO_HAS_SIGNAL`]
[
Can use signal().
]
[`ASIO_DISABLE_SIGNAL`]
]
[
[`ASIO_HAS_SOURCE_LOCATION`]
[
Standard library has a source_location that we can use.
]
[`ASIO_DISABLE_SOURCE_LOCATION`]
]
[
[`ASIO_HAS_SSIZE_T`]
[
Support for POSIX ssize_t typedef.
]
[`ASIO_DISABLE_SSIZE_T`]
]
[
[`ASIO_HAS_STD_ADDRESSOF`]
[
Standard library support for addressof.
]
[`ASIO_DISABLE_STD_ADDRESSOF`]
]
[
[`ASIO_HAS_STD_ALLOCATOR_ARG`]
[
Standard library support for allocator_arg_t.
]
[`ASIO_DISABLE_STD_ALLOCATOR_ARG`]
]
[
[`ASIO_HAS_STD_ANY`]
[
Standard library support for std::any.
]
[`ASIO_DISABLE_STD_ANY`]
]
[
[`ASIO_HAS_STD_ARRAY`]
[
Standard library support for arrays.
]
[`ASIO_DISABLE_STD_ARRAY`]
]
[
[`ASIO_HAS_STD_ATOMIC`]
[
Standard library support for atomic operations.
]
[`ASIO_DISABLE_STD_ATOMIC`]
]
[
[`ASIO_HAS_STD_CALL_ONCE`]
[
Standard library support for the call_once function.
]
[`ASIO_DISABLE_STD_CALL_ONCE`]
]
[
[`ASIO_HAS_STD_CHRONO`]
[
Standard library support for chrono. Some standard libraries (such as the
libstdc++ shipped with gcc 4.6) provide monotonic_clock as per early C++0x
drafts, rather than the eventually standardised name of steady_clock.
]
[`ASIO_DISABLE_STD_CHRONO`]
]
[
[`ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK`]
[
Standard library support for chrono. Some standard libraries (such as the
libstdc++ shipped with gcc 4.6) provide monotonic_clock as per early C++0x
drafts, rather than the eventually standardised name of steady_clock.
]
[]
]
[
[`ASIO_HAS_STD_COROUTINE`]
[
Standard library support for coroutines.
]
[`ASIO_DISABLE_STD_COROUTINE`]
]
[
[`ASIO_HAS_STD_EXCEPTION_PTR`]
[
Standard library support for std::exception_ptr and std::current_exception.
]
[`ASIO_DISABLE_STD_EXCEPTION_PTR`]
]
[
[`ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION`]
[
Standard library support for std::experimental::source_location.
]
[`ASIO_DISABLE_STD_EXPERIMENTAL_SOURCE_LOCATION`]
]
[
[`ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW`]
[
Standard library support for std::experimental::string_view.
]
[`ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW`]
]
[
[`ASIO_HAS_STD_FUNCTION`]
[
Standard library support for the function class.
]
[`ASIO_DISABLE_STD_FUNCTION`]
]
[
[`ASIO_HAS_STD_FUTURE`]
[
Standard library support for futures.
]
[`ASIO_DISABLE_STD_FUTURE`]
]
[
[`ASIO_HAS_STD_HASH`]
[
Standard library support for std::hash.
]
[`ASIO_DISABLE_STD_HASH`]
]
[
[`ASIO_HAS_STD_INVOKE_RESULT`]
[
Standard library has invoke_result (which supersedes result_of).
]
[`ASIO_DISABLE_STD_INVOKE_RESULT`]
]
[
[`ASIO_HAS_STD_IOSTREAM_MOVE`]
[
Standard library support for iostream move construction and assignment.
]
[`ASIO_DISABLE_STD_IOSTREAM_MOVE`]
]
[
[`ASIO_HAS_STD_MUTEX_AND_CONDVAR`]
[
Standard library support for the mutex and condition variable classes.
]
[`ASIO_DISABLE_STD_MUTEX_AND_CONDVAR`]
]
[
[`ASIO_HAS_STD_NESTED_EXCEPTION`]
[
Standard library support for std::nested_exception.
]
[`ASIO_DISABLE_STD_NESTED_EXCEPTION`]
]
[
[`ASIO_HAS_STD_REFERENCE_WRAPPER`]
[
Standard library support for the reference_wrapper class.
]
[`ASIO_DISABLE_STD_REFERENCE_WRAPPER`]
]
[
[`ASIO_HAS_STD_SHARED_PTR`]
[
Standard library support for shared_ptr and weak_ptr.
]
[`ASIO_DISABLE_STD_SHARED_PTR`]
]
[
[`ASIO_HAS_STD_STRING_VIEW`]
[
Standard library support for std::string_view.
]
[`ASIO_DISABLE_STD_STRING_VIEW`]
]
[
[`ASIO_HAS_STD_SYSTEM_ERROR`]
[
Standard library support for system errors.
]
[`ASIO_DISABLE_STD_SYSTEM_ERROR`]
]
[
[`ASIO_HAS_STD_THREAD`]
[
Standard library support for the thread class.
]
[`ASIO_DISABLE_STD_THREAD`]
]
[
[`ASIO_HAS_STD_TYPE_TRAITS`]
[
Standard library support for type traits.
]
[`ASIO_DISABLE_STD_TYPE_TRAITS`]
]
[
[`ASIO_HAS_STRING_VIEW`]
[
Standard library has a string_view that we can use.
]
[`ASIO_DISABLE_STRING_VIEW`]
]
[
[`ASIO_HAS_THREADS`]
[
Threads.
]
[`ASIO_DISABLE_THREADS`]
]
[
[`ASIO_HAS_THREAD_KEYWORD_EXTENSION`]
[
Support for the __thread keyword extension.
]
[`ASIO_DISABLE_THREAD_KEYWORD_EXTENSION`]
]
[
[`ASIO_HAS_TIMERFD`]
[
Linux: epoll, eventfd and timerfd.
]
[]
]
[
[`ASIO_HAS_UNISTD_H`]
[
On POSIX (and POSIX-like) platforms we need to include unistd.h in order to
get access to the various platform feature macros, e.g. to be able to test
for threads support.
]
[]
]
[
[`ASIO_HAS_VARIABLE_TEMPLATES`]
[
Support template variables on compilers known to allow it.
]
[`ASIO_DISABLE_VARIABLE_TEMPLATES`]
]
[
[`ASIO_HAS_VARIADIC_TEMPLATES`]
[
Support variadic templates on compilers known to allow it.
]
[`ASIO_DISABLE_VARIADIC_TEMPLATES`]
]
[
[`ASIO_HAS_WINDOWS_OBJECT_HANDLE`]
[
Windows: object handles.
]
[`ASIO_DISABLE_WINDOWS_OBJECT_HANDLE`]
]
[
[`ASIO_HAS_WINDOWS_OVERLAPPED_PTR`]
[
Windows: OVERLAPPED wrapper.
]
[`ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR`]
]
[
[`ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE`]
[
Windows: random access handles.
]
[`ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE`]
]
[
[`ASIO_HAS_WINDOWS_STREAM_HANDLE`]
[
Windows: stream handles.
]
[`ASIO_DISABLE_WINDOWS_STREAM_HANDLE`]
]
[
[`ASIO_HAS_WORKING_EXPRESSION_SFINAE`]
[
Enable workarounds for lack of working expression SFINAE.
]
[`ASIO_DISABLE_WORKING_EXPRESSION_SFINAE`]
]
]

View File

@@ -0,0 +1 @@
# This file intentionally left blank.

View File

@@ -0,0 +1,765 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "../../../boost/tools/boostbook/dtd/boostbook.dtd">
<!--
Copyright (c) 2003-2021 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)
-->
<informaltable frame="all">
<tgroup cols="4">
<colspec colname="a"/>
<colspec colname="b"/>
<colspec colname="c"/>
<colspec colname="d"/>
<thead>
<row>
<entry valign="center" namest="a" nameend="a">
<bridgehead renderas="sect2">Properties</bridgehead>
</entry>
<entry valign="center" namest="b" nameend="d">
<bridgehead renderas="sect2">Execution</bridgehead>
</entry>
</row>
</thead>
<tbody>
<row>
<entry valign="top">
<bridgehead renderas="sect3">Customisation Points</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.prefer">prefer</link></member>
<member><link linkend="asio.reference.query">query</link></member>
<member><link linkend="asio.reference.require">require</link></member>
<member><link linkend="asio.reference.require_concept">require_concept</link></member>
</simplelist>
<bridgehead renderas="sect3">Traits</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.can_prefer">can_prefer</link></member>
<member><link linkend="asio.reference.can_query">can_query</link></member>
<member><link linkend="asio.reference.can_require">can_require</link></member>
<member><link linkend="asio.reference.can_require_concept">can_require_concept</link></member>
<member><link linkend="asio.reference.is_nothrow_prefer">is_nothrow_prefer</link></member>
<member><link linkend="asio.reference.is_nothrow_query">is_nothrow_query</link></member>
<member><link linkend="asio.reference.is_nothrow_require">is_nothrow_require</link></member>
<member><link linkend="asio.reference.is_nothrow_require_concept">is_nothrow_require_concept</link></member>
<member><link linkend="asio.reference.prefer_result">prefer_result</link></member>
<member><link linkend="asio.reference.query_result">query_result</link></member>
<member><link linkend="asio.reference.require_result">require_result</link></member>
<member><link linkend="asio.reference.require_concept_result">require_concept_result</link></member>
</simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">Class Templates</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.execution__any_executor">execution::any_executor</link></member>
</simplelist>
<bridgehead renderas="sect3">Classes</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.execution__bad_executor">execution::bad_executor</link></member>
<member><link linkend="asio.reference.execution__invocable_archetype">execution::invocable_archetype</link></member>
<member><link linkend="asio.reference.execution__receiver_invocation_error">execution::receiver_invocation_error</link></member>
</simplelist>
<bridgehead renderas="sect3">Properties</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.execution__allocator_t">execution::allocator_t</link></member>
<member><link linkend="asio.reference.execution__blocking_t">execution::blocking_t</link></member>
<member><link linkend="asio.reference.execution__blocking_t__possibly_t">execution::blocking_t::possibly_t</link></member>
<member><link linkend="asio.reference.execution__blocking_t__always_t">execution::blocking_t::always_t</link></member>
<member><link linkend="asio.reference.execution__blocking_t__never_t">execution::blocking_t::never_t</link></member>
<member><link linkend="asio.reference.execution__blocking_adaptation_t">execution::blocking_adaptation_t</link></member>
<member><link linkend="asio.reference.execution__blocking_adaptation_t__disallowed_t">execution::blocking_adaptation_t::disallowed_t</link></member>
<member><link linkend="asio.reference.execution__blocking_adaptation_t__allowed_t">execution::blocking_adaptation_t::allowed_t</link></member>
<member><link linkend="asio.reference.execution__bulk_guarantee_t">execution::bulk_guarantee_t</link></member>
<member><link linkend="asio.reference.execution__bulk_guarantee_t__unsequenced_t">execution::bulk_guarantee_t::unsequenced_t</link></member>
<member><link linkend="asio.reference.execution__bulk_guarantee_t__sequenced_t">execution::bulk_guarantee_t::sequenced_t</link></member>
<member><link linkend="asio.reference.execution__bulk_guarantee_t__parallel_t">execution::bulk_guarantee_t::parallel_t</link></member>
<member><link linkend="asio.reference.execution__context_t">execution::context_t</link></member>
<member><link linkend="asio.reference.execution__context_as_t">execution::context_as_t</link></member>
<member><link linkend="asio.reference.execution__mapping_t">execution::mapping_t</link></member>
<member><link linkend="asio.reference.execution__mapping_t__thread_t">execution::mapping_t::thread_t</link></member>
<member><link linkend="asio.reference.execution__mapping_t__new_thread_t">execution::mapping_t::new_thread_t</link></member>
<member><link linkend="asio.reference.execution__mapping_t__other_t">execution::mapping_t::other_t</link></member>
<member><link linkend="asio.reference.execution__occupancy_t">execution::occupancy_t</link></member>
<member><link linkend="asio.reference.execution__outstanding_work_t">execution::outstanding_work_t</link></member>
<member><link linkend="asio.reference.execution__outstanding_work_t__untracked_t">execution::outstanding_work_t::untracked_t</link></member>
<member><link linkend="asio.reference.execution__outstanding_work_t__tracked_t">execution::outstanding_work_t::tracked_t</link></member>
<member><link linkend="asio.reference.execution__prefer_only">execution::prefer_only</link></member>
<member><link linkend="asio.reference.execution__relationship_t">execution::relationship_t</link></member>
<member><link linkend="asio.reference.execution__relationship_t__fork_t">execution::relationship_t::fork_t</link></member>
<member><link linkend="asio.reference.execution__relationship_t__continuation_t">execution::relationship_t::continuation_t</link></member>
</simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">Customisation Points</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.execution__bulk_execute">execution::bulk_execute</link></member>
<member><link linkend="asio.reference.execution__connect">execution::connect</link></member>
<member><link linkend="asio.reference.execution__execute">execution::execute</link></member>
<member><link linkend="asio.reference.execution__schedule">execution::schedule</link></member>
<member><link linkend="asio.reference.execution__set_done">execution::set_done</link></member>
<member><link linkend="asio.reference.execution__set_error">execution::set_error</link></member>
<member><link linkend="asio.reference.execution__set_value">execution::set_value</link></member>
<member><link linkend="asio.reference.execution__start">execution::start</link></member>
<member><link linkend="asio.reference.execution__submit">execution::submit</link></member>
</simplelist>
<bridgehead renderas="sect3">Property Objects</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.execution__allocator">execution::allocator</link></member>
<member><link linkend="asio.reference.execution__blocking">execution::blocking</link></member>
<member><link linkend="asio.reference.execution__blocking_t.possibly">execution::blocking.possibly</link></member>
<member><link linkend="asio.reference.execution__blocking_t.always">execution::blocking.always</link></member>
<member><link linkend="asio.reference.execution__blocking_t.never">execution::blocking.never</link></member>
<member><link linkend="asio.reference.execution__blocking_adaptation">execution::blocking_adaptation</link></member>
<member><link linkend="asio.reference.execution__blocking_adaptation_t.disallowed">execution::blocking_adaptation.disallowed</link></member>
<member><link linkend="asio.reference.execution__blocking_adaptation_t.allowed">execution::blocking_adaptation.allowed</link></member>
<member><link linkend="asio.reference.execution__bulk_guarantee">execution::bulk_guarantee</link></member>
<member><link linkend="asio.reference.execution__bulk_guarantee_t.unsequenced">execution::bulk_guarantee.unsequenced</link></member>
<member><link linkend="asio.reference.execution__bulk_guarantee_t.sequenced">execution::bulk_guarantee.sequenced</link></member>
<member><link linkend="asio.reference.execution__bulk_guarantee_t.parallel">execution::bulk_guarantee.parallel</link></member>
<member><link linkend="asio.reference.execution__context">execution::context</link></member>
<member><link linkend="asio.reference.execution__context_as">execution::context_as</link></member>
<member><link linkend="asio.reference.execution__mapping">execution::mapping</link></member>
<member><link linkend="asio.reference.execution__mapping_t.thread">execution::mapping.thread</link></member>
<member><link linkend="asio.reference.execution__mapping_t.new_thread">execution::mapping.new_thread</link></member>
<member><link linkend="asio.reference.execution__mapping_t.other">execution::mapping.other</link></member>
<member><link linkend="asio.reference.execution__occupancy">execution::occupancy</link></member>
<member><link linkend="asio.reference.execution__outstanding_work">execution::outstanding_work</link></member>
<member><link linkend="asio.reference.execution__outstanding_work_t.untracked">execution::outstanding_work.untracked</link></member>
<member><link linkend="asio.reference.execution__outstanding_work_t.tracked">execution::outstanding_work.tracked</link></member>
<member><link linkend="asio.reference.execution__relationship">execution::relationship</link></member>
<member><link linkend="asio.reference.execution__relationship_t.fork">execution::relationship.fork</link></member>
<member><link linkend="asio.reference.execution__relationship_t.continuation">execution::relationship.continuation</link></member>
</simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">Type Traits</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.execution__can_bulk_execute">execution::can_bulk_execute</link></member>
<member><link linkend="asio.reference.execution__can_connect">execution::can_connect</link></member>
<member><link linkend="asio.reference.execution__can_execute">execution::can_execute</link></member>
<member><link linkend="asio.reference.execution__can_schedule">execution::can_schedule</link></member>
<member><link linkend="asio.reference.execution__can_set_done">execution::can_set_done</link></member>
<member><link linkend="asio.reference.execution__can_set_error">execution::can_set_error</link></member>
<member><link linkend="asio.reference.execution__can_set_value">execution::can_set_value</link></member>
<member><link linkend="asio.reference.execution__can_start">execution::can_start</link></member>
<member><link linkend="asio.reference.execution__can_submit">execution::can_submit</link></member>
<member><link linkend="asio.reference.execution__connect_result">execution::connect_result</link></member>
<member><link linkend="asio.reference.execution__is_executor">execution::is_executor</link></member>
<member><link linkend="asio.reference.execution__is_executor_of">execution::is_executor_of</link></member>
<member><link linkend="asio.reference.execution__is_nothrow_receiver_of">execution::is_nothrow_receiver_of</link></member>
<member><link linkend="asio.reference.execution__is_receiver">execution::is_receiver</link></member>
<member><link linkend="asio.reference.execution__is_receiver_of">execution::is_receiver_of</link></member>
<member><link linkend="asio.reference.execution__is_sender">execution::is_sender</link></member>
<member><link linkend="asio.reference.execution__is_sender_to">execution::is_sender_to</link></member>
<member><link linkend="asio.reference.execution__is_typed_sender">execution::is_typed_sender</link></member>
<member><link linkend="asio.reference.execution__sender_traits">execution::sender_traits</link></member>
</simplelist>
<bridgehead renderas="sect3">Concepts</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.Executor1.standard_executors">executor</link></member>
<member><link linkend="asio.reference.Executor1.standard_executors">executor_of</link></member>
<member><link linkend="asio.reference.OperationState">operation_state</link></member>
<member><link linkend="asio.reference.Receiver">receiver</link></member>
<member><link linkend="asio.reference.Receiver">receiver_of</link></member>
<member><link linkend="asio.reference.Scheduler">scheduler</link></member>
<member><link linkend="asio.reference.Sender">sender</link></member>
<member><link linkend="asio.reference.Sender">sender_to</link></member>
<member><link linkend="asio.reference.Sender.typed_sender">typed_sender</link></member>
</simplelist>
</entry>
</row>
</tbody>
</tgroup>
<tgroup cols="4">
<colspec colname="a"/>
<colspec colname="b"/>
<colspec colname="c"/>
<colspec colname="d"/>
<thead>
<row>
<entry valign="center" namest="a" nameend="d">
<bridgehead renderas="sect2">Core</bridgehead>
</entry>
</row>
</thead>
<tbody>
<row>
<entry valign="top">
<bridgehead renderas="sect3">Classes</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.any_io_executor">any_io_executor</link></member>
<member><link linkend="asio.reference.bad_executor">bad_executor</link></member>
<member><link linkend="asio.reference.cancellation_signal">cancellation_signal</link></member>
<member><link linkend="asio.reference.cancellation_slot">cancellation_slot</link></member>
<member><link linkend="asio.reference.cancellation_state">cancellation_state</link></member>
<member><link linkend="asio.reference.cancellation_type">cancellation_type</link></member>
<member><link linkend="asio.reference.coroutine">coroutine</link></member>
<member><link linkend="asio.reference.detached_t">detached_t</link></member>
<member><link linkend="asio.reference.error_code">error_code</link></member>
<member><link linkend="asio.reference.execution_context">execution_context</link></member>
<member><link linkend="asio.reference.execution_context__id">execution_context::id</link></member>
<member><link linkend="asio.reference.execution_context__service">execution_context::service</link></member>
<member><link linkend="asio.reference.executor">executor</link></member>
<member><link linkend="asio.reference.executor_arg_t">executor_arg_t</link></member>
<member><link linkend="asio.reference.invalid_service_owner">invalid_service_owner</link></member>
<member><link linkend="asio.reference.io_context">io_context</link></member>
<member><link linkend="asio.reference.io_context.executor_type">io_context::executor_type</link></member>
<member><link linkend="asio.reference.io_context__service">io_context::service</link></member>
<member><link linkend="asio.reference.io_context__strand">io_context::strand</link></member>
<member><link linkend="asio.reference.io_context__work">io_context::work</link> (deprecated)</member>
<member><link linkend="asio.reference.multiple_exceptions">multiple_exceptions</link></member>
<member><link linkend="asio.reference.service_already_exists">service_already_exists</link></member>
<member><link linkend="asio.reference.static_thread_pool">static_thread_pool</link></member>
<member><link linkend="asio.reference.system_context">system_context</link></member>
<member><link linkend="asio.reference.system_error">system_error</link></member>
<member><link linkend="asio.reference.system_executor">system_executor</link></member>
<member><link linkend="asio.reference.this_coro__executor_t">this_coro::executor_t</link></member>
<member><link linkend="asio.reference.thread">thread</link></member>
<member><link linkend="asio.reference.thread_pool">thread_pool</link></member>
<member><link linkend="asio.reference.thread_pool.executor_type">thread_pool::executor_type</link></member>
<member><link linkend="asio.reference.yield_context">yield_context</link></member>
</simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">Free Functions</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.execution_context.add_service">add_service</link></member>
<member><link linkend="asio.reference.experimental__append">experimental::append</link></member>
<member><link linkend="asio.reference.experimental__as_single">experimental::as_single</link></member>
<member><link linkend="asio.reference.experimental__as_tuple">experimental::as_tuple</link></member>
<member><link linkend="asio.reference.experimental__make_parallel_group">experimental::make_parallel_group</link></member>
<member><link linkend="asio.reference.experimental__prepend">experimental::prepend</link></member>
<member><link linkend="asio.reference.asio_handler_allocate">asio_handler_allocate</link> (deprecated)</member>
<member><link linkend="asio.reference.asio_handler_deallocate">asio_handler_deallocate</link> (deprecated)</member>
<member><link linkend="asio.reference.asio_handler_invoke">asio_handler_invoke</link> (deprecated)</member>
<member><link linkend="asio.reference.asio_handler_is_continuation">asio_handler_is_continuation</link></member>
<member><link linkend="asio.reference.async_compose">async_compose</link></member>
<member><link linkend="asio.reference.async_initiate">async_initiate</link></member>
<member><link linkend="asio.reference.bind_cancellation_slot">bind_cancellation_slot</link></member>
<member><link linkend="asio.reference.bind_executor">bind_executor</link></member>
<member><link linkend="asio.reference.co_spawn">co_spawn</link></member>
<member><link linkend="asio.reference.dispatch">dispatch</link></member>
<member><link linkend="asio.reference.defer">defer</link></member>
<member><link linkend="asio.reference.get_associated_allocator">get_associated_allocator</link></member>
<member><link linkend="asio.reference.get_associated_cancellation_slot">get_associated_cancellation_slot</link></member>
<member><link linkend="asio.reference.get_associated_executor">get_associated_executor</link></member>
<member><link linkend="asio.reference.execution_context.has_service">has_service</link></member>
<member><link linkend="asio.reference.make_strand">make_strand</link></member>
<member><link linkend="asio.reference.make_work_guard">make_work_guard</link></member>
<member><link linkend="asio.reference.post">post</link></member>
<member><link linkend="asio.reference.redirect_error">redirect_error</link></member>
<member><link linkend="asio.reference.spawn">spawn</link></member>
<member><link linkend="asio.reference.this_coro__reset_cancellation_state">this_coro::reset_cancellation_state</link></member>
<member><link linkend="asio.reference.this_coro__throw_if_cancelled">this_coro::throw_if_cancelled</link></member>
<member><link linkend="asio.reference.execution_context.use_service">use_service</link></member>
</simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">Class Templates</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.async_completion">async_completion</link></member>
<member><link linkend="asio.reference.awaitable">awaitable</link></member>
<member><link linkend="asio.reference.basic_io_object">basic_io_object</link></member>
<member><link linkend="asio.reference.basic_system_executor">basic_system_executor</link></member>
<member><link linkend="asio.reference.basic_yield_context">basic_yield_context</link></member>
<member><link linkend="asio.reference.cancellation_filter">cancellation_filter</link></member>
<member><link linkend="asio.reference.cancellation_slot_binder">cancellation_slot_binder</link></member>
<member><link linkend="asio.reference.experimental__deferred_t">experimental::deferred_t</link></member>
<member><link linkend="asio.reference.executor_binder">executor_binder</link></member>
<member><link linkend="asio.reference.executor_work_guard">executor_work_guard</link></member>
<member><link linkend="asio.reference.experimental__append_t">experimental::append_t</link></member>
<member><link linkend="asio.reference.experimental__as_single_t">experimental::as_single_t</link></member>
<member><link linkend="asio.reference.experimental__as_tuple_t">experimental::as_tuple_t</link></member>
<member><link linkend="asio.reference.experimental__coro">experimental::coro</link></member>
<member><link linkend="asio.reference.experimental__parallel_group">experimental::parallel_group</link></member>
<member><link linkend="asio.reference.experimental__prepend_t">experimental::prepend_t</link></member>
<member><link linkend="asio.reference.experimental__promise_lt__void_lp_Ts_ellipsis__rp__comma__Executor__gt_">experimental::promise</link></member>
<member><link linkend="asio.reference.experimental__use_coro_t">experimental::use_coro_t</link></member>
<member><link linkend="asio.reference.experimental__wait_for_all">experimental::wait_for_all</link></member>
<member><link linkend="asio.reference.experimental__wait_for_one">experimental::wait_for_one</link></member>
<member><link linkend="asio.reference.experimental__wait_for_one_error">experimental::wait_for_one_error</link></member>
<member><link linkend="asio.reference.experimental__wait_for_one_success">experimental::wait_for_one_success</link></member>
<member><link linkend="asio.reference.io_context__basic_executor_type">io_context::basic_executor_type</link></member>
<member><link linkend="asio.reference.redirect_error_t">redirect_error_t</link></member>
<member><link linkend="asio.reference.strand">strand</link></member>
<member><link linkend="asio.reference.thread_pool__basic_executor_type">thread_pool::basic_executor_type</link></member>
<member><link linkend="asio.reference.use_awaitable_t">use_awaitable_t</link></member>
<member><link linkend="asio.reference.use_future_t">use_future_t</link></member>
</simplelist>
<bridgehead renderas="sect3">Special Values</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.detached">detached</link></member>
<member><link linkend="asio.reference.executor_arg">executor_arg</link></member>
<member><link linkend="asio.reference.experimental__deferred">experimental::deferred</link></member>
<member><link linkend="asio.reference.experimental__use_coro">experimental::use_coro</link></member>
<member><link linkend="asio.reference.this_coro__cancellation_state">this_coro::cancellation_state</link></member>
<member><link linkend="asio.reference.this_coro__executor">this_coro::executor</link></member>
<member><link linkend="asio.reference.use_future">use_future</link></member>
<member><link linkend="asio.reference.use_awaitable">use_awaitable</link></member>
</simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">Error Codes</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.error__basic_errors">error::basic_errors</link></member>
<member><link linkend="asio.reference.error__netdb_errors">error::netdb_errors</link></member>
<member><link linkend="asio.reference.error__addrinfo_errors">error::addrinfo_errors</link></member>
<member><link linkend="asio.reference.error__misc_errors">error::misc_errors</link></member>
</simplelist>
<bridgehead renderas="sect3">Boost.Bind Placeholders</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.placeholders__bytes_transferred">placeholders::bytes_transferred</link></member>
<member><link linkend="asio.reference.placeholders__endpoint">placeholders::endpoint</link></member>
<member><link linkend="asio.reference.placeholders__error">placeholders::error</link></member>
<member><link linkend="asio.reference.placeholders__iterator">placeholders::iterator</link></member>
<member><link linkend="asio.reference.placeholders__results">placeholders::results</link></member>
<member><link linkend="asio.reference.placeholders__signal_number">placeholders::signal_number</link></member>
</simplelist>
<bridgehead renderas="sect3">Type Traits</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.associated_allocator">associated_allocator</link></member>
<member><link linkend="asio.reference.associated_cancellation_slot">associated_cancellation_slot</link></member>
<member><link linkend="asio.reference.associated_executor">associated_executor</link></member>
<member><link linkend="asio.reference.associator">associator</link></member>
<member><link linkend="asio.reference.async_result">async_result</link></member>
<member><link linkend="asio.reference.default_completion_token">default_completion_token</link></member>
<member><link linkend="asio.reference.is_executor">is_executor</link></member>
<member><link linkend="asio.reference.uses_executor">uses_executor</link></member>
</simplelist>
<bridgehead renderas="sect3">Type Requirements</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.asynchronous_operations">Asynchronous operations</link></member>
<member><link linkend="asio.reference.CancellationHandler">CancellationHandler</link></member>
<member><link linkend="asio.reference.CancellationSlot">CancellationSlot</link></member>
<member><link linkend="asio.reference.CompletionHandler">CompletionHandler</link></member>
<member><link linkend="asio.reference.ExecutionContext">ExecutionContext</link></member>
<member><link linkend="asio.reference.Executor1">Executor</link></member>
<member><link linkend="asio.reference.Handler">Handler</link></member>
<member><link linkend="asio.reference.Service">Service</link></member>
</simplelist>
</entry>
</row>
</tbody>
</tgroup>
<tgroup cols="4">
<colspec colname="a"/>
<colspec colname="b"/>
<colspec colname="c"/>
<colspec colname="d"/>
<thead>
<row>
<entry valign="center" namest="a" nameend="d">
<bridgehead renderas="sect2">Buffers and Buffer-Oriented Operations</bridgehead>
</entry>
</row>
</thead>
<tbody>
<row>
<entry valign="top">
<bridgehead renderas="sect3">Classes</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.const_buffer">const_buffer</link></member>
<member><link linkend="asio.reference.mutable_buffer">mutable_buffer</link></member>
<member><link linkend="asio.reference.const_buffers_1">const_buffers_1 </link> (deprecated)</member>
<member><link linkend="asio.reference.mutable_buffers_1">mutable_buffers_1 </link> (deprecated)</member>
<member><link linkend="asio.reference.null_buffers">null_buffers</link> (deprecated)</member>
<member><link linkend="asio.reference.streambuf">streambuf</link></member>
</simplelist>
<bridgehead renderas="sect3">Class Templates</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.basic_streambuf">basic_streambuf</link></member>
<member><link linkend="asio.reference.buffered_read_stream">buffered_read_stream</link></member>
<member><link linkend="asio.reference.buffered_stream">buffered_stream</link></member>
<member><link linkend="asio.reference.buffered_write_stream">buffered_write_stream</link></member>
<member><link linkend="asio.reference.buffers_iterator">buffers_iterator</link></member>
<member><link linkend="asio.reference.dynamic_string_buffer">dynamic_string_buffer</link></member>
<member><link linkend="asio.reference.dynamic_vector_buffer">dynamic_vector_buffer</link></member>
</simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">Free Functions</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.async_read">async_read</link></member>
<member><link linkend="asio.reference.async_read_at">async_read_at</link></member>
<member><link linkend="asio.reference.async_read_until">async_read_until</link></member>
<member><link linkend="asio.reference.async_write">async_write</link></member>
<member><link linkend="asio.reference.async_write_at">async_write_at</link></member>
<member><link linkend="asio.reference.buffer">buffer</link></member>
<member><link linkend="asio.reference.buffer_cast">buffer_cast </link> (deprecated)</member>
<member><link linkend="asio.reference.buffer_copy">buffer_copy</link></member>
<member><link linkend="asio.reference.buffer_size">buffer_size</link></member>
<member><link linkend="asio.reference.buffer_sequence_begin">buffer_sequence_begin</link></member>
<member><link linkend="asio.reference.buffer_sequence_end">buffer_sequence_end</link></member>
<member><link linkend="asio.reference.buffers_begin">buffers_begin</link></member>
<member><link linkend="asio.reference.buffers_end">buffers_end</link></member>
<member><link linkend="asio.reference.dynamic_buffer">dynamic_buffer</link></member>
<member><link linkend="asio.reference.read">read</link></member>
<member><link linkend="asio.reference.read_at">read_at</link></member>
<member><link linkend="asio.reference.read_until">read_until</link></member>
<member><link linkend="asio.reference.transfer_all">transfer_all</link></member>
<member><link linkend="asio.reference.transfer_at_least">transfer_at_least</link></member>
<member><link linkend="asio.reference.transfer_exactly">transfer_exactly</link></member>
<member><link linkend="asio.reference.write">write</link></member>
<member><link linkend="asio.reference.write_at">write_at</link></member>
</simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">Type Traits</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.is_const_buffer_sequence">is_const_buffer_sequence</link></member>
<member><link linkend="asio.reference.is_dynamic_buffer">is_dynamic_buffer</link></member>
<member><link linkend="asio.reference.is_dynamic_buffer_v1">is_dynamic_buffer_v1</link></member>
<member><link linkend="asio.reference.is_dynamic_buffer_v2">is_dynamic_buffer_v2</link></member>
<member><link linkend="asio.reference.is_match_condition">is_match_condition</link></member>
<member><link linkend="asio.reference.is_mutable_buffer_sequence">is_mutable_buffer_sequence</link></member>
<member><link linkend="asio.reference.is_read_buffered">is_read_buffered</link></member>
<member><link linkend="asio.reference.is_write_buffered">is_write_buffered</link></member>
</simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">Type Requirements</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.read_write_operations">Read and write operations</link></member>
<member><link linkend="asio.reference.AsyncRandomAccessReadDevice">AsyncRandomAccessReadDevice</link></member>
<member><link linkend="asio.reference.AsyncRandomAccessWriteDevice">AsyncRandomAccessWriteDevice</link></member>
<member><link linkend="asio.reference.AsyncReadStream">AsyncReadStream</link></member>
<member><link linkend="asio.reference.AsyncWriteStream">AsyncWriteStream</link></member>
<member><link linkend="asio.reference.CompletionCondition">CompletionCondition</link></member>
<member><link linkend="asio.reference.ConstBufferSequence">ConstBufferSequence</link></member>
<member><link linkend="asio.reference.DynamicBuffer">DynamicBuffer</link></member>
<member><link linkend="asio.reference.DynamicBuffer_v1">DynamicBuffer_v1</link></member>
<member><link linkend="asio.reference.DynamicBuffer_v2">DynamicBuffer_v2</link></member>
<member><link linkend="asio.reference.MutableBufferSequence">MutableBufferSequence</link></member>
<member><link linkend="asio.reference.ReadHandler">ReadHandler</link></member>
<member><link linkend="asio.reference.SyncRandomAccessReadDevice">SyncRandomAccessReadDevice</link></member>
<member><link linkend="asio.reference.SyncRandomAccessWriteDevice">SyncRandomAccessWriteDevice</link></member>
<member><link linkend="asio.reference.SyncReadStream">SyncReadStream</link></member>
<member><link linkend="asio.reference.SyncWriteStream">SyncWriteStream</link></member>
<member><link linkend="asio.reference.WriteHandler">WriteHandler</link></member>
</simplelist>
</entry>
</row>
</tbody>
</tgroup>
<tgroup cols="4">
<colspec colname="a"/>
<colspec colname="b"/>
<colspec colname="c"/>
<colspec colname="d"/>
<thead>
<row>
<entry valign="center" namest="a" nameend="d">
<bridgehead renderas="sect2">Networking</bridgehead>
</entry>
</row>
</thead>
<tbody>
<row>
<entry valign="top">
<bridgehead renderas="sect3">Classes</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.generic__datagram_protocol">generic::datagram_protocol</link></member>
<member><link linkend="asio.reference.generic__datagram_protocol.endpoint">generic::datagram_protocol::endpoint</link></member>
<member><link linkend="asio.reference.generic__datagram_protocol.socket">generic::datagram_protocol::socket</link></member>
<member><link linkend="asio.reference.generic__raw_protocol">generic::raw_protocol</link></member>
<member><link linkend="asio.reference.generic__raw_protocol.endpoint">generic::raw_protocol::endpoint</link></member>
<member><link linkend="asio.reference.generic__raw_protocol.socket">generic::raw_protocol::socket</link></member>
<member><link linkend="asio.reference.generic__seq_packet_protocol">generic::seq_packet_protocol</link></member>
<member><link linkend="asio.reference.generic__seq_packet_protocol.endpoint">generic::seq_packet_protocol::endpoint</link></member>
<member><link linkend="asio.reference.generic__seq_packet_protocol.socket">generic::seq_packet_protocol::socket</link></member>
<member><link linkend="asio.reference.generic__stream_protocol">generic::stream_protocol</link></member>
<member><link linkend="asio.reference.generic__stream_protocol.endpoint">generic::stream_protocol::endpoint</link></member>
<member><link linkend="asio.reference.generic__stream_protocol.iostream">generic::stream_protocol::iostream</link></member>
<member><link linkend="asio.reference.generic__stream_protocol.socket">generic::stream_protocol::socket</link></member>
<member><link linkend="asio.reference.ip__address">ip::address</link></member>
<member><link linkend="asio.reference.ip__address_v4">ip::address_v4</link></member>
<member><link linkend="asio.reference.ip__address_v4_iterator">ip::address_v4_iterator</link></member>
<member><link linkend="asio.reference.ip__address_v4_range">ip::address_v4_range</link></member>
<member><link linkend="asio.reference.ip__address_v6">ip::address_v6</link></member>
<member><link linkend="asio.reference.ip__address_v6_iterator">ip::address_v6_iterator</link></member>
<member><link linkend="asio.reference.ip__address_v6_range">ip::address_v6_range</link></member>
<member><link linkend="asio.reference.ip__bad_address_cast">ip::bad_address_cast</link></member>
<member><link linkend="asio.reference.ip__icmp">ip::icmp</link></member>
<member><link linkend="asio.reference.ip__icmp.endpoint">ip::icmp::endpoint</link></member>
<member><link linkend="asio.reference.ip__icmp.resolver">ip::icmp::resolver</link></member>
<member><link linkend="asio.reference.ip__icmp.socket">ip::icmp::socket</link></member>
<member><link linkend="asio.reference.ip__network_v4">ip::network_v4</link></member>
<member><link linkend="asio.reference.ip__network_v6">ip::network_v6</link></member>
<member><link linkend="asio.reference.ip__resolver_base">ip::resolver_base</link></member>
<member><link linkend="asio.reference.ip__resolver_query_base">ip::resolver_query_base</link></member>
<member><link linkend="asio.reference.ip__tcp">ip::tcp</link></member>
<member><link linkend="asio.reference.ip__tcp.acceptor">ip::tcp::acceptor</link></member>
<member><link linkend="asio.reference.ip__tcp.endpoint">ip::tcp::endpoint</link></member>
<member><link linkend="asio.reference.ip__tcp.iostream">ip::tcp::iostream</link></member>
<member><link linkend="asio.reference.ip__tcp.resolver">ip::tcp::resolver</link></member>
<member><link linkend="asio.reference.ip__tcp.socket">ip::tcp::socket</link></member>
<member><link linkend="asio.reference.ip__udp">ip::udp</link></member>
<member><link linkend="asio.reference.ip__udp.endpoint">ip::udp::endpoint</link></member>
<member><link linkend="asio.reference.ip__udp.resolver">ip::udp::resolver</link></member>
<member><link linkend="asio.reference.ip__udp.socket">ip::udp::socket</link></member>
<member><link linkend="asio.reference.ip__v4_mapped_t">ip::v4_mapped_t</link></member>
<member><link linkend="asio.reference.socket_base">socket_base</link></member>
</simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">Free Functions</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.async_connect">async_connect</link></member>
<member><link linkend="asio.reference.connect">connect</link></member>
<member><link linkend="asio.reference.ip__host_name">ip::host_name</link></member>
<member><link linkend="asio.reference.ip__address.make_address">ip::make_address</link></member>
<member><link linkend="asio.reference.ip__address_v4.make_address_v4">ip::make_address_v4</link></member>
<member><link linkend="asio.reference.ip__address_v6.make_address_v6">ip::make_address_v6</link></member>
<member><link linkend="asio.reference.ip__network_v4.make_network_v4">ip::make_network_v4</link></member>
<member><link linkend="asio.reference.ip__network_v6.make_network_v6">ip::make_network_v6</link></member>
</simplelist>
<bridgehead renderas="sect3">Class Templates</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.basic_datagram_socket">basic_datagram_socket</link></member>
<member><link linkend="asio.reference.basic_raw_socket">basic_raw_socket</link></member>
<member><link linkend="asio.reference.basic_seq_packet_socket">basic_seq_packet_socket</link></member>
<member><link linkend="asio.reference.basic_socket">basic_socket</link></member>
<member><link linkend="asio.reference.basic_socket_acceptor">basic_socket_acceptor</link></member>
<member><link linkend="asio.reference.basic_socket_iostream">basic_socket_iostream</link></member>
<member><link linkend="asio.reference.basic_socket_streambuf">basic_socket_streambuf</link></member>
<member><link linkend="asio.reference.basic_stream_socket">basic_stream_socket</link></member>
<member><link linkend="asio.reference.generic__basic_endpoint">generic::basic_endpoint</link></member>
<member><link linkend="asio.reference.ip__basic_endpoint">ip::basic_endpoint</link></member>
<member><link linkend="asio.reference.ip__basic_resolver">ip::basic_resolver</link></member>
<member><link linkend="asio.reference.ip__basic_resolver_entry">ip::basic_resolver_entry</link></member>
<member><link linkend="asio.reference.ip__basic_resolver_iterator">ip::basic_resolver_iterator</link></member>
<member><link linkend="asio.reference.ip__basic_resolver_results">ip::basic_resolver_results</link></member>
<member><link linkend="asio.reference.ip__basic_resolver_query">ip::basic_resolver_query</link></member>
</simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">Socket Options</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.ip__multicast__enable_loopback">ip::multicast::enable_loopback</link></member>
<member><link linkend="asio.reference.ip__multicast__hops">ip::multicast::hops</link></member>
<member><link linkend="asio.reference.ip__multicast__join_group">ip::multicast::join_group</link></member>
<member><link linkend="asio.reference.ip__multicast__leave_group">ip::multicast::leave_group</link></member>
<member><link linkend="asio.reference.ip__multicast__outbound_interface">ip::multicast::outbound_interface</link></member>
<member><link linkend="asio.reference.ip__tcp.no_delay">ip::tcp::no_delay</link></member>
<member><link linkend="asio.reference.ip__unicast__hops">ip::unicast::hops</link></member>
<member><link linkend="asio.reference.ip__v6_only">ip::v6_only</link></member>
<member><link linkend="asio.reference.socket_base.broadcast">socket_base::broadcast</link></member>
<member><link linkend="asio.reference.socket_base.debug">socket_base::debug</link></member>
<member><link linkend="asio.reference.socket_base.do_not_route">socket_base::do_not_route</link></member>
<member><link linkend="asio.reference.socket_base.enable_connection_aborted">socket_base::enable_connection_aborted</link></member>
<member><link linkend="asio.reference.socket_base.keep_alive">socket_base::keep_alive</link></member>
<member><link linkend="asio.reference.socket_base.linger">socket_base::linger</link></member>
<member><link linkend="asio.reference.socket_base.receive_buffer_size">socket_base::receive_buffer_size</link></member>
<member><link linkend="asio.reference.socket_base.receive_low_watermark">socket_base::receive_low_watermark</link></member>
<member><link linkend="asio.reference.socket_base.reuse_address">socket_base::reuse_address</link></member>
<member><link linkend="asio.reference.socket_base.send_buffer_size">socket_base::send_buffer_size</link></member>
<member><link linkend="asio.reference.socket_base.send_low_watermark">socket_base::send_low_watermark</link></member>
</simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">I/O Control Commands</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.socket_base.bytes_readable">socket_base::bytes_readable</link></member>
</simplelist>
<bridgehead renderas="sect3">Type Requirements</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.synchronous_socket_operations">Synchronous socket operations</link></member>
<member><link linkend="asio.reference.asynchronous_socket_operations">Asynchronous socket operations</link></member>
<member><link linkend="asio.reference.AcceptableProtocol">AcceptableProtocol</link></member>
<member><link linkend="asio.reference.AcceptHandler">AcceptHandler</link></member>
<member><link linkend="asio.reference.ConnectCondition">ConnectCondition</link></member>
<member><link linkend="asio.reference.ConnectHandler">ConnectHandler</link></member>
<member><link linkend="asio.reference.Endpoint">Endpoint</link></member>
<member><link linkend="asio.reference.EndpointSequence">EndpointSequence</link></member>
<member><link linkend="asio.reference.GettableSocketOption">GettableSocketOption</link></member>
<member><link linkend="asio.reference.InternetProtocol">InternetProtocol</link></member>
<member><link linkend="asio.reference.IoControlCommand">IoControlCommand</link></member>
<member><link linkend="asio.reference.IteratorConnectHandler">IteratorConnectHandler</link></member>
<member><link linkend="asio.reference.MoveAcceptHandler">MoveAcceptHandler</link></member>
<member><link linkend="asio.reference.Protocol">Protocol</link></member>
<member><link linkend="asio.reference.RangeConnectHandler">RangeConnectHandler</link></member>
<member><link linkend="asio.reference.ResolveHandler">ResolveHandler</link></member>
<member><link linkend="asio.reference.SettableSocketOption">SettableSocketOption</link></member>
</simplelist>
</entry>
</row>
</tbody>
</tgroup>
<tgroup cols="4">
<colspec colname="a"/>
<colspec colname="b"/>
<colspec colname="c"/>
<colspec colname="d"/>
<thead>
<row>
<entry valign="center" namest="a" nameend="a">
<bridgehead renderas="sect2">Timers</bridgehead>
</entry>
<entry valign="center" namest="b" nameend="b">
<bridgehead renderas="sect2">SSL</bridgehead>
</entry>
<entry valign="center" namest="c" nameend="c">
<bridgehead renderas="sect2">Serial Ports</bridgehead>
</entry>
<entry valign="center" namest="d" nameend="d">
<bridgehead renderas="sect2">Signal Handling</bridgehead>
</entry>
</row>
</thead>
<tbody>
<row>
<entry valign="top">
<bridgehead renderas="sect3">Classes</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.deadline_timer">deadline_timer</link></member>
<member><link linkend="asio.reference.high_resolution_timer">high_resolution_timer</link></member>
<member><link linkend="asio.reference.steady_timer">steady_timer</link></member>
<member><link linkend="asio.reference.system_timer">system_timer</link></member>
</simplelist>
<bridgehead renderas="sect3">Class Templates</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.basic_deadline_timer">basic_deadline_timer</link></member>
<member><link linkend="asio.reference.basic_waitable_timer">basic_waitable_timer</link></member>
<member><link linkend="asio.reference.time_traits_lt__ptime__gt_">time_traits</link></member>
<member><link linkend="asio.reference.wait_traits">wait_traits</link></member>
</simplelist>
<bridgehead renderas="sect3">Type Requirements</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.TimeTraits">TimeTraits</link></member>
<member><link linkend="asio.reference.WaitHandler">WaitHandler</link></member>
<member><link linkend="asio.reference.WaitTraits">WaitTraits</link></member>
</simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">Classes</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.ssl__context">ssl::context</link></member>
<member><link linkend="asio.reference.ssl__context_base">ssl::context_base</link></member>
<member><link linkend="asio.reference.ssl__host_name_verification">ssl::host_name_verification</link></member>
<member><link linkend="asio.reference.ssl__rfc2818_verification">ssl::rfc2818_verification</link> (deprecated)</member>
<member><link linkend="asio.reference.ssl__stream_base">ssl::stream_base</link></member>
<member><link linkend="asio.reference.ssl__verify_context">ssl::verify_context</link></member>
</simplelist>
<bridgehead renderas="sect3">Class Templates</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.ssl__stream">ssl::stream</link></member>
</simplelist>
<bridgehead renderas="sect3">Error Codes</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.ssl__error__stream_errors">ssl::error::stream_errors</link></member>
</simplelist>
<bridgehead renderas="sect3">Type Requirements</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.BufferedHandshakeHandler">BufferedHandshakeHandler</link></member>
<member><link linkend="asio.reference.HandshakeHandler">HandshakeHandler</link></member>
<member><link linkend="asio.reference.ShutdownHandler">ShutdownHandler</link></member>
</simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">Classes</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.serial_port">serial_port</link></member>
<member><link linkend="asio.reference.serial_port_base">serial_port_base</link></member>
</simplelist>
<bridgehead renderas="sect3">Class templates</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.basic_serial_port">basic_serial_port</link></member>
</simplelist>
<bridgehead renderas="sect3">Serial Port Options</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.serial_port_base__baud_rate">serial_port_base::baud_rate</link></member>
<member><link linkend="asio.reference.serial_port_base__flow_control">serial_port_base::flow_control</link></member>
<member><link linkend="asio.reference.serial_port_base__parity">serial_port_base::parity</link></member>
<member><link linkend="asio.reference.serial_port_base__stop_bits">serial_port_base::stop_bits</link></member>
<member><link linkend="asio.reference.serial_port_base__character_size">serial_port_base::character_size</link></member>
</simplelist>
<bridgehead renderas="sect3">Type Requirements</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.GettableSerialPortOption">GettableSerialPortOption</link></member>
<member><link linkend="asio.reference.SettableSerialPortOption">SettableSerialPortOption</link></member>
</simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">Classes</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.signal_set">signal_set</link></member>
</simplelist>
<bridgehead renderas="sect3">Class Templates</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.basic_signal_set">basic_signal_set</link></member>
</simplelist>
<bridgehead renderas="sect3">Type Requirements</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.SignalHandler">SignalHandler</link></member>
</simplelist>
</entry>
</row>
</tbody>
</tgroup>
<tgroup cols="3">
<colspec colname="a"/>
<colspec colname="b"/>
<colspec colname="c"/>
<thead>
<row>
<entry valign="center" namest="a" nameend="b">
<bridgehead renderas="sect2">POSIX-specific</bridgehead>
</entry>
<entry valign="center" namest="c" nameend="c">
<bridgehead renderas="sect2">Windows-specific</bridgehead>
</entry>
</row>
</thead>
<tbody>
<row>
<entry valign="top">
<bridgehead renderas="sect3">Classes</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.local__stream_protocol">local::stream_protocol</link></member>
<member><link linkend="asio.reference.local__stream_protocol.acceptor">local::stream_protocol::acceptor</link></member>
<member><link linkend="asio.reference.local__stream_protocol.endpoint">local::stream_protocol::endpoint</link></member>
<member><link linkend="asio.reference.local__stream_protocol.iostream">local::stream_protocol::iostream</link></member>
<member><link linkend="asio.reference.local__stream_protocol.socket">local::stream_protocol::socket</link></member>
<member><link linkend="asio.reference.local__datagram_protocol">local::datagram_protocol</link></member>
<member><link linkend="asio.reference.local__datagram_protocol.endpoint">local::datagram_protocol::endpoint</link></member>
<member><link linkend="asio.reference.local__datagram_protocol.socket">local::datagram_protocol::socket</link></member>
<member><link linkend="asio.reference.posix__descriptor">posix::descriptor</link></member>
<member><link linkend="asio.reference.posix__descriptor_base">posix::descriptor_base</link></member>
<member><link linkend="asio.reference.posix__stream_descriptor">posix::stream_descriptor</link></member>
</simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">Free Functions</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.local__connect_pair">local::connect_pair</link></member>
</simplelist>
<bridgehead renderas="sect3">Class Templates</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.local__basic_endpoint">local::basic_endpoint</link></member>
<member><link linkend="asio.reference.posix__basic_descriptor">posix::basic_descriptor</link></member>
<member><link linkend="asio.reference.posix__basic_stream_descriptor">posix::basic_stream_descriptor</link></member>
</simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">Classes</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.windows__object_handle">windows::object_handle</link></member>
<member><link linkend="asio.reference.windows__overlapped_handle">windows::overlapped_handle</link></member>
<member><link linkend="asio.reference.windows__overlapped_ptr">windows::overlapped_ptr</link></member>
<member><link linkend="asio.reference.windows__random_access_handle">windows::random_access_handle</link></member>
<member><link linkend="asio.reference.windows__stream_handle">windows::stream_handle</link></member>
</simplelist>
<bridgehead renderas="sect3">Class Templates</bridgehead>
<simplelist type="vert" columns="1">
<member><link linkend="asio.reference.windows__basic_object_handle">windows::basic_object_handle</link></member>
<member><link linkend="asio.reference.windows__basic_overlapped_handle">windows::basic_overlapped_handle</link></member>
<member><link linkend="asio.reference.windows__basic_random_access_handle">windows::basic_random_access_handle</link></member>
<member><link linkend="asio.reference.windows__basic_stream_handle">windows::basic_stream_handle</link></member>
</simplelist>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>

View File

@@ -0,0 +1,273 @@
# Doxyfile 1.4.5
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "Asio Reference"
PROJECT_NUMBER =
OUTPUT_DIRECTORY = .
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = YES
INLINE_INHERITED_MEMB = YES
FULL_PATH_NAMES = YES
STRIP_FROM_PATH = ./../../include/
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = YES
DETAILS_AT_TOP = YES
INHERIT_DOCS = NO
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 2
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
BUILTIN_STL_SUPPORT = NO
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = NO
EXTRACT_LOCAL_METHODS = NO
HIDE_UNDOC_MEMBERS = YES
HIDE_UNDOC_CLASSES = YES
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = NO
INLINE_INFO = NO
SORT_MEMBER_DOCS = NO
SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = NO
GENERATE_TESTLIST = NO
GENERATE_BUGLIST = NO
GENERATE_DEPRECATEDLIST= NO
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = NO
SHOW_DIRECTORIES = NO
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ./../../include/asio.hpp \
./../../include/asio \
./../../include/asio/generic \
./../../include/asio/impl \
./../../include/asio/ip \
./../../include/asio/local \
./../../include/asio/posix \
./../../include/asio/ssl \
./../../include/asio/windows \
./../../include/asio/execution \
./../../include/asio/experimental \
./noncopyable_dox.txt \
./std_exception_dox.txt
FILE_PATTERNS =
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = YES
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = NO
USE_HTAGS = NO
VERBATIM_HEADERS = NO
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 1
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = NO
HTML_OUTPUT = .
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = YES
ENUM_VALUES_PER_LINE = 1
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = YES
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = NO
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = GENERATING_DOCUMENTATION \
ASIO_SOCKET_ERROR(e)=implementation_defined \
ASIO_NETDB_ERROR(e)=implementation_defined \
ASIO_EOF_ERROR(e)=implementation_defined \
ASIO_OS_ERROR(e1,e2)=implementation_defined \
ASIO_MOVE_ARG(a)=a&& \
ASIO_NONDEDUCED_MOVE_ARG(a)=a& \
ASIO_DECL= \
ASIO_CONSTEXPR=constexpr \
ASIO_NOEXCEPT=noexcept \
ASIO_NODISCARD= \
ASIO_COMPLETION_SIGNATURE=typename \
ASIO_COMPLETION_HANDLER_FOR(s)=typename \
ASIO_COMPLETION_TOKEN_FOR(s)=typename \
ASIO_COMPLETION_SIGNATURES_TPARAMS="typename... Signatures" \
ASIO_COMPLETION_SIGNATURES_TARGS=Signatures... \
ASIO_INITFN_RESULT_TYPE(t,a)=void_or_deduced \
ASIO_INITFN_AUTO_RESULT_TYPE(t,a)=void_or_deduced \
ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(e)==default_token \
ASIO_DEFAULT_COMPLETION_TOKEN(e)==default_token \
ASIO_SVC_TPARAM= \
ASIO_SVC_TPARAM_DEF1()= \
ASIO_SVC_TPARAM_DEF2()= \
ASIO_SVC_TARG= \
ASIO_SVC_TPARAM1= \
ASIO_SVC_TPARAM1_DEF1()= \
ASIO_SVC_TPARAM1_DEF2()= \
ASIO_SVC_TARG1= \
ASIO_SVC_T=asio::detail::service \
ASIO_SVC_T1=asio::detail::service \
ASIO_CONST_BUFFER=const_buffer \
ASIO_MUTABLE_BUFFER=mutable_buffer \
ASIO_SYNC_OP_VOID=void \
ASIO_STRING_VIEW_PARAM=string_view \
ASIO_UNUSED_VARIABLE= \
ASIO_UNSPECIFIED(e)=unspecified \
ASIO_EXECUTION_RECEIVER_ERROR_DEFAULT==std::exception_ptr \
ASIO_EXECUTION_RECEIVER_OF_0=typename \
ASIO_NOEXCEPT_IF(c)=
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE = reference.tags
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES
CLASS_GRAPH = YES
COLLABORATION_GRAPH = NO
GROUP_GRAPHS = NO
UML_LOOK = NO
TEMPLATE_RELATIONS = YES
INCLUDE_GRAPH = NO
INCLUDED_BY_GRAPH = NO
CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = NO
DIRECTORY_GRAPH = NO
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 640
MAX_DOT_GRAPH_HEIGHT = 640
MAX_DOT_GRAPH_DEPTH = 0
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = NO
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,68 @@
<html>
<head>
<title>asio Release Checklist</title>
</head>
<body>
<h1>asio Release Checklist</h1>
<form>
<table border="1">
<tr>
<td>Update version number in configure.ac</td>
<td><input type="checkbox"></td>
</tr>
<tr>
<td>Update version number and date in README</td>
<td><input type="checkbox"></td>
</tr>
<tr>
<td>Generate a clean distribution by doing a `make maintainer-clean`
followed by the steps necessary to do a `make dist'</td>
<td><input type="checkbox"></td>
</tr>
<tr>
<td>Unpack/build/test distribution on Mac OS X using g++ 4.0 with
adjacent boost directory</td>
<td><input type="checkbox"></td>
</tr>
<tr>
<td>Unpack/build/test distribution on Linux using g++ 3.4 using the
`--with-boost' configure option</td>
<td><input type="checkbox"></td>
</tr>
<tr>
<td>Unpack/build/test distribution on Solaris using g++ 3.3 with
adjacent boost directory</td>
<td><input type="checkbox"></td>
</tr>
<tr>
<td>Unpack/build/test distribution using MSVC 7.1 with adjacent boost
directory</td>
<td><input type="checkbox"></td>
</tr>
<tr>
<td>Unpack/build/test distribution using bcc32 5.6.4 with adjacent
boost directory</td>
<td><input type="checkbox"></td>
</tr>
<tr>
<td>Unpack/build/test distribution using MinGW-4.1.0 with adjacent
boost directory</td>
<td><input type="checkbox"></td>
</tr>
<tr>
<td>Commit version number changes to CVS</td>
<td><input type="checkbox"></td>
</tr>
<tr>
<td>Apply CVS tag of the form asio-x-y-z</td>
<td><input type="checkbox"></td>
</tr>
<tr>
<td>Generate a clean distribution by doing a `make maintainer-clean`
followed by the steps necessary to do a `make dist'</td>
<td><input type="checkbox"></td>
</tr>
</table>
</form>
</body>
</html>

View File

@@ -0,0 +1,72 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:AcceptHandler Accept handler requirements]
An accept handler must meet the requirements for a [link
asio.reference.Handler handler]. A value `h` of an accept handler
class should work correctly in the expression `h(ec)`, where `ec` is an lvalue
of type `const error_code`.
[heading Examples]
A free function as an accept handler:
void accept_handler(
const asio::error_code& ec)
{
...
}
An accept handler function object:
struct accept_handler
{
...
void operator()(
const asio::error_code& ec)
{
...
}
...
};
A lambda as an accept handler:
acceptor.async_accept(...,
[](const asio::error_code& ec)
{
...
});
A non-static class member function adapted to an accept handler using
`std::bind()`:
void my_class::accept_handler(
const asio::error_code& ec)
{
...
}
...
acceptor.async_accept(...,
std::bind(&my_class::accept_handler,
this, std::placeholders::_1));
A non-static class member function adapted to an accept handler using
`boost::bind()`:
void my_class::accept_handler(
const asio::error_code& ec)
{
...
}
...
acceptor.async_accept(...,
boost::bind(&my_class::accept_handler,
this, asio::placeholders::error));
[endsect]

View File

@@ -0,0 +1,25 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:AcceptableProtocol Acceptable protocol requirements]
A type `X` meets the `AcceptableProtocol` requirements if it satisfies the
requirements of [link asio.reference.Protocol `Protocol`] as well as the
additional requirements listed below.
[table AcceptableProtocol requirements
[[expression] [return type] [assertion/note[br]pre/post-conditions]]
[
[`X::socket`]
[A type that satisfies the requirements of `Destructible` (C++Std
\[destructible\]) and `MoveConstructible` (C++Std \[moveconstructible\]),
and that is publicly and unambiguously derived from `basic_socket<X>`.]
[]
]
]
[endsect]

View File

@@ -0,0 +1,56 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:AsyncRandomAccessReadDevice Buffer-oriented asynchronous random-access
read device requirements]
In the table below, `a` denotes an asynchronous random access read device
object, `o` denotes an offset of type `boost::uint64_t`, `mb` denotes an object
satisfying [link asio.reference.MutableBufferSequence mutable buffer sequence]
requirements, and `h` denotes an object satisfying [link
asio.reference.ReadHandler read handler] requirements.
[table Buffer-oriented asynchronous random-access read device requirements
[[operation] [type] [semantics, pre/post-conditions]]
[
[`a.get_executor()`]
[A type satisfying the [link asio.reference.Executor1 Executor requirements].]
[Returns the associated I/O executor.]
]
[
[`a.async_read_some_at(o, mb, h);`]
[`void`]
[
Initiates an asynchronous operation to read one or more bytes of data
from the device `a` at the offset `o`. The operation is performed via the
`io_service` object `a.get_io_service()` and behaves according to [link
asio.reference.asynchronous_operations asynchronous operation]
requirements.[br]
[br]
The mutable buffer sequence `mb` specifies memory where the data should
be placed. The `async_read_some_at` operation shall always fill a buffer
in the sequence completely before proceeding to the next.[br]
[br]
The implementation shall maintain one or more copies of `mb` until such
time as the read operation no longer requires access to the memory
specified by the buffers in the sequence. The program must ensure the
memory is valid until:[br]
[br]
[mdash] the last copy of `mb` is destroyed, or[br]
[br]
[mdash] the handler for the asynchronous read operation is invoked,[br]
[br]
whichever comes first.[br]
[br]
If the total size of all buffers in the sequence `mb` is `0`, the
asynchronous read operation shall complete immediately and pass `0` as
the argument to the handler that specifies the number of bytes read.
]
]
]
[endsect]

View File

@@ -0,0 +1,57 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:AsyncRandomAccessWriteDevice Buffer-oriented asynchronous
random-access write device requirements]
In the table below, `a` denotes an asynchronous write stream object, `o`
denotes an offset of type `boost::uint64_t`, `cb` denotes an object satisfying
[link asio.reference.ConstBufferSequence constant buffer sequence]
requirements, and `h` denotes an object satisfying [link
asio.reference.WriteHandler write handler] requirements.
[table Buffer-oriented asynchronous random-access write device requirements
[[operation] [type] [semantics, pre/post-conditions]]
[
[`a.get_executor()`]
[A type satisfying the [link asio.reference.Executor1 Executor requirements].]
[Returns the associated I/O executor.]
]
[
[`a.async_write_some_at(o, cb, h);`]
[`void`]
[
Initiates an asynchronous operation to write one or more bytes of data to
the device `a` at offset `o`. The operation is performed via the
`io_service` object `a.get_io_service()` and behaves according to [link
asio.reference.asynchronous_operations asynchronous operation]
requirements.[br]
[br]
The constant buffer sequence `cb` specifies memory where the data to be
written is located. The `async_write_some_at` operation shall always
write a buffer in the sequence completely before proceeding to the
next.[br]
[br]
The implementation shall maintain one or more copies of `cb` until such
time as the write operation no longer requires access to the memory
specified by the buffers in the sequence. The program must ensure the
memory is valid until:[br]
[br]
[mdash] the last copy of `cb` is destroyed, or[br]
[br]
[mdash] the handler for the asynchronous write operation is invoked,[br]
[br]
whichever comes first.[br]
[br]
If the total size of all buffers in the sequence `cb` is `0`, the
asynchronous write operation shall complete immediately and pass `0` as
the argument to the handler that specifies the number of bytes written.
]
]
]
[endsect]

View File

@@ -0,0 +1,50 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:AsyncReadStream Buffer-oriented asynchronous read stream requirements]
A type `X` meets the `AsyncReadStream` requirements if it satisfies the
requirements listed below.
In the table below, `a` denotes a value of type `X`, `mb` denotes a (possibly
const) value satisfying the [link asio.reference.MutableBufferSequence
`MutableBufferSequence`] requirements, and `t` is a completion token.
[table AsyncReadStream requirements
[[operation] [type] [semantics, pre/post-conditions]]
[
[`a.get_executor()`]
[A type satisfying the [link asio.reference.Executor1 Executor requirements].]
[Returns the associated I/O executor.]
]
[
[`a.async_read_some(mb,t)`]
[
The return type is determined according to the requirements for an
[link asio.reference.asynchronous_operations asynchronous operation].
]
[
Meets the requirements for a [link asio.reference.read_write_operations
read operation] and an [link asio.reference.asynchronous_operations
asynchronous operation] with completion signature `void(error_code ec,
size_t n)`.[br]
[br]
If `buffer_size(mb) > 0`, initiates an asynchronous operation to read one
or more bytes of data from the stream `a` into the buffer sequence `mb`.
If successful, `ec` is set such that `!ec` is `true`, and `n` is the
number of bytes read. If an error occurred, `ec` is set such that `!!ec`
is `true`, and `n` is 0. If all data has been read from the stream, and
the stream performed an orderly shutdown, `ec` is
`stream_errc::eof` and `n` is 0.[br]
[br]
If `buffer_size(mb) == 0`, the operation completes immediately. `ec` is
set such that `!ec` is `true`, and `n` is 0.
]
]
]
[endsect]

View File

@@ -0,0 +1,48 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:AsyncWriteStream Buffer-oriented asynchronous write stream requirements]
A type `X` meets the `AsyncWriteStream` requirements if it satisfies the
requirements listed below.
In the table below, `a` denotes a value of type `X`, `cb` denotes a (possibly
const) value satisfying the [link asio.reference.ConstBufferSequence
`ConstBufferSequence`] requirements, and `t` is a completion token.
[table AsyncWriteStream requirements
[[operation] [type] [semantics, pre/post-conditions]]
[
[`a.get_executor()`]
[A type satisfying the [link asio.reference.Executor1 Executor requirements].]
[Returns the associated I/O executor.]
]
[
[`a.async_write_some(cb,t)`]
[
The return type is determined according to the requirements for an
[link asio.reference.asynchronous_operations asynchronous operation].
]
[
Meets the requirements for a [link asio.reference.read_write_operations
write operation] and an [link asio.reference.asynchronous_operations
asynchronous operation] with completion signature `void(error_code ec,
size_t n)`.[br]
[br]
If `buffer_size(cb) > 0`, initiates an asynchronous operation to write
one or more bytes of data to the stream `a` from the buffer sequence
`cb`. If successful, `ec` is set such that `!ec` is `true`, and `n` is
the number of bytes written. If an error occurred, `ec` is set such that
`!!ec` is `true`, and `n` is 0.[br]
[br]
If `buffer_size(cb) == 0`, the operation completes immediately. `ec` is
set such that `!ec` is `true`, and `n` is 0.
]
]
]
[endsect]

View File

@@ -0,0 +1,55 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:BufferedHandshakeHandler Buffered handshake handler requirements]
A buffered handshake handler must meet the requirements for a [link
asio.reference.Handler handler]. A value `h` of a buffered handshake handler
class should work correctly in the expression `h(ec, s)`, where `ec` is an
lvalue of type `const error_code` and `s` is an lvalue of type `const size_t`.
[heading Examples]
A free function as a buffered handshake handler:
void handshake_handler(
const asio::error_code& ec,
std::size_t bytes_transferred)
{
...
}
A buffered handshake handler function object:
struct handshake_handler
{
...
void operator()(
const asio::error_code& ec,
std::size_t bytes_transferred)
{
...
}
...
};
A non-static class member function adapted to a buffered handshake handler
using `boost::bind()`:
void my_class::handshake_handler(
const asio::error_code& ec,
std::size_t bytes_transferred)
{
...
}
...
socket.async_handshake(...,
boost::bind(&my_class::handshake_handler,
this, asio::placeholders::error,
asio::placeholders::bytes_transferred));
[endsect]

View File

@@ -0,0 +1,49 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:CancellationHandler Cancellation handler requirements]
A value `h` of a cancellation handler class should work correctly in the
expression `h(t)`, where `t` is a value of type
`asio::cancellation_type`.
[heading Examples]
A free function as a cancellation handler:
void cancellation_handler(
asio::cancellation_type type)
{
...
}
slot.assign(cancellation_handler);
A cancellation handler function object:
struct cancellation_handler
{
...
void operator()(
asio::cancellation_type type)
{
...
}
...
};
cancellation_handler& h = slot.assign(cancellation_handler{ ... });
A lambda as a cancellation handler:
auto& h = slot.assign(
[](asio::cancellation_type type)
{
...
});
[endsect]

View File

@@ -0,0 +1,63 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:CancellationSlot Cancellation slot requirements]
A type `X` meets the `CancellationSlot` requirements if it satisfies the
requirements of `CopyConstructible` (C++Std [copyconstructible]) and
`Destructible` (C++Std [destructible]), as well as the additional requirements
listed below.
In the table below, `x1` and `x2` denote (possibly const) values of type `X`,
`mx1` denotes an xvalue of type `X`, `H` denotes a type that satisfies
`CancellationHandler`, `h` denotes an xvalue of type `H`, and `u0` to `uN`
denote identifiers.
[table CancellationSlot requirements
[[expression] [type] [assertion/note[br]pre/post-conditions]]
[
[`X u(x1);`]
[]
[Shall not exit via an exception.[br]
[br]
post: `u == x1`.]
]
[
[`X u(mx1);`]
[]
[Shall not exit via an exception.[br]
[br]
post: `u` equals the prior value of `mx1`.]
]
[
[`x1 == x2`]
[`bool`]
[ Returns `true` only if `x1` and `x2` can be interchanged with identical
effects.
[br]
`operator==` shall be reflexive, symmetric, and transitive, and shall not
exit via an exception.]
]
[
[`x1 != x2`]
[`bool`]
[Same as `!(x1 == x2)`.]
]
[
[`x1.assign(h)`]
[`H&`]
[]
]
[
[`x1.emplace<H>(u0, ..., uN)`]
[`H&`]
[Requires that `is_constructible<H, decltype(u0), ...,
decltype(u0)>::value` be true.]
]
]
[endsect]

View File

@@ -0,0 +1,42 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:CompletionCondition Completion condition requirements]
A ['completion condition] is a function object that is used with the algorithms
[link asio.reference.read `read`], [link asio.reference.async_read
`async_read`], [link asio.reference.write `write`], and [link
asio.reference.async_write `async_write`] to determine when the algorithm has
completed transferring data.
A type `X` meets the `CompletionCondition` requirements if it satisfies the
requirements of `Destructible` (C++Std [destructible]) and
`MoveConstructible` (C++Std [moveconstructible]), as well as the additional
requirements listed below.
In the table below, `x` denotes a value of type `X`, `ec` denotes a (possibly
const) value of type `error_code`, and `n` denotes a (possibly const) value of
type `size_t`.
[table CompletionCondition requirements
[[expression] [return type] [assertion/note[br]pre/post-condition]]
[
[`x(ec, n)`]
[`size_t`]
[
Let `n` be the total number of bytes transferred by the read or write
algorithm so far.[br]
[br]
Returns the maximum number of bytes to be transferred on the next
`read_some`, `async_read_some`, `write_some`, or `async_write_some`
operation performed by the algorithm. Returns `0` to indicate that the
algorithm is complete.
]
]
]
[endsect]

View File

@@ -0,0 +1,63 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:CompletionHandler Completion handler requirements]
A completion handler must meet the requirements for a [link
asio.reference.Handler handler]. A value `h` of a completion handler
class should work correctly in the expression `h()`.
[heading Examples]
A free function as a completion handler:
void completion_handler()
{
...
}
A completion handler function object:
struct completion_handler
{
...
void operator()()
{
...
}
...
};
A lambda as a completion handler:
my_io_service.post(
[]()
{
...
});
A non-static class member function adapted to a completion handler using
`std::bind()`:
void my_class::completion_handler()
{
...
}
...
my_io_service.post(std::bind(&my_class::completion_handler, this));
A non-static class member function adapted to a completion handler using
`boost::bind()`:
void my_class::completion_handler()
{
...
}
...
my_io_service.post(boost::bind(&my_class::completion_handler, this));
[endsect]

View File

@@ -0,0 +1,34 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:ConnectCondition Connect condition requirements]
A type `X` meets the `ConnectCondition` requirements if it satisfies the
requirements of `Destructible` (C++Std [destructible]) and
`CopyConstructible` (C++Std [copyconstructible]), as well as the additional
requirements listed below.
In the table below, `x` denotes a value of type `X`, `ec` denotes a (possibly
const) value of type `error_code`, and `ep` denotes a (possibly const) value of
some type satisfying the [link asio.reference.Endpoint endpoint] requirements.
[table ConnectCondition requirements
[[expression] [return type] [assertion/note[br]pre/post-condition]]
[
[`x(ec, ep)`]
[`bool`]
[
Returns `true` to indicate that the `connect` or `async_connect`
algorithm should attempt a connection to the endpoint `ep`. Otherwise,
returns `false` to indicate that the algorithm should not attempt
connection to the endpoint `ep`, and should instead skip to the next
endpoint in the sequence.
]
]
]
[endsect]

View File

@@ -0,0 +1,72 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:ConnectHandler Connect handler requirements]
A connect handler must meet the requirements for a [link
asio.reference.Handler handler]. A value `h` of a connect handler
class should work correctly in the expression `h(ec)`, where `ec` is an lvalue
of type `const error_code`.
[heading Examples]
A free function as a connect handler:
void connect_handler(
const asio::error_code& ec)
{
...
}
A connect handler function object:
struct connect_handler
{
...
void operator()(
const asio::error_code& ec)
{
...
}
...
};
A lambda as a connect handler:
socket.async_connect(...,
[](const asio::error_code& ec)
{
...
});
A non-static class member function adapted to a connect handler using
`std::bind()`:
void my_class::connect_handler(
const asio::error_code& ec)
{
...
}
...
socket.async_connect(...,
std::bind(&my_class::connect_handler,
this, std::placeholders::_1));
A non-static class member function adapted to a connect handler using
`boost::bind()`:
void my_class::connect_handler(
const asio::error_code& ec)
{
...
}
...
socket.async_connect(...,
boost::bind(&my_class::connect_handler,
this, asio::placeholders::error));
[endsect]

View File

@@ -0,0 +1,53 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:ConstBufferSequence Constant buffer sequence requirements]
A ['constant buffer sequence] represents a set of memory regions that may be
used as input to an operation, such as the `send` operation of a socket.
A type `X` meets the `ConstBufferSequence` requirements if it satisfies the
requirements of `Destructible` (C++Std [destructible]) and
`CopyConstructible` (C++Std [copyconstructible]), as well as the additional
requirements listed below.
In the table below, `x` denotes a (possibly const) value of type `X`, and `u`
denotes an identifier.
[table ConstBufferSequence requirements
[[expression] [return type] [assertion/note[br]pre/post-condition]]
[
[`asio::buffer_sequence_begin(x)`[br]
`asio::buffer_sequence_end(x)`]
[An iterator type meeting the requirements for bidirectional iterators
(C++Std \[bidirectional.iterators\]) whose value type is convertible to
`const_buffer`.]
[]
]
[
[``
X u(x);
``]
[]
[post:[br]
``
equal(
asio::buffer_sequence_begin(x),
asio::buffer_sequence_end(x),
asio::buffer_sequence_begin(u),
asio::buffer_sequence_end(u),
[](const const_buffer& b1,
const const_buffer& b2)
{
return b1.data() == b2.data()
&& b1.size() == b2.size();
})
``]
]
]
[endsect]

View File

@@ -0,0 +1,16 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:DynamicBuffer Dynamic buffer requirements]
See:
* [link asio.reference.DynamicBuffer_v1 Dynamic buffer requirements (version 1)]
* [link asio.reference.DynamicBuffer_v2 Dynamic buffer requirements (version 2)]
[endsect]

View File

@@ -0,0 +1,93 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:DynamicBuffer_v1 Dynamic buffer requirements (version 1)]
A dynamic buffer encapsulates memory storage that may be automatically resized
as required, where the memory is divided into an input sequence followed by an
output sequence. These memory regions are internal to the dynamic buffer
sequence, but direct access to the elements is provided to permit them to be
efficiently used with I/O operations, such as the `send` or `receive`
operations of a socket. Data written to the output sequence of a dynamic buffer
sequence object is appended to the input sequence of the same object.
A dynamic buffer type `X` shall satisfy the requirements of `MoveConstructible`
(C++ Std, [moveconstructible]) types in addition to those listed below.
In the table below, `X` denotes a dynamic buffer class, `x` denotes a
value of type `X&`, `x1` denotes values of type `const X&`, and `n` denotes a
value of type `size_t`, and `u` denotes an identifier.
[table DynamicBuffer_v1 requirements
[[expression] [type] [assertion/note[br]pre/post-conditions]]
[
[`X::const_buffers_type`]
[type meeting [link asio.reference.ConstBufferSequence ConstBufferSequence]
requirements.]
[This type represents the memory associated with the input sequence.]
]
[
[`X::mutable_buffers_type`]
[type meeting [link asio.reference.MutableBufferSequence MutableBufferSequence]
requirements.]
[This type represents the memory associated with the output sequence.]
]
[
[`x1.size()`]
[`size_t`]
[Returns the size, in bytes, of the input sequence.]
]
[
[`x1.max_size()`]
[`size_t`]
[Returns the permitted maximum of the sum of the sizes of the input
sequence and output sequence.]
]
[
[`x1.capacity()`]
[`size_t`]
[Returns the maximum sum of the sizes of the input sequence and output
sequence that the dynamic buffer can hold without requiring reallocation.]
]
[
[`x1.data()`]
[`X::const_buffers_type`]
[Returns a constant buffer sequence `u` that represents the memory
associated with the input sequence, and where `buffer_size(u) == size()`.]
]
[
[`x.prepare(n)`]
[`X::mutable_buffers_type`]
[Requires: `size() + n <= max_size()`.[br]
[br]
Returns a mutable buffer sequence `u` representing the output sequence, and
where `buffer_size(u) == n`. The dynamic buffer reallocates memory as
required. All constant or mutable buffer sequences previously obtained
using `data()` or `prepare()` are invalidated.[br]
[br]
Throws: `length_error` if `size() + n > max_size()`.]
]
[
[`x.commit(n)`]
[]
[Appends `n` bytes from the start of the output sequence to the end of the
input sequence. The remainder of the output sequence is discarded. If `n`
is greater than the size of the output sequence, the entire output sequence
is appended to the input sequence. All constant or mutable buffer sequences
previously obtained using `data()` or `prepare()` are invalidated.]
]
[
[`x.consume(n)`]
[]
[Removes `n` bytes from beginning of the input sequence. If `n` is greater
than the size of the input sequence, the entire input sequence is removed.
All constant or mutable buffer sequences previously obtained using `data()`
or `prepare()` are invalidated.]
]
]
[endsect]

View File

@@ -0,0 +1,94 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:DynamicBuffer_v2 Dynamic buffer requirements (version 2)]
A dynamic buffer encapsulates memory storage that may be automatically resized
as required.
A dynamic buffer type `X` shall satisfy the requirements of `CopyConstructible`
(C++ Std, [copyconstructible]) types in addition to those listed below.
In the table below, `X` denotes a dynamic buffer class, `x` denotes a value of
type `X&`, `x1` denotes values of type `const X&`, `pos` and `n` denote values
of type `size_t`, and `u` denotes an identifier.
[table DynamicBuffer_v2 requirements
[[expression] [type] [assertion/note[br]pre/post-conditions]]
[
[`X::const_buffers_type`]
[type meeting [link asio.reference.ConstBufferSequence ConstBufferSequence]
requirements.]
[This type represents the underlying memory as a sequence of @c const_buffer
objects.]
]
[
[`X::mutable_buffers_type`]
[type meeting [link asio.reference.MutableBufferSequence MutableBufferSequence]
requirements.]
[This type represents the underlying memory as a sequence of @c
mutable_buffer objects.]
]
[
[`x1.size()`]
[`size_t`]
[Returns the size, in bytes, of the underlying memory.]
]
[
[`x1.max_size()`]
[`size_t`]
[Returns the permitted maximum size of the underlying memory.]
]
[
[`x1.capacity()`]
[`size_t`]
[Returns the maximum size to which the underlying memory can grow without
requiring reallocation.]
]
[
[`x1.data(pos, n)`]
[`X::const_buffers_type`]
[Returns a constant buffer sequence `u` that represents the underlying
memory beginning at offset `pos`, and where `buffer_size(u) <= n`.]
]
[
[`x.data(pos, n)`]
[`X::mutable_buffers_type`]
[Returns a mutable buffer sequence `u` that represents the underlying
memory beginning at offset `pos`, and where `buffer_size(u) <= n`.]
]
[
[`x.grow(n)`]
[]
[Requires: `size() + n <= max_size()`.[br]
[br]
Extends the underlying memory to accommodate `n` additional bytes at the
end. The dynamic buffer reallocates memory as required. All constant or
mutable buffer sequences previously obtained using `data()` are
invalidated.[br]
[br]
Throws: `length_error` if `size() + n > max_size()`.]
]
[
[`x.shrink(n)`]
[]
[Removes `n` bytes from the end of the underlying memory. If `n` is greater
than the size of the underlying memory, the entire underlying memory is
emptied. All constant or mutable buffer sequences previously obtained
using `data()` are invalidated.]
]
[
[`x.consume(n)`]
[]
[Removes `n` bytes from the beginning of the underlying memory. If `n` is
greater than the size of the underlying memory, the entire underlying memory
is emptied. All constant or mutable buffer sequences previously obtained
using `data()` are invalidated.]
]
]
[endsect]

View File

@@ -0,0 +1,97 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:Endpoint Endpoint requirements]
A type `X` meets the `Endpoint` requirements if it satisfies the requirements
of `Destructible` (C++Std [destructible]), `DefaultConstructible` (C++Std
[defaultconstructible]), `CopyConstructible` (C++Std [copyconstructible]),
and `CopyAssignable` (C++Std [copyassignable]), as well as the additional
requirements listed below.
The default constructor and move operations of the type `X` shall not exit via
an exception.
In the table below, `a` denotes a (possibly const) value of type `X`, and `u`
denotes an identifier.
[table Endpoint requirements
[[expression] [type] [assertion/note[br]pre/post-conditions]]
[
[`X::protocol_type`]
[type meeting [link asio.reference.Protocol `Protocol`] requirements]
[]
]
[
[`a.protocol()`]
[`protocol_type`]
[]
]
]
In the table below, `a` denotes a (possibly const) value of type `X`, `b`
denotes a value of type `X`, and `s` denotes a (possibly const) value of a type
that is convertible to `size_t` and denotes a size in bytes.
[table Endpoint requirements for extensible implementations
[[expression] [type] [assertion/note[br]pre/post-conditions]]
[
[`a.data()`]
[`const void*`]
[
Returns a pointer suitable for passing as the /address/ argument to
functions such as __POSIX__ __connect__, or as the /dest_addr/ argument
to functions such as __POSIX__ __sendto__. The implementation shall
perform a `static_cast` on the pointer to convert it to `const
sockaddr*`.
]
]
[
[`b.data()`]
[`void*`]
[
Returns a pointer suitable for passing as the /address/ argument to
functions such as __POSIX__ __accept__, __getpeername__, __getsockname__
and __recvfrom__. The implementation shall perform a `static_cast` on the
pointer to convert it to `sockaddr*`.
]
]
[
[`a.size()`]
[`size_t`]
[
Returns a value suitable for passing as the /address_len/ argument
to functions such as __POSIX__ __connect__, or as the /dest_len/ argument
to functions such as __POSIX__ __sendto__, after appropriate integer
conversion has been performed.
]
]
[
[`b.resize(s)`]
[]
[
pre: `s >= 0`[br]
post: `a.size() == s`[br]
Passed the value contained in the /address_len/ argument to functions
such as __POSIX__ __accept__, __getpeername__, __getsockname__ and
__recvfrom__, after successful completion of the function. Permitted to
throw an exception if the protocol associated with the endpoint object
`a` does not support the specified size.
]
]
[
[`a.capacity()`]
[`size_t`]
[
Returns a value suitable for passing as the /address_len/ argument to
functions such as __POSIX__ __accept__, __getpeername__, __getsockname__
and __recvfrom__, after appropriate integer conversion has been performed.
]
]
]
[endsect]

View File

@@ -0,0 +1,30 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:EndpointSequence Endpoint sequence requirements]
A type `X` meets the `EndpointSequence` requirements if it satisfies the
requirements of `Destructible` (C++Std [destructible]) and `CopyConstructible`
(C++Std [copyconstructible]), as well as the additional requirements listed
below.
In the table below, `x` denotes a (possibly const) value of type `X`.
[table EndpointSequence requirements
[[expression] [return type] [assertion/note[br]pre/post-condition]]
[
[`x.begin()`[br]
`x.end()`]
[A type meeting the requirements for forward iterators
(C++Std \[forward.iterators\]) whose value type is convertible to
a type satisfying the [link asio.reference.Endpoint `Endpoint`]
requirements.]
[[half_open_range `x.begin()`,`x.end()`] is a valid range.]
]
]
[endsect]

View File

@@ -0,0 +1,36 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:ExecutionContext Execution context requirements]
A type `X` meets the `ExecutionContext` requirements if it is publicly and
unambiguously derived from `execution_context`, and satisfies the additional
requirements listed below.
In the table below, `x` denotes a value of type `X`.
[table ExecutionContext requirements
[[expression] [return type] [assertion/note[br]pre/post-condition]]
[
[`X::executor_type`]
[type meeting [link asio.reference.Executor1 `Executor`] requirements]
[]
]
[
[`x.~X()`]
[]
[Destroys all unexecuted function objects that were submitted via an
executor object that is associated with the execution context.]
]
[
[`x.get_executor()`]
[`X::executor_type`]
[Returns an executor object that is associated with the execution context.]
]
]
[endsect]

View File

@@ -0,0 +1,222 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:Executor1 Executor requirements]
[heading Standard executors]
Let `executor-of-impl` be the exposition-only concept
template<class E, class F>
concept executor-of-impl =
invocable<decay_t<F>&> &&
constructible_from<decay_t<F>, F> &&
move_constructible<decay_t<F>> &&
copy_constructible<E> &&
is_nothrow_copy_constructible_v<E> &&
equality_comparable<E> /* nothrow */ &&
requires(const E& e, F&& f) {
execution::execute(e, (F&&)f);
};
Then the `executor` and `executor_of` concepts are defined as follows:
template<class E>
concept executor =
executor-of-impl<E, execution::invocable_archetype>;
template<class E, class F>
concept executor_of =
executor<E> &&
executor-of-impl<E, F>;
Neither an executor's equality comparison nor `swap` operation shall exit via
an exception.
None of an executor type's copy constructor, destructor, equality comparison,
`swap` function, `execute` function, or associated `query` functions shall
introduce data races as a result of concurrent invocations of those functions
from different threads.
For any two (possibly const) values `x1` and `x2` of some executor type `X`,
`x1 == x2` shall return `true` only if `asio::query(x1,p) == asio::query(x2,p)`
for every property `p` where both `asio::query(x1,p)` and `asio::query(x2,p)`
are well-formed and result in a non-void type that is `equality_comparable`
(C++Std [equalitycomparable]). [inline_note The above requirements imply that `x1
== x2` returns `true` if `x1` and `x2` can be interchanged with identical
effects. An executor may conceptually contain additional properties which are
not exposed by a named property type that can be observed via `asio::query`; in
this case, it is up to the concrete executor implementation to decide if these
properties affect equality. Returning `false` does not necessarily imply that
the effects are not identical.]
An executor type's destructor shall not block pending completion of the
submitted function objects. [inline_note The ability to wait for completion of
submitted function objects may be provided by the associated execution
context.]
In addition to the above requirements, types `E` and `F` model `executor_of`
only if they satisfy the requirements of the Table below.
Let:
* `e` denotes a (possibly const) executor object of type `E`,
* `cf` denotes the function object `DECAY_COPY(std::forward<F>(f))`
* `f` denotes a function of type `F&&` invocable as `cf()` and where
`decay_t<F>` models `move_constructible`.
The expression `execution::execute(e, f)`:
* Evaluates `DECAY_COPY(std::forward<F>(f))` on the calling thread to create
`cf` that will be invoked at most once by an execution agent.
* May block pending completion of this invocation. Synchronizes with
[intro.multithread] the invocation of `f`.
* Shall not propagate any exception thrown by the function object or any other
function submitted to the executor.
[inline_note The treatment of exceptions thrown by one-way submitted functions
is implementation-defined. The forward progress guarantee of the associated
execution agent(s) is implementation-defined.]
[heading Networking TS-style executors]
The library describes a standard set of requirements for ['executors]. A type
meeting the `Executor` requirements embodies a set of rules for determining how
submitted function objects are to be executed.
A type `X` meets the `Executor` requirements if it satisfies the requirements of
`CopyConstructible` (C++Std [copyconstructible]) and `Destructible` (C++Std
[destructible]), as well as the additional requirements listed below.
No constructor, comparison operator, copy operation, move operation, swap
operation, or member functions `context`, `on_work_started`, and
`on_work_finished` on these types shall exit via an exception.
The executor copy constructor, comparison operators, and other member functions
defined in these requirements shall not introduce data races as a result of
concurrent calls to those functions from different threads.
Let `ctx` be the execution context returned by the executor's `context()`
member function. An executor becomes ['invalid] when the first call to
`ctx.shutdown()` returns. The effect of calling `on_work_started`,
`on_work_finished`, `dispatch`, `post`, or `defer` on an invalid executor is
undefined. [inline_note The copy constructor, comparison operators, and
`context()` member function continue to remain valid until `ctx` is destroyed.]
In the table below, `x1` and `x2` denote (possibly const) values of type `X`,
`mx1` denotes an xvalue of type `X`, `f` denotes a `MoveConstructible` (C++Std
[moveconstructible]) function object callable with zero arguments, `a` denotes
a (possibly const) value of type `A` meeting the `Allocator` requirements
(C++Std [allocator.requirements]), and `u` denotes an identifier.
[table Executor requirements
[[expression] [type] [assertion/note[br]pre/post-conditions]]
[
[`X u(x1);`]
[]
[Shall not exit via an exception.[br]
[br]
post: `u == x1` and
`std::addressof(u.context()) == std::addressof(x1.context()).`]
]
[
[`X u(mx1);`]
[]
[Shall not exit via an exception.[br]
[br]
post: `u` equals the prior value of `mx1` and
`std::addressof(u.context())` equals the prior value of
`std::addressof(mx1.context())`.]
]
[
[`x1 == x2`]
[`bool`]
[ Returns `true` only if `x1` and `x2` can be interchanged with identical
effects in any of the expressions defined in these type requirements.
[inline_note Returning `false` does not necessarily imply that the effects
are not identical.][br]
[br]
`operator==` shall be reflexive, symmetric, and transitive, and shall not
exit via an exception.]
]
[
[`x1 != x2`]
[`bool`]
[Same as `!(x1 == x2)`.]
]
[
[`x1.context()`]
[`execution_context&`, or `E&` where `E` is a type that satifisfies the
[link asio.reference.ExecutionContext `ExecutionContext`] requirements.]
[Shall not exit via an exception.[br]
[br]
The comparison operators and member functions defined in these
requirements shall not alter the reference returned by this function.]
]
[
[`x1.on_work_started()`]
[]
[Shall not exit via an exception.]
]
[
[`x1.on_work_finished()`]
[]
[Shall not exit via an exception.[br]
[br]
Precondition: A preceding call `x2.on_work_started()` where `x1 == x2`.]
]
[
[`x1.dispatch(std::move(f),a)`]
[]
[Effects: Creates an object `f1` initialized with
[^['DECAY_COPY]]`(forward<Func>(f))` (C++Std \[thread.decaycopy\]) in the
current thread of execution . Calls `f1()` at most once. The executor may
block forward progress of the caller until `f1()` finishes execution.[br]
[br]
Executor implementations should use the supplied allocator to allocate any
memory required to store the function object. Prior to invoking the
function object, the executor shall deallocate any memory allocated.
[inline_note Executors defined in this Technical Specification always use
the supplied allocator unless otherwise specified.][br]
[br]
Synchronization: The invocation of `dispatch` synchronizes with (C++Std
\[intro.multithread\]) the invocation of `f1`.]
]
[
[`x1.post(std::move(f),a)`[br]
`x1.defer(std::move(f),a)`]
[]
[Effects: Creates an object `f1` initialized with
[^['DECAY_COPY]]`(forward<Func>(f))` in the current thread of execution.
Calls `f1()` at most once. The executor shall not block forward progress
of the caller pending completion of `f1()`.[br]
[br]
Executor implementations should use the supplied allocator to allocate any
memory required to store the function object. Prior to invoking the
function object, the executor shall deallocate any memory allocated.
[inline_note Executors defined in this Technical Specification always use
the supplied allocator unless otherwise specified.][br]
[br]
Synchronization: The invocation of `post` or `defer` synchronizes with
(C++Std \[intro.multithread\]) the invocation of `f1`.[br]
[br]
[inline_note Although the requirements placed on `defer` are identical to
`post`, the use of `post` conveys a preference that the caller ['does not]
block the first step of [^f1]'s progress, whereas `defer` conveys a
preference that the caller ['does] block the first step of [^f1]. One use
of `defer` is to convey the intention of the caller that [^f1] is a
continuation of the current call context. The executor may use this
information to optimize or otherwise adjust the way in which `f1` is
invoked.]]
]
]
[endsect]

View File

@@ -0,0 +1,33 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:GettableSerialPortOption Gettable serial port option requirements]
In the table below, `X` denotes a serial port option class, `a` denotes a value
of `X`, `ec` denotes a value of type `error_code`, and `s` denotes a value of
implementation-defined type ['[^storage]] (where ['[^storage]] is the type
`DCB` on Windows and `termios` on __POSIX__ platforms), and `u` denotes an
identifier.
[table GettableSerialPortOption requirements
[[expression] [type] [assertion/note[br]pre/post-conditions]]
[
[
`const `['[^storage]]`& u = s;`[br]
`a.load(u, ec);`
]
[`error_code`]
[
Retrieves the value of the serial port option from the storage.[br]
[br]
If successful, sets `ec` such that `!ec` is true. If an error occurred,
sets `ec` such that `!!ec` is true. Returns `ec`.
]
]
]
[endsect]

View File

@@ -0,0 +1,67 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:GettableSocketOption Gettable socket option requirements]
A type `X` meets the `GettableSocketOption` requirements if it satisfies the
requirements listed below.
In the table below, `a` denotes a (possibly const) value of type `X`, `b`
denotes a value of type `X`, `p` denotes a (possibly const) value that meets
the [link asio.reference.Protocol `Protocol`] requirements, and `s` denotes a
(possibly const) value of a type that is convertible to `size_t` and denotes a
size in bytes.
[table GettableSocketOption requirements for extensible implementations
[[expression] [type] [assertion/note[br]pre/post-conditions]]
[
[`a.level(p)`]
[`int`]
[
Returns a value suitable for passing as the /level/ argument to __POSIX__
__getsockopt__ (or equivalent).
]
]
[
[`a.name(p)`]
[`int`]
[
Returns a value suitable for passing as the /option_name/ argument to
__POSIX__ __getsockopt__ (or equivalent).
]
]
[
[`b.data(p)`]
[`void*`]
[
Returns a pointer suitable for passing as the /option_value/ argument to
__POSIX__ __getsockopt__ (or equivalent).
]
]
[
[`a.size(p)`]
[`size_t`]
[
Returns a value suitable for passing as the /option_len/ argument to
__POSIX__ __getsockopt__ (or equivalent), after appropriate
integer conversion has been performed.
]
]
[
[`b.resize(p,s)`]
[]
[
post: `b.size(p) == s`.[br]
Passed the value contained in the /option_len/ argument to __POSIX__
__getsockopt__ (or equivalent) after successful completion of the
function. Permitted to throw an exception if the socket option object `b`
does not support the specified size.
]
]
]
[endsect]

View File

@@ -0,0 +1,64 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:Handler Handlers]
A handler must meet the requirements of `MoveConstructible` types (C++Std
[moveconstructible]).
In the table below, `X` denotes a handler class, `h` denotes a value of `X`,
`p` denotes a pointer to a block of allocated memory of type `void*`, `s`
denotes the size for a block of allocated memory, and `f` denotes a function
object taking no arguments.
[table Handler requirements
[[expression] [return type] [assertion/note[br]pre/post-conditions]]
[
[``
using asio::asio_handler_allocate;
asio_handler_allocate(s, &h);
``]
[`void*`]
[
Returns a pointer to a block of memory of size `s`. The pointer must
satisfy the same alignment requirements as a pointer returned by
`::operator new()`. Throws `bad_alloc` on failure.[br][br] The
`asio_handler_allocate()` function is located using argument-dependent
lookup. The function `asio::asio_handler_allocate()` serves as a
default if no user-supplied function is available.
]
]
[
[``
using asio::asio_handler_deallocate;
asio_handler_deallocate(p, s, &h);
``]
[]
[
Frees a block of memory associated with a pointer `p`, of at least size
`s`, that was previously allocated using `asio_handler_allocate()`.[br][br] The
`asio_handler_deallocate()` function is located using argument-dependent
lookup. The function `asio::asio_handler_deallocate()` serves as a
default if no user-supplied function is available.
]
]
[
[``
using asio::asio_handler_invoke;
asio_handler_invoke(f, &h);
``]
[]
[
Causes the function object `f` to be executed as if by calling `f()`.[br][br]
The `asio_handler_invoke()` function is located using argument-dependent
lookup. The function `asio::asio_handler_invoke()` serves as a
default if no user-supplied function is available.
]
]
]
[endsect]

View File

@@ -0,0 +1,72 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:HandshakeHandler SSL handshake handler requirements]
A handshake handler must meet the requirements for a [link
asio.reference.Handler handler]. A value `h` of a handshake handler
class should work correctly in the expression `h(ec)`, where `ec` is an lvalue
of type `const error_code`.
[heading Examples]
A free function as a handshake handler:
void handshake_handler(
const asio::error_code& ec)
{
...
}
A handshake handler function object:
struct handshake_handler
{
...
void operator()(
const asio::error_code& ec)
{
...
}
...
};
A lambda as a handshake handler:
ssl_stream.async_handshake(...,
[](const asio::error_code& ec)
{
...
});
A non-static class member function adapted to a handshake handler using
`std::bind()`:
void my_class::handshake_handler(
const asio::error_code& ec)
{
...
}
...
ssl_stream.async_handshake(...,
std::bind(&my_class::handshake_handler,
this, std::placeholders::_1));
A non-static class member function adapted to a handshake handler using
`boost::bind()`:
void my_class::handshake_handler(
const asio::error_code& ec)
{
...
}
...
ssl_stream.async_handshake(...,
boost::bind(&my_class::handshake_handler,
this, asio::placeholders::error));
[endsect]

View File

@@ -0,0 +1,47 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:InternetProtocol Internet protocol requirements]
A type `X` meets the `InternetProtocol` requirements if it satisfies the
requirements of [link asio.reference.AcceptableProtocol `AcceptableProtocol`],
as well as the additional requirements listed below.
In the table below, `a` denotes a (possibly const) value of type `X`, and `b`
denotes a (possibly const) value of type `X`.
[table InternetProtocol requirements
[[expression] [return type] [assertion/note[br]pre/post-conditions]]
[
[`X::resolver`]
[`ip::basic_resolver<X>`]
[The type of a resolver for the protocol.]
]
[
[`X::v4()`]
[`X`]
[Returns an object representing the IP version 4 protocol.]
]
[
[`X::v6()`]
[`X`]
[Returns an object representing the IP version 6 protocol.]
]
[
[`a == b`]
[convertible to `bool`]
[Returns `true` if `a` and `b` represent the same IP protocol version,
otherwise `false`.]
]
[
[`a != b`]
[convertible to `bool`]
[Returns `!(a == b)`.]
]
]
[endsect]

View File

@@ -0,0 +1,34 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:IoControlCommand I/O control command requirements]
A type `X` meets the `IoControlCommand` requirements if it satisfies the
requirements listed below.
In the table below, `a` denotes a (possibly const) value of type `X`, and `b`
denotes a value of type `X`.
[table IoControlCommand requirements for extensible implementations
[[expression] [type] [assertion/note[br]pre/post-conditions]]
[
[`a.name()`]
[`int`]
[
Returns a value suitable for passing as the /request/ argument to
__POSIX__ __ioctl__ (or equivalent).
]
]
[
[`b.data()`]
[`void*`]
[
]
]
]
[endsect]

View File

@@ -0,0 +1,62 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:IoObjectService I/O object service requirements]
An I/O object service must meet the requirements for a [link
asio.reference.Service service], as well as the requirements listed
below.
In the table below, `X` denotes an I/O object service class, `a` and `ao` denote
values of type `X`, `b` and `c` denote values of type `X::implementation_type`,
and `u` denotes an identifier.
[table IoObjectService requirements
[[expression] [return type] [assertion/note[br]pre/post-condition]]
[
[`X::implementation_type`]
[]
[]
]
[
[`X::implementation_type u;`]
[]
[note: `X::implementation_type` has a public default constructor and
destructor.]
]
[
[``
a.construct(b);
``]
[]
[]
]
[
[``
a.destroy(b);
``]
[]
[note: `destroy()` will only be called on a value that has previously been
initialised with `construct()` or `move_construct()`.]
]
[
[``
a.move_construct(b, c);
``]
[]
[note: only required for I/O objects that support movability.]
]
[
[``
a.move_assign(b, ao, c);
``]
[]
[note: only required for I/O objects that support movability.]
]
]
[endsect]

View File

@@ -0,0 +1,81 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:IteratorConnectHandler Iterator connect handler requirements]
An iterator connect handler must meet the requirements for a [link
asio.reference.Handler handler]. A value `h` of an iterator connect handler
class should work correctly in the expression `h(ec, i)`, where `ec` is an
lvalue of type `const error_code` and `i` is an lvalue of the type `Iterator`
used in the corresponding `connect()` or async_connect()` function.
[heading Examples]
A free function as an iterator connect handler:
void connect_handler(
const asio::error_code& ec,
asio::ip::tcp::resolver::iterator iterator)
{
...
}
An iterator connect handler function object:
struct connect_handler
{
...
template <typename Iterator>
void operator()(
const asio::error_code& ec,
Iterator iterator)
{
...
}
...
};
A lambda as an iterator connect handler:
asio::async_connect(...,
[](const asio::error_code& ec,
asio::ip::tcp::resolver::iterator iterator)
{
...
});
A non-static class member function adapted to an iterator connect handler using
`std::bind()`:
void my_class::connect_handler(
const asio::error_code& ec,
asio::ip::tcp::resolver::iterator iterator)
{
...
}
...
asio::async_connect(...,
std::bind(&my_class::connect_handler,
this, std::placeholders::_1,
std::placeholders::_2));
A non-static class member function adapted to an iterator connect handler using
`boost::bind()`:
void my_class::connect_handler(
const asio::error_code& ec,
asio::ip::tcp::resolver::iterator iterator)
{
...
}
...
asio::async_connect(...,
boost::bind(&my_class::connect_handler,
this, asio::placeholders::error,
asio::placeholders::iterator));
[endsect]

View File

@@ -0,0 +1,65 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:LegacyCompletionHandler Legacy completion handler requirements]
A legacy completion handler must meet the requirements for a [link
asio.reference.Handler handler]. A legacy completion handler must meet the
requirements of `CopyConstructible` types (C++Std [copyconstructible]). A value
`h` of a completion handler class should work correctly in the expression
`h()`.
[heading Examples]
A free function as a completion handler:
void completion_handler()
{
...
}
A completion handler function object:
struct completion_handler
{
...
void operator()()
{
...
}
...
};
A lambda as a completion handler:
my_io_service.post(
[]()
{
...
});
A non-static class member function adapted to a completion handler using
`std::bind()`:
void my_class::completion_handler()
{
...
}
...
my_io_service.post(std::bind(&my_class::completion_handler, this));
A non-static class member function adapted to a completion handler using
`boost::bind()`:
void my_class::completion_handler()
{
...
}
...
my_io_service.post(boost::bind(&my_class::completion_handler, this));
[endsect]

View File

@@ -0,0 +1,61 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:MoveAcceptHandler Move accept handler requirements]
A move accept handler must meet the requirements for a [link
asio.reference.Handler handler]. A value `h` of a move accept handler class
should work correctly in the expression `h(ec, s)`, where `ec` is an lvalue of
type `const error_code` and `s` is an lvalue of the nested type
`Protocol::socket` for the type `Protocol` of the socket class template.
[heading Examples]
A free function as a move accept handler:
void accept_handler(
const asio::error_code& ec, asio::ip::tcp::socket s)
{
...
}
A move accept handler function object:
struct accept_handler
{
...
void operator()(
const asio::error_code& ec, asio::ip::tcp::socket s)
{
...
}
...
};
A lambda as a move accept handler:
acceptor.async_accept(...,
[](const asio::error_code& ec, asio::ip::tcp::socket s)
{
...
});
A non-static class member function adapted to a move accept handler using
`std::bind()`:
void my_class::accept_handler(
const asio::error_code& ec, asio::ip::tcp::socket socket)
{
...
}
...
asio::async_accept(...,
std::bind(&my_class::accept_handler,
this, std::placeholders::_1,
std::placeholders::_2));
[endsect]

View File

@@ -0,0 +1,54 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:MutableBufferSequence Mutable buffer sequence requirements]
A ['mutable buffer sequence] represents a set of memory regions that may be
used to receive the output of an operation, such as the `receive` operation of
a socket.
A type `X` meets the `MutableBufferSequence` requirements if it satisfies the
requirements of `Destructible` (C++Std [destructible]) and
`CopyConstructible` (C++Std [copyconstructible]), as well as the additional
requirements listed below.
In the table below, `x` denotes a (possibly const) value of type `X`, and `u`
denotes an identifier.
[table MutableBufferSequence requirements
[[expression] [return type] [assertion/note[br]pre/post-condition]]
[
[`asio::buffer_sequence_begin(x)`[br]
`asio::buffer_sequence_end(x)`]
[An iterator type meeting the requirements for bidirectional iterators
(C++Std \[bidirectional.iterators\]) whose value type is convertible to
`mutable_buffer`.]
[]
]
[
[``
X u(x);
``]
[]
[post:[br]
``
equal(
asio::buffer_sequence_begin(x),
asio::buffer_sequence_end(x),
asio::buffer_sequence_begin(u),
asio::buffer_sequence_end(u),
[](const mutable_buffer& b1,
const mutable_buffer& b2)
{
return b1.data() == b2.data()
&& b1.size() == b2.size();
})
``]
]
]
[endsect]

View File

@@ -0,0 +1,34 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:OperationState Operation state concept]
template<class O>
concept operation_state =
destructible<O> &&
is_object_v<O> &&
requires (O& o) {
{ execution::start(o) } noexcept;
};
An object whose type satisfies `operation_state` represents the state of an
asynchronous operation. It is the result of calling `execution::connect` with a
`sender` and a `receiver`.
`execution::start` may be called on an `operation_state` object at most once.
Once `execution::start` has been invoked, the caller shall ensure that the
start of a non-exceptional invocation of one of the receiver's
completion-signalling operations strongly happens before [intro.multithread]
the call to the `operation_state` destructor.
The start of the invocation of `execution::start` shall strongly happen before
[intro.multithread] the invocation of one of the three receiver operations.
`execution::start` may or may not block pending the successful transfer of
execution to one of the three receiver operations.
[endsect]

View File

@@ -0,0 +1,19 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:ProtoAllocator Proto-allocator requirements]
A type `A` meets the proto-allocator requirements if `A` is `CopyConstructible`
(C++Std [copyconstructible]), `Destructible` (C++Std [destructible]), and
`allocator_traits<A>::rebind_alloc<U>` meets the allocator requirements (C++Std
[allocator.requirements]), where `U` is an object type. [inline_note For
example, `std::allocator<void>` meets the proto-allocator requirements but not
the allocator requirements.] No constructor, comparison operator, copy
operation, move operation, or swap operation on these types shall exit via an
exception.
[endsect]

View File

@@ -0,0 +1,56 @@
[/
/ Copyright (c) 2003-2021 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)
/]
[section:Protocol Protocol requirements]
A type `X` meets the `Protocol` requirements if it satisfies the requirements
of `Destructible` (C++Std [destructible]), `CopyConstructible` (C++Std
[copyconstructible]), and `CopyAssignable` (C++Std [copyassignable]), as well
as the additional requirements listed below.
No copy or move operation of the type `X` shall exit via an exception.
[table Protocol requirements
[[expression] [return type] [assertion/note[br]pre/post-conditions]]
[
[`X::endpoint`]
[type meeting [link asio.reference.Endpoint endpoint] requirements]
[]
]
]
In the table below, `a` denotes a (possibly const) value of type `X`.
[table Protocol requirements for extensible implementations
[[expression] [return type] [assertion/note[br]pre/post-conditions]]
[
[`a.family()`]
[`int`]
[
Returns a value suitable for passing as the /domain/ argument to
__POSIX__ __socket__ (or equivalent).
]
]
[
[`a.type()`]
[`int`]
[
Returns a value suitable for passing as the /type/ argument to __POSIX__
__socket__ (or equivalent).
]
]
[
[`a.protocol()`]
[`int`]
[
Returns a value suitable for passing as the /protocol/ argument to
__POSIX__ __socket__ (or equivalent).
]
]
]
[endsect]

Some files were not shown because too many files have changed in this diff Show More