blob: b4e134ce1b10c1e5aee340f7a8f0a6d3b25894ad [file] [log] [blame]
William A. Kennington IIIeac9d472020-08-03 13:57:14 -07001#pragma once
2#include <stdplus/fd/intf.hpp>
3
4namespace stdplus
5{
6namespace fd
7{
8
9class FdImpl : public Fd
10{
11 public:
12 virtual int get() const = 0;
13
Patrick Williams68975b92022-04-27 16:00:26 -050014 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 IIIeac9d472020-08-03 13:57:14 -070020 size_t lseek(off_t offset, Whence whence) override;
21 void truncate(off_t size) override;
Patrick Williams68975b92022-04-27 16:00:26 -050022 void bind(std::span<const std::byte> sockaddr) override;
William A. Kennington III1151c6d2022-02-08 15:11:12 -080023 void listen(int backlog) override;
Patrick Williams68975b92022-04-27 16:00:26 -050024 std::tuple<std::optional<int>, std::span<std::byte>>
25 accept(std::span<std::byte> sockaddr) override;
William A. Kennington IIIeac9d472020-08-03 13:57:14 -070026 void setsockopt(SockLevel level, SockOpt optname,
Patrick Williams68975b92022-04-27 16:00:26 -050027 std::span<const std::byte> opt) override;
William A. Kennington IIIeac9d472020-08-03 13:57:14 -070028 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
38using fd::FdImpl;
39
40} // namespace stdplus