21#ifndef IO_SOCKET_MESSAGE_HPP
22#define IO_SOCKET_MESSAGE_HPP
23#include "detail/buffer_iterator.hpp"
24#include "detail/socket.hpp"
48 [[nodiscard]]
explicit operator socket_message_type() noexcept;
57template <
AllocatorLike Allocator = std::allocator<native_buffer_type>>
61 using buffer_type = std::vector<native_buffer_type, Allocator>;
63 using iterator = buffer_iterator<typename buffer_type::iterator>;
66 using const_iterator = buffer_iterator<typename buffer_type::const_iterator>;
75 noexcept(Allocator()));
92 constexpr auto push_back(const Buf &buf) ->
void;
98 constexpr auto push_back(native_buffer_type buf) ->
void;
107 template <typename... Args>
108 constexpr auto emplace_back(Args &&...args) -> decltype(auto);
111 [[nodiscard]] constexpr auto begin() noexcept ->
iterator;
118 [[nodiscard]] constexpr auto end() noexcept ->
iterator;
124 [[nodiscard]] constexpr auto size() const noexcept ->
size_type;
127 [[nodiscard]] constexpr auto empty() const noexcept ->
bool;
133 [[nodiscard]] explicit constexpr operator
bool() const noexcept;
159template <SocketAddress Addr = sockaddr_storage_type,
164 Allocator>::template rebind_alloc<native_buffer_type>;
167 std::allocator_traits<Allocator>::template rebind_alloc<std::byte>;
190 [[nodiscard]] explicit operator socket_message_type() noexcept;
195#include "impl/socket_message_impl.hpp"
A container for managing buffers for scatter-gather I/O operations.
Definition socket_message.hpp:58
std::vector< native_buffer_type, Allocator > buffer_type
The underlying buffer type.
Definition socket_message.hpp:61
message_buffer(const Allocator &alloc=Allocator()) noexcept(noexcept(Allocator()))
Construct message buffer with a custom allocator.
typename buffer_type::size_type size_type
Size type for the buffer.
Definition socket_message.hpp:68
buffer_iterator< typename buffer_type::const_iterator > const_iterator
Constant iterator for the buffer that returns spans when dereferenced.
Definition socket_message.hpp:66
buffer_iterator< typename buffer_type::iterator > iterator
Iterator for the buffer that returns spans when dereferenced.
Definition socket_message.hpp:63
A concept that checks if a type is an allocator.
Definition concepts.hpp:51
A concept that describes a scatter/gather like buffer object.
Definition concepts.hpp:66
The io::socket namespace provides a cross-platform abstraction for socket-level I/O operations.
Definition poll_multiplexer.hpp:36
Defines the socket_address class for platform-independent socket address management.
Represents a complete socket message.
Definition socket_message.hpp:161
std::vector< std::byte, control_allocator > control_type
The control buffer type.
Definition socket_message.hpp:173
std::optional< socket_address< Addr > > address_type
The socket address type.
Definition socket_message.hpp:169
address_type address
Optional address of the sender/receiver.
Definition socket_message.hpp:176
std::allocator_traits< Allocator >::template rebind_alloc< std::byte > control_allocator
The allocator type for control data.
Definition socket_message.hpp:167
message_type buffers
Buffers for scatter/gather I/O.
Definition socket_message.hpp:179
control_type control
Ancillary data (control information).
Definition socket_message.hpp:182
std::allocator_traits< Allocator >::template rebind_alloc< native_buffer_type > message_allocator
The allocator type for message buffers.
Definition socket_message.hpp:164