Max Kellermann
ce49d99c2f
check.h: remove obsolete header
...
Since we switched from autotools to Meson in commit
94592c1406
, we don't need to include
`config.h` early to properly enable large file support. Meson passes
the required macros on the compiler command line instead of defining
them in `config.h`.
This means we can include `config.h` at any time, whenever we want to
check its macros, and there are no ordering constraints.
2018-11-19 16:33:49 +01:00
Max Kellermann
5a5229b499
net/IPv[46]Address: make the initializers more portable
...
Thanks to C++14, we can declare and fill variables inside `constexpr`
functions. This means me can stop make assumptions on the `struct`
layouts without losing `constexpr`.
Closes #393
2018-11-02 17:47:43 +01:00
Max Kellermann
f5c9071494
*: copyright year 2018
2018-10-31 17:54:59 +01:00
Max Kellermann
f5857c4689
net/SocketUtil: update API documentation
2018-10-30 19:56:10 +01:00
Max Kellermann
94592c1406
build with Meson instead of autotools
...
So long, autotools! This is my last MPD related project to migrate
away from it. It has its strengths, but also very obvious weaknesses
and weirdnesses. Today, many of its quirks are not needed anymore,
and are cumbersome and slow. Now welcome our new Meson overlords!
2018-10-14 23:41:38 +02:00
Max Kellermann
dda5516eec
net/IPv6Address: pass reference to Cast()
2018-08-21 20:21:41 +02:00
Max Kellermann
adc5c5db88
net/IPv4Address: pass reference to Cast()
2018-08-21 20:16:57 +02:00
Max Kellermann
9151b84c25
net/AllocatedSocketAddress: convert operator== to template
2018-08-21 12:26:19 +02:00
Max Kellermann
5d7dd12f7a
net/SocketDescriptor: add multicast methods
2018-08-21 11:37:19 +02:00
Max Kellermann
21783ff5f7
net/SocketDescriptor: remove unnecessary SO_REUSEPORT check
2018-08-21 11:35:29 +02:00
Max Kellermann
fd923d5d96
net/SocketDescriptor: add Shutdown()
2018-08-21 11:31:58 +02:00
Max Kellermann
ebf607eef8
net/SocketDescriptor: fix SOCK_NONBLOCK flag in CreateSocketPairNonBlock()
2018-08-21 11:27:15 +02:00
Max Kellermann
e092eadd8d
net/SocketDescriptor: add "noexcept"
2018-08-21 11:08:34 +02:00
Max Kellermann
185148f57c
net/SocketAddress: add cast to size_type
2018-08-21 11:06:05 +02:00
Max Kellermann
ede7434901
net/SocketAddress: add GetSteadyPart()
2018-08-21 10:57:46 +02:00
Max Kellermann
ba3b422ce5
net/SocketDescriptor: make accept4() mandatory on Linux
2018-08-21 10:53:54 +02:00
Max Kellermann
1f3ce380ed
net/SocketAddress: reimplement GetPort() using IPv4Address::GetPort()
2018-08-21 10:49:55 +02:00
Max Kellermann
dfc1f6342a
net/SocketAddress: add IsV4Mapped()
2018-08-21 10:48:37 +02:00
Max Kellermann
94092f1f90
net/SocketAddress: reimplement IsV6Any() using IPv6Address::IsAny()
2018-08-21 10:46:20 +02:00
Max Kellermann
a84b83f20f
net/IPv6Address: new class
2018-08-21 10:39:54 +02:00
Max Kellermann
614e410fe7
net/Resolver: update copyright year
2018-08-21 10:30:24 +02:00
Max Kellermann
4a1e885c0a
net/Resolver: replace with more advanced implementation
...
The new implementation is copied from another project and is
BSD-licensed. It is exception-safe and can parse IPv6 scope ids with
interface names.
2018-08-21 08:26:12 +02:00
Max Kellermann
ec54754e22
Compiler.h: move to util/
2018-08-20 16:19:17 +02:00
Max Kellermann
0ebba73cb8
net/SocketDescriptor: add method GetPeerCredentials()
2018-08-20 16:11:17 +02:00
Max Kellermann
50c7337965
net/SocketDescriptor: add GetType(), IsStream()
2018-08-20 16:06:58 +02:00
Max Kellermann
b5c569cd30
system/FileDescriptor: add IsPipe(), IsSocket()
2018-08-20 16:05:03 +02:00
Max Kellermann
11396d4fba
net/SocketAddress: add method GetLocalRaw()
2018-08-20 15:59:17 +02:00
Max Kellermann
4c6ae4e9e8
net/IPv4Address: add various helper methods
2018-08-20 15:57:13 +02:00
Max Kellermann
9cb9154b08
net/IPv4Address: add struct sockaddr_in constructor
2018-08-20 15:57:13 +02:00
Max Kellermann
234a6193bb
net/SocketAddress: make GetAddress() constexpr
2018-08-20 15:57:13 +02:00
Max Kellermann
2bf5f32224
net/IPv4Address: add API documentation
2018-08-20 15:50:25 +02:00
Max Kellermann
82d0f68acf
net/IPv4Address: add static method ConstructInAddrBE()
2018-08-20 15:48:52 +02:00
Max Kellermann
616c8383c0
net/IPv4Address: check _WIN32 instead of WIN32
2018-08-20 15:48:49 +02:00
Max Kellermann
5de46268af
net/IPv4Address: add "noexcept"
2018-08-20 15:43:35 +02:00
1848
4797357fa9
fixed setting unix socket permissions
...
first call fchmod() to prevent TOCTTOU, then apply permissions using
chmod()
2018-08-14 22:53:19 +02:00
1848
737267cedc
Moved call to fchmod() on socket from OneServerSocket::Open() to socket_bind_listen()
2018-08-07 22:01:13 +02:00
Max Kellermann
d4ce9c0df2
system/FileDescriptor: no-op implementation of *CloseOnExec() on Windows
...
Fixes the NFS client build, closes #305 .
2018-07-13 18:16:39 +02:00
Max Kellermann
1fb358249b
Merge branch 'v0.20.x'
2018-02-24 23:18:25 +01:00
Max Kellermann
418f71ec0f
net/Init: work around -Werror=unused-variable
2018-02-24 23:17:36 +01:00
Max Kellermann
b30a510b45
release v0.20.18
...
-----BEGIN PGP SIGNATURE-----
iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAlqR3zoQHG1heEBtdXNp
Y3BkLm9yZwAKCRAjbopYxttFEqNGEACGhsZJbhqls0EawfHhpOz/x7JcloMLWvoX
GzuvVinhdFmmFId0akLsg3TCyGElNA+4YzfDjB1TyMpPFBUxM/nnthYPrSmjiT68
t+0IV6OnqFVLE2PF6pHV2Gia0Km746GZBJ+TRLeZSIksADH7nU+soepIA6idwNRN
x8Wo0ashsRIPG3FyL6f/2W/vUvD/enoxohCBB/tvnZ73Px0k2bYAwlBNW/i9/yrX
ktJ2yJqbCkKOhBQnbUvsG72Nrd4/Iz2m7cA//KBVrDEGwNv5hxNKiK/hCq3YK2W9
Ndnl0+EQxNLT1NUwF5e1LS3GtU2Mh3FQwrcq81Cj7o/wEH5e7piKBZhwDCBgOYYH
vLbaLYWK+XW/EqitkRZx5ZBrfNoqOrLreX0d2+AZJOjKDjAWgMZXoOEjmQC9/Dcj
pGcRow4jAusBRJKVN0Wmu6eeVQMjiYJNWehhyhhruShHL2ZAjJSuDhygAFW5YB3I
N2kfhwZWMHVFpA0HvcVx5JwNx7U1OyJGs0lRGThV/6jhnklGzoujvomRNJ6VNx10
ppYhmcLaHm19GR1eb8KCYnZYL2QWoQT5YLVlm0vybTX9i1k3wdf9ezU/n5hB52rP
j20Ol1I9YQw4/L985SV1W+8ll1i71o9paoJx17C8AQpxWWamQLe+vgENt9fPKIPl
aLBYU7hq9Q==
=ndLr
-----END PGP SIGNATURE-----
Merge tag 'v0.20.18'
release v0.20.18
2018-02-24 23:16:06 +01:00
Max Kellermann
5b80711d75
Main: move WinSock initialization to class ScopeNetInit
2018-02-24 22:44:27 +01:00
François Revol
7b2283c28b
configure.ac: autodetect sin_len member in struct sockaddr_in.
...
This fixes a build issue on Haiku as it does have sin_len.
Tested on Linux as well.
For some reason AC_CHECK_MEMBER doesn't generate the proper define
in config.h.in, so I used AC_CHECK_MEMBERS.
2018-01-05 22:20:47 +01:00
Max Kellermann
6246d36fe6
Merge branch 'v0.20.x'
2017-12-16 20:56:06 +01:00
Max Kellermann
dfaf08743c
*: check defined(_WIN32) instead of defined(WIN32)
...
Only _WIN32 is defined by the compiler, and WIN32 is not standardized
and may be missing.
Closes #169
2017-12-12 10:22:20 +01:00
Christopher Zimmermann
4d563e08e1
Fix building on BSDs
2017-09-16 09:14:11 +02:00
Max Kellermann
8a81b986c0
net/AllocatedSocketAddress: pass SocketAddress by value to operator!=
2017-09-13 17:51:51 +02:00
Max Kellermann
d705a92e43
net/IPv4Address: new class
2017-08-11 09:09:04 +02:00
Max Kellermann
614b3634d4
net/SocketDescriptor: add AcceptNonBlock() overload without address
2017-08-11 09:07:35 +02:00
Max Kellermann
b234f4307f
net/SocketDescriptor: AcceptNonBlock() enables non-blocking even if SOCK_NONBLOCK is unavailable
2017-08-11 09:04:38 +02:00
Max Kellermann
e38c213ee0
net/SocketDescriptor: check HAVE_ACCEPT4
2017-08-11 09:04:10 +02:00
Max Kellermann
cf0120e8e0
net/SocketUtil: use SocketDescriptor::SetBoolOption()
2017-08-10 19:30:46 +02:00
Max Kellermann
1f47dc990d
net/SocketDescriptor: add method SetKeepAlive()
2017-08-10 19:25:02 +02:00
Max Kellermann
39f422ded8
net/SocketDescriptor: allow constructing with "int"
2017-08-10 17:37:08 +02:00
Max Kellermann
d2cdaa041c
net/SocketDescriptor: SO_REUSEADDR is portable
2017-08-10 13:23:14 +02:00
Max Kellermann
d84dae488e
net/SocketUtil: fix -Wunused
2017-08-10 13:22:00 +02:00
Max Kellermann
79e75bfbb9
net/SocketDescriptor: cast setsockopt() value to "const char *" for Windows
2017-08-10 13:21:24 +02:00
Max Kellermann
73b15c1bee
net/SocketDescriptor: socketpair() is unavailable on Windows
2017-08-10 13:19:47 +02:00
Max Kellermann
b180604422
net/SocketDescriptor: implement SetNonBlocking() on Windows
2017-08-10 13:18:23 +02:00
Max Kellermann
fab12ef241
net/SocketDescriptor: call SetNonBlocking() on Linux if SOCK_NONBLOCK unavailable
2017-08-10 13:16:25 +02:00
Max Kellermann
917881aa48
net/SocketDescriptors: IsValid() is not available on Windows
2017-08-10 13:15:57 +02:00
Max Kellermann
9259e989a4
net/SocketDescriptors: fix includes for Windows
2017-08-10 13:13:19 +02:00
Max Kellermann
da90f484aa
net/SocketUtil: socket_bind_listen() returns UniqueSocketDescriptor
2017-08-10 13:12:13 +02:00
Max Kellermann
817e912025
net/SocketDescriptor: specialization of FileDescriptor for network sockets
2017-08-10 13:12:13 +02:00
Max Kellermann
7f83d38bca
net/StaticSocketAddress: add struct sockaddr cast operators
2017-08-10 13:12:13 +02:00
Max Kellermann
54de8b8e77
net/*, ...: use AF_LOCAL instead of AF_UNIX
2017-08-10 13:12:13 +02:00
Max Kellermann
796956970e
net/StaticSocketAddress: pass SocketAddress by value to operator!=
2017-08-10 13:12:13 +02:00
Max Kellermann
c0020142da
net/StaticSocketAddress: add method SetMaxSize()
2017-08-10 13:12:13 +02:00
Max Kellermann
ee6eea95af
net/StaticSocketAddress: set a valid size in Clear()
2017-08-10 13:12:13 +02:00
Max Kellermann
ae713cb099
*: add lots of "noexcept" specifications
2017-06-04 13:09:11 +02:00
Max Kellermann
979f1b6c39
release v0.20.9
...
-----BEGIN PGP SIGNATURE-----
iQJEBAABCAAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAlkz5jkQHG1heEBtdXNp
Y3BkLm9yZwAKCRAjbopYxttFEubuD/kBXMcV4XawqGNNtSHdrY8CxSL8wJMCMJQl
aMgRkKLPRml8Hj9FNNG9pjXBuT+qUgPX7t9gBEiT7c+sV3fHH40gUf1js5GIsEPm
BAVfvww5EhmQWWVhPTLk1iZ4jp6E96mDmIG1znwo7etSZHXU8RJfR7woBi3SPJ9f
OPcrimskNuWpAWeaEIKi/1Iwzy8d9VK9Ttb73gA3M5zSm7ioXzt3YClpwLRM8JU6
QeUJchy6VwXnygswjUNmbhPc3GsD2FyUZ4OtJ0hodnqqajfldBxhcHUnQk4zZULr
1nLSyOuA9bwLuFohH1T6HiY9z8PFzgqdIHvsjOJgZ4gQa69PVNjal2tUEUav9zFv
aK4LvTVPnIk+hqRbtLpV7/rPKuClrC9BO4oYdBGBDNY4hqVpvRA9obP1s00aOi+K
UhYqLqg7yeIEeTlUxFOhXJCKAEL69BuXT5ihJtDlB/dCUzv37sEch/4WDgs7uc+O
9kJYlElvozw57mbczsee/PCSnSWrLCq/qG/bNEUUQOTueWNuifh3PL62UXGgfbEH
01hJDyLr6ETSmWn7rjTfLJiHThX/EQQvOhs+35fbCyry65z4tFwrilGDmFVUWGPq
/6QEpY1D6q4fkoma/iWOZoTkfKewatAPGMGWoJaGhCnfQFz4VTFtS2bDtuUctQ16
jnXnPFxqBw==
=0SSp
-----END PGP SIGNATURE-----
Merge tag 'v0.20.9'
release v0.20.9
2017-06-04 12:57:05 +02:00
Max Kellermann
a057b4f6d8
*: add lost of "noexcept" specifications
2017-06-04 12:46:48 +02:00
Max Kellermann
3bcabad28c
net/SocketAddress: add method IsV6Any()
2017-05-17 12:22:59 +02:00
Max Kellermann
c629ac7168
net/SocketAddress: add more "noexcept"
2017-05-17 12:21:36 +02:00
Max Kellermann
0195d5590f
net/AllocatedSocketAddress: allow copying
2017-05-17 12:19:24 +02:00
Max Kellermann
e7bebb0089
net/AllocatedSocketAddress: add more "noexcept"
2017-05-17 12:07:20 +02:00
Max Kellermann
7b05df8d33
net/AllocatedSocketAddress: use C++11 initializers
2017-05-17 12:06:45 +02:00
Max Kellermann
a8db9ae304
net/StaticSocketAddress: add method SetPort()
2017-05-17 12:03:45 +02:00
Max Kellermann
e6e9b2041e
net/AllocatedSocketAddress: add method SetPort()
2017-05-17 09:36:01 +02:00
Max Kellermann
77c747a8fd
net/SocketAddress: add method GetPort()
2017-05-17 09:28:12 +02:00
Max Kellermann
71f0ed8b74
*: add "noexcept" to many, many function prototypes
...
This eliminates some overhead, because the compiler doesn't need to
consider these functions throwing.
2017-05-08 14:44:49 +02:00
Max Kellermann
6eea56861b
AUTHORS, ...: update my email address
2017-01-17 11:54:55 +01:00
Max Kellermann
5900253b85
update copyright year
2017-01-03 20:48:59 +01:00
Max Kellermann
22dcca9832
util/Error: remove obsolete class
2016-11-10 12:58:26 +01:00
Max Kellermann
8c4246f2ad
net/SocketError: remove obsolete Error functions
2016-11-07 08:58:26 +01:00
Max Kellermann
aead221184
event/ServerSocket: migrate from class Error to C++ exceptions
2016-10-28 21:22:25 +02:00
Lazaros Koromilas
f59ca94416
net/Resolver: correct includes for gettaddrinfo(3)
...
Signed-off-by: Lazaros Koromilas <lostd@2f30.org>
2016-06-12 16:36:17 +02:00
Max Kellermann
1aee89f5ea
*: include cleanup (using iwyu)
2016-03-01 22:08:13 +01:00
Max Kellermann
1d67aa7bf2
update copyright year to 2016
2016-02-26 17:54:05 +01:00
François Revol
193ffa06d9
system/SocketUtil: guard usage of SO_PASSCRED
...
Haiku has struct ucred but no SO_PASSCRED (yet).
2015-09-17 22:46:46 +02:00
Max Kellermann
f084bbbf35
net/AllocatedSocketAddress: new sockaddr wrapper class
2015-07-22 10:56:35 +02:00
Max Kellermann
20d69b957f
Net/StaticSocketAddress: add equality operator with SocketAddress
2015-07-22 10:56:32 +02:00
Max Kellermann
7de0a621e3
net/StaticSocketAddress: replace cast operator with GetAddress()
...
The implicit cast operator can be very dangerous.
2015-07-22 10:55:57 +02:00
Max Kellermann
3441ea9844
net/ToString: relicense to BSD-2
2015-07-22 10:26:18 +02:00
Max Kellermann
83752e9349
net/ToString: rename sockaddr_to_string() to ToString()
2015-07-22 10:26:18 +02:00
Max Kellermann
8fdfe85b5f
net/ToString: move V4 mapping code to functions
2015-07-22 10:26:18 +02:00
Max Kellermann
d4d9a85ad8
net/ToString: make variables more local
2015-07-22 10:26:18 +02:00
Max Kellermann
6f22452b54
net/Resolver: move sockaddr_to_string() to ToString.cxx
2015-07-22 10:03:36 +02:00
Max Kellermann
a4a37d7a19
net/StaticSocketAddress: remove unused method SetLocal()
2015-07-21 14:42:46 +02:00
Max Kellermann
d1b1a8e490
net/StaticSocketAddress: include cleanup
2015-07-21 13:56:21 +02:00
Max Kellermann
104fe124df
net/StaticSocketAddress: disable SetLocal() on Android
...
Fixes build failure because Bionic doesn't provide SUN_LEN().
2015-07-21 12:08:25 +02:00
Max Kellermann
5bdbd74d59
net: add header Features.hxx
...
For improved portability of the net library to projects without
autoconf.
2015-07-21 11:57:53 +02:00
Max Kellermann
e621c24270
net/StaticSocketAddress: include config.h
2015-07-21 11:57:53 +02:00
Max Kellermann
554888318a
net/StaticSocketAddress: use SocketAddress::size_type
2015-07-21 10:39:50 +02:00
Max Kellermann
49aaf98a7f
net/StaticSocketAddress: include cleanup
2015-07-21 10:38:58 +02:00
Max Kellermann
b31d171ae8
*: doxygen fixups
2015-03-17 11:21:43 +01:00
Max Kellermann
65ff72cdf8
fs/Traits: enable _UNICODE on Windows
...
Use wchar_t for everything on Windows. Solves a lot of filesystem
charset problems.
2015-03-05 10:15:10 +01:00
Max Kellermann
12de22d3bb
net/StaticSocketAdress: new class wrapping struct sockaddr_storage
2015-02-13 21:16:43 +01:00
Max Kellermann
6e66a5b77b
net/Resolver: relax size check in LocalAddressToString()
...
Handles abstract sockets on Linux.
2015-02-10 22:47:26 +01:00
Max Kellermann
cf5c10bbe6
net/Resolver: move code to LocalAddressToString()
2015-02-10 22:46:04 +01:00
Max Kellermann
4e30e74739
net/SocketAddress: light wrapper for struct sockaddr
2015-02-10 22:06:06 +01:00
Max Kellermann
42890b9acf
system/{Resolver,Socket{Error,Util}}: move to new library libnet.a
2015-02-10 22:06:06 +01:00