Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
Signals | Public Member Functions | Private Attributes | List of all members
CSSHTunnelThread Class Reference

Data is forwarded over a local socket and SSH tunnel. More...

#include <SSHTunnelThread.h>

Inheritance diagram for CSSHTunnelThread:

Signals

void sigServer (QString szHost, quint16 nPort)
 It is triggered when the socket service establishes a listener and is used to notify other local sockets that it can connect to it.
 
void sigServer (QString szUnixDomainSocket)
 
void sigError (const int nError, const QString &szError=QString())
 
void sigDisconnect ()
 

Public Member Functions

 CSSHTunnelThread (QSharedPointer< CParameterChannelSSH > parameter)
 
void run () override
 
void Exit ()
 

Private Attributes

QSharedPointer< CParameterChannelSSHm_Parameter
 
bool m_bExit
 

Detailed Description

Data is forwarded over a local socket and SSH tunnel.

It is suitable for cases where the library does not implement a transport layer interface, only socket.

Note
When the thread finished, the thread will be deleted.
#ifdef HAVE_LIBSSH
case CParameterProxy::TYPE::SSHTunnel:
{
// Set SSH parameters
QSharedPointer<CParameterChannelSSH> parameter(new CParameterChannelSSH());
auto &ssh = m_pParameter->m_Proxy.m_SSH;
parameter->setServer(ssh.GetHost());
parameter->setPort(ssh.GetPort());
auto &user = ssh.m_User;
parameter->SetUser(user.GetUser());
parameter->SetUseSystemFile(user.GetUseSystemFile());
if(CParameterUser::TYPE::UserPassword == user.GetUsedType()) {
parameter->SetAuthenticationMethod(SSH_AUTH_METHOD_PASSWORD);
parameter->SetPassword(user.GetPassword());
}
if(CParameterUser::TYPE::PublicKey == user.GetUsedType()) {
parameter->SetAuthenticationMethod(SSH_AUTH_METHOD_PUBLICKEY);
parameter->SetPublicKeyFile(user.GetPublicKeyFile());
parameter->SetPrivateKeyFile(user.GetPrivateKeyFile());
parameter->SetPassphrase(user.GetPassphrase());
}
auto &net = m_pParameter->m_Net;
parameter->SetRemoteHost(net.GetHost());
parameter->SetRemotePort(net.GetPort());
// Start ssh thread
if(!m_pThread)
m_pThread = new CSSHTunnelThread(parameter);
if(!m_pThread)
return OnInitReturnValue::Fail;
bool check = connect(m_pThread, SIGNAL(sigServer(QString, quint16)),
this, SLOT(slotConnectProxyServer(QString, quint16)));
Q_ASSERT(check);
#if defined(HAVE_UNIX_DOMAIN_SOCKET) && defined(Q_OS_UNIX)
check = connect(m_pThread, SIGNAL(sigServer(QString)),
this, SLOT(slotConnectProxyServer(QString)));
Q_ASSERT(check);
#endif
check = connect(m_pThread, SIGNAL(sigError(int,QString)),
this, SIGNAL(sigError(int,QString)));
Q_ASSERT(check);
check = connect(m_pThread, SIGNAL(sigDisconnect()),
this, SIGNAL(sigDisconnect()));
Q_ASSERT(check);
m_pThread->start();
return OnInitReturnValue::UseOnProcess;
}
#endif
Data is forwarded over a local socket and SSH tunnel.
void sigServer(QString szHost, quint16 nPort)
It is triggered when the socket service establishes a listener and is used to notify other local sock...
See also
CChannelSSHTunnelForward

Definition at line 24 of file SSHTunnelThread.h.

Constructor & Destructor Documentation

◆ ~CSSHTunnelThread()

CSSHTunnelThread::~CSSHTunnelThread ( )
virtual

Definition at line 23 of file SSHTunnelThread.cpp.

Member Function Documentation

◆ Exit()

void CSSHTunnelThread::Exit ( )

Definition at line 28 of file SSHTunnelThread.cpp.

◆ run()

void CSSHTunnelThread::run ( )
override

Definition at line 33 of file SSHTunnelThread.cpp.

◆ sigServer

void CSSHTunnelThread::sigServer ( QString  szHost,
quint16  nPort 
)
signal

It is triggered when the socket service establishes a listener and is used to notify other local sockets that it can connect to it.

void CConnectLibVNCServer::slotConnectProxyServer(QString szHost, quint16 nPort)
{
QString szErr;
qDebug(log) << "CConnectLibVNCServer::slotConnectServer" << nPort;
// Set server ip and port
m_pClient->serverHost = strdup(szHost.toStdString().c_str());
m_pClient->serverPort = nPort;
szErr = tr("Connect to local socket server %1:%2")
.arg(m_pClient->serverHost,
QString::number(m_pClient->serverPort));
qDebug(log) << szErr;
if(!rfbInitClient(m_pClient, nullptr, nullptr))
{
szErr += tr(" fail");
qCritical(log) << szErr;
//emit sigShowMessageBox(tr("Error"), szErr, QMessageBox::Critical);
return;
}
QString szInfo = QString("Connect to ") + m_pClient->desktopName;
qInfo(log) << szInfo;
emit sigSetDesktopSize(m_pClient->width, m_pClient->height);
emit sigServerName(m_pClient->desktopName);
emit sigInformation(szInfo);
emit sigConnected();
}
#if defined(HAVE_UNIX_DOMAIN_SOCKET) && defined(Q_OS_UNIX)
{
QString szErr;
qDebug(log) << "CConnectLibVNCServer::slotConnectServer" << szFile;
// Set server ip and port
m_pClient->serverHost = strdup(szFile.toStdString().c_str());
szErr = tr("Connect to local socket server ") + szFile;
qDebug(log) << szErr;
if(!rfbInitClient(m_pClient, nullptr, nullptr))
{
szErr += + " " + tr("fail");
qCritical(log) << szErr;
//emit sigShowMessageBox(tr("Error"), szErr, QMessageBox::Critical);
return;
}
QString szInfo = QString("Connect to ") + m_pClient->desktopName;
qInfo(log) << szInfo;
emit sigSetDesktopSize(m_pClient->width, m_pClient->height);
emit sigServerName(m_pClient->desktopName);
emit sigInformation(szInfo);
emit sigConnected();
}
#endif
void slotConnectProxyServer(QString szHost, quint16 nPort)
[connect local socket server]

Member Data Documentation

◆ m_bExit

bool CSSHTunnelThread::m_bExit
private

Definition at line 50 of file SSHTunnelThread.h.

◆ m_Parameter

QSharedPointer<CParameterChannelSSH> CSSHTunnelThread::m_Parameter
private

Definition at line 49 of file SSHTunnelThread.h.


The documentation for this class was generated from the following files: