Toolbox snapshot
The Reactive C++ Toolbox
Loading...
Searching...
No Matches
Classes | Namespaces | Typedefs | Functions
Socket.hpp File Reference
#include <toolbox/net/Error.hpp>
#include <toolbox/io/File.hpp>
#include <net/if.h>
#include <netdb.h>
#include <netinet/tcp.h>
Include dependency graph for Socket.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  toolbox::net::Sock
 

Namespaces

namespace  toolbox
 
namespace  toolbox::net
 
namespace  toolbox::os
 

Typedefs

using toolbox::net::AddrInfoPtr = std::unique_ptr< addrinfo, void(*)(addrinfo *)>
 

Functions

AddrInfoPtr toolbox::os::getaddrinfo (const char *node, const char *service, const addrinfo &hints, std::error_code &ec) noexcept
 Get network address from Internet host and service.
 
AddrInfoPtr toolbox::os::getaddrinfo (const char *node, const char *service, const addrinfo &hints)
 Get network address from Internet host and service.
 
AddrInfoPtr toolbox::os::getaddrinfo (const char *node, const char *service, int family, int type, int protocol, std::error_code &ec) noexcept
 Get network address from Internet host and service.
 
AddrInfoPtr toolbox::os::getaddrinfo (const char *node, const char *service, int family, int type, int protocol)
 Get network address from Internet host and service.
 
template<typename ProtocolT >
AddrInfoPtr toolbox::os::getaddrinfo (const char *node, const char *service, ProtocolT protocol, std::error_code &ec) noexcept
 Get network address from Internet host and service.
 
template<typename ProtocolT >
AddrInfoPtr toolbox::os::getaddrinfo (const char *node, const char *service, ProtocolT protocol)
 Get network address from Internet host and service.
 
unsigned toolbox::os::if_nametoindex (const char *ifname, std::error_code &ec) noexcept
 Returns the index of the network interface corresponding to the name ifname.
 
unsigned toolbox::os::if_nametoindex (const char *ifname)
 Returns the index of the network interface corresponding to the name ifname.
 
FileHandle toolbox::os::socket (int family, int type, int protocol, std::error_code &ec) noexcept
 Create an endpoint for communication.
 
FileHandle toolbox::os::socket (int family, int type, int protocol)
 Create an endpoint for communication.
 
template<typename ProtocolT >
FileHandle toolbox::os::socket (ProtocolT protocol, std::error_code &ec) noexcept
 Create an endpoint for communication.
 
template<typename ProtocolT >
FileHandle toolbox::os::socket (ProtocolT protocol)
 Create an endpoint for communication.
 
std::pair< FileHandle, FileHandletoolbox::os::socketpair (int family, int type, int protocol, std::error_code &ec) noexcept
 Create a pair of connected sockets.
 
std::pair< FileHandle, FileHandletoolbox::os::socketpair (int family, int type, int protocol)
 Create a pair of connected sockets.
 
template<typename ProtocolT >
std::pair< FileHandle, FileHandletoolbox::os::socketpair (ProtocolT protocol, std::error_code &ec) noexcept
 Create a pair of connected sockets.
 
template<typename ProtocolT >
std::pair< FileHandle, FileHandletoolbox::os::socketpair (ProtocolT protocol)
 Create a pair of connected sockets.
 
FileHandle toolbox::os::accept (int sockfd, sockaddr &addr, socklen_t &addrlen, std::error_code &ec) noexcept
 Accept a connection on a socket.
 
FileHandle toolbox::os::accept (int sockfd, sockaddr &addr, socklen_t &addrlen)
 Accept a connection on a socket.
 
FileHandle toolbox::os::accept (int sockfd, std::error_code &ec) noexcept
 Accept a connection on a socket.
 
FileHandle toolbox::os::accept (int sockfd)
 Accept a connection on a socket.
 
template<typename EndpointT >
FileHandle toolbox::os::accept (int sockfd, EndpointT &ep, std::error_code &ec) noexcept
 Accept a connection on a socket.
 
template<typename EndpointT >
FileHandle toolbox::os::accept (int sockfd, EndpointT &ep)
 Accept a connection on a socket.
 
