Commit 1a516cf3 authored by Max Kellermann's avatar Max Kellermann

net/AllocatedSocketAddress: add method GetLocalRaw()

parent 5c25499c
/* /*
* 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 * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "config.h" #include "config.h"
#include "AllocatedSocketAddress.hxx" #include "AllocatedSocketAddress.hxx"
#include "util/StringView.hxx"
#include <string.h> #include <string.h>
...@@ -70,6 +71,12 @@ AllocatedSocketAddress::SetSize(size_type new_size) noexcept ...@@ -70,6 +71,12 @@ AllocatedSocketAddress::SetSize(size_type new_size) noexcept
#ifdef HAVE_UN #ifdef HAVE_UN
StringView
AllocatedSocketAddress::GetLocalRaw() const noexcept
{
return SocketAddress(*this).GetLocalRaw();
}
void void
AllocatedSocketAddress::SetLocal(const char *path) noexcept AllocatedSocketAddress::SetLocal(const char *path) noexcept
{ {
......
/* /*
* 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 * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
* OF THE POSSIBILITY OF SUCH DAMAGE. * OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef ALLOCATED_SOCKET_ADDRESS_HPP #ifndef ALLOCATED_SOCKET_ADDRESS_HXX
#define ALLOCATED_SOCKET_ADDRESS_HPP #define ALLOCATED_SOCKET_ADDRESS_HXX
#include "SocketAddress.hxx" #include "SocketAddress.hxx"
#include "Features.hxx" #include "Features.hxx"
...@@ -141,6 +141,12 @@ public: ...@@ -141,6 +141,12 @@ public:
#ifdef HAVE_UN #ifdef HAVE_UN
/** /**
* @see SocketAddress::GetLocalRaw()
*/
gcc_pure
StringView GetLocalRaw() const noexcept;
/**
* Make this a "local" address (UNIX domain socket). If the path * Make this a "local" address (UNIX domain socket). If the path
* begins with a '@', then the rest specifies an "abstract" local * begins with a '@', then the rest specifies an "abstract" local
* address. * address.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment