irccd
3.0.3
|
Abstract connection to a server. More...
#include <irc.hpp>
Public Types | |
using | connect_handler = std::function< void(std::error_code)> |
using | recv_handler = std::function< void(std::error_code, message)> |
using | send_handler = std::function< void(std::error_code)> |
Public Member Functions | |
connection (boost::asio::io_service &service) | |
virtual | ~connection ()=default |
void | use_ipv4 (bool enable=true) noexcept |
void | use_ipv6 (bool enable=true) noexcept |
void | use_ssl (bool enable=true) noexcept |
void | connect (std::string_view hostname, std::string_view service, connect_handler handler) |
void | disconnect () |
void | recv (recv_handler handler) |
void | send (std::string_view message, send_handler handler) |
Abstract connection to a server.
using irccd::daemon::irc::connection::connect_handler = std::function<void (std::error_code)> |
Handler for connecting.
using irccd::daemon::irc::connection::recv_handler = std::function<void (std::error_code, message)> |
Handler for receiving.
using irccd::daemon::irc::connection::send_handler = std::function<void (std::error_code)> |
Handler for sending.
irccd::daemon::irc::connection::connection | ( | boost::asio::io_service & | service | ) |
Default constructor.
service | the I/O service |
|
virtualdefault |
Virtual destructor defaulted.
void irccd::daemon::irc::connection::connect | ( | std::string_view | hostname, |
std::string_view | service, | ||
connect_handler | handler | ||
) |
Connect to the host.
hostname | the hostname |
service | the service or port number |
handler | the non-null handler |
void irccd::daemon::irc::connection::disconnect | ( | ) |
Force disconnection.
void irccd::daemon::irc::connection::recv | ( | recv_handler | handler | ) |
Start receiving data.
The handler must not throw exceptions and this
must be valid in the lifetime of the handler.
handler | the handler to call |
void irccd::daemon::irc::connection::send | ( | std::string_view | message, |
send_handler | handler | ||
) |
Start sending data.
The handler must not throw exceptions and this
must be valid in the lifetime of the handler.
message | the raw message |
handler | the handler to call |
|
noexcept |
Enable IPv4
enable | true to enable |
|
noexcept |
Enable IPv6
enable | true to enable |
|
noexcept |
Enable TLS.
enable | true to enable |