OpenTTD Source
20241108-master-g80f628063a
|
Basic functions to receive and send TCP packets for game purposes. More...
#include "os_abstraction.h"
#include "tcp.h"
#include "../network_type.h"
#include "../../core/pool_type.hpp"
#include <chrono>
Go to the source code of this file.
Data Structures | |
class | NetworkGameSocketHandler |
Base socket handler for all TCP sockets. More... | |
Typedefs | |
using | CommandQueue = std::vector< CommandPacket > |
A "queue" of CommandPackets. More... | |
Basic functions to receive and send TCP packets for game purposes.
Definition in file tcp_game.h.
using CommandQueue = std::vector<CommandPacket> |
A "queue" of CommandPackets.
Not a std::queue because, when paused, some commands remain on the queue. In other words, you do not always pop the first element from this queue.
Definition at line 138 of file tcp_game.h.
enum PacketGameType : uint8_t |
Enum with all types of TCP packets.
For the exact meaning, look at NetworkGameSocketHandler.
Enumerator | |
---|---|
PACKET_SERVER_FULL | The server is full and has no place for you. |
PACKET_SERVER_BANNED | The server has banned you. |
PACKET_CLIENT_JOIN | The client telling the server it wants to join. |
PACKET_SERVER_ERROR | Server sending an error message to the client. |
PACKET_CLIENT_UNUSED | Unused. |
PACKET_SERVER_UNUSED | Unused. |
PACKET_SERVER_GAME_INFO | Information about the server. |
PACKET_CLIENT_GAME_INFO | Request information about the server. |
PACKET_SERVER_NEWGAME | The server is preparing to start a new game. |
PACKET_SERVER_SHUTDOWN | The server is shutting down. |
PACKET_SERVER_AUTH_REQUEST | The server requests the client to authenticate using a number of methods. |
PACKET_CLIENT_AUTH_RESPONSE | The client responds to the authentication request. |
PACKET_SERVER_ENABLE_ENCRYPTION | The server tells that authentication has completed and requests to enable encryption with the keys of the last |
PACKET_CLIENT_IDENTIFY | Client telling the server the client's name and requested company. |
PACKET_SERVER_CHECK_NEWGRFS | Server sends NewGRF IDs and MD5 checksums for the client to check. |
PACKET_CLIENT_NEWGRFS_CHECKED | Client acknowledges that it has all required NewGRFs. |
PACKET_SERVER_WELCOME | Server welcomes you and gives you your ClientID. |
PACKET_SERVER_CLIENT_INFO | Server sends you information about a client. |
PACKET_CLIENT_GETMAP | Client requests the actual map. |
PACKET_SERVER_WAIT | Server tells the client there are some people waiting for the map as well. |
PACKET_SERVER_MAP_BEGIN | Server tells the client that it is beginning to send the map. |
PACKET_SERVER_MAP_SIZE | Server tells the client what the (compressed) size of the map is. |
PACKET_SERVER_MAP_DATA | Server sends bits of the map to the client. |
PACKET_SERVER_MAP_DONE | Server tells it has just sent the last bits of the map to the client. |
PACKET_CLIENT_MAP_OK | Client tells the server that it received the whole map. |
PACKET_SERVER_JOIN | Tells clients that a new client has joined. |
PACKET_SERVER_FRAME | Server tells the client what frame it is in, and thus to where the client may progress. |
PACKET_CLIENT_ACK | The client tells the server which frame it has executed. |
PACKET_SERVER_SYNC | Server tells the client what the random state should be. |
PACKET_CLIENT_COMMAND | Client executed a command and sends it to the server. |
PACKET_SERVER_COMMAND | Server distributes a command to (all) the clients. |
PACKET_CLIENT_CHAT | Client said something that should be distributed. |
PACKET_SERVER_CHAT | Server distributing the message of a client (or itself). |
PACKET_SERVER_EXTERNAL_CHAT | Server distributing the message from external source. |
PACKET_CLIENT_RCON | Client asks the server to execute some command. |
PACKET_SERVER_RCON | Response of the executed command on the server. |
PACKET_CLIENT_MOVE | A client would like to be moved to another company. |
PACKET_SERVER_MOVE | Server tells everyone that someone is moved to another company. |
PACKET_CLIENT_SET_NAME | A client changes its name. |
PACKET_SERVER_CONFIG_UPDATE | Some network configuration important to the client changed. |
PACKET_CLIENT_QUIT | A client tells the server it is going to quit. |
PACKET_SERVER_QUIT | A server tells that a client has quit. |
PACKET_CLIENT_ERROR | A client reports an error to the server. |
PACKET_SERVER_ERROR_QUIT | A server tells that a client has hit an error and did quit. |
PACKET_END | Must ALWAYS be on the end of this list!! (period) |
Definition at line 25 of file tcp_game.h.