diff options
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 |
