From 1eb4aa971ea329f18dd77b58bf7fc84d6240ea57 Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 8 Apr 2009 00:26:49 +0000 Subject: (svn r15975) -Codechange: register each of the IPs we have bound to to the masterserver --- src/network/core/address.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/network/core/address.h') diff --git a/src/network/core/address.h b/src/network/core/address.h index 4c0abdf63..0d0f61f7e 100644 --- a/src/network/core/address.h +++ b/src/network/core/address.h @@ -92,7 +92,13 @@ public: NetworkAddress(const char *hostname = "0.0.0.0", uint16 port = 0, int family = AF_INET) : address_length(0) { + /* Also handle IPv6 bracket enclosed hostnames */ + if (StrEmpty(hostname)) hostname = ""; + if (*hostname == '[') hostname++; strecpy(this->hostname, StrEmpty(hostname) ? "" : hostname, lastof(this->hostname)); + char *tmp = strrchr(hostname, ']'); + if (tmp != NULL) *tmp = '\0'; + memset(&this->address, 0, sizeof(this->address)); this->address.ss_family = family; this->SetPort(port); @@ -158,6 +164,13 @@ public: return this->address_length != 0; } + /** + * Checks of this address is of the given family. + * @param family the family to check against + * @return true if it is of the given family + */ + bool IsFamily(int family); + /** * Checks whether this IP address is contained by the given netmask. * @param netmask the netmask in CIDR notation to test against. -- cgit v1.2.3-70-g09d2