void toolbox::os::bind (int sockfd, const sockaddr &addr, socklen_t addrlen, std::error_code &ec) noexcept
 Bind a name to a socket.
 
void toolbox::os::bind (int sockfd, const sockaddr &addr, socklen_t addrlen)
 Bind a name to a socket.
 
template<typename EndpointT >
void toolbox::os::bind (int sockfd, const EndpointT &ep, std::error_code &ec) noexcept
 Bind a name to a socket.
 
template<typename EndpointT >
void toolbox::os::bind (int sockfd, const EndpointT &ep)
 Bind a name to a socket.
 
void toolbox::os::connect (int sockfd, const sockaddr &addr, socklen_t addrlen, std::error_code &ec) noexcept
 Initiate a connection on a socket.
 
void toolbox::os::connect (int sockfd, const sockaddr &addr, socklen_t addrlen)
 Initiate a connection on a socket.
 
template<typename EndpointT >
void toolbox::os::connect (int sockfd, const EndpointT &ep, std::error_code &ec) noexcept
 Initiate a connection on a socket.
 
template<typename EndpointT >
void toolbox::os::connect (int sockfd, const EndpointT &ep)
 Initiate a connection on a socket.
 
void toolbox::os::listen (int sockfd, int backlog, std::error_code &ec) noexcept
 Listen for connections on a socket.
 
void toolbox::os::listen (int sockfd, int backlog)
 Listen for connections on a socket.
 
void toolbox::os::shutdown (int sockfd, int how, std::error_code &ec) noexcept
 Shut-down part of a full-duplex connection.
 
void toolbox::os::shutdown (int sockfd, int how)
 Shut-down part of a full-duplex connection.
 
ssize_t toolbox::os::recv (int sockfd, void *buf, std::size_t len, int flags, std::error_code &ec) noexcept
 Receive a message from a socket.
 
std::size_t toolbox::os::recv (int sockfd, void *buf, std::size_t len, int flags)
 Receive a message from a socket.
 
ssize_t toolbox::os::recv (int sockfd, MutableBuffer buf, int flags, std::error_code &ec) noexcept
 Receive a message from a socket.
 
std::size_t toolbox::os::recv (int sockfd, MutableBuffer buf, int flags)
 Receive a message from a socket.
 
ssize_t toolbox::os::recvfrom (int sockfd, void *buf, std::size_t len, int flags, sockaddr &addr, socklen_t &addrlen, std::error_code &ec) noexcept
 Receive a message from a socket.
 
std::size_t toolbox::os::recvfrom (int sockfd, void *buf, std::size_t len, int flags, sockaddr &addr, socklen_t &addrlen)
 Receive a message from a socket.
 
template<typename EndpointT >
ssize_t toolbox::os::recvfrom (int sockfd, void *buf, std::size_t len, int flags, EndpointT &ep, std::error_code &ec) noexcept
 Receive a message from a socket.
 
template<typename EndpointT >
std::size_t toolbox::os::recvfrom (int sockfd, void *buf, std::size_t len, int flags, EndpointT &ep)
 Receive a message from a socket.
 
template<typename EndpointT >
ssize_t toolbox::os::recvfrom (int sockfd, MutableBuffer buf, int flags, EndpointT &ep, std::error_code &ec) noexcept
 Receive a message from a socket.
 
template<typename EndpointT >
std::size_t toolbox::os::recvfrom (int sockfd, MutableBuffer buf, int flags, EndpointT &ep)
 Receive a message from a socket.
 
ssize_t toolbox::os::send (int sockfd, const void *buf, std::size_t len, int flags, std::error_code &ec) noexcept
 Send a message on a socket.
 
std::size_t toolbox::os::send (int sockfd, const void *buf, std::size_t len, int flags)
 Send a message on a socket.
 
ssize_t toolbox::os::send (int sockfd, ConstBuffer buf, int flags, std::error_code &ec) noexcept
 Send a message on a socket.
 
std::size_t toolbox::os::send (int sockfd, ConstBuffer buf, int flags)
 Send a message on a socket.
 
ssize_t toolbox::os::sendto (int sockfd, const void *buf, std::size_t len, int flags, const sockaddr &addr, socklen_t addrlen, std::error_code &ec) noexcept
 Send a message on a socket.
 
