Toolbox snapshot
The Reactive C++ Toolbox
|
Namespaces | |
namespace | detail |
Classes | |
struct | DgramProtocol |
struct | DgramSock |
Connectionless Datagram Socket. All state is in base class, so object can be sliced. More... | |
struct | IoSock |
struct | IpMcastGroup |
struct | McastSock |
Connectionless Datagram Socket. All state is in base class, so object can be sliced. More... | |
class | RateLimit |
class | RateWindow |
RateWindow maintains a sliding window of second time buckets for the specified interval. More... | |
class | Resolver |
struct | Sock |
class | StreamAcceptor |
class | StreamConnector |
struct | StreamProtocol |
struct | StreamSockClnt |
Active Client Stream Socket. All state is in base class, so object can be sliced. More... | |
struct | StreamSockServ |
Passive Server Stream Socket. All state is in base class, so object can be sliced. More... | |
struct | TcpProtocol |
struct | UdpProtocol |
struct | UnixDgramProtocol |
struct | UnixStreamProtocol |
Typedefs | |
template<typename ProtocolT > | |
using | BasicEndpoint = boost::asio::generic::basic_endpoint< ProtocolT > |
using | DgramEndpoint = BasicEndpoint< DgramProtocol > |
using | StreamEndpoint = BasicEndpoint< StreamProtocol > |
template<typename ProtocolT > | |
using | IpEndpoint = boost::asio::ip::basic_endpoint< ProtocolT > |
using | UdpEndpoint = IpEndpoint< UdpProtocol > |
using | TcpEndpoint = IpEndpoint< TcpProtocol > |
template<typename ProtocolT > | |
using | UnixEndpoint = boost::asio::local::basic_endpoint< ProtocolT > |
using | UnixDgramEndpoint = UnixEndpoint< UnixDgramProtocol > |
using | UnixStreamEndpoint = UnixEndpoint< UnixStreamProtocol > |
using | IpAddr = boost::asio::ip::address |
using | IpAddrV4 = boost::asio::ip::address_v4 |
using | IpAddrV6 = boost::asio::ip::address_v6 |
using | AddrInfoFuture = std::future< AddrInfoPtr > |
using | AddrInfoPtr = std::unique_ptr< addrinfo, void(*)(addrinfo *)> |
Functions | |
constexpr std::uint16_t | bswap (std::uint16_t n) noexcept |
constexpr std::int16_t | bswap (std::int16_t n) noexcept |
constexpr std::uint32_t | bswap (std::uint32_t n) noexcept |
constexpr std::int32_t | bswap (std::int32_t n) noexcept |
constexpr std::uint64_t | bswap (std::uint64_t n) noexcept |
constexpr std::int64_t | bswap (std::int64_t n) noexcept |
template<typename ValueT > requires std::integral<ValueT> | |
constexpr ValueT | ntoh (ValueT n) noexcept |
template<typename ValueT > requires std::integral<ValueT> | |
constexpr ValueT | hton (ValueT n) noexcept |
template<typename ValueT > requires std::integral<ValueT> | |
constexpr ValueT | ltoh (ValueT n) noexcept |
template<typename ValueT > requires std::integral<ValueT> | |
constexpr ValueT | htol (ValueT n) noexcept |
AddrInfoPtr | parse_endpoint (string_view uri, int type) |
istream & | operator>> (istream &is, DgramEndpoint &ep) |
istream & | operator>> (istream &is, StreamEndpoint &ep) |
ostream & | operator<< (ostream &os, const DgramEndpoint &ep) |
ostream & | operator<< (ostream &os, const StreamEndpoint &ep) |
DgramEndpoint | parse_dgram_endpoint (std::string_view uri) |
StreamEndpoint | parse_stream_endpoint (std::string_view uri) |
const std::error_category & | gai_error_category () noexcept |
std::error_code | make_gai_error_code (int err) noexcept |
constexpr std::uint16_t | get_length (const char *buf, std::endian net_byte_order) noexcept |
std::uint16_t | get_length (ConstBuffer buf, std::endian net_byte_order) noexcept |
void | put_length (char *buf, std::uint16_t len, std::endian net_byte_order) noexcept |
void | put_length (MutableBuffer buf, std::uint16_t len, std::endian net_byte_order) noexcept |
template<typename FnT > | |
std::size_t | parse_frame (ConstBuffer buf, FnT fn, std::endian net_byte_order) |
template<typename FnT > | |
std::size_t | parse_frame (std::string_view buf, FnT fn, std::endian net_byte_order) |
template<typename ProtocolT > | |
std::pair< IoSock, IoSock > | socketpair (ProtocolT protocol) |
void | join_group (int sockfd, const IpMcastGroup &group, std::error_code &ec) noexcept |
Join a multicast group. | |
void | join_group (int sockfd, const IpMcastGroup &group) |
Join a multicast group. | |
void | join_group (int sockfd, const IpAddr &addr, unsigned ifindex, std::error_code &ec) noexcept |
Join a multicast group. | |
void | join_group (int sockfd, const IpAddr &addr, unsigned ifindex) |
Join a multicast group. | |
void | join_group (int sockfd, const IpAddr &addr, const char *ifname, std::error_code &ec) noexcept |
Join a multicast group. The system will choose an appropriate interface if ifname is null. | |
void | join_group (int sockfd, const IpAddr &addr, const char *ifname) |
Join a multicast group. The system will choose an appropriate interface if ifname is null. | |
void | leave_group (int sockfd, const IpMcastGroup &group, std::error_code &ec) noexcept |
Leave a multicast group. | |
void | leave_group (int sockfd, const IpMcastGroup &group) |
Leave a multicast group. | |
void | leave_group (int sockfd, const IpAddr &addr, unsigned ifindex, std::error_code &ec) noexcept |
Leave a multicast group. | |
void | leave_group (int sockfd, const IpAddr &addr, unsigned ifindex) |
Leave a multicast group. | |
void | leave_group (int sockfd, const IpAddr &addr, const char *ifname, std::error_code &ec) noexcept |
Leave a multicast group. The system will leave on the first matching interface if ifname is null. | |
void | leave_group (int sockfd, const IpAddr &addr, const char *ifname) |
Leave a multicast group. The system will leave on the first matching interface if ifname is null. | |
void | set_ip_mcast_if (int sockfd, int family, unsigned ifindex, std::error_code &ec) noexcept |
void | set_ip_mcast_if (int sockfd, int family, unsigned ifindex) |
void | set_ip_mcast_if (int sockfd, int family, const char *ifname, std::error_code &ec) noexcept |
void | set_ip_mcast_if (int sockfd, int family, const char *ifname) |
void | set_ip_mcast_loop (int sockfd, int family, bool enabled, std::error_code &ec) noexcept |
Determines whether sent multicast packets should be looped back to the local sockets. | |
void | set_ip_mcast_loop (int sockfd, int family, bool enabled) |
Determines whether sent multicast packets should be looped back to the local sockets. | |
void | set_ip_mcast_ttl (int sockfd, int family, int ttl, std::error_code &ec) noexcept |
Set or read the time-to-live value of outgoing multicast packets for this socket. | |
void | set_ip_mcast_ttl (int sockfd, int family, int ttl) |
Set or read the time-to-live value of outgoing multicast packets for this socket. | |
RateLimit | parse_rate_limit (const string &s) |
istream & | operator>> (istream &is, RateLimit &rl) |
ostream & | operator<< (ostream &os, RateLimit rl) |
template<typename EndpointT > | |
EndpointT | get_endpoint (AddrInfoFuture &future) |
Wait for future and convert result to endpoint. | |
template<typename ResultT > | |
bool | is_ready (std::future< ResultT > &future) |
Returns true if future is ready. | |
AddrInfoPtr | get_unix_addrinfo (std::string_view path, int type) |
Create an addrinfo structure for a Unix domain address. | |
template<typename EndpointT > | |
void | get_sock_name (int sockfd, EndpointT &ep, std::error_code &ec) noexcept |
template<typename EndpointT > | |
void | get_sock_name (int sockfd, EndpointT &ep) |
std::error_code | get_so_error (int sockfd, std::error_code &ec) noexcept |
std::error_code | get_so_error (int sockfd) |
int | get_so_rcv_buf (int sockfd, std::error_code &ec) noexcept |
int | get_so_rcv_buf (int sockfd) |
int | get_so_snd_buf (int sockfd, std::error_code &ec) noexcept |
int | get_so_snd_buf (int sockfd) |
bool | is_tcp_no_delay (int sockfd, std::error_code &ec) noexcept |
bool | is_tcp_no_delay (int sockfd) |
void | set_so_rcv_buf (int sockfd, int size, std::error_code &ec) noexcept |
void | set_so_rcv_buf (int sockfd, int size) |
void | set_so_reuse_addr (int sockfd, bool enabled, std::error_code &ec) noexcept |
void | set_so_reuse_addr (int sockfd, bool enabled) |
void | set_so_snd_buf (int sockfd, int size, std::error_code &ec) noexcept |
void | set_so_snd_buf (int sockfd, int size) |
void | set_tcp_no_delay (int sockfd, bool enabled, std::error_code &ec) noexcept |
void | set_tcp_no_delay (int sockfd, bool enabled) |
void | set_tcp_syn_nt (int sockfd, int retrans, std::error_code &ec) noexcept |
void | set_tcp_syn_nt (int sockfd, int retrans) |
using toolbox::net::BasicEndpoint = typedef boost::asio::generic::basic_endpoint<ProtocolT> |
Definition at line 32 of file Endpoint.hpp.
Definition at line 34 of file Endpoint.hpp.
Definition at line 35 of file Endpoint.hpp.
using toolbox::net::IpEndpoint = typedef boost::asio::ip::basic_endpoint<ProtocolT> |
Definition at line 38 of file Endpoint.hpp.
Definition at line 40 of file Endpoint.hpp.
Definition at line 41 of file Endpoint.hpp.
using toolbox::net::UnixEndpoint = typedef boost::asio::local::basic_endpoint<ProtocolT> |
Definition at line 44 of file Endpoint.hpp.
Definition at line 46 of file Endpoint.hpp.
Definition at line 47 of file Endpoint.hpp.
using toolbox::net::IpAddr = typedef boost::asio::ip::address |
Definition at line 24 of file IpAddr.hpp.
using toolbox::net::IpAddrV4 = typedef boost::asio::ip::address_v4 |
Definition at line 25 of file IpAddr.hpp.
using toolbox::net::IpAddrV6 = typedef boost::asio::ip::address_v6 |
Definition at line 26 of file IpAddr.hpp.
using toolbox::net::AddrInfoFuture = typedef std::future<AddrInfoPtr> |
Definition at line 30 of file Resolver.hpp.
Definition at line 30 of file Socket.hpp.
|
constexprnoexcept |
Definition at line 27 of file Endian.hpp.
Referenced by toolbox::net::detail::get_length(), and toolbox::net::detail::put_length().
|
constexprnoexcept |
Definition at line 32 of file Endian.hpp.
|
constexprnoexcept |
Definition at line 37 of file Endian.hpp.
|
constexprnoexcept |
Definition at line 42 of file Endian.hpp.
|
constexprnoexcept |
Definition at line 47 of file Endian.hpp.
|
constexprnoexcept |
Definition at line 53 of file Endian.hpp.
Definition at line 60 of file Endian.hpp.
Definition at line 71 of file Endian.hpp.
Definition at line 82 of file Endian.hpp.
Definition at line 93 of file Endian.hpp.
TOOLBOX_API AddrInfoPtr toolbox::net::parse_endpoint | ( | string_view | uri, |
int | type | ||
) |
Definition at line 59 of file Endpoint.cpp.
Referenced by toolbox::net::Resolver::resolve().
TOOLBOX_API std::istream & toolbox::net::operator>> | ( | istream & | is, |
DgramEndpoint & | ep | ||
) |
Definition at line 100 of file Endpoint.cpp.
TOOLBOX_API std::istream & toolbox::net::operator>> | ( | istream & | is, |
StreamEndpoint & | ep | ||
) |
Definition at line 109 of file Endpoint.cpp.
TOOLBOX_API std::ostream & toolbox::net::operator<< | ( | ostream & | os, |
const DgramEndpoint & | ep | ||
) |
Definition at line 133 of file Endpoint.cpp.
TOOLBOX_API std::ostream & toolbox::net::operator<< | ( | ostream & | os, |
const StreamEndpoint & | ep | ||
) |
Definition at line 155 of file Endpoint.cpp.
|
inline |
Definition at line 51 of file Endpoint.hpp.
|
inline |
Definition at line 57 of file Endpoint.hpp.
|
noexcept |
|
noexcept |
|
inlinenoexcept |
|
inlinenoexcept |
std::size_t toolbox::net::parse_frame | ( | ConstBuffer | buf, |
FnT | fn, | ||
std::endian | net_byte_order | ||
) |
Calls the function object for each message encapsulated in a length-prefixed frame.
FnT | The type of the function object. |
buf | The input buffer. |
fn | The function object that is called for each complete message. |
net_byte_order | Endianness used for network byte order decoding. |
std::size_t toolbox::net::parse_frame | ( | std::string_view | buf, |
FnT | fn, | ||
std::endian | net_byte_order | ||
) |
Calls the function object for each message encapsulated in a length-prefixed frame.
FnT | The type of the function object. |
buf | The input buffer. |
fn | The function object that is called for each complete message. |
net_byte_order | Endianness used for network byte order decoding. |
Definition at line 90 of file IoSock.hpp.
|
inlinenoexcept |
Join a multicast group.
Definition at line 47 of file McastSock.hpp.
|
inline |
Join a multicast group.
Definition at line 58 of file McastSock.hpp.
|
inlinenoexcept |
Join a multicast group.
Definition at line 69 of file McastSock.hpp.
Join a multicast group.
Definition at line 76 of file McastSock.hpp.
|
inlinenoexcept |
Join a multicast group. The system will choose an appropriate interface if ifname is null.
Definition at line 82 of file McastSock.hpp.
Join a multicast group. The system will choose an appropriate interface if ifname is null.
Definition at line 89 of file McastSock.hpp.
|
inlinenoexcept |
Leave a multicast group.
Definition at line 95 of file McastSock.hpp.
|
inline |
Leave a multicast group.
Definition at line 106 of file McastSock.hpp.
|
inlinenoexcept |
Leave a multicast group.
Definition at line 117 of file McastSock.hpp.
Leave a multicast group.
Definition at line 124 of file McastSock.hpp.
|
inlinenoexcept |
Leave a multicast group. The system will leave on the first matching interface if ifname is null.
Definition at line 130 of file McastSock.hpp.
Leave a multicast group. The system will leave on the first matching interface if ifname is null.
Definition at line 137 of file McastSock.hpp.
|
inlinenoexcept |
Definition at line 142 of file McastSock.hpp.
Definition at line 154 of file McastSock.hpp.
|
inlinenoexcept |
Definition at line 166 of file McastSock.hpp.
Definition at line 175 of file McastSock.hpp.
|
inlinenoexcept |
Determines whether sent multicast packets should be looped back to the local sockets.
Definition at line 181 of file McastSock.hpp.
Determines whether sent multicast packets should be looped back to the local sockets.
Definition at line 194 of file McastSock.hpp.
|
inlinenoexcept |
Set or read the time-to-live value of outgoing multicast packets for this socket.
Definition at line 207 of file McastSock.hpp.
Set or read the time-to-live value of outgoing multicast packets for this socket.
Definition at line 220 of file McastSock.hpp.
TOOLBOX_API RateLimit toolbox::net::parse_rate_limit | ( | const string & | s | ) |
Definition at line 24 of file RateLimit.cpp.
TOOLBOX_API std::istream & toolbox::net::operator>> | ( | istream & | is, |
RateLimit & | rl | ||
) |
Definition at line 30 of file RateLimit.cpp.
TOOLBOX_API std::ostream & toolbox::net::operator<< | ( | ostream & | os, |
RateLimit | rl | ||
) |
Definition at line 39 of file RateLimit.cpp.
EndpointT toolbox::net::get_endpoint | ( | AddrInfoFuture & | future | ) |
Wait for future and convert result to endpoint.
Definition at line 69 of file Resolver.hpp.
Returns true if future is ready.
Definition at line 78 of file Resolver.hpp.
TOOLBOX_API AddrInfoPtr toolbox::net::get_unix_addrinfo | ( | string_view | path, |
int | type | ||
) |
Create an addrinfo structure for a Unix domain address.
Definition at line 35 of file Socket.cpp.
|
inlinenoexcept |
Definition at line 619 of file Socket.hpp.
Definition at line 625 of file Socket.hpp.
|
inlinenoexcept |
Definition at line 630 of file Socket.hpp.
|
inline |
Definition at line 638 of file Socket.hpp.
Definition at line 646 of file Socket.hpp.
Definition at line 654 of file Socket.hpp.
Definition at line 662 of file Socket.hpp.
Definition at line 670 of file Socket.hpp.
Definition at line 678 of file Socket.hpp.
Referenced by toolbox::net::StreamConnector< DerivedT >::connect(), and toolbox::net::StreamAcceptor< DerivedT >::~StreamAcceptor().
Definition at line 686 of file Socket.hpp.
Definition at line 694 of file Socket.hpp.
Definition at line 699 of file Socket.hpp.
|
inlinenoexcept |
Definition at line 704 of file Socket.hpp.
Definition at line 710 of file Socket.hpp.
Definition at line 716 of file Socket.hpp.
Definition at line 721 of file Socket.hpp.
|
inlinenoexcept |
Enable or disable the Nagle algorithm.
This means that segments are always sent as soon as possible, even if there is only a small amount of data. When not set, data is buffered until there is a sufficient amount to send out, thereby avoiding the frequent sending of small packets, which results in poor utilization of the network.
sockfd | The socket descriptor. |
enabled | Boolean switch to enable or disable. |
ec | Error-code set on failure. |
Definition at line 736 of file Socket.hpp.
Referenced by toolbox::net::StreamConnector< DerivedT >::connect(), and toolbox::net::StreamAcceptor< DerivedT >::~StreamAcceptor().
Enable or disable the Nagle algorithm.
This means that segments are always sent as soon as possible, even if there is only a small amount of data. When not set, data is buffered until there is a sufficient amount to send out, thereby avoiding the frequent sending of small packets, which results in poor utilization of the network.
sockfd | The socket descriptor. |
enabled | Boolean switch to enable or disable. |
Definition at line 751 of file Socket.hpp.
Set the number of SYN retransmits that TCP should send before aborting the attempt to connect.
The number of retransmits cannot exceed 255.
sockfd | The socket descriptor. |
retrans | The number of retransmits. |
ec | Error-code set on failure. |
Definition at line 764 of file Socket.hpp.
Set the number of SYN retransmits that TCP should send before aborting the attempt to connect.
The number of retransmits cannot exceed 255.
sockfd | The socket descriptor. |
retrans | The number of retransmits. |
Definition at line 775 of file Socket.hpp.