Max Kellermann
491cc8f54d
net/SocketDescriptor: add {Read,Write}NoWait()
...
It was surprising that Read() was non-blocking, but there was no
blocking version of it. Let's make the non-blocking behavior explicit
and change Read() to be blocking.
In order to find existing callers easily with compiler errors, this
also refactors Read()/Write() to take a std::span parameter.
2023-09-27 11:39:55 +02:00
Max Kellermann
8ca6606323
net/SocketDescriptor: move code to Receive(), Send()
2023-09-27 10:16:21 +02:00
Max Kellermann
b36f5f1ec4
net/ToString: use #pragma once
2023-09-18 22:01:40 +02:00
Max Kellermann
592649d3f2
net/ToString: check family==AF_INET6 instead of looking for colons
2023-09-18 21:59:27 +02:00
Max Kellermann
9398599816
net/ToString: use libfmt
2023-09-18 21:58:55 +02:00
Max Kellermann
61c29473d3
net/ToString: append port only if it is non-zero
2023-09-18 11:11:00 +02:00
Max Kellermann
5fd2fc77f3
net/ToString: add null check
2023-09-18 11:08:16 +02:00
Max Kellermann
3eb0681e3d
net/ToString: use SocketAddress::GetLocalRaw()
2023-09-18 10:54:52 +02:00
Max Kellermann
339b9f6e7b
net/StaticSocketAddress: add method GetSteadyPart()
2023-09-11 21:27:12 +02:00
Max Kellermann
35cfa6efa3
net/StaticSocketAddress: add SocketAddress cast constructor
2023-09-11 21:27:12 +02:00
Max Kellermann
34ec024bf4
net/AllocatedSocketAddress: add method GetSteadyPart()
2023-09-11 21:27:12 +02:00
Max Kellermann
53ec02d5e9
net/SocketDescriptor: decouple from FileDescriptor on Windows
...
On Windows, a socket is not a file descriptor; it is a different beast
(and anyway, Windows doesn't have file descriptors).
2023-03-29 10:12:50 +02:00
Max Kellermann
148aca23be
use SPDX IDs, replacing the long copyright headers
2023-03-06 14:59:48 +01:00
Max Kellermann
452400b7ef
net/SocketAddress: remove __cpp_lib_span checks
2023-03-05 08:41:33 +01:00
Max Kellermann
d9b1f2fefa
net/SocketAddress: add method HasPort()
2022-12-01 15:10:25 +01:00
Max Kellermann
fa58db798b
lib/fmt/RuntimeError: new library
...
Replacing FormatRuntimeError().
2022-11-29 14:10:34 +01:00
Max Kellermann
bbc82a9892
io/FileDescriptor, net/SocketDescriptor: make lots of methods "const"
...
Only the file descriptor value itself is const, but the file itself
may be readable/writable.
2022-11-09 19:19:20 +01:00
Max Kellermann
cc0def15c4
Copyright year 2022
2022-07-14 17:59:35 +02:00
Max Kellermann
2ba092711f
event/net/UdpListener: use IsSocketErrorReceiveWouldBlock()
2022-06-30 10:32:25 +02:00
Max Kellermann
8aa4227c0c
net/SocketAddress: add std::span cast operators
2022-06-30 10:30:54 +02:00
Max Kellermann
bc3415ce8b
Copyright year 2022
2022-06-30 09:41:53 +02:00
Max Kellermann
12d67dad35
net/SocketError: support ETIMEDOUT
2022-06-29 17:28:47 +02:00
Max Kellermann
f2cfa3e1c4
net/SocketError: add SocketErrorCategory()
2022-06-13 21:26:58 +02:00
Max Kellermann
eedd490e2d
net/AddressInfo: add iterator type aliases
2022-06-07 10:11:26 +02:00
Max Kellermann
d2983b7fde
net/SocketAddress: include cleanup
2022-05-31 13:54:19 +02:00
Max Kellermann
059955a48c
net/SocketAddress: add #ifdefs for std::span
2022-05-31 13:51:12 +02:00
Max Kellermann
6ebac6a0b2
net/StaticSocketAddress: use std::string_view instead of StringView
2022-05-31 13:49:18 +02:00
Max Kellermann
b5a9d0654e
net/Resolver: use std::copy()
2022-05-31 13:44:25 +02:00
Max Kellermann
242ba727b2
net/HostParser: use std::string_view instead of StringView
2022-05-31 13:44:25 +02:00
Max Kellermann
d5db4ca0e7
net/SocketAddress: GetSteadyPart() returns std::span
2022-05-31 13:32:27 +02:00
Max Kellermann
774024a41b
net/SocketAddress: add std::span cast operator
2022-05-19 20:52:48 +02:00
Max Kellermann
601e5e6abc
net/AddressInfo: add noexcept
2022-04-26 21:17:01 +02:00
dgcampea
4f3828237a
Fix DSCP LE value
...
Correct value is 0x04 since we need to account for the 2 ECN bits.
2022-02-02 16:29:01 +00:00
Max Kellermann
16f7ec9950
net/DscpParser: new library
2022-01-11 20:31:52 +01:00
Max Kellermann
089a843abd
net/SocketDescriptor: add method SetIntOption()
2022-01-10 21:36:15 +01:00
Max Kellermann
c30466b84a
net/IPv4Address: add method GetPortBE()
2021-11-26 16:25:43 +01:00
Max Kellermann
868f1a4431
net/UniqueSocketDescriptor, ...: include <utility> instead of <algorithm>
...
Since C++11, std::swap() lives in <utility>.
2021-11-26 16:25:29 +01:00
Rosen Penev
94b0baceb0
convert address_family_ranking to std::array
...
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-11 01:27:31 -08:00
Max Kellermann
77d74b404e
Permission: add option "host_permissions"
...
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1115
2021-10-14 14:44:18 +02:00
Max Kellermann
f510564d9d
more [[gnu::...]] attributes
2021-10-13 12:07:05 +02:00
Max Kellermann
b394d8d059
net/Resolver: include cleanup
2021-10-13 11:06:10 +02:00
Max Kellermann
4a1c231734
net/SocketError: use constexpr
2021-04-06 13:59:58 +02:00
Max Kellermann
fd0e958e95
net/SocketError: use auto
2021-04-06 13:58:46 +02:00
Max Kellermann
3d814115c8
net/SocketError: change "const" to "pure"
2021-04-06 13:58:32 +02:00
Max Kellermann
3456b1e50d
use std::size_t
2021-02-12 18:39:28 +01:00
Max Kellermann
6cdb3ff21e
use [[gnu::pure]] instead of gcc_pure
...
This is semi-standard and doesn't require the util/Compiler.h header.
2021-02-12 18:34:16 +01:00
Max Kellermann
d56a51cb5e
Merge branch 'v0.22.x'
2021-01-21 22:28:11 +01:00
Max Kellermann
9e2d09dabc
net/SocketError: add syscall specific check functions
...
Fixes Windows compatibility.
2021-01-21 22:05:21 +01:00
Max Kellermann
2719f62feb
net/SocketError: relicense to BSD-2
2021-01-21 21:31:02 +01:00
Max Kellermann
bcb7e954e9
net/Resolver: add simple getaddrinfo() wrapper
2021-01-12 15:43:26 +01:00