37 std::scoped_lock lock(lhs.mtx_, rhs.mtx_);
40 swap(lhs.data_, rhs.data_);
44 std::lock_guard lock{mtx_};
50 std::lock_guard lock{mtx_};
51 data_ = std::make_unique<message_data>(std::move(data));
56 std::lock_guard lock{mtx_};
57 return data_->address;
61 std::lock_guard lock{mtx_};
68 std::lock_guard lock{mtx_};
70 swap(data_->address, address);
75 std::lock_guard lock{mtx_};
76 return data_->buffers;
81 std::lock_guard lock{mtx_};
82 data_->
buffers = std::move(buffers);
88 std::lock_guard lock{mtx_};
90 swap(data_->buffers, buffers);
95 std::lock_guard lock{mtx_};
96 data_->
buffers.push_back(buffer);
101 std::lock_guard lock{mtx_};
102 return data_->control;
106 std::lock_guard lock{mtx_};
107 data_->
control = std::move(control);
113 std::lock_guard lock{mtx_};
115 swap(data_->control, control);
120 std::lock_guard lock{mtx_};
125 std::lock_guard lock{mtx_};
126 data_->
flags = flags;
131 std::lock_guard lock{mtx_};
133 swap(data_->flags, flags);
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 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.
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.
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.
auto swap(socket_handle &lhs, socket_handle &rhs) noexcept -> void
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_message class, a thread-safe container for advanced socket I/O operation...
A data structure that contains all the components of a socket message.