From f66b373b52b2daef69507c402577a1a02b65c40b Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 12 Jan 2007 20:19:49 +0000 Subject: (svn r8083) -Codechange: make a NetworkSocketHandler as base for all sockets and move a little of NetworkClientState functionality to the NetworkSocketHandler. Move the rest of the NetworkClientState to the new NetworkTCPSocketHandler class/struct, which is not yet implemented in an object oriented manner. The UDP socket handler now extends the NetworkSocketHandler instead of having a reference to a NetworkClientState. --- src/network/core/udp.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/network/core/udp.h') diff --git a/src/network/core/udp.h b/src/network/core/udp.h index 755829600..9bb743841 100644 --- a/src/network/core/udp.h +++ b/src/network/core/udp.h @@ -6,11 +6,11 @@ #ifdef ENABLE_NETWORK #include "os_abstraction.h" +#include "core.h" #include "game.h" #include "packet.h" #include "../../newgrf_config.h" #include "../../debug.h" -#include "../network_data.h" /** * @file udp.h Basic functions to receive and send UDP packets. @@ -91,11 +91,11 @@ enum PacketUDPType { #define DECLARE_UDP_RECEIVE_COMMAND(type) virtual void NetworkPacketReceive_## type ##_command(Packet *p, const struct sockaddr_in *) -class NetworkUDPSocketHandler { -private: - SOCKET udp; +/** Base socket handler for all UDP sockets */ +class NetworkUDPSocketHandler : public NetworkSocketHandler { protected: - NetworkClientState cs; + NetworkRecvStatus CloseConnection(); + /* Declare all possible packets here. If it can be received by the * a specific handler, it has to be implemented. */ DECLARE_UDP_RECEIVE_COMMAND(PACKET_UDP_CLIENT_FIND_SERVER); @@ -121,10 +121,8 @@ protected: */ virtual void HandleIncomingNetworkGameInfoGRFConfig(GRFConfig *config) { NOT_REACHED(); } public: - NetworkUDPSocketHandler(); virtual ~NetworkUDPSocketHandler() { this->Close(); } - bool IsListening() { return this->udp != INVALID_SOCKET; } bool Listen(uint32 host, uint16 port, bool broadcast); void Close(); -- cgit v1.2.3-54-g00ecf