OpenTTD Source: src/network/core/config.h Source File

OpenTTD Source 12.0-beta1

config.h
Go to the documentation of this file.
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
12 #ifndef NETWORK_CORE_CONFIG_H
13 #define NETWORK_CORE_CONFIG_H
14
15 const char *NetworkCoordinatorConnectionString();
16 const char *NetworkStunConnectionString();
17 const char *NetworkContentServerConnectionString();
18 const char *NetworkContentMirrorConnectionString();
19
21 static const char * const NETWORK_CONTENT_MIRROR_URL = "/bananas";
22
23 static const uint16 NETWORK_COORDINATOR_SERVER_PORT = 3976;
24 static const uint16 NETWORK_STUN_SERVER_PORT = 3975;
25 static const uint16 NETWORK_TURN_SERVER_PORT = 3974;
26 static const uint16 NETWORK_CONTENT_SERVER_PORT = 3978;
27 static const uint16 NETWORK_CONTENT_MIRROR_PORT = 80;
28 static const uint16 NETWORK_DEFAULT_PORT = 3979;
29 static const uint16 NETWORK_ADMIN_PORT = 3977;
30 static const uint16 NETWORK_DEFAULT_DEBUGLOG_PORT = 3982;
31
32 static const uint16 UDP_MTU = 1460;
33 /*
34 * Technically a TCP packet could become 64kiB, however the high bit is kept so it becomes possible in the future
35 * to go to (significantly) larger packets if needed. This would entail a strategy such as employed for UTF-8.
36 *
37 * Packets up to 32 KiB have the high bit not set:
38 * 00000000 00000000 0bbbbbbb aaaaaaaa -> aaaaaaaa 0bbbbbbb
39 * Send_uint16(GB(size, 0, 15)
40 *
41 * Packets up to 1 GiB, first uint16 has high bit set so it knows to read a
42 * next uint16 for the remaining bits of the size.
43 * 00dddddd cccccccc bbbbbbbb aaaaaaaa -> cccccccc 10dddddd aaaaaaaa bbbbbbbb
44 * Send_uint16(GB(size, 16, 14) | 0b10 << 14)
45 * Send_uint16(GB(size, 0, 16))
46 */
47 static const uint16 TCP_MTU = 32767;
48 static const uint16 COMPAT_MTU = 1460;
49
50 static const byte NETWORK_GAME_ADMIN_VERSION = 1;
51 static const byte NETWORK_GAME_INFO_VERSION = 6;
52 static const byte NETWORK_COMPANY_INFO_VERSION = 6;
53 static const byte NETWORK_COORDINATOR_VERSION = 5;
54
55 static const uint NETWORK_NAME_LENGTH = 80;
56 static const uint NETWORK_COMPANY_NAME_LENGTH = 128;
57 static const uint NETWORK_HOSTNAME_LENGTH = 80;
58 static const uint NETWORK_HOSTNAME_PORT_LENGTH = 80 + 6;
59 static const uint NETWORK_SERVER_ID_LENGTH = 33;
60 static const uint NETWORK_REVISION_LENGTH = 33;
61 static const uint NETWORK_PASSWORD_LENGTH = 33;
62 static const uint NETWORK_CLIENTS_LENGTH = 200;
63 static const uint NETWORK_CLIENT_NAME_LENGTH = 25;
64 static const uint NETWORK_RCONCOMMAND_LENGTH = 500;
65 static const uint NETWORK_GAMESCRIPT_JSON_LENGTH = COMPAT_MTU - 3;
66 static const uint NETWORK_CHAT_LENGTH = 900;
67 static const uint NETWORK_CONTENT_FILENAME_LENGTH = 48;
68 static const uint NETWORK_CONTENT_NAME_LENGTH = 32;
69 static const uint NETWORK_CONTENT_VERSION_LENGTH = 16;
70 static const uint NETWORK_CONTENT_URL_LENGTH = 96;
71 static const uint NETWORK_CONTENT_DESC_LENGTH = 512;
72 static const uint NETWORK_CONTENT_TAG_LENGTH = 32;
73 static const uint NETWORK_ERROR_DETAIL_LENGTH = 100;
74 static const uint NETWORK_INVITE_CODE_LENGTH = 64;
75 static const uint NETWORK_INVITE_CODE_SECRET_LENGTH = 80;
76 static const uint NETWORK_TOKEN_LENGTH = 64;
77
78 static const uint NETWORK_GRF_NAME_LENGTH = 80;
79
95 static const uint NETWORK_MAX_GRF_COUNT = 255;
96
97 #endif /* NETWORK_CORE_CONFIG_H */
NETWORK_DEFAULT_PORT
static const uint16 NETWORK_DEFAULT_PORT
The default port of the game server (TCP & UDP)
Definition: config.h:28
NETWORK_COORDINATOR_SERVER_PORT
static const uint16 NETWORK_COORDINATOR_SERVER_PORT
The default port of the Game Coordinator server (TCP)
Definition: config.h:23
NETWORK_INVITE_CODE_SECRET_LENGTH
static const uint NETWORK_INVITE_CODE_SECRET_LENGTH
The maximum length of the invite code secret, in bytes including '\0'.
Definition: config.h:75
NetworkCoordinatorConnectionString
const char * NetworkCoordinatorConnectionString()
Get the connection string for the game coordinator from the environment variable OTTD_COORDINATOR_CS,...
Definition: config.cpp:36
NETWORK_CONTENT_MIRROR_PORT
static const uint16 NETWORK_CONTENT_MIRROR_PORT
The default port of the content mirror (TCP)
Definition: config.h:27
NETWORK_NAME_LENGTH
static const uint NETWORK_NAME_LENGTH
The maximum length of the server name and map name, in bytes including '\0'.
Definition: config.h:55
NETWORK_CHAT_LENGTH
static const uint NETWORK_CHAT_LENGTH
The maximum length of a chat message, in bytes including '\0'.
Definition: config.h:66
NETWORK_CONTENT_VERSION_LENGTH
static const uint NETWORK_CONTENT_VERSION_LENGTH
The maximum length of a content's version, in bytes including '\0'.
Definition: config.h:69
NETWORK_TOKEN_LENGTH
static const uint NETWORK_TOKEN_LENGTH
The maximum length of a token, in bytes including '\0'.
Definition: config.h:76
NETWORK_CLIENT_NAME_LENGTH
static const uint NETWORK_CLIENT_NAME_LENGTH
The maximum length of a client's name, in bytes including '\0'.
Definition: config.h:63
NETWORK_GAME_ADMIN_VERSION
static const byte NETWORK_GAME_ADMIN_VERSION
What version of the admin network do we use?
Definition: config.h:50
NETWORK_ERROR_DETAIL_LENGTH
static const uint NETWORK_ERROR_DETAIL_LENGTH
The maximum length of the error detail, in bytes including '\0'.
Definition: config.h:73
NETWORK_MAX_GRF_COUNT
static const uint NETWORK_MAX_GRF_COUNT
Maximum number of GRFs that can be sent.
Definition: config.h:95
NETWORK_CLIENTS_LENGTH
static const uint NETWORK_CLIENTS_LENGTH
The maximum length for the list of clients that controls a company, in bytes including '\0'.
Definition: config.h:62
NETWORK_CONTENT_DESC_LENGTH
static const uint NETWORK_CONTENT_DESC_LENGTH
The maximum length of a content's description, in bytes including '\0'.
Definition: config.h:71
COMPAT_MTU
static const uint16 COMPAT_MTU
Number of bytes we can pack in a single packet for backward compatibility.
Definition: config.h:48
NETWORK_STUN_SERVER_PORT
static const uint16 NETWORK_STUN_SERVER_PORT
The default port of the STUN server (TCP)
Definition: config.h:24
NETWORK_CONTENT_MIRROR_URL
static const char *const NETWORK_CONTENT_MIRROR_URL
URL of the HTTP mirror system.
Definition: config.h:21
NETWORK_SERVER_ID_LENGTH
static const uint NETWORK_SERVER_ID_LENGTH
The maximum length of the network id of the servers, in bytes including '\0'.
Definition: config.h:59
NetworkContentServerConnectionString
const char * NetworkContentServerConnectionString()
Get the connection string for the content server from the environment variable OTTD_CONTENT_SERVER_CS...
Definition: config.cpp:56
TCP_MTU
static const uint16 TCP_MTU
Number of bytes we can pack in a single TCP packet.
Definition: config.h:47
NETWORK_COMPANY_INFO_VERSION
static const byte NETWORK_COMPANY_INFO_VERSION
What version of company info is this?
Definition: config.h:52
NETWORK_REVISION_LENGTH
static const uint NETWORK_REVISION_LENGTH
The maximum length of the revision, in bytes including '\0'.
Definition: config.h:60
NETWORK_ADMIN_PORT
static const uint16 NETWORK_ADMIN_PORT
The default port for admin network.
Definition: config.h:29
NETWORK_HOSTNAME_PORT_LENGTH
static const uint NETWORK_HOSTNAME_PORT_LENGTH
The maximum length of the host name + port, in bytes including '\0'. The extra six is ":" + port numb...
Definition: config.h:58
NETWORK_PASSWORD_LENGTH
static const uint NETWORK_PASSWORD_LENGTH
The maximum length of the password, in bytes including '\0' (must be >= NETWORK_SERVER_ID_LENGTH)
Definition: config.h:61
NETWORK_CONTENT_SERVER_PORT
static const uint16 NETWORK_CONTENT_SERVER_PORT
The default port of the content server (TCP)
Definition: config.h:26
NETWORK_CONTENT_FILENAME_LENGTH
static const uint NETWORK_CONTENT_FILENAME_LENGTH
The maximum length of a content's filename, in bytes including '\0'.
Definition: config.h:67
NETWORK_RCONCOMMAND_LENGTH
static const uint NETWORK_RCONCOMMAND_LENGTH
The maximum length of a rconsole command, in bytes including '\0'.
Definition: config.h:64
NetworkContentMirrorConnectionString
const char * NetworkContentMirrorConnectionString()
Get the connection string for the content mirror from the environment variable OTTD_CONTENT_MIRROR_CS...
Definition: config.cpp:66
NETWORK_GRF_NAME_LENGTH
static const uint NETWORK_GRF_NAME_LENGTH
Maximum length of the name of a GRF.
Definition: config.h:78
NETWORK_INVITE_CODE_LENGTH
static const uint NETWORK_INVITE_CODE_LENGTH
The maximum length of the invite code, in bytes including '\0'.
Definition: config.h:74
NETWORK_DEFAULT_DEBUGLOG_PORT
static const uint16 NETWORK_DEFAULT_DEBUGLOG_PORT
The default port debug-log is sent to (TCP)
Definition: config.h:30
UDP_MTU
static const uint16 UDP_MTU
Number of bytes we can pack in a single UDP packet.
Definition: config.h:32
NETWORK_HOSTNAME_LENGTH
static const uint NETWORK_HOSTNAME_LENGTH
The maximum length of the host name, in bytes including '\0'.
Definition: config.h:57
NETWORK_CONTENT_NAME_LENGTH
static const uint NETWORK_CONTENT_NAME_LENGTH
The maximum length of a content's name, in bytes including '\0'.
Definition: config.h:68
NETWORK_COORDINATOR_VERSION
static const byte NETWORK_COORDINATOR_VERSION
What version of game-coordinator-protocol do we use?
Definition: config.h:53
NETWORK_GAME_INFO_VERSION
static const byte NETWORK_GAME_INFO_VERSION
What version of game-info do we use?
Definition: config.h:51
NETWORK_CONTENT_TAG_LENGTH
static const uint NETWORK_CONTENT_TAG_LENGTH
The maximum length of a content's tag, in bytes including '\0'.
Definition: config.h:72
NETWORK_CONTENT_URL_LENGTH
static const uint NETWORK_CONTENT_URL_LENGTH
The maximum length of a content's url, in bytes including '\0'.
Definition: config.h:70
NETWORK_GAMESCRIPT_JSON_LENGTH
static const uint NETWORK_GAMESCRIPT_JSON_LENGTH
The maximum length of a gamescript json string, in bytes including '\0'. Must not be longer than COMP...
Definition: config.h:65
NETWORK_TURN_SERVER_PORT
static const uint16 NETWORK_TURN_SERVER_PORT
The default port of the TURN server (TCP)
Definition: config.h:25
NetworkStunConnectionString
const char * NetworkStunConnectionString()
Get the connection string for the STUN server from the environment variable OTTD_STUN_CS,...
Definition: config.cpp:46
NETWORK_COMPANY_NAME_LENGTH
static const uint NETWORK_COMPANY_NAME_LENGTH
The maximum length of the company name, in bytes including '\0'.
Definition: config.h:56