summaryrefslogtreecommitdiff
path: root/src/network/core
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-04-08 17:51:04 +0000
committerrubidium <rubidium@openttd.org>2009-04-08 17:51:04 +0000
commit080095ade5e6dc330529ff01d66c14c844aa7005 (patch)
tree4e05169cad087736da37833cbbd06e8d61b41a6f /src/network/core
parentcd8da0d69eaec81702ca033f375957bb24acdbf1 (diff)
downloadopenttd-080095ade5e6dc330529ff01d66c14c844aa7005.tar.xz
(svn r15984) -Codechange: prepare the UDP receiver to process multiple types of returned server lists.
Diffstat (limited to 'src/network/core')
-rw-r--r--src/network/core/address.cpp4
-rw-r--r--src/network/core/udp.h9
2 files changed, 11 insertions, 2 deletions
diff --git a/src/network/core/address.cpp b/src/network/core/address.cpp
index 963a2e970..d14d1dab6 100644
--- a/src/network/core/address.cpp
+++ b/src/network/core/address.cpp
@@ -58,9 +58,9 @@ const char *NetworkAddress::GetAddressAsString(bool with_family)
/* 6 = for the : and 5 for the decimal port number */
static char buf[NETWORK_HOSTNAME_LENGTH + 6 + 7];
char *p = buf;
- if (this->address.ss_family == AF_INET6) p = strecpy(p, "[", lastof(buf));
+ if (this->GetAddress()->ss_family == AF_INET6) p = strecpy(p, "[", lastof(buf));
p = strecpy(p, this->GetHostname(), lastof(buf));
- if (this->address.ss_family == AF_INET6) p = strecpy(p, "]", lastof(buf));
+ if (this->GetAddress()->ss_family == AF_INET6) p = strecpy(p, "]", lastof(buf));
p += seprintf(p, lastof(buf), ":%d", this->GetPort());
if (with_family) {
diff --git a/src/network/core/udp.h b/src/network/core/udp.h
index 2302dab0d..6f68c213d 100644
--- a/src/network/core/udp.h
+++ b/src/network/core/udp.h
@@ -90,6 +90,15 @@ enum PacketUDPType {
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
+};
+
#define DECLARE_UDP_RECEIVE_COMMAND(type) virtual void NetworkPacketReceive_## type ##_command(Packet *p, NetworkAddress *client_addr)
#define DEF_UDP_RECEIVE_COMMAND(cls, type) void cls ##NetworkUDPSocketHandler::NetworkPacketReceive_ ## type ## _command(Packet *p, NetworkAddress *client_addr)