From e4483eca01b48b943cd0461e24a74ae1a3139ed4 Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Wed, 12 Feb 2025 21:57:46 +1100 Subject: Update to most recent version (old initial commit) --- src/shared/net/packet.hh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/shared/net/packet.hh (limited to 'src/shared/net/packet.hh') diff --git a/src/shared/net/packet.hh b/src/shared/net/packet.hh new file mode 100644 index 0000000..417fd0e --- /dev/null +++ b/src/shared/net/packet.hh @@ -0,0 +1,42 @@ +#ifndef SHARED_NET_PACKET_HH_ +#define SHARED_NET_PACKET_HH_ + +#include + +#include "shared/net/net.hh" +#include "shared/net/proto.hh" +#include "shared/shared.hh" + +namespace shared { +namespace net { + +using packet_header_t = std::uint32_t; + +// A packet is a simple object which holds compressed protobuf data. +// We split up upackets and rpackets as rpackets require a header on the +// (due to using the reliable stream) which is not the case for the unreliable +// stream. +class packet { +public: + std::string data; + +public: + //virtual ~packet() = 0; +}; + +class upacket : public packet { +public: + upacket(const proto::packet& proto); + virtual ~upacket() {}; +}; + +class rpacket : public packet { +public: + rpacket(const proto::packet& proto); + virtual ~rpacket() {}; +}; + +} // namespace net +} // namespace shared + +#endif -- cgit v1.2.3