summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2019-02-19 12:43:16 +0100
committerMax Kellermann <max@musicpd.org>2019-02-19 12:43:16 +0100
commit1a516cf3c0abadcb0086d9fcdbc6f86550b2b336 (patch)
treeb4d5ea24a494fa9ca4777feffb3ec10b960de004
parent5c25499c5e61582f9fbb19e219e951ab13ddb4cd (diff)
net/AllocatedSocketAddress: add method GetLocalRaw()
-rw-r--r--src/net/AllocatedSocketAddress.cxx9
-rw-r--r--src/net/AllocatedSocketAddress.hxx12
2 files changed, 17 insertions, 4 deletions
diff --git a/src/net/AllocatedSocketAddress.cxx b/src/net/AllocatedSocketAddress.cxx
index f3632ca3c..02cbb67d7 100644
--- a/src/net/AllocatedSocketAddress.cxx
+++ b/src/net/AllocatedSocketAddress.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 "AllocatedSocketAddress.hxx"
+#include "util/StringView.hxx"
#include <string.h>
@@ -70,6 +71,12 @@ AllocatedSocketAddress::SetSize(size_type new_size) noexcept
#ifdef HAVE_UN
+StringView
+AllocatedSocketAddress::GetLocalRaw() const noexcept
+{
+ return SocketAddress(*this).GetLocalRaw();
+}
+
void
AllocatedSocketAddress::SetLocal(const char *path) noexcept
{
diff --git a/src/net/AllocatedSocketAddress.hxx b/src/net/AllocatedSocketAddress.hxx
index 10f61624a..2bd6b372d 100644
--- a/src/net/AllocatedSocketAddress.hxx
+++ b/src/net/AllocatedSocketAddress.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
@@ -27,8 +27,8 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef ALLOCATED_SOCKET_ADDRESS_HPP
-#define ALLOCATED_SOCKET_ADDRESS_HPP
+#ifndef ALLOCATED_SOCKET_ADDRESS_HXX
+#define ALLOCATED_SOCKET_ADDRESS_HXX
#include "SocketAddress.hxx"
#include "Features.hxx"
@@ -141,6 +141,12 @@ public:
#ifdef HAVE_UN
/**
+ * @see SocketAddress::GetLocalRaw()
+ */
+ gcc_pure
+ StringView GetLocalRaw() const noexcept;
+
+ /**
* Make this a "local" address (UNIX domain socket). If the path
* begins with a '@', then the rest specifies an "abstract" local
* address.