Codechange: define the size of the PacketType enumerations

This commit is contained in:
Rubidium 2024-02-04 12:31:56 +01:00 committed by rubidium42
parent 6f77c2eaa2
commit 63708609fb
8 changed files with 10 additions and 10 deletions

View File

@ -25,7 +25,7 @@ static const uint16_t NETWORK_CONTENT_SERVER_PORT = 3978; ///< The
static const uint16_t NETWORK_DEFAULT_PORT = 3979; ///< The default port of the game server (TCP & UDP)
static const uint16_t NETWORK_ADMIN_PORT = 3977; ///< The default port for admin network
static const size_t UDP_MTU = 1460; ///< Number of bytes we can pack in a single UDP packet
static const size_t UDP_MTU = 1460; ///< Number of bytes we can pack in a single UDP packet
static const std::string NETWORK_SURVEY_DETAILS_LINK = "https://survey.openttd.org/participate"; ///< Link with more details & privacy statement of the survey.
/*
@ -42,8 +42,8 @@ static const std::string NETWORK_SURVEY_DETAILS_LINK = "https://survey.openttd.o
* Send_uint16(GB(size, 16, 14) | 0b10 << 14)
* Send_uint16(GB(size, 0, 16))
*/
static const size_t TCP_MTU = 32767; ///< Number of bytes we can pack in a single TCP packet
static const size_t COMPAT_MTU = 1460; ///< Number of bytes we can pack in a single packet for backward compatibility
static const size_t TCP_MTU = 32767; ///< Number of bytes we can pack in a single TCP packet
static const size_t COMPAT_MTU = 1460; ///< Number of bytes we can pack in a single packet for backward compatibility
static const byte NETWORK_GAME_ADMIN_VERSION = 3; ///< What version of the admin network do we use?
static const byte NETWORK_GAME_INFO_VERSION = 7; ///< What version of game-info do we use?

View File

@ -21,7 +21,7 @@
* Enum with types of TCP packets specific to the admin network.
* This protocol may only be extended to ensure stability.
*/
enum PacketAdminType {
enum PacketAdminType : uint8_t {
ADMIN_PACKET_ADMIN_JOIN, ///< The admin announces and authenticates itself to the server.
ADMIN_PACKET_ADMIN_QUIT, ///< The admin tells the server that it is quitting.
ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY, ///< The admin tells the server the update frequency of a particular piece of information.

View File

@ -32,7 +32,7 @@ enum ContentType {
};
/** Enum with all types of TCP content packets. The order MUST not be changed **/
enum PacketContentType {
enum PacketContentType : uint8_t {
PACKET_CONTENT_CLIENT_INFO_LIST, ///< Queries the content server for a list of info of a given content type
PACKET_CONTENT_CLIENT_INFO_ID, ///< Queries the content server for information about a list of internal IDs
PACKET_CONTENT_CLIENT_INFO_EXTID, ///< Queries the content server for information about a list of external IDs

View File

@ -25,7 +25,7 @@
* CLIENT -> packets from Client to Game Coordinator.
* SERCLI -> packets from either the Server or Client to Game Coordinator.
**/
enum PacketCoordinatorType {
enum PacketCoordinatorType : uint8_t {
PACKET_COORDINATOR_GC_ERROR, ///< Game Coordinator indicates there was an error.
PACKET_COORDINATOR_SERVER_REGISTER, ///< Server registration.
PACKET_COORDINATOR_GC_REGISTER_ACK, ///< Game Coordinator accepts the registration.

View File

@ -22,7 +22,7 @@
* Enum with all types of TCP packets.
* For the exact meaning, look at #NetworkGameSocketHandler.
*/
enum PacketGameType {
enum PacketGameType : uint8_t {
/*
* These first four pair of packets (thus eight in
* total) must remain in this order for backward

View File

@ -17,7 +17,7 @@
#include "packet.h"
/** Enum with all types of TCP STUN packets. The order MUST not be changed. **/
enum PacketStunType {
enum PacketStunType : uint8_t {
PACKET_STUN_SERCLI_STUN, ///< Send a STUN request to the STUN server.
PACKET_STUN_END, ///< Must ALWAYS be on the end of this list!! (period)
};

View File

@ -18,7 +18,7 @@
#include "network_game_info.h"
/** Enum with all types of TCP TURN packets. The order MUST not be changed. **/
enum PacketTurnType {
enum PacketTurnType : uint8_t {
PACKET_TURN_TURN_ERROR, ///< TURN server is unable to relay.
PACKET_TURN_SERCLI_CONNECT, ///< Client or server is connecting to the TURN server.
PACKET_TURN_TURN_CONNECTED, ///< TURN server indicates the socket is now being relayed.

View File

@ -16,7 +16,7 @@
#include "packet.h"
/** Enum with all types of UDP packets. The order MUST not be changed **/
enum PacketUDPType {
enum PacketUDPType : uint8_t {
PACKET_UDP_CLIENT_FIND_SERVER, ///< Queries a game server for game information
PACKET_UDP_SERVER_RESPONSE, ///< Reply of the game server with game information
PACKET_UDP_END, ///< Must ALWAYS be on the end of this list!! (period)