-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetworkPacket.hpp
More file actions
51 lines (45 loc) · 816 Bytes
/
NetworkPacket.hpp
File metadata and controls
51 lines (45 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef NETWORKPACKET_HPP_
#define NETWORKPACKET_HPP_
#include <cstddef>
#include <cstdint>
namespace arcade
{
enum NetworkGames
{
NO_GAME = 0x0,
SNAKE,
CENTIPEDE,
SOLAR_FOX,
PACMAN,
PONG
};
enum NetworkAction
{
HELLO_EVENT = 0x0,
PLAYER_EVENT,
GAME_EVENT,
ENTITY_EVENT
};
///
/// \struct NetworkPacketHeader
/// \brief Network packet header
///
struct NetworkPacketHeader
{
static constexpr uint32_t packetMagicNumber = 0x41C4D3;
uint32_t magicNumber;
uint32_t checksum;
NetworkGames game;
};
///
/// \struct NetworkPacket
/// \brief Network packet
///
struct NetworkPacket
{
NetworkPacketHeader header;
uint32_t len;
uint8_t *data;
};
}
#endif // !NETWORKPACKET_HPP_