#ifndef SHARED_NET_NET_HH_ #define SHARED_NET_NET_HH_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "shared/shared.hh" namespace shared { namespace net { std::string get_net_error(const int code) noexcept; std::string get_errno_error() noexcept; std::shared_ptr get_addr_info(const std::string_view address, const std::string_view port, const addrinfo* const hints); int make_socket(const addrinfo* const info); void bind_socket(const int socket, const addrinfo* const info); void connect_socket(const int socket, const addrinfo* const info); void nonblock_socket(const int sock); void listen_socket(const int socket); void* get_info_address(sockaddr& info) noexcept; void close_socket(const int sock); // Return socket and the sockaddr_storage we get from an accept call. struct accept_ret { sockaddr_storage storage; int socket; }; std::optional get_accept(const int socket); std::size_t get_backlog_size(const int sock); std::string get_socket_host_address(const int sock); std::string get_socket_host_port(const int sock); std::string get_socket_peer_address(const int sock); std::string get_socket_peer_port(const int sock); } // namespace net } // namespace shared #endif