fd/ops: Add sendto / recvfrom helpers

Change-Id: I19311c43b2b310831d9a57c699e4461552911393
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/fd/ops.cpp b/src/fd/ops.cpp
index d18e855..c299ed0 100644
--- a/src/fd/ops.cpp
+++ b/src/fd/ops.cpp
@@ -61,6 +61,20 @@
     opExact("sendExact", &Fd::send, fd, data, flags);
 }
 
+void sendtoExact(Fd& fd, std::span<const std::byte> data, SendFlags flags,
+                 std::span<const std::byte> addr)
+{
+    auto r = fd.sendto(data, flags, addr);
+    if (r.size() == 0)
+    {
+        throw exception::WouldBlock("sendto");
+    }
+    if (r.size() < data.size())
+    {
+        throw exception::Incomplete("sendto");
+    }
+}
+
 template <typename Fun, typename Byte, typename... Args>
 static std::span<Byte> opAligned(const char* name, Fun&& fun, Fd& fd,
                                  size_t align, std::span<Byte> data,