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

net/StaticSocketAddress: add GetLocalRaw()

parent 20b6e0d6
/* /*
* 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 "StaticSocketAddress.hxx" #include "StaticSocketAddress.hxx"
#include "util/StringView.hxx"
#include <algorithm> #include <algorithm>
...@@ -50,6 +51,16 @@ StaticSocketAddress::operator=(SocketAddress other) noexcept ...@@ -50,6 +51,16 @@ StaticSocketAddress::operator=(SocketAddress other) noexcept
return *this; return *this;
} }
#ifdef HAVE_UN
StringView
StaticSocketAddress::GetLocalRaw() const noexcept
{
return SocketAddress(*this).GetLocalRaw();
}
#endif
#ifdef HAVE_TCP #ifdef HAVE_TCP
bool bool
......
/* /*
* 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
...@@ -109,6 +109,14 @@ public: ...@@ -109,6 +109,14 @@ public:
address.ss_family = AF_UNSPEC; address.ss_family = AF_UNSPEC;
} }
#ifdef HAVE_UN
/**
* @see SocketAddress::GetLocalRaw()
*/
gcc_pure
StringView GetLocalRaw() const noexcept;
#endif
#ifdef HAVE_TCP #ifdef HAVE_TCP
/** /**
* Extract the port number. Returns 0 if not applicable. * Extract the port number. Returns 0 if not applicable.
......
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