17#ifndef TOOLBOX_NET_SOCKET_HPP
18#define TOOLBOX_NET_SOCKET_HPP
26#include <netinet/tcp.h>
27#include <linux/net_tstamp.h>
37 std::error_code&
ec)
noexcept
54 "getaddrinfo (" + std::string{
node ?
node :
""} +
")"};
61 int protocol, std::error_code&
ec)
noexcept
66 hints.ai_family = family;
67 hints.ai_socktype = type;
68 hints.ai_protocol = protocol;
79 hints.ai_family = family;
80 hints.ai_socktype = type;
81 hints.ai_protocol = protocol;
86template <
typename ProtocolT>
88 std::error_code&
ec)
noexcept
94template <
typename ProtocolT>
107 return std::string{
buffer};
118 return std::string{
buffer};
166template <
typename ProtocolT>
169 return socket(protocol.family(), protocol.type(), protocol.protocol(),
ec);
173template <
typename ProtocolT>
176 return socket(protocol.family(), protocol.type(), protocol.protocol());
180inline std::pair<FileHandle, FileHandle>
socketpair(
int family,
int type,
int protocol,
181 std::error_code&
ec)
noexcept
191inline std::pair<FileHandle, FileHandle>
socketpair(
int family,
int type,
int protocol)
201template <
typename ProtocolT>
203 std::error_code&
ec)
noexcept
205 return socketpair(protocol.family(), protocol.type(), protocol.protocol(),
ec);
209template <
typename ProtocolT>
212 return socketpair(protocol.family(), protocol.type(), protocol.protocol());
217 std::error_code&
ec)
noexcept
261template <
typename Endpo
intT>
267 ep.resize(std::min<std::size_t>(
addrlen,
ep.capacity()));
273template <
typename Endpo
intT>
278 ep.resize(std::min<std::size_t>(
addrlen,
ep.capacity()));
299template <
typename Endpo
intT>
306template <
typename Endpo
intT>
314 std::error_code&
ec)
noexcept
330template <
typename Endpo
intT>
337template <
typename Endpo
intT>
452template <
typename Endpo
intT>
454 std::error_code&
ec)
noexcept
459 ep.resize(std::min<std::size_t>(
addrlen,
ep.capacity()));
465template <
typename Endpo
intT>
470 ep.resize(std::min<std::size_t>(
addrlen,
ep.capacity()));
475template <
typename Endpo
intT>
477 std::error_code&
ec)
noexcept
483template <
typename Endpo
intT>
491 std::error_code&
ec)
noexcept
545template <
typename Endpo
intT>
547 std::error_code& )
noexcept
553template <
typename Endpo
intT>
561template <
typename Endpo
intT>
563 std::error_code&
ec)
noexcept
570template <
typename Endpo
intT>
579 std::error_code&
ec)
noexcept
599template <
typename Endpo
intT>
605 ep.resize(std::min<std::size_t>(
addrlen,
ep.capacity()));
610template <
typename Endpo
intT>
615 ep.resize(std::min<std::size_t>(
addrlen,
ep.capacity()));
620 std::error_code&
ec)
noexcept
637 std::error_code&
ec)
noexcept
653inline namespace net {
658template <
typename Endpo
intT>
664template <
typename Endpo
intT>