Commit 2d792e1e authored by Lefebvre, Jordan's avatar Lefebvre, Jordan
Browse files

WIP: working on widget example.

parent c1e01c96
Pipeline #87575 failed
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.7.0, 2020-01-16T14:06:52. -->
<!-- Written by QtCreator 4.7.0, 2020-01-24T16:47:48. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
......@@ -67,7 +67,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{2df204d4-6c25-4675-bba0-dfd06e3fa597}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">4</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<valuelist type="QVariantList" key="CMake.Configuration">
<value type="QString">CMAKE_BUILD_TYPE:STRING=DEBUG</value>
......@@ -80,6 +80,7 @@
<value type="QString">OPENSSL_ROOT_DIR:STRING=/opt/openssl/1.1.1d/</value>
<value type="QString">QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}</value>
<value type="QString">rsm_ENABLE_rsmcore:STRING=ON</value>
<value type="QString">rsm_ENABLE_rsmwidgets:STRING=ON</value>
</valuelist>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/jap/projects/build/rsm/Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
......@@ -178,7 +179,7 @@
</valuelist>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory.default">/home/jap/projects/build/rsm/Debug/rsmcore/tests</value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory.default"></value>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">rsmcore_tstSession</value>
......@@ -192,7 +193,231 @@
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory.default">/home/jap/projects/build/rsm/Debug/rsmcore/tests</value>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">rsmcore_tstSessionWorker</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.rsmcore_tstSessionWorker
/home/jap/projects/rsm/rsmcore/tests/</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.2">
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory.default">/home/jap/projects/build/rsm/Debug/rsmcore/tests</value>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">rsmcore_tstSessionController</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.rsmcore_tstSessionController
/home/jap/projects/rsm/rsmcore/tests/</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.3">
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory.default"></value>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">rsmwidgets_NOEXEPREFIX</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.rsmwidgets_NOEXEPREFIX
/home/jap/projects/rsm/rsmwidgets/examples/</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.4">
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory.default">/home/jap/projects/build/rsm/Debug/rsmwidgets/examples</value>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">rsmportalexample</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.rsmportalexample
/home/jap/projects/rsm/rsmwidgets/examples/</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">5</value>
</valuemap>
</data>
<data>
......
TRIBITS_PACKAGE_DEFINE_DEPENDENCIES(
SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS
core rsmcore SS OPTIONAL
# widgets rsmwidgets SS OPTIONAL
widgets rsmwidgets SS OPTIONAL
)
......@@ -13,8 +13,9 @@ QT5_WRAP_CPP(MOC_FILES
${HEADERS}
)
SET(HEADERS
${HEADERS}
declspec.hh
${HEADERS}
declspec.hh
sessionlog.hh
)
TRIBITS_ADD_LIBRARY(rsmcore
SOURCES ${SOURCES} ${MOC_FILES}
......
#include "rsmcore/sessioncontroller.hh"
#include "rsmcore/sessionworker.hh"
#include <QThread>
#include "radixbug/bug.hh"
namespace rsm
{
class SessionControllerImpl
......@@ -17,9 +18,12 @@ class SessionControllerImpl
worker = new SessionWorker();
thread = new QThread();
worker->moveToThread(thread);
thread->start();
} // SessionControllerImpl constructor
~SessionControllerImpl()
{
radix_tagged_line("~SessionControllerImpl()");
if (worker != nullptr)
{
delete worker;
......@@ -36,4 +40,117 @@ class SessionControllerImpl
} // SessionControllerImpl destructor
}; // class SessionControllerImpl
SessionController::SessionController(QObject* parent)
: QObject(parent)
{
qRegisterMetaType<SessionVerbosity>("SessionVerbosity");
p = new SessionControllerImpl();
// forward signals from worker
QObject::connect(p->worker, &SessionWorker::connectionFailed, this,
&SessionController::connectionFailed);
QObject::connect(p->worker, &SessionWorker::connectionSuccessful, this,
&SessionController::connectionSuccessful);
QObject::connect(p->worker, &SessionWorker::verifyKnownHostSuccessful, this,
&SessionController::verifyKnownHostSuccessful);
QObject::connect(p->worker, &SessionWorker::getServerPublicKeyFailed, this,
&SessionController::getServerPublicKeyFailed);
QObject::connect(p->worker, &SessionWorker::hostUnknown, this,
&SessionController::hostUnknown);
QObject::connect(p->worker, &SessionWorker::hostPublicKeyChanged, this,
&SessionController::hostPublicKeyChanged);
QObject::connect(p->worker, &SessionWorker::hostPublicKeyUnavailable, this,
&SessionController::hostPublicKeyUnavailable);
QObject::connect(p->worker, &SessionWorker::knownHostError, this,
&SessionController::knownHostError);
QObject::connect(p->worker, &SessionWorker::updateKnownHostsFailed, this,
&SessionController::updateKnownHostsFailed);
QObject::connect(p->worker, &SessionWorker::authenticationError, this,
&SessionController::authenticationError);
QObject::connect(p->worker, &SessionWorker::authenticationSucceeded, this,
&SessionController::authenticationSucceeded);
QObject::connect(p->worker, &SessionWorker::passwordRequested, this,
&SessionController::passwordRequested);
QObject::connect(p->worker, &SessionWorker::loginBannerIssued, this,
&SessionController::loginBannerIssued);
QObject::connect(p->worker, &SessionWorker::execOutputReady, this,
&SessionController::execOutputReady);
QObject::connect(p->worker, &SessionWorker::execFailed, this,
&SessionController::execFailed);
QObject::connect(p->worker, &SessionWorker::execFinished, this,
&SessionController::execFinished);
// connect
QObject::connect(this, &SessionController::setHostRequested, p->worker,
&SessionWorker::setHost);
QObject::connect(this, &SessionController::setLogVerbosityRequested,
p->worker, &SessionWorker::setLogVerbosity);
QObject::connect(this, &SessionController::setPortRequested, p->worker,
&SessionWorker::setPort);
QObject::connect(this, &SessionController::setUserRequested, p->worker,
&SessionWorker::setUser);
QObject::connect(this, &SessionController::connectRequested, p->worker,
&SessionWorker::connect);
QObject::connect(this, &SessionController::disconnectRequested, p->worker,
&SessionWorker::disconnect);
QObject::connect(this, &SessionController::verifyKnownHostRequested,
p->worker, &SessionWorker::verifyKnownHost);
QObject::connect(this, &SessionController::acceptHostPublicKeyUpdateRequested,
p->worker, &SessionWorker::acceptHostPublicKeyUpdate);
QObject::connect(this, &SessionController::authenticateRequested, p->worker,
&SessionWorker::authenticate);
QObject::connect(this, &SessionController::authenticateWithPasswordRequested,
p->worker, &SessionWorker::authenticateWithPassword);
QObject::connect(this, &SessionController::requestExecRequested, p->worker,
&SessionWorker::requestExec);
}
SessionController::~SessionController()
{
if (p != nullptr)
{
delete p;
}
}
QByteArray SessionController::readExecOutput()
{
return p->worker->readExecOutput();
}
void SessionController::setHost(QString host) { emit setHostRequested(host); }
void SessionController::setLogVerbosity(SessionVerbosity level)
{
emit setLogVerbosityRequested(level);
}
void SessionController::setPort(int port) { emit setPortRequested(port); }
void SessionController::setUser(QString name) { emit setUserRequested(name); }
void SessionController::connect() { emit connectRequested(); }
void SessionController::disconnect() { emit disconnectRequested(); }
void SessionController::verifyKnownHost() { emit verifyKnownHostRequested(); }
void SessionController::acceptHostPublicKeyUpdate()
{
emit acceptHostPublicKeyUpdateRequested();
}
void SessionController::authenticate() { emit authenticateRequested(); }
void SessionController::authenticateWithPassword(QString pswd)
{
emit authenticateWithPasswordRequested(pswd);
}
void SessionController::requestExec(QString command)
{
emit requestExecRequested(command);
}
} // namespace rsm
\ No newline at end of file
......@@ -4,6 +4,8 @@
#include <QObject>
#include "rsmcore/declspec.hh"
#include "rsmcore/sessionlog.hh"
namespace rsm
{
/** Forward declaration of private implementation */
......@@ -18,6 +20,216 @@ class RSM_PUBLIC SessionController : public QObject
public:
SessionController(QObject* parent = nullptr);
~SessionController();
QByteArray readExecOutput();
public slots:
/**
* Set the remote host to connect to
*/
void setHost(QString host);
/**
* Set the Log verbosity
*/
void setLogVerbosity(SessionVerbosity level);
/**
* Set the ssh port number
*/
void setPort(int port);
/**
* Set the user
* Defaults to system user
*/
void setUser(QString name);
/**
* Perform hand-shake to connect to host.
*/
void connect();
/**
* Disconnect ssh session
*/
void disconnect();
/**
* Perform known host verification.
* Checks known_host file to validate remote host SHA
* Can emit hostUnknown(QString host_hash).
* Can emit hostPublicKeyChanged(QString host_hash).
* Can emit hostPublicKeyUnavailable().
* Can emit knownHostError().
*/
void verifyKnownHost();
/**
* Performs a request to accept/save the host's public key,
* updating the known_hosts
*/
void acceptHostPublicKeyUpdate();
/**
* Attempts to authenticate using public key or password.
* Can emit authenticationError(QString message).
* Can emit authenticationSucceeded() upon acceptance of public key.
* Can emit passworedRequested().
*/
void authenticate();
/**
* Attempts to authenticate with username and password.
* Can emit authenticationError(QString message).
* Can emit authenticationSuccessed() upon acceptance of password.
* Can emit loginBannerIssued(QString message) give availability.
*/
void authenticateWithPassword(QString pswd);
/**
* Requests remote execution of command
* @param command - QString command to execute
*/
void requestExec(QString command);
signals:
void connectionFailed(QString message);
void connectionSuccessful();
void verifyKnownHostSuccessful();
/**
* @brief getServerPublicKeyFailed
* Signal is emitted when the remote host does not have or provide a public
* key. Recommended to disconnect from session
*/
void getServerPublicKeyFailed();
/**
* @brief hostUnknown
* Signal is emitted when the remote host's public key is not in known_hosts
* on this client. Recommend prompt for user action/acceptance of host.
* @param host_hash
*/
void hostUnknown(QString host_hash);
/**
* @brief hostPublicKeyChanged
* Signal is emitted when the host is known, but the key differs from that in
* known_hosts. This could be a man-in-the-middle attack. Recommended
* disconnect from session.
* @param host_hash
*/
void hostPublicKeyChanged(QString host_hash);
/**
* @brief hostPublicKeyUnavailable
* Signal is emitted when the remote host does not have a public key.
* Recommended to disconnect from session.
*/
void hostPublicKeyUnavailable();
/**
* @brief knownHostError
* This signal is emitted when an unknown error occurs retrieving known_hosts.
* @param message
*/
void knownHostError(QString message);
/**
* @brief updateKnownHostsFailed
* Signal is emitted upon accepting public key update that fails to update
* client known_hosts.
*/
void updateKnownHostsFailed();
/**
* @brief authenticationError
* Signal is emitted when the user's authentication method password/pubkey
* fails.
* @param message
*/
void authenticationError(QString message);
/**
* @brief authenticationSucceeded
* Signal is emitted indicating successful authentication again remote host.
*/
void authenticationSucceeded();
/**
* @brief passwordRequested
* Signal is emitted when public key authentication fails and password is
* asked for. Recommend prompt user for password and
* authenticateWithPassword().
*/
void passwordRequested();
/**
* @brief loginBannerIssued
* Signal is emitted after authentication has succeeded and if a banner is
* available on the remote host.
* @param message
*/
void loginBannerIssued(QString message);
/**
* @brief execOutputReady
* Signal is emitted if a requestExec was performed with standard output.
*/
void execOutputReady();
/**
* @brief execFailed
* Signal is emitted if requestExec fails in someway.
* @param message
*/
void execFailed(QString message);
/**
* @brief execFinished
* Signal is emitted when requestExec() has completed.
*/
void execFinished();
/**
* Set the remote host to connect to
*/
void setHostRequested(QString host);
/**
* Set the Log verbosity
*/
void setLogVerbosityRequested(SessionVerbosity level);
/**
* Set the ssh port number