19 #ifndef HEADER_SERVER_HPP
20 #define HEADER_SERVER_HPP
27 #include "race/race_manager.hpp"
30 #include <irrString.h>
54 std::string m_server_owner_lower_case_name;
56 std::string m_lower_case_player_names;
65 uint32_t m_server_owner;
75 uint32_t m_bookmark_id;
85 unsigned m_server_mode;
89 bool m_password_protected;
93 core::stringw m_server_owner_name;
101 bool m_supports_encrytion;
105 bool m_ipv6_connection;
107 bool m_reconnect_when_quit_lobby;
109 bool m_aes_gcm_128bit_tag;
111 std::vector<std::tuple<
112 int, core::stringw, double,
float
115 std::string m_current_track;
117 std::string m_country_code;
122 Server(
unsigned server_id,
const irr::core::stringw &name,
123 int max_players,
int current_players,
unsigned difficulty,
125 bool password_protected,
bool game_started,
126 const std::string& current_track =
"");
155 unsigned getServerMode()
const {
return m_server_mode; }
159 bool isPasswordProtected()
const {
return m_password_protected; }
161 const core::stringw& getServerOwnerName()
const
162 {
return m_server_owner_name; }
164 const std::string& getServerOwnerLowerCaseName()
const
165 {
return m_server_owner_lower_case_name; }
167 float getDistance()
const {
return m_distance; }
169 bool supportsEncryption()
const {
return m_supports_encrytion; }
171 bool isOfficial()
const {
return m_official; }
173 bool isGameStarted()
const {
return m_game_started; }
175 const std::vector<std::tuple<int, core::stringw, double, float> >&
176 getPlayers()
const {
return m_players; }
178 void setServerId(
unsigned id) { m_server_id = id; }
182 void setSupportsEncryption(
bool val)
184 m_supports_encrytion = val;
186 if (m_supports_encrytion)
187 m_aes_gcm_128bit_tag =
true;
190 bool searchByName(
const std::string& lower_case_word);
192 Track* getCurrentTrack()
const;
194 const std::string& getCountryCode()
const {
return m_country_code; }
196 void setIPV6Connection(
bool val)
199 m_ipv6_connection =
false;
201 m_ipv6_connection = val;
204 bool useIPV6Connection()
const {
return m_ipv6_connection; }
215 virtual void saveServer()
const {}
217 void setIsPasswordProtected(
bool password_protected) { m_password_protected = password_protected; }
219 bool reconnectWhenQuitLobby()
const {
return m_reconnect_when_quit_lobby; }
221 void setReconnectWhenQuitLobby(
bool val)
222 { m_reconnect_when_quit_lobby = val; }
224 std::string getBookmarkKey()
const;
226 const int getCurrentAI()
const {
return m_current_ai; }
228 uint32_t getBookmarkID()
const {
return m_bookmark_id; }
230 void setBookmarkID(uint32_t
id) { m_bookmark_id = id; }
232 bool supportsAESGCM128BitTag()
const {
return m_aes_gcm_128bit_tag; }
239 bool password_protected =
false)
240 :
Server(0, name, 0, 0, 0, 0, ipv4, password_protected,
false) {}
242 virtual void saveServer()
const;
Difficulty
Game difficulty.
Definition: race_manager.hpp:231
Definition: server.hpp:44
const int getCurrentPlayers() const
Returns the number of currently connected players.
Definition: server.hpp:153
Server(const XMLNode &server_info)
Initialises the object from an XML node.
Definition: server.cpp:39
int m_current_players
The number of players currently on the server.
Definition: server.hpp:71
int m_max_players
The maximum number of players that the server supports.
Definition: server.hpp:68
const uint32_t getServerOwner() const
Returns the user id in STK addon server of the server owner (WAN).
Definition: server.hpp:145
const uint32_t getServerId() const
Returns the ID of this server.
Definition: server.hpp:142
const int getMaxPlayers() const
Returns the maximum number of players allowed on this server.
Definition: server.hpp:150
irr::core::stringw m_name
The server name to be displayed.
Definition: server.hpp:49
std::unique_ptr< SocketAddress > m_address
The public ip address and port of this server.
Definition: server.hpp:78
std::string m_lower_case_name
Name in lower case for comparisons.
Definition: server.hpp:52
const SocketAddress & getAddress() const
Returns IPv4 address and port of this server.
Definition: server.hpp:131
const std::string & getLowerCaseName() const
Returns the lower case name of the server.
Definition: server.hpp:136
uint16_t m_private_port
This is the private port of the server.
Definition: server.hpp:83
const irr::core::stringw & getName() const
Returns the name of the server.
Definition: server.hpp:139
std::unique_ptr< SocketAddress > m_ipv6_address
We need to use full socket address structure instead of string to hold it, because for local link add...
Definition: server.hpp:62
Describes a IPv4 or IPv6 address in sockaddr_in(6) format, suitable in using with sendto.
Definition: socket_address.hpp:47
Definition: track.hpp:115
Definition: server.hpp:236
utility class used to parse XML files
Definition: xml_node.hpp:48
Declares the general types that are used by the network.