Commit Graph

256 Commits

Author SHA1 Message Date
Max Kellermann 9ff8e02e54 net/Resolver: use StringIsEqual() 2024-09-04 17:26:45 +02:00
Max Kellermann c866199d4c net/SocketError: cast to socket_error_t to fix -Wsign-compare
Only relevant on Windows where socket_error_t is a `DWORD` (unsigned).
2024-08-30 12:45:10 +02:00
Max Kellermann f535ccf9bf net/UniqueSocketDescriptor: add UniqueFileDescriptor constructor 2024-08-30 12:28:19 +02:00
Max Kellermann 75eb2c257c net/SocketError: add IsSocketError() overload with socket_error_t 2024-08-30 12:27:19 +02:00
Max Kellermann 314667259e net/SocketDescriptor: add Duplicate() method
The the Duplicate() method we inherited from class FileDescriptor
returns a UniqueFileDescriptor, but we really want to return a
UniqueSocketDescriptor.
2024-08-30 12:27:13 +02:00
Max Kellermann dbb2b29271 net/IPv6Address: add method GetPortBE() 2024-08-30 12:24:12 +02:00
Max Kellermann 7f25ede888 net/AddressInfo: add method Cast() 2024-08-30 12:23:45 +02:00
Max Kellermann d24e7763f6 net/AddressInfo: remove unnecessary operator!=()
The compiler must generate this implicitly from operator==().
2024-07-23 13:05:19 +02:00
Max Kellermann ea96b321dc net/SocketAdddress: remove unnecessary operator!=()
The compiler must generate this implicitly from operator==().
2024-07-23 13:04:48 +02:00
Max Kellermann d3ef4ab234 net/FormatAddress: new library to replace ToString.cxx
This library writes to a caller-specified buffer instead of
allocating a std::string which can be faster by avoiding heap
allocations.
2024-07-05 18:38:17 +02:00
Max Kellermann 432bfa15f4 net/SocketError: move check to IsSocketError() 2024-06-25 20:29:27 +02:00
Max Kellermann 03b674ce73 net/meson.build: compile IPv[46]Address.cxx only if TCP is enabled 2024-05-06 12:57:55 +02:00
Max Kellermann 9c421997bf net/SocketDescriptor: WriteNoWait() uses MSG_NOSIGNAL 2024-05-06 12:55:02 +02:00
Max Kellermann 73509fc189 net/LocalSocketAddress: new class wrapping struct sockaddr_un 2024-05-06 12:54:45 +02:00
Max Kellermann 7c9b7fa311 net/SocketAddress: use std::string_view::find() instead of std::memchr() 2024-05-06 12:54:45 +02:00
Max Kellermann cbba22c947 net/SocketAddress: include IPv[46]Address.hxx only ifdef HAVE_TCP 2024-05-06 12:50:44 +02:00
Max Kellermann f8529d4fe6 net/{Allocated,Static}SocketAddress: inline GetLocalRaw() 2024-05-06 12:50:29 +02:00
Max Kellermann 2a206ef309 net/StaticSocketAddress: add method GetLocalPath() 2024-05-06 12:50:24 +02:00
Max Kellermann 6200c0dc46 net/StaticSocketAddress: include <string_view> only ifdef HAVE_UN 2024-05-06 12:50:19 +02:00
Max Kellermann 6830cf9dcf net/AllocatedSocketAddress: add SetLocal() overload with std::string_view 2024-05-06 12:48:42 +02:00
Max Kellermann 1e4bf90c60 io, net, evnet: quote file names in error messages 2024-04-10 13:36:05 +02:00
Max Kellermann 011b96ff98 net/UniqueSocketDescriptor: add method MoveToFileDescriptor() 2024-04-04 09:16:44 +02:00
Max Kellermann 9c68f24cfc net/SocketError: fix typo
Whoops.  This function has never been used.
2024-03-11 15:32:24 +01:00
Max Kellermann be84b189dc util, io, net, ...: use "#pragma once" 2024-03-11 15:32:24 +01:00
Max Kellermann b68c3b7f55 net/SocketDescriptor: disable msghdr methods on Windows 2024-01-18 15:44:44 +01:00
Max Kellermann 0fbed6dec1 net/SocketDescriptor: remove misplaced [[nodiscard]] 2024-01-18 15:44:43 +01:00
Max Kellermann 6f6cbeba80 net/SocketDescriptor: add Send()/Receive() overloads with iovec 2024-01-13 22:32:35 +01:00
Max Kellermann 974ed0166c net/SocketDescriptor: add sendmsg(), recvmsg() wrappers 2024-01-13 22:31:58 +01:00
Max Kellermann a91920a8ff net/SocketDescriptor: pass span<byte> to Read()/Write() 2024-01-13 22:31:34 +01:00
Max Kellermann 7cd38dde09 net/SocketDescriptor: add [[nodiscard]] 2024-01-13 22:31:24 +01:00
Max Kellermann 7f439b01a3 net/SocketAddress: move code to IsInet() 2024-01-08 13:48:13 +01:00
Max Kellermann 0fd6f83766 net/StaticSocketAddress: add `constexpr` 2024-01-08 13:48:05 +01:00
Max Kellermann b15b2125e2 net/AddressInfo: add methods IsInet(), IsTCP() 2024-01-08 13:47:59 +01:00
Max Kellermann 0dfd7e3d8c net/SocketDescriptor: SO_PROTOCOL is really Linux-specific 2023-11-25 23:03:30 +01:00
Max Kellermann 6dc708f53f net/SocketDescriptor: use method GetOption() internally 2023-11-25 21:58:17 +01:00
Max Kellermann 60033f3eb4 net/SocketDescriptor: add method GetProtocol() 2023-11-25 21:58:09 +01:00
Max Kellermann 1239e075b8 net/SocketDescriptor: add method GetIntOption() 2023-11-25 21:56:07 +01:00
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