William A. Kennington III | eac9d47 | 2020-08-03 13:57:14 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | #include <stdplus/fd/intf.hpp> |
| 3 | |
| 4 | namespace stdplus |
| 5 | { |
| 6 | namespace fd |
| 7 | { |
| 8 | |
| 9 | class FdImpl : public Fd |
| 10 | { |
| 11 | public: |
| 12 | virtual int get() const = 0; |
| 13 | |
Patrick Williams | 68975b9 | 2022-04-27 16:00:26 -0500 | [diff] [blame^] | 14 | std::span<std::byte> read(std::span<std::byte> buf) override; |
| 15 | std::span<std::byte> recv(std::span<std::byte> buf, |
| 16 | RecvFlags flags) override; |
| 17 | std::span<const std::byte> write(std::span<const std::byte> data) override; |
| 18 | std::span<const std::byte> send(std::span<const std::byte> data, |
| 19 | SendFlags flags) override; |
William A. Kennington III | eac9d47 | 2020-08-03 13:57:14 -0700 | [diff] [blame] | 20 | size_t lseek(off_t offset, Whence whence) override; |
| 21 | void truncate(off_t size) override; |
Patrick Williams | 68975b9 | 2022-04-27 16:00:26 -0500 | [diff] [blame^] | 22 | void bind(std::span<const std::byte> sockaddr) override; |
William A. Kennington III | 1151c6d | 2022-02-08 15:11:12 -0800 | [diff] [blame] | 23 | void listen(int backlog) override; |
Patrick Williams | 68975b9 | 2022-04-27 16:00:26 -0500 | [diff] [blame^] | 24 | std::tuple<std::optional<int>, std::span<std::byte>> |
| 25 | accept(std::span<std::byte> sockaddr) override; |
William A. Kennington III | eac9d47 | 2020-08-03 13:57:14 -0700 | [diff] [blame] | 26 | void setsockopt(SockLevel level, SockOpt optname, |
Patrick Williams | 68975b9 | 2022-04-27 16:00:26 -0500 | [diff] [blame^] | 27 | std::span<const std::byte> opt) override; |
William A. Kennington III | eac9d47 | 2020-08-03 13:57:14 -0700 | [diff] [blame] | 28 | int ioctl(unsigned long id, void* data) override; |
| 29 | int constIoctl(unsigned long id, void* data) const override; |
| 30 | void fcntlSetfd(FdFlags flags) override; |
| 31 | FdFlags fcntlGetfd() const override; |
| 32 | void fcntlSetfl(FileFlags flags) override; |
| 33 | FileFlags fcntlGetfl() const override; |
| 34 | }; |
| 35 | |
| 36 | } // namespace fd |
| 37 | |
| 38 | using fd::FdImpl; |
| 39 | |
| 40 | } // namespace stdplus |