diff options
| author | Nicolas James <Eele1Ephe7uZahRie@tutanota.com> | 2025-02-12 21:57:46 +1100 |
|---|---|---|
| committer | Nicolas James <Eele1Ephe7uZahRie@tutanota.com> | 2025-02-12 21:57:46 +1100 |
| commit | e4483eca01b48b943cd0461e24a74ae1a3139ed4 (patch) | |
| tree | ed58c3c246e3af1af337697695d780aa31f6ad9a /src/shared/net/packet.hh | |
| parent | 1cc08c51eb4b0f95c30c0a98ad1fc5ad3459b2df (diff) | |
Update to most recent version (old initial commit)
Diffstat (limited to 'src/shared/net/packet.hh')
| -rw-r--r-- | src/shared/net/packet.hh | 42 |
1 files changed, 42 insertions, 0 deletions
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 <string> + +#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 |
