ConnectX 3.0
ConnectX Game Suite
Loading...
Searching...
No Matches
constants.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4
5namespace Protocol
6{
7 // Version
8 constexpr uint32_t VERSION = 1;
9
10 // Network
11 constexpr uint16_t DEFAULT_PORT = 8080;
12 constexpr size_t MAX_MESSAGE_SIZE = 8192; // 8KB max message
13 constexpr uint32_t HEARTBEAT_INTERVAL_MS = 30000; // 30 seconds
14 constexpr uint32_t CONNECTION_TIMEOUT_MS = 60000; // 60 seconds
15
16 // Game limits
17 constexpr uint8_t MAX_PLAYERS = 4;
18 constexpr uint8_t MIN_BOARD_SIZE = 4;
19 constexpr uint8_t MAX_BOARD_SIZE = 20;
20 constexpr uint8_t MAX_PLAYER_NAME_LENGTH = 32;
21
22 // Error codes
23 namespace ErrorCode
24 {
25 constexpr uint16_t UNKNOWN_ERROR = 0;
26 constexpr uint16_t INVALID_MESSAGE = 1;
27 constexpr uint16_t PROTOCOL_VERSION_MISMATCH = 2;
28
29 // Connection errors (100-199)
30 constexpr uint16_t CONNECTION_REFUSED = 100;
31 constexpr uint16_t ALREADY_CONNECTED = 101;
32 constexpr uint16_t SESSION_EXPIRED = 102;
33 constexpr uint16_t INVALID_SESSION_TOKEN = 103;
34
35 // Game errors (200-299)
36 constexpr uint16_t GAME_NOT_FOUND = 200;
37 constexpr uint16_t GAME_FULL = 201;
38 constexpr uint16_t GAME_ALREADY_STARTED = 202;
39 constexpr uint16_t GAME_NOT_STARTED = 203;
40
41 // Move errors (300-399)
42 constexpr uint16_t INVALID_MOVE = 300;
43 constexpr uint16_t NOT_YOUR_TURN = 301;
44 constexpr uint16_t COLUMN_FULL = 302;
45 constexpr uint16_t GAME_ALREADY_OVER = 303;
46 }
47}
constexpr uint16_t GAME_NOT_FOUND
Definition constants.hpp:36
constexpr uint16_t ALREADY_CONNECTED
Definition constants.hpp:31
constexpr uint16_t GAME_ALREADY_STARTED
Definition constants.hpp:38
constexpr uint16_t INVALID_MOVE
Definition constants.hpp:42
constexpr uint16_t GAME_NOT_STARTED
Definition constants.hpp:39
constexpr uint16_t INVALID_SESSION_TOKEN
Definition constants.hpp:33
constexpr uint16_t CONNECTION_REFUSED
Definition constants.hpp:30
constexpr uint16_t UNKNOWN_ERROR
Definition constants.hpp:25
constexpr uint16_t PROTOCOL_VERSION_MISMATCH
Definition constants.hpp:27
constexpr uint16_t GAME_ALREADY_OVER
Definition constants.hpp:45
constexpr uint16_t NOT_YOUR_TURN
Definition constants.hpp:43
constexpr uint16_t COLUMN_FULL
Definition constants.hpp:44
constexpr uint16_t GAME_FULL
Definition constants.hpp:37
constexpr uint16_t SESSION_EXPIRED
Definition constants.hpp:32
constexpr uint16_t INVALID_MESSAGE
Definition constants.hpp:26
Definition constants.hpp:6
constexpr uint32_t HEARTBEAT_INTERVAL_MS
Definition constants.hpp:13
constexpr uint8_t MIN_BOARD_SIZE
Definition constants.hpp:18
constexpr size_t MAX_MESSAGE_SIZE
Definition constants.hpp:12
constexpr uint8_t MAX_BOARD_SIZE
Definition constants.hpp:19
constexpr uint32_t VERSION
Definition constants.hpp:8
constexpr uint32_t CONNECTION_TIMEOUT_MS
Definition constants.hpp:14
constexpr uint8_t MAX_PLAYER_NAME_LENGTH
Definition constants.hpp:20
constexpr uint8_t MAX_PLAYERS
Definition constants.hpp:17
constexpr uint16_t DEFAULT_PORT
Definition constants.hpp:11