Rabbit Remote Control 0.0.36
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 (CParameterSSHTunnel *parameter, CParameterNet *remote, CConnect *pConnect)
 
void run () override
 
void Exit ()
 

Private Attributes

CConnectm_pConnect
 
CParameterSSHTunnelm_pParameter
 
CParameterNetm_pRemoteNet
 
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:
{
// Start ssh thread
if(!m_pThread) {
// Don' t delete it, It deletes itself when it ends. See: CSSHTunnelThread::CSSHTunnelThread()
m_pThread = new CSSHTunnelThread(
&m_pParameter->m_Proxy.m_SSH, &m_pParameter->m_Net, this);
}
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)
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::NotUseOnProcess;
}
#endif // #ifdef HAVE_LIBSSH
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 25 of file SSHTunnelThread.h.

Constructor & Destructor Documentation

◆ ~CSSHTunnelThread()

CSSHTunnelThread::~CSSHTunnelThread ( )
virtual

Definition at line 24 of file SSHTunnelThread.cpp.

Member Function Documentation

◆ Exit()

void CSSHTunnelThread::Exit ( )

Definition at line 29 of file SSHTunnelThread.cpp.

◆ run()

void CSSHTunnelThread::run ( )
override

Definition at line 34 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;
auto &net = m_pParameter->m_Proxy.m_SSH.m_Net;
//qDebug(log) << "CConnectLibVNCServer::slotConnectServer" << nPort;
// Set server ip and port
m_pClient->serverHost = strdup(szHost.toStdString().c_str());
m_pClient->serverPort = nPort;
szErr = tr("Will 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))
{
// Because delete m_pClient in rfbInitClient
m_pClient = nullptr;
QString szErr;
szErr = tr("Fail: Connect to %1:%2 <- %3:%4 <- %5:%6")
.arg(m_pParameter->m_Net.GetHost(),
QString::number(m_pParameter->m_Net.GetPort()),
net.GetHost(), QString::number(net.GetPort()),
szHost, QString::number(nPort)
);
qCritical(log) << szErr;
emit sigShowMessageBox(tr("Error"), szErr, QMessageBox::Critical);
return;
}
QString szInfo = QString("Connected to %1 <- %2:%3 <- %4:%5")
.arg(m_pClient->desktopName,
net.GetHost(), QString::number(net.GetPort()),
szHost, QString::number(nPort));
qInfo(log) << szInfo;
slotTimeOut();
emit sigSetDesktopSize(m_pClient->width, m_pClient->height);
emit sigServerName(m_pClient->desktopName);
emit sigInformation(szInfo);
emit sigConnected();
}
#if defined(HAVE_UNIX_DOMAIN_SOCKET)
{
QString szErr;
//qDebug(log) << "CConnectLibVNCServer::slotConnectServer" << szFile;
// Set server ip and port
m_pClient->serverHost = strdup(szFile.toStdString().c_str());
szErr = tr("Will connect to local socket server: ") + szFile;
qDebug(log) << szErr;
if(!rfbInitClient(m_pClient, nullptr, nullptr))
{
// Because delete m_pClient in rfbInitClient
m_pClient = nullptr;
QString szErr;
szErr = tr("Fail: Connect to %1:%2 with %3")
.arg(m_pParameter->m_Net.GetHost(),
QString::number(m_pParameter->m_Net.GetPort()),
szFile);
qCritical(log) << szErr;
emit sigShowMessageBox(tr("Error"), szErr, QMessageBox::Critical);
return;
}
QString szInfo = QString("Connected to ") + m_pClient->desktopName + " with " + szFile;
qInfo(log) << szInfo;
slotTimeOut();
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 54 of file SSHTunnelThread.h.

◆ m_pConnect

CConnect* CSSHTunnelThread::m_pConnect
private

Definition at line 51 of file SSHTunnelThread.h.

◆ m_pParameter

CParameterSSHTunnel* CSSHTunnelThread::m_pParameter
private

Definition at line 52 of file SSHTunnelThread.h.

◆ m_pRemoteNet

CParameterNet* CSSHTunnelThread::m_pRemoteNet
private

Definition at line 53 of file SSHTunnelThread.h.


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