net/ToString: move UnmapV4() to class IPv6Address

This commit is contained in:
Max Kellermann
2019-07-03 21:39:34 +02:00
parent 08552f3938
commit 77b5b4158c
5 changed files with 40 additions and 24 deletions

View File

@@ -33,6 +33,7 @@
#include "IPv6Address.hxx"
#include "util/StringView.hxx"
#include <assert.h>
#include <string.h>
#ifdef HAVE_UN
@@ -104,6 +105,14 @@ SocketAddress::IsV4Mapped() const noexcept
return GetFamily() == AF_INET6 && IPv6Address::Cast(*this).IsV4Mapped();
}
IPv4Address
SocketAddress::UnmapV4() const noexcept
{
assert(IsV4Mapped());
return IPv6Address::Cast(*this).UnmapV4();
}
unsigned
SocketAddress::GetPort() const noexcept
{