aboutsummaryrefslogtreecommitdiff
path: root/src/protocolhandler.hpp
diff options
context:
space:
mode:
authorFelix (xq) Queißner <git@mq32.de>2020-06-16 23:01:16 +0200
committerFelix (xq) Queißner <git@mq32.de>2020-06-16 23:01:16 +0200
commit94dbe30902e36cedb30cb89ea3bd7ecd6c5a03f2 (patch)
tree98b32b834960a59102118630f4d936671081f6c7 /src/protocolhandler.hpp
parenta3f3e3933c4a2522e233917a6795c6e9d677e65c (diff)
Adds improved error handling.
Diffstat (limited to 'src/protocolhandler.hpp')
-rw-r--r--src/protocolhandler.hpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/protocolhandler.hpp b/src/protocolhandler.hpp
index f4ae9eb..f93ef87 100644
--- a/src/protocolhandler.hpp
+++ b/src/protocolhandler.hpp
@@ -1,10 +1,11 @@
#ifndef GENERICPROTOCOLCLIENT_HPP
#define GENERICPROTOCOLCLIENT_HPP
-#include <QObject>
-
#include "cryptoidentity.hpp"
+#include <QObject>
+#include <QAbstractSocket>
+
class ProtocolHandler : public QObject
{
Q_OBJECT
@@ -12,7 +13,8 @@ public:
enum NetworkError {
UnknownError, //!< There was an unhandled network error
ProtocolViolation, //!< The server responded with something unexpected and violated the protocol
- HostNotFound, //!< The host
+ HostNotFound, //!< The host was not found by the client
+ ConnectionRefused, //!< The host refused connection on that port
ResourceNotFound, //!< The requested resource was not found on the server
BadRequest, //!< Our client misbehaved and did a request the server cannot understand
ProxyRequest, //!< We requested to
@@ -22,6 +24,7 @@ public:
MistrustedHost, //!< We know the host and it's not the server identity we've seen before
Unauthorized, //!< The requested resource could not be accessed.
TlsFailure, //!< Unspecified TLS failure
+ Timeout, //!< The network connection timed out.
};
public:
explicit ProtocolHandler(QObject *parent = nullptr);
@@ -54,6 +57,8 @@ signals:
//! The server wants us to use a client certificate
void certificateRequired(QString const & info);
+protected:
+ void emitNetworkError(QAbstractSocket::SocketError error_code, QString const & textual_description);
};
#endif // GENERICPROTOCOLCLIENT_HPP