-
Notifications
You must be signed in to change notification settings - Fork 0
/
jekiqsocket.h
55 lines (40 loc) · 1.13 KB
/
jekiqsocket.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef JEKIQSOCKET_H
#define JEKIQSOCKET_H
#include <QObject>
#include <QTcpSocket>
#include <botan/types.h>
#include <botan/tls_client.h>
#include <botan/auto_rng.h>
#include <botan/pkcs8.h>
#include <botan/hex.h>
#include "credentials.h"
using namespace Botan;
class JekiQSocket : public QTcpSocket
{
Q_OBJECT
public:
JekiQSocket(QObject* parent = nullptr);
~JekiQSocket();
virtual void connectToHost(const QString& hostname, quint16 port);
signals:
void readyForApp();
private:
void socketWrite(const byte buf[], size_t length);
void alertReceived(TLS::Alert alert, const byte buf[], size_t length);
bool handshakeComplete(const TLS::Session& session);
void processData(const byte buf[], size_t size);
TLS::Client* client;
AutoSeeded_RNG* rng;
TLS::Policy policy;
Basic_Credentials_Manager* creds;
TLS::Session_Manager_In_Memory* sessionManager;
QString hostname;
quint16 port;
int index;
private slots:
void onConnected();
void onError(QAbstractSocket::SocketError socketError);
void onReceivedData();
void onReadyForApp();
};
#endif // JEKIQSOCKET_H