QcTcpConnector Class
Opens a TLS connection to a server (name lookup, IPv4 or IPv6; decisions E-251, E-872, E-964) and hands it over as a transport once the handshake is done. More...
| Header: | #include <network/QcTcpConnector.h> |
| Inherits: | QObject |
Public Functions
| QcTcpConnector(QObject *parent = nullptr) | |
| QcTcpConnector(const QcTcpConnector &) | |
| QcTcpConnector(QcTcpConnector &&) | |
| void | abort() |
| void | connectTo(const QcServerAddress &address, int timeoutMs = 10'000, const QcTcpTransport::Limits &limits = {}) |
| QByteArray | peerFingerprint() const |
| std::unique_ptr<QcTcpTransport> | takeTransport() |
| QcTcpConnector & | operator=(QcTcpConnector &&) |
| QcTcpConnector & | operator=(const QcTcpConnector &) |
Signals
Detailed Description
It looks the name up itself and tries its addresses in the order the system gives them, each with an equal share of the time left, so an address that never answers (IPv6 without IPv6) does not use up the time of the next one. A failure names the step, the address and every IP address tried (QcJoinFailure).
The server's certificate is its own, signed by nobody: it is not checked against authorities, the caller compares peerFingerprint() with what it pinned (QcKnownServers) before it sends anything. Exactly one of connected() and failed() follows connectTo().
Member Function Documentation
[explicit] QcTcpConnector::QcTcpConnector(QObject *parent = nullptr)
A connector without a connection, child of parent.
[delete] QcTcpConnector::QcTcpConnector(const QcTcpConnector &)
Copy-constructs an instance of QcTcpConnector. This function is deleted.
[delete] QcTcpConnector::QcTcpConnector(QcTcpConnector &&)
Move-constructs an instance of QcTcpConnector. This function is deleted.
void QcTcpConnector::abort()
Ends the attempt running, without a signal.
void QcTcpConnector::connectTo(const QcServerAddress &address, int timeoutMs = 10'000, const QcTcpTransport::Limits &limits = {})
Starts connecting to address, ending an attempt still running; fails after timeoutMs without a finished handshake. The transport gets limits.
[signal] void QcTcpConnector::connected()
The handshake is done; takeTransport() hands the transport over.
[signal] void QcTcpConnector::failed(const QcJoinFailure &failure)
The attempt failed as failure says.
QByteArray QcTcpConnector::peerFingerprint() const
Returns SHA-256 of the server's certificate after connected() (QcTlsFingerprint); empty in a build without TLS (QcTlsBackend::enabled).
std::unique_ptr<QcTcpTransport> QcTcpConnector::takeTransport()
Returns the open transport after connected(); null before and after taking it.
[delete] QcTcpConnector &QcTcpConnector::operator=(QcTcpConnector &&)
Move-assigns other to this QcTcpConnector instance. This function is deleted.
[delete] QcTcpConnector &QcTcpConnector::operator=(const QcTcpConnector &)
Copy-assigns other to this QcTcpConnector instance. This function is deleted.