14 #ifndef NETWORK_CORE_UDP_H 15 #define NETWORK_CORE_UDP_H Autodetect the type based on the connection.
virtual void Receive_CLIENT_GET_NEWGRFS(Packet *p, NetworkAddress *client_addr)
The client requests information about some NewGRFs.
Internal entity of a packet.
Sends a fresh session key to the client.
NetworkUDPSocketHandler(NetworkAddressList *bind=NULL)
Create an UDP socket but don't listen yet.
virtual void Receive_SERVER_REGISTER(Packet *p, NetworkAddress *client_addr)
Registers the server to the master server.
Queries a game server for game information.
virtual ~NetworkUDPSocketHandler()
On destructing of this class, the socket needs to be closed.
Requests the name for a list of GRFs (GRF_ID and MD5)
void ReceivePackets()
Receive a packet at UDP level.
virtual void Receive_SERVER_RESPONSE(Packet *p, NetworkAddress *client_addr)
Return of server information to the client.
Request for serverlist from master server.
void SendNetworkGameInfo(Packet *p, const NetworkGameInfo *info)
Serializes the NetworkGameInfo struct to the packet.
virtual void Receive_SERVER_UNREGISTER(Packet *p, NetworkAddress *client_addr)
A server unregisters itself at the master server.
SocketList sockets
The opened sockets.
virtual void Receive_MASTER_SESSION_KEY(Packet *p, NetworkAddress *client_addr)
The master server sends us a session key.
Wrapper for (un)resolved network addresses; there's no reason to transform a numeric IP to a string a...
PacketUDPType
Enum with all types of UDP packets.
Base socket handler for all UDP sockets.
Request to be removed from the server-list.
Information about a game that is sent between a game server, game client and masterserver.
void ReceiveInvalidPacket(PacketUDPType, NetworkAddress *client_addr)
Helper for logging receiving invalid packets.
The game information that is sent from the server to the clients.
virtual void Receive_CLIENT_FIND_SERVER(Packet *p, NetworkAddress *client_addr)
Queries to the server for information about the game.
virtual void HandleIncomingNetworkGameInfoGRFConfig(GRFConfig *config)
Function that is called for every GRFConfig that is read when receiving a NetworkGameInfo.
Must ALWAYS be on the end of this list!! (period)
Information about GRF, used in the game and (part of it) in savegames.
virtual void Receive_CLIENT_GET_LIST(Packet *p, NetworkAddress *client_addr)
The client requests a list of servers.
Packet to register itself to the master server.
Packet indicating registration has succeeded.
virtual void Receive_SERVER_NEWGRFS(Packet *p, NetworkAddress *client_addr)
The server returns information about some NewGRFs.
Reply of the game server about details of the game, such as companies.
NetworkRecvStatus
Status of a network client; reasons why a client has quit.
ServerListType
The types of server lists we can get.
Wrapper for network addresses.
virtual void Receive_CLIENT_DETAIL_INFO(Packet *p, NetworkAddress *client_addr)
Query for detailed information about companies.
virtual void Receive_MASTER_ACK_REGISTER(Packet *p, NetworkAddress *client_addr)
The master server acknowledges the registration.
bool Listen()
Start listening on the given host and port.
void SendPacket(Packet *p, NetworkAddress *recv, bool all=false, bool broadcast=false)
Send a packet over UDP.
Sends the list of NewGRF's requested.
void HandleUDPPacket(Packet *p, NetworkAddress *client_addr)
Handle an incoming packets by sending it to the correct function.
void Close()
Close the given UDP socket.
virtual void Receive_SERVER_DETAIL_INFO(Packet *p, NetworkAddress *client_addr)
Reply with detailed company information.
void CDECL error(const char *s,...)
Error handling for fatal non-user errors.
Basic functions to create, fill and read packets.
Response from master server with server ip's + port's.
NetworkAddressList bind
The address to bind to.
void ReceiveNetworkGameInfo(Packet *p, NetworkGameInfo *info)
Deserializes the NetworkGameInfo struct from the packet.
NetworkRecvStatus CloseConnection(bool error=true)
Close the current connection; for TCP this will be mostly equivalent to Close(), but for UDP it just ...
Queries a game server about details of the game, such as companies.
Reply of the game server with game information.
virtual void Receive_MASTER_RESPONSE_LIST(Packet *p, NetworkAddress *client_addr)
The server sends a list of servers.
End of 'arrays' marker.
SocketHandler for all network sockets in OpenTTD.