srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/include/wireframe/net/udp.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/wireframe/net/udp.hpp')
-rw-r--r--include/wireframe/net/udp.hpp35
1 files changed, 0 insertions, 35 deletions
diff --git a/include/wireframe/net/udp.hpp b/include/wireframe/net/udp.hpp
deleted file mode 100644
index 07664c2..0000000
--- a/include/wireframe/net/udp.hpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#pragma once
-
-#include <cstdint>
-#include <optional>
-#include <span>
-
-#include "wireframe/byteio.hpp"
-
-namespace wireframe::net {
-
-inline constexpr std::size_t kUdpHeaderLen = 8;
-
-struct UdpHeader {
- std::uint16_t src_port;
- std::uint16_t dst_port;
- std::uint16_t length;
-};
-
-struct UdpDatagram {
- UdpHeader header;
- std::span<const unsigned char> payload;
-};
-
-inline std::optional<UdpDatagram> parse_udp(std::span<const unsigned char> bytes) {
- if (bytes.size() < kUdpHeaderLen) return std::nullopt;
-
- UdpHeader header{};
- header.src_port = read_be16(bytes, 0);
- header.dst_port = read_be16(bytes, 2);
- header.length = read_be16(bytes, 4);
-
- return UdpDatagram{header, bytes.subspan(kUdpHeaderLen)};
-}
-
-} // namespace wireframe::net