2007-01-02 17:34:03 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
|
|
|
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2007-02-23 08:37:33 +00:00
|
|
|
/**
|
|
|
|
* @file core/udp.cpp Basic functions to receive and send UDP packets.
|
|
|
|
*/
|
|
|
|
|
2007-01-02 17:34:03 +00:00
|
|
|
#ifdef ENABLE_NETWORK
|
|
|
|
|
|
|
|
#include "../../stdafx.h"
|
2007-12-26 13:50:40 +00:00
|
|
|
#include "../../date_func.h"
|
2010-01-15 16:41:15 +00:00
|
|
|
#include "../../debug.h"
|
2007-01-02 17:34:03 +00:00
|
|
|
#include "udp.h"
|
|
|
|
|
2009-04-07 20:27:13 +00:00
|
|
|
/**
|
|
|
|
* Create an UDP socket but don't listen yet.
|
|
|
|
* @param bind the addresses to bind to.
|
|
|
|
*/
|
|
|
|
NetworkUDPSocketHandler::NetworkUDPSocketHandler(NetworkAddressList *bind)
|
|
|
|
{
|
|
|
|
if (bind != NULL) {
|
|
|
|
for (NetworkAddress *addr = bind->Begin(); addr != bind->End(); addr++) {
|
|
|
|
*this->bind.Append() = *addr;
|
|
|
|
}
|
|
|
|
} else {
|
2009-04-08 00:26:49 +00:00
|
|
|
/* As hostname NULL and port 0/NULL don't go well when
|
|
|
|
* resolving it we need to add an address for each of
|
|
|
|
* the address families we support. */
|
2009-04-07 20:27:13 +00:00
|
|
|
*this->bind.Append() = NetworkAddress(NULL, 0, AF_INET);
|
2009-04-09 01:22:45 +00:00
|
|
|
*this->bind.Append() = NetworkAddress(NULL, 0, AF_INET6);
|
2009-04-07 20:27:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-02 17:34:03 +00:00
|
|
|
/**
|
|
|
|
* Start listening on the given host and port.
|
2009-04-07 20:27:13 +00:00
|
|
|
* @return true if at least one port is listening
|
2007-01-02 17:34:03 +00:00
|
|
|
*/
|
2009-04-07 20:27:13 +00:00
|
|
|
bool NetworkUDPSocketHandler::Listen()
|
2007-01-02 17:34:03 +00:00
|
|
|
{
|
|
|
|
/* Make sure socket is closed */
|
2007-01-12 14:30:01 +00:00
|
|
|
this->Close();
|
2007-01-02 17:34:03 +00:00
|
|
|
|
2009-04-07 20:27:13 +00:00
|
|
|
for (NetworkAddress *addr = this->bind.Begin(); addr != this->bind.End(); addr++) {
|
2009-04-08 00:03:05 +00:00
|
|
|
addr->Listen(SOCK_DGRAM, &this->sockets);
|
2009-04-07 20:27:13 +00:00
|
|
|
}
|
2007-01-02 17:34:03 +00:00
|
|
|
|
2009-04-07 20:27:13 +00:00
|
|
|
return this->sockets.Length() != 0;
|
2007-01-02 17:34:03 +00:00
|
|
|
}
|
|
|
|
|
2007-01-04 18:10:40 +00:00
|
|
|
/**
|
|
|
|
* Close the given UDP socket
|
|
|
|
*/
|
2007-01-12 14:30:01 +00:00
|
|
|
void NetworkUDPSocketHandler::Close()
|
2007-01-04 18:10:40 +00:00
|
|
|
{
|
2009-04-07 20:27:13 +00:00
|
|
|
for (SocketList::iterator s = this->sockets.Begin(); s != this->sockets.End(); s++) {
|
|
|
|
closesocket(s->second);
|
|
|
|
}
|
|
|
|
this->sockets.Clear();
|
2007-01-04 18:10:40 +00:00
|
|
|
}
|
|
|
|
|
2009-06-19 20:26:18 +00:00
|
|
|
NetworkRecvStatus NetworkUDPSocketHandler::CloseConnection(bool error)
|
2007-01-12 20:19:49 +00:00
|
|
|
{
|
2009-06-19 20:26:18 +00:00
|
|
|
NetworkSocketHandler::CloseConnection(error);
|
2007-01-12 20:19:49 +00:00
|
|
|
return NETWORK_RECV_STATUS_OKAY;
|
|
|
|
}
|
2007-01-04 18:10:40 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Send a packet over UDP
|
|
|
|
* @param p the packet to send
|
|
|
|
* @param recv the receiver (target) of the packet
|
2009-04-07 20:27:13 +00:00
|
|
|
* @param all send the packet using all sockets that can send it
|
|
|
|
* @param broadcast whether to send a broadcast message
|
2007-01-04 18:10:40 +00:00
|
|
|
*/
|
2009-04-07 20:27:13 +00:00
|
|
|
void NetworkUDPSocketHandler::SendPacket(Packet *p, NetworkAddress *recv, bool all, bool broadcast)
|
2007-01-04 18:10:40 +00:00
|
|
|
{
|
2009-04-07 20:27:13 +00:00
|
|
|
if (this->sockets.Length() == 0) this->Listen();
|
2007-01-04 18:10:40 +00:00
|
|
|
|
2009-04-07 20:27:13 +00:00
|
|
|
for (SocketList::iterator s = this->sockets.Begin(); s != this->sockets.End(); s++) {
|
2009-04-08 00:26:49 +00:00
|
|
|
/* Make a local copy because if we resolve it we cannot
|
|
|
|
* easily unresolve it so we can resolve it later again. */
|
|
|
|
NetworkAddress send(*recv);
|
|
|
|
|
2009-04-07 20:27:13 +00:00
|
|
|
/* Not the same type */
|
2009-04-08 00:26:49 +00:00
|
|
|
if (!send.IsFamily(s->first.GetAddress()->ss_family)) continue;
|
2007-01-04 18:10:40 +00:00
|
|
|
|
2009-04-07 20:27:13 +00:00
|
|
|
p->PrepareToSend();
|
2007-01-04 18:10:40 +00:00
|
|
|
|
2009-04-07 20:27:13 +00:00
|
|
|
#ifndef BEOS_NET_SERVER /* will work around this, some day; maybe. */
|
|
|
|
if (broadcast) {
|
|
|
|
/* Enable broadcast */
|
|
|
|
unsigned long val = 1;
|
|
|
|
setsockopt(s->second, SOL_SOCKET, SO_BROADCAST, (char *) &val, sizeof(val));
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Send the buffer */
|
2009-04-08 00:26:49 +00:00
|
|
|
int res = sendto(s->second, (const char*)p->buffer, p->size, 0, (struct sockaddr *)send.GetAddress(), send.GetAddressLength());
|
|
|
|
DEBUG(net, 7, "[udp] sendto(%s)", send.GetAddressAsString());
|
2009-04-07 20:27:13 +00:00
|
|
|
|
|
|
|
/* Check for any errors, but ignore it otherwise */
|
2009-04-08 00:26:49 +00:00
|
|
|
if (res == -1) DEBUG(net, 1, "[udp] sendto(%s) failed with: %i", send.GetAddressAsString(), GET_LAST_ERROR());
|
2009-04-07 20:27:13 +00:00
|
|
|
|
|
|
|
if (!all) break;
|
|
|
|
}
|
2007-01-04 18:10:40 +00:00
|
|
|
}
|
|
|
|
|
2007-01-02 17:34:03 +00:00
|
|
|
/**
|
|
|
|
* Receive a packet at UDP level
|
|
|
|
*/
|
2007-01-12 14:30:01 +00:00
|
|
|
void NetworkUDPSocketHandler::ReceivePackets()
|
2007-01-02 17:34:03 +00:00
|
|
|
{
|
2009-04-07 20:27:13 +00:00
|
|
|
for (SocketList::iterator s = this->sockets.Begin(); s != this->sockets.End(); s++) {
|
|
|
|
struct sockaddr_storage client_addr;
|
|
|
|
memset(&client_addr, 0, sizeof(client_addr));
|
|
|
|
|
|
|
|
Packet p(this);
|
|
|
|
int packet_len = sizeof(p.buffer);
|
|
|
|
socklen_t client_len = sizeof(client_addr);
|
|
|
|
|
|
|
|
/* Try to receive anything */
|
|
|
|
SetNonBlocking(s->second); // Some OSes seem to lose the non-blocking status of the socket
|
|
|
|
int nbytes = recvfrom(s->second, (char*)p.buffer, packet_len, 0, (struct sockaddr *)&client_addr, &client_len);
|
|
|
|
|
|
|
|
/* We got some bytes for the base header of the packet. */
|
|
|
|
if (nbytes > 2) {
|
|
|
|
NetworkAddress address(client_addr, client_len);
|
|
|
|
p.PrepareToRead();
|
|
|
|
|
|
|
|
/* If the size does not match the packet must be corrupted.
|
2009-11-03 17:30:08 +00:00
|
|
|
* Otherwise it will be marked as corrupted later on. */
|
2009-04-07 20:27:13 +00:00
|
|
|
if (nbytes != p.size) {
|
|
|
|
DEBUG(net, 1, "received a packet with mismatching size from %s", address.GetAddressAsString());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle the packet */
|
|
|
|
this->HandleUDPPacket(&p, &address);
|
2007-01-09 14:48:21 +00:00
|
|
|
}
|
2007-01-02 17:34:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Serializes the NetworkGameInfo struct to the packet
|
|
|
|
* @param p the packet to write the data to
|
|
|
|
* @param info the NetworkGameInfo struct to serialize
|
|
|
|
*/
|
2007-01-12 14:30:01 +00:00
|
|
|
void NetworkUDPSocketHandler::Send_NetworkGameInfo(Packet *p, const NetworkGameInfo *info)
|
2007-01-02 17:34:03 +00:00
|
|
|
{
|
2007-02-01 23:26:44 +00:00
|
|
|
p->Send_uint8 (NETWORK_GAME_INFO_VERSION);
|
2007-01-02 17:34:03 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Please observe the order.
|
|
|
|
* The parts must be read in the same order as they are sent!
|
|
|
|
*/
|
|
|
|
|
2007-01-05 21:33:58 +00:00
|
|
|
/* Update the documentation in udp.h on changes
|
|
|
|
* to the NetworkGameInfo wire-protocol! */
|
2007-01-02 17:34:03 +00:00
|
|
|
|
|
|
|
/* NETWORK_GAME_INFO_VERSION = 4 */
|
|
|
|
{
|
|
|
|
/* Only send the GRF Identification (GRF_ID and MD5 checksum) of
|
|
|
|
* the GRFs that are needed, i.e. the ones that the server has
|
|
|
|
* selected in the NewGRF GUI and not the ones that are used due
|
|
|
|
* to the fact that they are in [newgrf-static] in openttd.cfg */
|
|
|
|
const GRFConfig *c;
|
|
|
|
uint count = 0;
|
|
|
|
|
|
|
|
/* Count number of GRFs to send information about */
|
|
|
|
for (c = info->grfconfig; c != NULL; c = c->next) {
|
2007-11-19 21:02:30 +00:00
|
|
|
if (!HasBit(c->flags, GCF_STATIC)) count++;
|
2007-01-02 17:34:03 +00:00
|
|
|
}
|
2007-02-01 23:26:44 +00:00
|
|
|
p->Send_uint8 (count); // Send number of GRFs
|
2007-01-02 17:34:03 +00:00
|
|
|
|
|
|
|
/* Send actual GRF Identifications */
|
|
|
|
for (c = info->grfconfig; c != NULL; c = c->next) {
|
2010-02-25 20:05:31 +00:00
|
|
|
if (!HasBit(c->flags, GCF_STATIC)) this->Send_GRFIdentifier(p, &c->ident);
|
2007-01-02 17:34:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* NETWORK_GAME_INFO_VERSION = 3 */
|
2007-02-01 23:26:44 +00:00
|
|
|
p->Send_uint32(info->game_date);
|
|
|
|
p->Send_uint32(info->start_date);
|
2007-01-02 17:34:03 +00:00
|
|
|
|
|
|
|
/* NETWORK_GAME_INFO_VERSION = 2 */
|
2007-02-01 23:26:44 +00:00
|
|
|
p->Send_uint8 (info->companies_max);
|
|
|
|
p->Send_uint8 (info->companies_on);
|
|
|
|
p->Send_uint8 (info->spectators_max);
|
2007-01-02 17:34:03 +00:00
|
|
|
|
|
|
|
/* NETWORK_GAME_INFO_VERSION = 1 */
|
2007-02-01 23:26:44 +00:00
|
|
|
p->Send_string(info->server_name);
|
|
|
|
p->Send_string(info->server_revision);
|
|
|
|
p->Send_uint8 (info->server_lang);
|
2007-02-02 23:16:58 +00:00
|
|
|
p->Send_bool (info->use_password);
|
2007-02-01 23:26:44 +00:00
|
|
|
p->Send_uint8 (info->clients_max);
|
|
|
|
p->Send_uint8 (info->clients_on);
|
|
|
|
p->Send_uint8 (info->spectators_on);
|
|
|
|
p->Send_string(info->map_name);
|
|
|
|
p->Send_uint16(info->map_width);
|
|
|
|
p->Send_uint16(info->map_height);
|
|
|
|
p->Send_uint8 (info->map_set);
|
2007-02-02 23:16:58 +00:00
|
|
|
p->Send_bool (info->dedicated);
|
2007-01-02 17:34:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deserializes the NetworkGameInfo struct from the packet
|
|
|
|
* @param p the packet to read the data from
|
|
|
|
* @param info the NetworkGameInfo to deserialize into
|
|
|
|
*/
|
2007-01-12 14:30:01 +00:00
|
|
|
void NetworkUDPSocketHandler::Recv_NetworkGameInfo(Packet *p, NetworkGameInfo *info)
|
2007-01-02 17:34:03 +00:00
|
|
|
{
|
2007-01-22 21:38:16 +00:00
|
|
|
static const Date MAX_DATE = ConvertYMDToDate(MAX_YEAR, 11, 31); // December is month 11
|
|
|
|
|
2007-02-01 23:26:44 +00:00
|
|
|
info->game_info_version = p->Recv_uint8();
|
2007-01-02 17:34:03 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Please observe the order.
|
|
|
|
* The parts must be read in the same order as they are sent!
|
|
|
|
*/
|
|
|
|
|
2007-01-05 21:33:58 +00:00
|
|
|
/* Update the documentation in udp.h on changes
|
|
|
|
* to the NetworkGameInfo wire-protocol! */
|
|
|
|
|
2007-01-02 17:34:03 +00:00
|
|
|
switch (info->game_info_version) {
|
|
|
|
case 4: {
|
2007-01-11 17:29:39 +00:00
|
|
|
GRFConfig **dst = &info->grfconfig;
|
2007-01-02 17:34:03 +00:00
|
|
|
uint i;
|
2007-02-01 23:26:44 +00:00
|
|
|
uint num_grfs = p->Recv_uint8();
|
2007-01-02 17:34:03 +00:00
|
|
|
|
2008-04-09 14:05:50 +00:00
|
|
|
/* Broken/bad data. It cannot have that many NewGRFs. */
|
|
|
|
if (num_grfs > NETWORK_MAX_GRF_COUNT) return;
|
|
|
|
|
2007-01-02 17:34:03 +00:00
|
|
|
for (i = 0; i < num_grfs; i++) {
|
2010-02-25 20:06:11 +00:00
|
|
|
GRFConfig *c = new GRFConfig();
|
2010-02-25 20:05:31 +00:00
|
|
|
this->Recv_GRFIdentifier(p, &c->ident);
|
2007-01-12 14:30:01 +00:00
|
|
|
this->HandleIncomingNetworkGameInfoGRFConfig(c);
|
2007-01-02 17:34:03 +00:00
|
|
|
|
|
|
|
/* Append GRFConfig to the list */
|
|
|
|
*dst = c;
|
|
|
|
dst = &c->next;
|
|
|
|
}
|
2010-07-29 14:26:28 +00:00
|
|
|
} // FALL THROUGH
|
2007-01-02 17:34:03 +00:00
|
|
|
case 3:
|
2007-11-19 18:38:10 +00:00
|
|
|
info->game_date = Clamp(p->Recv_uint32(), 0, MAX_DATE);
|
|
|
|
info->start_date = Clamp(p->Recv_uint32(), 0, MAX_DATE);
|
2010-07-29 14:26:28 +00:00
|
|
|
/* FALL THROUGH */
|
2007-01-02 17:34:03 +00:00
|
|
|
case 2:
|
2007-02-01 23:26:44 +00:00
|
|
|
info->companies_max = p->Recv_uint8 ();
|
|
|
|
info->companies_on = p->Recv_uint8 ();
|
|
|
|
info->spectators_max = p->Recv_uint8 ();
|
2010-07-29 14:26:28 +00:00
|
|
|
/* FALL THROUGH */
|
2007-01-02 17:34:03 +00:00
|
|
|
case 1:
|
2007-02-01 23:26:44 +00:00
|
|
|
p->Recv_string(info->server_name, sizeof(info->server_name));
|
|
|
|
p->Recv_string(info->server_revision, sizeof(info->server_revision));
|
|
|
|
info->server_lang = p->Recv_uint8 ();
|
2007-02-02 23:16:58 +00:00
|
|
|
info->use_password = p->Recv_bool ();
|
2007-02-01 23:26:44 +00:00
|
|
|
info->clients_max = p->Recv_uint8 ();
|
|
|
|
info->clients_on = p->Recv_uint8 ();
|
|
|
|
info->spectators_on = p->Recv_uint8 ();
|
2007-01-02 17:34:03 +00:00
|
|
|
if (info->game_info_version < 3) { // 16 bits dates got scrapped and are read earlier
|
2007-02-01 23:26:44 +00:00
|
|
|
info->game_date = p->Recv_uint16() + DAYS_TILL_ORIGINAL_BASE_YEAR;
|
|
|
|
info->start_date = p->Recv_uint16() + DAYS_TILL_ORIGINAL_BASE_YEAR;
|
2007-01-02 17:34:03 +00:00
|
|
|
}
|
2007-02-01 23:26:44 +00:00
|
|
|
p->Recv_string(info->map_name, sizeof(info->map_name));
|
|
|
|
info->map_width = p->Recv_uint16();
|
|
|
|
info->map_height = p->Recv_uint16();
|
|
|
|
info->map_set = p->Recv_uint8 ();
|
2007-02-02 23:16:58 +00:00
|
|
|
info->dedicated = p->Recv_bool ();
|
2007-01-22 21:38:16 +00:00
|
|
|
|
2007-01-23 14:47:38 +00:00
|
|
|
if (info->server_lang >= NETWORK_NUM_LANGUAGES) info->server_lang = 0;
|
|
|
|
if (info->map_set >= NETWORK_NUM_LANDSCAPES) info->map_set = 0;
|
2007-01-02 17:34:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-01-28 20:47:25 +00:00
|
|
|
/**
|
|
|
|
* Defines a simple (switch) case for each network packet
|
|
|
|
* @param type the packet type to create the case for
|
|
|
|
*/
|
2007-01-12 14:30:01 +00:00
|
|
|
#define UDP_COMMAND(type) case type: this->NetworkPacketReceive_ ## type ## _command(p, client_addr); break;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle an incoming packets by sending it to the correct function.
|
|
|
|
* @param p the received packet
|
|
|
|
* @param client_addr the sender of the packet
|
|
|
|
*/
|
2009-04-02 19:21:26 +00:00
|
|
|
void NetworkUDPSocketHandler::HandleUDPPacket(Packet *p, NetworkAddress *client_addr)
|
2007-01-12 14:30:01 +00:00
|
|
|
{
|
|
|
|
PacketUDPType type;
|
|
|
|
|
2007-01-12 20:19:49 +00:00
|
|
|
/* New packet == new client, which has not quit yet */
|
2009-04-07 18:23:14 +00:00
|
|
|
this->Reopen();
|
2007-01-12 14:30:01 +00:00
|
|
|
|
2007-02-01 23:26:44 +00:00
|
|
|
type = (PacketUDPType)p->Recv_uint8();
|
2007-01-12 14:30:01 +00:00
|
|
|
|
2007-01-12 20:19:49 +00:00
|
|
|
switch (this->HasClientQuit() ? PACKET_UDP_END : type) {
|
2007-01-12 14:30:01 +00:00
|
|
|
UDP_COMMAND(PACKET_UDP_CLIENT_FIND_SERVER);
|
|
|
|
UDP_COMMAND(PACKET_UDP_SERVER_RESPONSE);
|
|
|
|
UDP_COMMAND(PACKET_UDP_CLIENT_DETAIL_INFO);
|
|
|
|
UDP_COMMAND(PACKET_UDP_SERVER_DETAIL_INFO);
|
|
|
|
UDP_COMMAND(PACKET_UDP_SERVER_REGISTER);
|
|
|
|
UDP_COMMAND(PACKET_UDP_MASTER_ACK_REGISTER);
|
|
|
|
UDP_COMMAND(PACKET_UDP_CLIENT_GET_LIST);
|
|
|
|
UDP_COMMAND(PACKET_UDP_MASTER_RESPONSE_LIST);
|
|
|
|
UDP_COMMAND(PACKET_UDP_SERVER_UNREGISTER);
|
|
|
|
UDP_COMMAND(PACKET_UDP_CLIENT_GET_NEWGRFS);
|
|
|
|
UDP_COMMAND(PACKET_UDP_SERVER_NEWGRFS);
|
2009-04-05 19:43:41 +00:00
|
|
|
UDP_COMMAND(PACKET_UDP_MASTER_SESSION_KEY);
|
2007-01-12 14:30:01 +00:00
|
|
|
|
|
|
|
default:
|
2007-01-12 20:19:49 +00:00
|
|
|
if (this->HasClientQuit()) {
|
2009-04-02 19:21:26 +00:00
|
|
|
DEBUG(net, 0, "[udp] received invalid packet type %d from %s", type, client_addr->GetAddressAsString());
|
2007-01-12 14:30:01 +00:00
|
|
|
} else {
|
2009-04-02 19:21:26 +00:00
|
|
|
DEBUG(net, 0, "[udp] received illegal packet from %s", client_addr->GetAddressAsString());
|
2007-01-12 14:30:01 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-01-28 20:47:25 +00:00
|
|
|
/**
|
2007-01-12 14:30:01 +00:00
|
|
|
* Create stub implementations for all receive commands that only
|
|
|
|
* show a warning that the given command is not available for the
|
|
|
|
* socket where the packet came from.
|
2007-01-28 20:47:25 +00:00
|
|
|
* @param type the packet type to create the stub for
|
2007-01-12 14:30:01 +00:00
|
|
|
*/
|
|
|
|
#define DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND(type) \
|
|
|
|
void NetworkUDPSocketHandler::NetworkPacketReceive_## type ##_command(\
|
2009-04-02 19:21:26 +00:00
|
|
|
Packet *p, NetworkAddress *client_addr) { \
|
|
|
|
DEBUG(net, 0, "[udp] received packet type %d on wrong port from %s", \
|
|
|
|
type, client_addr->GetAddressAsString()); \
|
2007-01-12 14:30:01 +00:00
|
|
|
}
|
|
|
|
|
2010-03-23 22:36:02 +00:00
|
|
|
DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND(PACKET_UDP_CLIENT_FIND_SERVER)
|
|
|
|
DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND(PACKET_UDP_SERVER_RESPONSE)
|
|
|
|
DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND(PACKET_UDP_CLIENT_DETAIL_INFO)
|
|
|
|
DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND(PACKET_UDP_SERVER_DETAIL_INFO)
|
|
|
|
DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND(PACKET_UDP_SERVER_REGISTER)
|
|
|
|
DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND(PACKET_UDP_MASTER_ACK_REGISTER)
|
|
|
|
DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND(PACKET_UDP_CLIENT_GET_LIST)
|
|
|
|
DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND(PACKET_UDP_MASTER_RESPONSE_LIST)
|
|
|
|
DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND(PACKET_UDP_SERVER_UNREGISTER)
|
|
|
|
DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND(PACKET_UDP_CLIENT_GET_NEWGRFS)
|
|
|
|
DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND(PACKET_UDP_SERVER_NEWGRFS)
|
|
|
|
DEFINE_UNAVAILABLE_UDP_RECEIVE_COMMAND(PACKET_UDP_MASTER_SESSION_KEY)
|
2007-01-12 14:30:01 +00:00
|
|
|
|
2007-01-02 17:34:03 +00:00
|
|
|
#endif /* ENABLE_NETWORK */
|