fd: Add TCP stream functions
This makes it possible to listen on stream sockets and accept new
connections.
Change-Id: I6a79035b4b7f308a62eab6c73075fef98df7a866
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/stdplus/fd/intf.hpp b/src/stdplus/fd/intf.hpp
index aac85a2..bd8de13 100644
--- a/src/stdplus/fd/intf.hpp
+++ b/src/stdplus/fd/intf.hpp
@@ -1,9 +1,11 @@
#pragma once
#include <cstddef>
#include <fcntl.h>
+#include <optional>
#include <stdplus/flags.hpp>
#include <stdplus/types.hpp>
#include <sys/socket.h>
+#include <tuple>
namespace stdplus
{
@@ -91,6 +93,9 @@
virtual size_t lseek(off_t offset, Whence whence) = 0;
virtual void truncate(off_t size) = 0;
virtual void bind(span<const std::byte> sockaddr) = 0;
+ virtual void listen(int backlog) = 0;
+ virtual std::tuple<std::optional<int>, span<std::byte>>
+ accept(span<std::byte> sockaddr) = 0;
virtual void setsockopt(SockLevel level, SockOpt optname,
span<const std::byte> opt) = 0;
virtual int ioctl(unsigned long id, void* data) = 0;