std::size_t toolbox::os::sendto (int sockfd, const void *buf, std::size_t len, int flags, const sockaddr &addr, socklen_t addrlen)
 Send a message on a socket.
 
template<typename EndpointT >
ssize_t toolbox::os::sendto (int sockfd, const void *buf, std::size_t len, int flags, const EndpointT &ep, std::error_code &) noexcept
 Send a message on a socket.
 
template<typename EndpointT >
std::size_t toolbox::os::sendto (int sockfd, const void *buf, std::size_t len, int flags, const EndpointT &ep)
 Send a message on a socket.
 
template<typename EndpointT >
ssize_t toolbox::os::sendto (int sockfd, ConstBuffer buf, int flags, const EndpointT &ep, std::error_code &ec) noexcept
 Send a message on a socket.
 
template<typename EndpointT >
std::size_t toolbox::os::sendto (int sockfd, ConstBuffer buf, int flags, const EndpointT &ep)
 Send a message on a socket.
 
void toolbox::os::getsockname (int sockfd, sockaddr &addr, socklen_t &addrlen, std::error_code &ec) noexcept
 Get the socket name.
 
void toolbox::os::getsockname (int sockfd, sockaddr &addr, socklen_t &addrlen)
 Get the socket name.
 
template<typename EndpointT >
void toolbox::os::getsockname (int sockfd, EndpointT &ep, std::error_code &ec) noexcept
 Get the socket name.
 
template<typename EndpointT >
void toolbox::os::getsockname (int sockfd, EndpointT &ep)
 Get the socket name.
 
void toolbox::os::getsockopt (int sockfd, int level, int optname, void *optval, socklen_t &optlen, std::error_code &ec) noexcept
 Get socket option.
 
void toolbox::os::getsockopt (int sockfd, int level, int optname, void *optval, socklen_t &optlen)
 Get socket option.
 
void toolbox::os::setsockopt (int sockfd, int level, int optname, const void *optval, socklen_t optlen, std::error_code &ec) noexcept
 Set socket option.
 
void toolbox::os::setsockopt (int sockfd, int level, int optname, const void *optval, socklen_t optlen)
 Set socket option.
 
AddrInfoPtr toolbox::net::get_unix_addrinfo (std::string_view path, int type)
 Create an addrinfo structure for a Unix domain address.
 
template<typename EndpointT >
void toolbox::net::get_sock_name (int sockfd, EndpointT &ep, std::error_code &ec) noexcept
 
template<typename EndpointT >
void toolbox::net::get_sock_name (int sockfd, EndpointT &ep)
 
std::error_code toolbox::net::get_so_error (int sockfd, std::error_code &ec) noexcept
 
std::error_code toolbox::net::get_so_error (int sockfd)
 
int toolbox::net::get_so_rcv_buf (int sockfd, std::error_code &ec) noexcept
 
int toolbox::net::get_so_rcv_buf (int sockfd)
 
int toolbox::net::get_so_snd_buf (int sockfd, std::error_code &ec) noexcept
 
int toolbox::net::get_so_snd_buf (int sockfd)
 
bool toolbox::net::is_tcp_no_delay (int sockfd, std::error_code &ec) noexcept
 
bool toolbox::net::is_tcp_no_delay (int sockfd)
 
void toolbox::net::set_so_rcv_buf (int sockfd, int size, std::error_code &ec) noexcept
 
void toolbox::net::set_so_rcv_buf (int sockfd, int size)
 
void toolbox::net::set_so_reuse_addr (int sockfd, bool enabled, std::error_code &ec) noexcept
 
void toolbox::net::set_so_reuse_addr (int sockfd, bool enabled)
 
void toolbox::net::set_so_snd_buf (int sockfd, int size, std::error_code &ec) noexcept
 
void toolbox::net::set_so_snd_buf (int sockfd, int size)
 
void toolbox::net::set_tcp_no_delay (int sockfd, bool enabled, std::error_code &ec) noexcept
 
void toolbox::net::set_tcp_no_delay (int sockfd, bool enabled)
 
void toolbox::net::set_tcp_syn_nt (int sockfd, int retrans, std::error_code &ec) noexcept
 
void toolbox::net::set_tcp_syn_nt (int sockfd, int retrans)