12#ifndef NETWORK_CORE_UDP_H
13#define NETWORK_CORE_UDP_H
Wrapper for network addresses.
std::vector< NetworkAddress > NetworkAddressList
Type for a list of addresses.
std::map< SOCKET, NetworkAddress > SocketList
Type for a mapping between address and socket.
Wrapper for (un)resolved network addresses; there's no reason to transform a numeric IP to a string a...
SocketHandler for all network sockets in OpenTTD.
Base socket handler for all UDP sockets.
void CloseSocket()
Close the actual UDP socket.
bool Listen()
Start listening on the given host and port.
SocketList sockets
The opened sockets.
void SendPacket(Packet &p, NetworkAddress &recv, bool all=false, bool broadcast=false)
Send a packet over UDP.
virtual ~NetworkUDPSocketHandler()
On destructing of this class, the socket needs to be closed.
void ReceivePackets()
Receive a packet at UDP level.
virtual void Receive_CLIENT_FIND_SERVER(Packet &p, NetworkAddress &client_addr)
Queries to the server for information about the game.
void ReceiveInvalidPacket(PacketUDPType, NetworkAddress &client_addr)
Helper for logging receiving invalid packets.
NetworkAddressList bind
The address to bind to.
virtual void Receive_SERVER_RESPONSE(Packet &p, NetworkAddress &client_addr)
Response to a query letting the client know we are here.
void HandleUDPPacket(Packet &p, NetworkAddress &client_addr)
Handle an incoming packets by sending it to the correct function.
Basic functions to create, fill and read packets.
Internal entity of a packet.
PacketUDPType
Enum with all types of UDP packets.
@ 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)