]> git.localhorst.tv Git - blank.git/blob - src/net/Packet.hpp
client-side implementation of login packet
[blank.git] / src / net / Packet.hpp
1 #ifndef BLANK_NET_PACKET_HPP_
2 #define BLANK_NET_PACKET_HPP_
3
4 #include <cstdint>
5 #include <string>
6
7
8 namespace blank {
9
10 struct Packet {
11
12         static constexpr std::uint32_t TAG = 0xFB1AB1AF;
13
14         enum Type {
15                 PING = 0,
16                 LOGIN = 1,
17         };
18
19         struct Header {
20                 std::uint32_t tag;
21                 std::uint8_t type;
22         } header;
23
24         std::uint8_t payload[500 - sizeof(Header)];
25
26
27         void Tag() noexcept;
28
29         std::size_t Ping() noexcept;
30         std::size_t Login(const std::string &name) noexcept;
31
32 };
33
34 }
35
36 #endif