summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2019-02-27 23:26:00 +0100
committerMax Kellermann <max@musicpd.org>2019-02-27 23:26:00 +0100
commit1f8ff48168f680bd300a8cb58bb04a14f66199d8 (patch)
treeb1bd4e7f1616def945670b5ee418ba695924d7b2 /src/net
parent20b6e0d68429c97c8b44feb7ada0ecbf0521e000 (diff)
net/StaticSocketAddress: add GetLocalRaw()
Diffstat (limited to 'src/net')
-rw-r--r--src/net/StaticSocketAddress.cxx13
-rw-r--r--src/net/StaticSocketAddress.hxx10
2 files changed, 21 insertions, 2 deletions
diff --git a/src/net/StaticSocketAddress.cxx b/src/net/StaticSocketAddress.cxx
index 5ff64d518..8010ffbfe 100644
--- a/src/net/StaticSocketAddress.cxx
+++ b/src/net/StaticSocketAddress.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2017 Max Kellermann <max.kellermann@gmail.com>
+ * Copyright 2012-2019 Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,6 +29,7 @@
#include "config.h"
#include "StaticSocketAddress.hxx"
+#include "util/StringView.hxx"
#include <algorithm>
@@ -50,6 +51,16 @@ StaticSocketAddress::operator=(SocketAddress other) noexcept
return *this;
}
+#ifdef HAVE_UN
+
+StringView
+StaticSocketAddress::GetLocalRaw() const noexcept
+{
+ return SocketAddress(*this).GetLocalRaw();
+}
+
+#endif
+
#ifdef HAVE_TCP
bool
diff --git a/src/net/StaticSocketAddress.hxx b/src/net/StaticSocketAddress.hxx
index 8b9e8ecde..893828ef9 100644
--- a/src/net/StaticSocketAddress.hxx
+++ b/src/net/StaticSocketAddress.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2017 Max Kellermann <max.kellermann@gmail.com>
+ * Copyright 2012-2019 Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -109,6 +109,14 @@ public:
address.ss_family = AF_UNSPEC;
}
+#ifdef HAVE_UN
+ /**
+ * @see SocketAddress::GetLocalRaw()
+ */
+ gcc_pure
+ StringView GetLocalRaw() const noexcept;
+#endif
+
#ifdef HAVE_TCP
/**
* Extract the port number. Returns 0 if not applicable.