|
| | SocketDevice () noexcept=default |
| | Default constructor.
|
| |
| | SocketDevice (std::reference_wrapper< const io::StopSource > stopSource) noexcept |
| | Constructor that associates a stop source with the socket.
|
| |
| template<tools::OneOf< WithStopSource >... Options> |
| | SocketDevice (Socket &&socket, Options... options) |
| | Constructor from a generic socket object.
|
| |
| template<tools::OneOf< Protocol, WithStopSource >... Options> |
| | SocketDevice (int addressFamily, Options... options) |
| | Constructor that creates a stream socket.
|
| |
| template<tools::OneOf< WithStopSource >... Options> |
| | SocketDevice (posix::File socketFileDescriptor, Options... options) |
| | Creates a socket object from a Posix file descriptor.
|
| |
| template<tools::OneOf< WithStopSource >... Options> |
| | SocketDevice (windows::Socket socket, Options... options) |
| | Creates a socket object from a native Windows socket.
|
| |
| | ~SocketDevice () noexcept=default |
| | Noexcept Destructor.
|
| |
| internal auto | operator= (Socket &&socket) -> SocketDevice & |
| | Assignment operator for a generic socket object.
|
| |
| auto | operator= (posix::File socketFileDescriptor) -> SocketDevice & |
| | Assignment operator for a Posix file descriptor.
|
| |
| auto | operator= (windows::Socket socket) -> SocketDevice & |
| | Assignment operator for a native Windows socket.
|
| |
| | operator bool () const noexcept |
| | Checks whether the object contains a valid socket.
|
| |
| auto | addressFamily () const noexcept -> int |
| | Gets the address family of the socket, also called the socket domain.
|
| |
| auto | protocol () const noexcept -> int |
| | Gets the protocol of the socket.
|
| |
| auto | setReadTimeout (std::chrono::nanoseconds timeout) noexcept |
| | Sets the read timeout.
|
| |
| auto | setWriteTimeout (std::chrono::nanoseconds timeout) noexcept |
| | Sets the write timeout.
|
| |
| auto | setTimeout (std::chrono::nanoseconds timeout) noexcept |
| | Sets the read and write timeout to the same value.
|
| |
| template<typename Value > |
| auto | option (int level, int optionName) const -> Value |
| | Gets a socket option.
|
| |
| template<typename Value > |
| auto | setOption (int level, int optionName, const Value &value) -> void |
| | Sets a socket option.
|
| |
| template<typename Value > |
| auto | getOption (int level, int optionName, std::nothrow_t) const noexcept -> xentara::utils::eh::expected< Value, std::error_code > |
| | Gets a socket option.
|
| |
| template<typename Value > |
| auto | setOption (int level, int optionName, const Value &value, std::nothrow_t) noexcept -> std::error_code |
| | Sets a socket option without throwing exceptions.
|
| |
| auto | connect (const Address &address) -> void |
| | Connects to an address.
|
| |
| auto | connect (const Address &address, std::optional< std::chrono::nanoseconds > timeout) -> bool |
| | Connects to an address with optional timeout.
|
| |
| auto | bind (PortNumber portNumber) -> void |
| | Binds the socket to a port number on all local interfaces.
|
| |
| auto | bind (const Address &address) -> void |
| | Binds the socket to a specific address.
|
| |
| auto | localAddress () const -> Address |
| | Gets the local address of a bound or connected socket.
|
| |
| auto | remoteAddress () const -> Address |
| | Gets the address that the socket is connected to.
|
| |
| auto | shutdown (Socket::Direction directions=Socket::Direction::ReadWrite) -> void |
| | Shuts down the socket.
|
| |
| auto | close () noexcept -> void |
| | Closes the socket, if one is open.
|
| |
| auto | socket () const &noexcept -> const Socket & |
| | Gets the socket as a generic socket.
|
| |
| auto | socket () &&noexcept -> Socket && |
| | Gets the socket as a generic socket.
|
| |
| auto | native () const noexcept -> int |
| | Gets the underlying Posix file descriptor for the socket.
|
| |
| auto | native () const noexcept -> SOCKET |
| | Gets the underlying Windows Sockets 2 SOCKET.
|
| |
| auto | release () noexcept -> int |
| | Removes the the socket and passes ownership to the caller.
|
| |
| auto | release () noexcept -> SOCKET |
| | Removes the socket and passes ownership to the caller.
|
| |
| virtual | ~InputDevice () noexcept(false)=0 |
| | Virtual, throwing destructor.
|
| |
| auto | read (std::size_t size) -> core::RawDataBlock |
| | Reads a block of data of a specific size.
|
| |
| auto | readByte () -> std::byte |
| | Reads a single byte.
|
| |
| auto | tryReadByte () -> std::optional< std::byte > |
| | Tries to read a single byte from a device.
|
| |
| auto | readAll () -> core::RawDataBlock |
| | Reads all remaining data.
|
| |
| auto | readAll (std::size_t maxSize) -> core::RawDataBlock |
| | Reads all remaining data up to a maximum size.
|
| |
| auto | readChunk () -> core::RawDataBlock |
| | Reads a single chunk of data.
|
| |
| auto | readChunk (std::size_t maxSize) -> core::RawDataBlock |
| | Reads a single chunk of data up to a maximum size.
|
| |
| auto | readAvailable () -> std::pair< core::RawDataBlock, bool > |
| | Reads all immediately available data.
|
| |
| auto | readAvailable (std::size_t maxSize) -> std::pair< core::RawDataBlock, bool > |
| | Reads immediately available data up to a maximum size.
|
| |
| template<std::size_t kArraySize> |
| auto | read (std::byte(&array)[kArraySize]) -> void |
| | Read a block of data into an array.
|
| |
| template<std::size_t kArraySize> |
| auto | read (std::array< std::byte, kArraySize > &array) -> void |
| | Read a block of data into an array.
|
| |
| template<std::size_t kArraySize> |
| auto | readChunk (std::byte(&array)[kArraySize]) -> core::RawDataBlock |
| | Reads a single chunk of data into an array.
|
| |
| template<std::size_t kArraySize> |
| auto | readChunk (std::array< std::byte, kArraySize > &array) -> core::RawDataBlock |
| | Reads a single chunk of data into an array.
|
| |
| template<std::size_t kArraySize> |
| auto | readAvailable (std::byte(&array)[kArraySize]) -> std::pair< std::size_t, bool > |
| | Reads immediately available data into an array.
|
| |
| template<std::size_t kArraySize> |
| auto | readAvailable (std::array< std::byte, kArraySize > &array) -> std::pair< std::size_t, bool > |
| | Reads immediately available data into an array.
|
| |
template<std::contiguous_iterator Iterator, std::sized_sentinel_for< Iterator > Sentinel>
requires std::same_as<std::remove_volatile_t<std::iter_value_t<Iterator>>, std::byte> |
| auto | read (Iterator first, Sentinel last) -> void |
| | Read data to fill an iterator range.
|
| |
template<std::contiguous_iterator Iterator, std::sized_sentinel_for< Iterator > Sentinel>
requires std::same_as<std::iter_value_t<Iterator>, std::byte> |
| auto | readChunk (Iterator first, Sentinel last) -> Iterator |
| | Reads a single chunk of data data into an iterator range.
|
| |
template<std::contiguous_iterator Iterator, std::sized_sentinel_for< Iterator > Sentinel>
requires std::same_as<std::iter_value_t<Iterator>, std::byte> |
| auto | readAvailable (Iterator first, Sentinel last) -> std::pair< Iterator, bool > |
| | Reads immediately available data into an iterator range.
|
| |
| auto | read (std::byte *buffer, std::size_t size) -> void |
| | Read a block of data into a buffer.
|
| |
| auto | readChunk (std::byte *buffer, std::size_t size) -> std::size_t |
| | Reads a single chunk of data into a buffer.
|
| |
| auto | readAvailable (std::byte *buffer, std::size_t size) -> std::pair< std::size_t, bool > |
| | Reads immediately available data into a buffer.
|
| |
| auto | availableReadSize () const -> std::optional< std::size_t > |
| | Get the number of bytes for reading without blocking.
|
| |
| auto | remainingReadSize () const -> std::optional< std::size_t > |
| | Get the number of bytes remaining before the end of the device.
|
| |
| auto | readPosition () const -> std::optional< std::size_t > |
| | Gets the current read position within the device.
|
| |
| auto | setReadPosition (std::size_t position) -> std::optional< std::size_t > |
| | Sets the current read position within the device.
|
| |
| auto | moveReadPosition (std::ptrdiff_t offset, std::ios_base::seekdir origin=std::ios_base::cur) -> std::optional< std::size_t > |
| | Advances or retreats the current read position within the device.
|
| |
| auto | advanceReadPosition (std::size_t offset) -> std::optional< std::size_t > |
| | Advance the current read position within the device.
|
| |
| auto | rewind () -> bool |
| | Sets the current read position to the beginning of the device.
|
| |
| auto | waitForData () -> void |
| | Waits for more read data to become available.
|
| |
| auto | waitForData (std::optional< std::chrono::nanoseconds > timeout) -> bool |
| | Waits for more read data to become available within a certain time.
|
| |
| auto | readTimeout () const noexcept -> std::chrono::nanoseconds |
| | Returns the read timeout for communication devices.
|
| |
| auto | throwEndOfStreamError () const -> void |
| | Throws an error denoting the end of the stream.
|
| |
| virtual | ~DeviceBase () noexcept(false)=0 |
| | Virtual, throwing destructor.
|
| |
| auto | deviceDescription () const -> std::string |
| | Get a description of the device.
|
| |
| virtual | ~OutputDevice () noexcept(false)=0 |
| | Virtual, throwing destructor.
|
| |
template<std::ranges::contiguous_range Data>
requires std::same_as<std::remove_cv_t<std::ranges::range_value_t<Data>>, std::byte> |
| auto | write (const Data &data) -> void |
| | Writes a block of data.
|
| |
| auto | writeByte (std::byte byte) -> void |
| | Write a single byte.
|
| |
template<std::ranges::contiguous_range Data>
requires std::same_as<std::remove_cv_t<std::ranges::range_value_t<Data>>, std::byte> |
| auto | writeChunk (const Data &data) -> std::ranges::range_size_t< Data > |
| | Writes a single chunk of data contained in an iterator range.
|
| |
template<std::ranges::contiguous_range Data>
requires std::same_as<std::remove_cv_t<std::ranges::range_value_t<Data>>, std::byte> |
| auto | tryWrite (const Data &data) -> std::ranges::range_size_t< Data > |
| | Write as much of a data block as is possible without blocking.
|
| |
| auto | tryWriteByte (std::byte byte) -> bool |
| | Write a single byte, if this can be done without blocking.
|
| |
template<std::contiguous_iterator Iterator, std::sized_sentinel_for< Iterator > Sentinel>
requires std::same_as<std::remove_cv_t<std::iter_value_t<Iterator>>, std::byte> |
| auto | write (Iterator first, Sentinel last) -> void |
| | Writes the data contained in an iterator range.
|
| |
template<std::contiguous_iterator Iterator, std::sized_sentinel_for< Iterator > Sentinel>
requires std::same_as<std::remove_cv_t<std::iter_value_t<Iterator>>, std::byte> |
| auto | writeChunk (Iterator first, Sentinel last) -> Iterator |
| | Writes a single chunk of data from an an iterator range.
|
| |
template<std::contiguous_iterator Iterator, std::sized_sentinel_for< Iterator > Sentinel>
requires std::same_as<std::iter_value_t<Iterator>, std::byte> |
| auto | tryWrite (Iterator first, Sentinel last) -> Iterator |
| | Write as much of the data contained in an iterator range as is possible without blocking.
|
| |
| auto | write (const std::byte *data, std::size_t size) -> void |
| | Write a block of data.
|
| |
| auto | writeChunk (const std::byte *data, std::size_t size) -> std::size_t |
| | Writes a single chunk of data.
|
| |
| auto | tryWrite (const std::byte *data, std::size_t size) -> std::size_t |
| | Write as much of a data block as is possible without blocking.
|
| |
| auto | writePosition () const -> std::optional< std::size_t > |
| | Gets the current write position within the device.
|
| |
| auto | setWritePosition (std::size_t position) -> std::optional< std::size_t > |
| | Sets the current write position within the device.
|
| |
| auto | moveWritePosition (std::ptrdiff_t offset, std::ios_base::seekdir origin=std::ios_base::cur) -> std::optional< std::size_t > |
| | Advances or retreats the current write position within the device.
|
| |
| auto | waitUntilWritable (std::chrono::nanoseconds timeout) -> bool |
| | Waits for the device to be able to accept more write data within a certain time.
|
| |
| auto | writeTimeout () const noexcept -> std::chrono::nanoseconds |
| | Returns the write timeout for communication devices.
|
| |
|
| virtual auto | doRead (std::byte *buffer, std::size_t size) -> std::optional< std::size_t >=0 |
| | Called by the framework to read available data into a buffer up to a maximum size.
|
| |
| virtual auto | doThrowEndOfStreamError () const -> void |
| | Called by the framework to throw an error denoting the end of the stream.
|
| |
| virtual auto | doGetAvailableReadSize () const -> std::optional< std::size_t > |
| | Called by the framework to get the number of bytes that will be read by the next call to doRead().
|
| |
| virtual auto | doGetRemainingReadSize () const -> std::optional< std::size_t > |
| | Called by the framework to get the number of bytes remaining before the end of the device.
|
| |
| virtual auto | doWaitForData (std::optional< std::chrono::nanoseconds > timeout) -> bool |
| | Called by the framework to wait for more read data to become available.
|
| |
| virtual auto | doWaitForDataAndRead (std::byte *buffer, std::size_t size, std::chrono::nanoseconds timeout) -> std::optional< std::size_t > |
| | Called by the framework to wait for read data to become available, and then read it.
|
| |
| virtual auto | doGetReadTimeout () const noexcept -> std::chrono::nanoseconds |
| | Called by the framework to get the read timeout.
|
| |
| virtual auto | doGetReadPosition () const -> std::optional< std::size_t > |
| | Called by the framework to get the current read position within the device.
|
| |
| virtual auto | doSetReadPosition (std::size_t position) -> std::optional< std::size_t > |
| | Called by the framework to set the current read position within the device.
|
| |
| virtual auto | doMoveReadPosition (std::ptrdiff_t offset, std::ios_base::seekdir origin=std::ios_base::cur) -> std::optional< std::size_t > |
| | Called by the framework to advance or retreat the current read position within the device.
|
| |
| virtual auto | doAdvanceReadPosition (std::size_t offset) -> std::optional< std::size_t > |
| | Called by the framework to advance the current read position within the device.
|
| |
| virtual auto | doGetDeviceDescription () const -> std::string=0 |
| | Called by the framework to get a description of the device.
|
| |
| virtual auto | doWrite (const std::byte *data, std::size_t size) -> std::size_t=0 |
| | Called by the framework to write data up to a maximum size.
|
| |
| virtual auto | doWaitUntilWritable (std::optional< std::chrono::nanoseconds > timeout) -> bool |
| | Called by the framework to wait for the device to be able to accept more write data with an optional timeout.
|
| |
| virtual auto | doWaitUntilWritableAndWrite (const std::byte *data, std::size_t size, std::chrono::nanoseconds timeout) -> std::size_t |
| | Called by the framework to wait for the device to be able to accept more write data, and then write to it.
|
| |
| virtual auto | doGetWriteTimeout () const noexcept -> std::chrono::nanoseconds |
| | Called by the framework to get the write timeout.
|
| |
| virtual auto | doGetWritePosition () const -> std::optional< std::size_t > |
| | Called by the framework to get the current write position within the device.
|
| |
| virtual auto | doSetWritePosition (std::size_t position) -> std::optional< std::size_t > |
| | Called by the framework to set the current write position within the device.
|
| |
| virtual auto | doMoveWritePosition (std::ptrdiff_t offset, std::ios_base::seekdir origin=std::ios_base::cur) -> std::optional< std::size_t > |
| | Called by the framework to advance or retreat the current write position within the device.
|
| |