aboutsummaryrefslogtreecommitdiff
path: root/src/ext_packet.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ext_packet.h')
-rw-r--r--src/ext_packet.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/ext_packet.h b/src/ext_packet.h
new file mode 100644
index 0000000..c6c77c4
--- /dev/null
+++ b/src/ext_packet.h
@@ -0,0 +1,53 @@
+#pragma once
+
+#include <QByteArray>
+#include <QString>
+
+enum class ExMsgType : quint8
+{
+ ident = 1,
+ auth_request = 2,
+ auth_challenge = 3,
+ auth_response = 4
+};
+
+struct ExMessage
+{
+ ExMsgType type;
+ QByteArray body;
+};
+
+enum class AuthMethod
+{
+ certificate = 1,
+ password = 2,
+};
+
+struct Ident
+{
+ quint8 version;
+};
+
+struct AuthRequest
+{
+ QString username;
+ AuthMethod method;
+ // Will be replaced if passwords are implemented.
+ QByteArray credentials;
+};
+
+struct AuthChallenge
+{
+ QByteArray challenge;
+};
+
+struct AuthResponse
+{
+ QByteArray response;
+};
+
+QByteArray serializeIdent(const Ident &m);
+QByteArray serializeAuthRequest(const AuthRequest &m);
+QByteArray serializeAuthResponse(const AuthResponse &m);
+
+bool parseAuthChallenge(QByteArrayView in, AuthChallenge &out);