1/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
2/* If you are missing that file, acquire a complete release at teeworlds.com. */
3#ifndef ENGINE_SHARED_PROTOCOL_H
4#define ENGINE_SHARED_PROTOCOL_H
5
6#include <bitset>
7
8/*
9 Connection diagram - How the initialization works.
10
11 Client -> INFO -> Server
12 Contains version info, name, and some other info.
13
14 Client <- MAP <- Server
15 Contains current map.
16
17 Client -> READY -> Server
18 The client has loaded the map and is ready to go,
19 but the mod needs to send it's information as well.
20 modc_connected is called on the client and
21 mods_connected is called on the server.
22 The client should call client_entergame when the
23 mod has done it's initialization.
24
25 Client -> ENTERGAME -> Server
26 Tells the server to start sending snapshots.
27 client_entergame and server_client_enter is called.
28*/
29
30enum
31{
32 NETMSG_EX = 0,
33
34 // the first thing sent by the client
35 // contains the version info for the client
36 NETMSG_INFO = 1,
37
38 // sent by server
39 NETMSG_MAP_CHANGE, // sent when client should switch map
40 NETMSG_MAP_DATA, // map transfer, contains a chunk of the map file
41 NETMSG_CON_READY, // connection is ready, client should send start info
42 NETMSG_SNAP, // normal snapshot, multiple parts
43 NETMSG_SNAPEMPTY, // empty snapshot
44 NETMSG_SNAPSINGLE, // ?
45 NETMSG_SNAPSMALL, //
46 NETMSG_INPUTTIMING, // reports how off the input was
47 NETMSG_RCON_AUTH_STATUS, // result of the authentication
48 NETMSG_RCON_LINE, // line that should be printed to the remote console
49
50 NETMSG_UNUSED1,
51 NETMSG_UNUSED2,
52
53 // sent by client
54 NETMSG_READY, //
55 NETMSG_ENTERGAME,
56 NETMSG_INPUT, // contains the inputdata from the client
57 NETMSG_RCON_CMD, //
58 NETMSG_RCON_AUTH, //
59 NETMSG_REQUEST_MAP_DATA, //
60
61 NETMSG_UNUSED3,
62 NETMSG_UNUSED4,
63
64 // sent by both
65 NETMSG_PING,
66 NETMSG_PING_REPLY,
67 NETMSG_UNUSED5,
68
69 // sent by server (todo: move it up)
70 NETMSG_RCON_CMD_ADD,
71 NETMSG_RCON_CMD_REM,
72
73 NUM_NETMSGS,
74};
75
76// this should be revised
77enum
78{
79 SERVER_TICK_SPEED = 50,
80 SERVER_FLAG_PASSWORD = 1 << 0,
81 SERVER_FLAG_TIMESCORE = 1 << 1,
82 SERVERINFO_LEVEL_MIN = 0,
83 SERVERINFO_LEVEL_MAX = 2,
84
85 MAX_SERVER_ADDRESSES = 16,
86 SERVERINFO_MAX_CLIENTS = 128,
87 MAX_CLIENTS = 64,
88 VANILLA_MAX_CLIENTS = 16,
89 MAX_CHECKPOINTS = 25,
90 MIN_TICK = 0,
91 MAX_TICK = 0x6FFFFFFF,
92
93 MAX_INPUT_SIZE = 128,
94 MAX_SNAPSHOT_PACKSIZE = 900,
95
96 MAX_NAME_LENGTH = 16,
97 MAX_CLAN_LENGTH = 12,
98
99 // message packing
100 MSGFLAG_VITAL = 1,
101 MSGFLAG_FLUSH = 2,
102 MSGFLAG_NORECORD = 4,
103 MSGFLAG_RECORD = 8,
104 MSGFLAG_NOSEND = 16
105};
106
107enum
108{
109 VERSION_NONE = -1,
110 VERSION_VANILLA = 0,
111 VERSION_DDRACE = 1,
112 VERSION_DDNET_OLD = 2,
113 VERSION_DDNET_WHISPER = 217,
114 VERSION_DDNET_GOODHOOK = 221,
115 VERSION_DDNET_RCONPROTECT = 408,
116 VERSION_DDNET_ANTIPING_PROJECTILE = 604,
117 VERSION_DDNET_UPDATER_FIXED = 707,
118 VERSION_DDNET_GAMETICK = 10042,
119 VERSION_DDNET_EARLY_VERSION = 13020,
120 VERSION_DDNET_MSG_LEGACY = 15040,
121 VERSION_DDNET_SWITCH = 15060,
122 VERSION_DDNET_INDEPENDENT_SPECTATORS_TEAM = 16000,
123 VERSION_DDNET_WEAPON_SHIELDS = 16010,
124 VERSION_DDNET_NEW_HUD = 16020,
125 VERSION_DDNET_MULTI_LASER = 16040,
126 VERSION_DDNET_ENTITY_NETOBJS = 16200,
127 VERSION_DDNET_REDIRECT = 17020,
128};
129
130typedef std::bitset<MAX_CLIENTS> CClientMask;
131
132#endif
133