21#ifndef IO_CUSTOMIZATION_HPP 
   22#define IO_CUSTOMIZATION_HPP 
   41struct getpeername_t {};
 
   42struct getsockname_t {};
 
   43struct getsockopt_t {};
 
   47struct setsockopt_t {};
 
   60template <
typename T> 
struct cpo {
 
   68  template <
typename... Args>
 
   69  constexpr auto operator()(Args &&...args) 
const -> 
decltype(
auto)
 
   71    return tag_invoke(
static_cast<T *
>(
nullptr), std::forward<Args>(args)...);
 
   94                   std::span<std::byte> address = {}) -> 
decltype(
auto)
 
   96  static constexpr cpo<accept_t> 
accept{};
 
   97  return accept(std::forward<
decltype(socket)>(socket), std::move(address));
 
 
  107                 std::span<const std::byte> address) -> 
decltype(
auto)
 
  109  static constexpr cpo<bind_t> 
bind{};
 
  110  return bind(std::forward<
decltype(socket)>(socket), std::move(address));
 
 
  121                    std::span<const std::byte> address) -> 
decltype(
auto)
 
  123  static constexpr cpo<connect_t> 
connect{};
 
  124  return connect(std::forward<
decltype(socket)>(socket), std::move(address));
 
 
  134inline auto fcntl(
auto &&socket, 
int cmd, 
auto &&...args) -> 
decltype(
auto)
 
  136  static constexpr cpo<fcntl_t> 
fcntl{};
 
  137  return fcntl(std::forward<
decltype(socket)>(socket), cmd,
 
  138               std::forward<
decltype(args)>(args)...);
 
 
  148                        std::span<std::byte> address) -> 
decltype(
auto)
 
  151  return getpeername(std::forward<
decltype(socket)>(socket),
 
 
  166                       std::span<std::byte> option) -> 
decltype(
auto)
 
  168  static constexpr cpo<getsockopt_t> 
getsockopt{};
 
  169  return getsockopt(std::forward<
decltype(socket)>(socket), level, optname,
 
 
  180                        std::span<std::byte> address) -> 
decltype(
auto)
 
  183  return getsockname(std::forward<
decltype(socket)>(socket),
 
 
  193inline auto listen(
auto &&socket, 
int backlog) -> 
decltype(
auto)
 
  195  static constexpr cpo<listen_t> 
listen{};
 
  196  return listen(std::forward<
decltype(socket)>(socket), backlog);
 
 
  207inline auto recvmsg(
auto &&socket, 
auto &&msg, 
int flags) -> 
decltype(
auto)
 
  209  static constexpr cpo<recvmsg_t> 
recvmsg{};
 
  210  return recvmsg(std::forward<
decltype(socket)>(socket),
 
  211                 std::forward<
decltype(msg)>(msg), flags);
 
 
  222inline auto sendmsg(
auto &&socket, 
auto &&msg, 
int flags) -> 
decltype(
auto)
 
  224  static constexpr cpo<sendmsg_t> 
sendmsg{};
 
  225  return sendmsg(std::forward<
decltype(socket)>(socket),
 
  226                 std::forward<
decltype(msg)>(msg), flags);
 
 
  239                       std::span<const std::byte> option) -> 
decltype(
auto)
 
  241  static constexpr cpo<setsockopt_t> 
setsockopt{};
 
  242  return setsockopt(std::forward<
decltype(socket)>(socket), level, optname,
 
 
  252inline auto shutdown(
auto &&socket, 
int how) -> 
decltype(
auto)
 
  254  static constexpr cpo<shutdown_t> 
shutdown{};
 
  255  return shutdown(std::forward<
decltype(socket)>(socket), how);
 
 
auto listen(auto &&socket, int backlog) -> decltype(auto)
Sets a socket to listen for incoming connections.
Definition customization.hpp:193
auto sendmsg(auto &&socket, auto &&msg, int flags) -> decltype(auto)
Sends a message on a socket.
Definition customization.hpp:222
auto shutdown(auto &&socket, int how) -> decltype(auto)
Shuts down all or part of a connection on a socket.
Definition customization.hpp:252
auto accept(auto &&socket, std::span< std::byte > address={}) -> decltype(auto)
Accepts an incoming connection on a listening socket.
Definition customization.hpp:93
auto getsockname(auto &&socket, std::span< std::byte > address) -> decltype(auto)
Gets the local address of a socket.
Definition customization.hpp:179
auto getpeername(auto &&socket, std::span< std::byte > address) -> decltype(auto)
Gets the peer address of a connected socket.
Definition customization.hpp:147
auto bind(auto &&socket, std::span< const std::byte > address) -> decltype(auto)
Binds a socket to a local address.
Definition customization.hpp:106
auto setsockopt(auto &&socket, int level, int optname, std::span< const std::byte > option) -> decltype(auto)
Sets a socket option.
Definition customization.hpp:238
auto fcntl(auto &&socket, int cmd, auto &&...args) -> decltype(auto)
Performs a file control operation on a socket.
Definition customization.hpp:134
auto connect(auto &&socket, std::span< const std::byte > address) -> decltype(auto)
Connects a socket to a remote address.
Definition customization.hpp:120
auto getsockopt(auto &&socket, int level, int optname, std::span< std::byte > option) -> decltype(auto)
Gets a socket option.
Definition customization.hpp:165
auto recvmsg(auto &&socket, auto &&msg, int flags) -> decltype(auto)
Receives a message from a socket.
Definition customization.hpp:207
The io namespace contains all the functions and classes for the I/O library.
Definition executor.hpp:33