summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-05-06 13:12:11 +0200
committerPatric Stout <github@truebrain.nl>2021-07-10 20:17:07 +0200
commit6212d0a8da81f0f348bf4dcb03e332b3ef661a60 (patch)
tree6b1adee921a068d182f2a9e8aa155b58b9ed9214
parent8a2da494138b9dda5ae94d83a95153f2c68afb58 (diff)
downloadopenttd-6212d0a8da81f0f348bf4dcb03e332b3ef661a60.tar.xz
Remove: unused UDP protocol parts
-rw-r--r--src/network/core/udp.cpp20
-rw-r--r--src/network/core/udp.h136
2 files changed, 1 insertions, 155 deletions
diff --git a/src/network/core/udp.cpp b/src/network/core/udp.cpp
index 7a3fc19f3..b4fcec5b8 100644
--- a/src/network/core/udp.cpp
+++ b/src/network/core/udp.cpp
@@ -162,16 +162,6 @@ void NetworkUDPSocketHandler::HandleUDPPacket(Packet *p, NetworkAddress *client_
switch (this->HasClientQuit() ? PACKET_UDP_END : type) {
case PACKET_UDP_CLIENT_FIND_SERVER: this->Receive_CLIENT_FIND_SERVER(p, client_addr); break;
case PACKET_UDP_SERVER_RESPONSE: this->Receive_SERVER_RESPONSE(p, client_addr); break;
- case PACKET_UDP_CLIENT_DETAIL_INFO: this->Receive_CLIENT_DETAIL_INFO(p, client_addr); break;
- case PACKET_UDP_SERVER_DETAIL_INFO: this->Receive_SERVER_DETAIL_INFO(p, client_addr); break;
- case PACKET_UDP_SERVER_REGISTER: this->Receive_SERVER_REGISTER(p, client_addr); break;
- case PACKET_UDP_MASTER_ACK_REGISTER: this->Receive_MASTER_ACK_REGISTER(p, client_addr); break;
- case PACKET_UDP_CLIENT_GET_LIST: this->Receive_CLIENT_GET_LIST(p, client_addr); break;
- case PACKET_UDP_MASTER_RESPONSE_LIST: this->Receive_MASTER_RESPONSE_LIST(p, client_addr); break;
- case PACKET_UDP_SERVER_UNREGISTER: this->Receive_SERVER_UNREGISTER(p, client_addr); break;
- case PACKET_UDP_CLIENT_GET_NEWGRFS: this->Receive_CLIENT_GET_NEWGRFS(p, client_addr); break;
- case PACKET_UDP_SERVER_NEWGRFS: this->Receive_SERVER_NEWGRFS(p, client_addr); break;
- case PACKET_UDP_MASTER_SESSION_KEY: this->Receive_MASTER_SESSION_KEY(p, client_addr); break;
default:
if (this->HasClientQuit()) {
@@ -195,13 +185,3 @@ void NetworkUDPSocketHandler::ReceiveInvalidPacket(PacketUDPType type, NetworkAd
void NetworkUDPSocketHandler::Receive_CLIENT_FIND_SERVER(Packet *p, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_CLIENT_FIND_SERVER, client_addr); }
void NetworkUDPSocketHandler::Receive_SERVER_RESPONSE(Packet *p, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_SERVER_RESPONSE, client_addr); }
-void NetworkUDPSocketHandler::Receive_CLIENT_DETAIL_INFO(Packet *p, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_CLIENT_DETAIL_INFO, client_addr); }
-void NetworkUDPSocketHandler::Receive_SERVER_DETAIL_INFO(Packet *p, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_SERVER_DETAIL_INFO, client_addr); }
-void NetworkUDPSocketHandler::Receive_SERVER_REGISTER(Packet *p, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_SERVER_REGISTER, client_addr); }
-void NetworkUDPSocketHandler::Receive_MASTER_ACK_REGISTER(Packet *p, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_MASTER_ACK_REGISTER, client_addr); }
-void NetworkUDPSocketHandler::Receive_CLIENT_GET_LIST(Packet *p, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_CLIENT_GET_LIST, client_addr); }
-void NetworkUDPSocketHandler::Receive_MASTER_RESPONSE_LIST(Packet *p, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_MASTER_RESPONSE_LIST, client_addr); }
-void NetworkUDPSocketHandler::Receive_SERVER_UNREGISTER(Packet *p, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_SERVER_UNREGISTER, client_addr); }
-void NetworkUDPSocketHandler::Receive_CLIENT_GET_NEWGRFS(Packet *p, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_CLIENT_GET_NEWGRFS, client_addr); }
-void NetworkUDPSocketHandler::Receive_SERVER_NEWGRFS(Packet *p, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_SERVER_NEWGRFS, client_addr); }
-void NetworkUDPSocketHandler::Receive_MASTER_SESSION_KEY(Packet *p, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_MASTER_SESSION_KEY, client_addr); }
diff --git a/src/network/core/udp.h b/src/network/core/udp.h
index 489e21985..61866351d 100644
--- a/src/network/core/udp.h
+++ b/src/network/core/udp.h
@@ -19,28 +19,9 @@
enum PacketUDPType {
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_CLIENT_DETAIL_INFO, ///< Queries a game server about details of the game, such as companies
- PACKET_UDP_SERVER_DETAIL_INFO, ///< Reply of the game server about details of the game, such as companies
- PACKET_UDP_SERVER_REGISTER, ///< Packet to register itself to the master server
- PACKET_UDP_MASTER_ACK_REGISTER, ///< Packet indicating registration has succeeded
- PACKET_UDP_CLIENT_GET_LIST, ///< Request for serverlist from master server
- PACKET_UDP_MASTER_RESPONSE_LIST, ///< Response from master server with server ip's + port's
- PACKET_UDP_SERVER_UNREGISTER, ///< Request to be removed from the server-list
- PACKET_UDP_CLIENT_GET_NEWGRFS, ///< Requests the name for a list of GRFs (GRF_ID and MD5)
- PACKET_UDP_SERVER_NEWGRFS, ///< Sends the list of NewGRF's requested.
- PACKET_UDP_MASTER_SESSION_KEY, ///< Sends a fresh session key to the client
PACKET_UDP_END, ///< Must ALWAYS be on the end of this list!! (period)
};
-/** The types of server lists we can get */
-enum ServerListType {
- SLT_IPv4 = 0, ///< Get the IPv4 addresses
- SLT_IPv6 = 1, ///< Get the IPv6 addresses
- SLT_AUTODETECT, ///< Autodetect the type based on the connection
-
- SLT_END = SLT_AUTODETECT, ///< End of 'arrays' marker
-};
-
/** Base socket handler for all UDP sockets */
class NetworkUDPSocketHandler : public NetworkSocketHandler {
protected:
@@ -59,127 +40,12 @@ protected:
virtual void Receive_CLIENT_FIND_SERVER(Packet *p, NetworkAddress *client_addr);
/**
- * Return of server information to the client.
- * Serialized NetworkGameInfo. See game_info.h for details.
+ * Response to a query letting the client know we are here.
* @param p The received packet.
* @param client_addr The origin of the packet.
*/
virtual void Receive_SERVER_RESPONSE(Packet *p, NetworkAddress *client_addr);
- /**
- * Query for detailed information about companies.
- * @param p The received packet.
- * @param client_addr The origin of the packet.
- */
- virtual void Receive_CLIENT_DETAIL_INFO(Packet *p, NetworkAddress *client_addr);
-
- /**
- * Reply with detailed company information.
- * uint8 Version of the packet.
- * uint8 Number of companies.
- * For each company:
- * uint8 ID of the company.
- * string Name of the company.
- * uint32 Year the company was inaugurated.
- * uint64 Value.
- * uint64 Money.
- * uint64 Income.
- * uint16 Performance (last quarter).
- * bool Company is password protected.
- * uint16 Number of trains.
- * uint16 Number of lorries.
- * uint16 Number of busses.
- * uint16 Number of planes.
- * uint16 Number of ships.
- * uint16 Number of train stations.
- * uint16 Number of lorry stations.
- * uint16 Number of bus stops.
- * uint16 Number of airports and heliports.
- * uint16 Number of harbours.
- * bool Company is an AI.
- * @param p The received packet.
- * @param client_addr The origin of the packet.
- */
- virtual void Receive_SERVER_DETAIL_INFO(Packet *p, NetworkAddress *client_addr);
-
- /**
- * Registers the server to the master server.
- * string The "welcome" message to root out other binary packets.
- * uint8 Version of the protocol.
- * uint16 The port to unregister.
- * uint64 The session key.
- * @param p The received packet.
- * @param client_addr The origin of the packet.
- */
- virtual void Receive_SERVER_REGISTER(Packet *p, NetworkAddress *client_addr);
-
- /**
- * The master server acknowledges the registration.
- * @param p The received packet.
- * @param client_addr The origin of the packet.
- */
- virtual void Receive_MASTER_ACK_REGISTER(Packet *p, NetworkAddress *client_addr);
-
- /**
- * The client requests a list of servers.
- * uint8 The protocol version.
- * uint8 The type of server to look for: IPv4, IPv6 or based on the received packet.
- * @param p The received packet.
- * @param client_addr The origin of the packet.
- */
- virtual void Receive_CLIENT_GET_LIST(Packet *p, NetworkAddress *client_addr);
-
- /**
- * The server sends a list of servers.
- * uint8 The protocol version.
- * For each server:
- * 4 or 16 bytes of IPv4 or IPv6 address.
- * uint8 The port.
- * @param p The received packet.
- * @param client_addr The origin of the packet.
- */
- virtual void Receive_MASTER_RESPONSE_LIST(Packet *p, NetworkAddress *client_addr);
-
- /**
- * A server unregisters itself at the master server.
- * uint8 Version of the protocol.
- * uint16 The port to unregister.
- * @param p The received packet.
- * @param client_addr The origin of the packet.
- */
- virtual void Receive_SERVER_UNREGISTER(Packet *p, NetworkAddress *client_addr);
-
- /**
- * The client requests information about some NewGRFs.
- * uint8 The number of NewGRFs information is requested about.
- * For each NewGRF:
- * uint32 The GRFID.
- * 16 * uint8 MD5 checksum of the GRF.
- * @param p The received packet.
- * @param client_addr The origin of the packet.
- */
- virtual void Receive_CLIENT_GET_NEWGRFS(Packet *p, NetworkAddress *client_addr);
-
- /**
- * The server returns information about some NewGRFs.
- * uint8 The number of NewGRFs information is requested about.
- * For each NewGRF:
- * uint32 The GRFID.
- * 16 * uint8 MD5 checksum of the GRF.
- * string The name of the NewGRF.
- * @param p The received packet.
- * @param client_addr The origin of the packet.
- */
- virtual void Receive_SERVER_NEWGRFS(Packet *p, NetworkAddress *client_addr);
-
- /**
- * The master server sends us a session key.
- * uint64 The session key.
- * @param p The received packet.
- * @param client_addr The origin of the packet.
- */
- virtual void Receive_MASTER_SESSION_KEY(Packet *p, NetworkAddress *client_addr);
-
void HandleUDPPacket(Packet *p, NetworkAddress *client_addr);
public:
NetworkUDPSocketHandler(NetworkAddressList *bind = nullptr);