22#ifndef IO_SOCKET_MESSAGE_HPP
23#define IO_SOCKET_MESSAGE_HPP
24#include <boost/predef.h>
264 template <typename... Args>
266 std::lock_guard<std::mutex> lock{mtx_};
267 data_->buffers.emplace_back(std::forward<Args>(args)...);
311 [[nodiscard]] auto
flags() const ->
int;
348 mutable std::mutex mtx_;
A platform-independent representation of a socket address.
A thread-safe container for socket messages used in advanced I/O operations.
socket_message()
Default constructor.
auto exchange_buffers(scatter_gather_buffer buffers) -> scatter_gather_buffer
Exchanges the data buffers.
auto emplace_back(Args &&...args) -> socket_message &
Constructs a new buffer in-place at the end of the buffer collection.
auto push_back(socket_buffer_type buffer) -> socket_message &
Adds a new data buffer to the end of the buffer collection.
auto get() const -> message_data
Gets the underlying message_data struct.
auto buffers() const -> scatter_gather_buffer
Gets the data buffers.
auto flags() const -> int
Gets the message flags.
auto set_flags(int flags) -> socket_message &
Sets the message flags.
auto set_address(socket_address address) -> socket_message &
Sets the socket address.
auto exchange_control(ancillary_buffer control) -> ancillary_buffer
Exchanges the ancillary data.
auto set_control(ancillary_buffer control) -> socket_message &
Sets the ancillary data.
friend auto swap(socket_message &lhs, socket_message &rhs) noexcept -> void
Swaps the contents of two socket_message instances.
auto set_buffers(scatter_gather_buffer buffers) -> socket_message &
Sets the data buffers.
auto exchange_address(socket_address address) -> socket_address
Exchanges the socket address.
auto operator=(const socket_message &other) -> socket_message &=delete
Deleted copy assignment operator.
auto address() const -> socket_address
Gets the socket address.
auto control() const -> ancillary_buffer
Gets the ancillary data.
socket_message(const socket_message &other)=delete
Deleted copy constructor.
auto exchange_flags(int flags) -> int
Exchanges the message flags.
The io::socket namespace provides a cross-platform abstraction for socket-level I/O operations.
std::vector< socket_buffer_type > scatter_gather_buffer
Type alias for scatter-gather I/O buffer collection.
std::span< char, std::dynamic_extent > socket_buffer_type
The socket buffer type for POSIX systems.
std::vector< char > ancillary_buffer
Type alias for ancillary data buffer used in socket messages.
This file defines the socket_address class, a platform-independent abstraction for socket addresses.
A data structure that contains all the components of a socket message.
socket_address address
The socket address for the message.
ancillary_buffer control
The ancillary data (control information).
int flags
The message flags for socket operations.
scatter_gather_buffer buffers
A collection of data buffers for scatter-gather I/O.