1
/**************************************************************************
2
* Copyright (C) 2005-2015 by Oleksandr Shneyder *
3
* o.shneyder@phoca-gmbh.de *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
9
* This program is distributed in the hope that it will be useful, *
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12
* GNU General Public License for more details. *
14
* You should have received a copy of the GNU General Public License *
15
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
16
***************************************************************************/
18
#ifndef HTTPBROKERCLIENT_H
19
#define HTTPBROKERCLIENT_H
20
#include "x2goclientconfig.h"
21
#include <QNetworkAccessManager>
23
#include <QNetworkRequest>
24
#include <QNetworkReply>
30
#include "sshmasterconnection.h"
32
@author Oleksandr Shneyder <oleksandr.shneyder@obviously-nice.de>
34
class QNetworkAccessManager;
38
class HttpBrokerClient: public QObject
42
HttpBrokerClient ( ONMainWindow* wnd, ConfigFile* cfg );
44
void selectUserSession(const QString& session );
45
void changePassword(QString newPass);
46
void testConnection();
48
QNetworkAccessManager* http;
49
QNetworkRequest* netRequest;
50
QSslSocket* sslSocket;
51
QNetworkReply* sessionsRequest;
52
QNetworkReply* selSessRequest;
53
QNetworkReply* chPassRequest;
54
QNetworkReply* testConRequest;
56
QString newBrokerPass;
58
ONMainWindow* mainWindow;
61
SshMasterConnection* sshConnection;
63
void createIniFile(const QString& raw_content);
64
void parseSession(QString sInfo);
65
void createSshConnection();
66
bool checkAccess(QString answer);
69
void slotRequestFinished ( QNetworkReply* reply );
70
void slotSslErrors ( QNetworkReply* netReply, const QList<QSslError> & errors ) ;
71
QString getHexVal ( const QByteArray& ba );
72
void slotSshConnectionError ( QString message, QString lastSessionError );
73
void slotSshServerAuthError ( int error, QString sshMessage, SshMasterConnection* connection );
74
void slotSshServerAuthPassphrase ( SshMasterConnection* connection, bool verificationCode=false );
75
void slotSshUserAuthError ( QString error );
76
void slotSshConnectionOk();
77
void slotListSessions ( bool success, QString answer, int pid);
78
void slotSelectSession ( bool success, QString answer, int pid);
79
void slotPassChanged ( bool success, QString answer, int pid);
80
void slotConnectionTest( bool success, QString answer, int pid);
83
void getUserSessions();
86
void haveSshKey ( QString );
87
void fatalHttpError();
89
void sessionsLoaded();
90
void sessionSelected( );
91
void passwordChanged( QString );
92
void connectionTime(int, int);