-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit 'e6b7730437464f4ac060ee20df2ca533c6bbf426' into main
- Loading branch information
Showing
57 changed files
with
4,998 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
!build_fcitx_qt6_linux.sh | ||
!build_winpty_ms.sh | ||
!build_libssh2.sh | ||
!build_libssh2_msvc.bat | ||
!build_libssh2_mingw.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd) | ||
|
||
cd $SHELL_FOLDER | ||
tar -xzvf openssl-3.1.4.tar.gz | ||
cd $SHELL_FOLDER/openssl-3.1.4 | ||
./config --prefix=$SHELL_FOLDER/output --openssldir=$SHELL_FOLDER/output no-threads | ||
make -j16 | ||
make install | ||
rm -rf $SHELL_FOLDER/openssl-3.1.4 | ||
|
||
cd $SHELL_FOLDER | ||
tar -xzvf libssh2-1.11.0.tar.gz | ||
cd $SHELL_FOLDER/libssh2-1.11.0 | ||
./configure --prefix=$SHELL_FOLDER/output --enable-shared --disable-static --without-libz --with-openssl=$SHELL_FOLDER/output | ||
make -j16 | ||
make install | ||
rm -rf $SHELL_FOLDER/libssh2-1.11.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd) | ||
|
||
cd $SHELL_FOLDER | ||
tar -xzvf openssl-3.1.4.tar.gz | ||
cd $SHELL_FOLDER/openssl-3.1.4 | ||
./configure --prefix=$SHELL_FOLDER/output --openssldir=$SHELL_FOLDER/output no-threads mingw64 | ||
make -j16 | ||
make install | ||
rm -rf $SHELL_FOLDER/openssl-3.1.4 | ||
|
||
cd $SHELL_FOLDER | ||
tar -xzvf libssh2-1.11.0.tar.gz | ||
cd $SHELL_FOLDER/libssh2-1.11.0 | ||
./configure --prefix=$SHELL_FOLDER/output --enable-shared --disable-static --without-libz --with-openssl=$SHELL_FOLDER/output | ||
make -j16 | ||
make install | ||
rm -rf $SHELL_FOLDER/libssh2-1.11.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
tar -xzvf libssh2-1.11.0.tar.gz | ||
mkdir output | ||
cd ./libssh2-1.11.0 | ||
cmake -DCRYPTO_BACKEND=WinCNG -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=../output . | ||
cmake --build . --config Release --target install |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
HEADERS += \ | ||
$$PWD/sshchannel.h \ | ||
$$PWD/sshclient.h \ | ||
$$PWD/sshprocess.h \ | ||
$$PWD/sshshell.h \ | ||
$$PWD/sshkey.h \ | ||
$$PWD/sshscpget.h \ | ||
$$PWD/sshscpsend.h \ | ||
$$PWD/sshsftpcommandget.h \ | ||
$$PWD/sshsftpcommandfileinfo.h \ | ||
$$PWD/sshsftpcommand.h \ | ||
$$PWD/sshsftpcommandmkdir.h \ | ||
$$PWD/sshsftpcommandsend.h \ | ||
$$PWD/sshsftpcommandreaddir.h \ | ||
$$PWD/sshsftpcommandunlink.h \ | ||
$$PWD/sshsftp.h \ | ||
$$PWD/sshtunneldataconnector.h \ | ||
$$PWD/sshtunnelinconnection.h \ | ||
$$PWD/sshtunneloutconnection.h \ | ||
$$PWD/sshtunnelout.h \ | ||
$$PWD/sshtunnelin.h | ||
|
||
SOURCES += \ | ||
$$PWD/sshchannel.cpp \ | ||
$$PWD/sshclient.cpp \ | ||
$$PWD/sshkey.cpp \ | ||
$$PWD/sshprocess.cpp \ | ||
$$PWD/sshshell.cpp \ | ||
$$PWD/sshscpget.cpp \ | ||
$$PWD/sshscpsend.cpp \ | ||
$$PWD/sshsftpcommand.cpp \ | ||
$$PWD/sshsftpcommandfileinfo.cpp \ | ||
$$PWD/sshsftpcommandget.cpp \ | ||
$$PWD/sshsftpcommandmkdir.cpp \ | ||
$$PWD/sshsftpcommandreaddir.cpp \ | ||
$$PWD/sshsftpcommandsend.cpp \ | ||
$$PWD/sshsftpcommandunlink.cpp \ | ||
$$PWD/sshsftp.cpp \ | ||
$$PWD/sshtunneldataconnector.cpp \ | ||
$$PWD/sshtunnelinconnection.cpp \ | ||
$$PWD/sshtunnelin.cpp \ | ||
$$PWD/sshtunneloutconnection.cpp \ | ||
$$PWD/sshtunnelout.cpp | ||
|
||
INCLUDEPATH += \ | ||
$$PWD | ||
|
||
LIBSSH2_DIR=/home/qqm/Downloads/work/quardCRT/quardCRT/depend/output | ||
|
||
|
||
|
||
|
||
win32:{ | ||
win32-g++ { | ||
INCLUDEPATH += $${LIBSSH2_DIR}/include | ||
LIBS += -L$${LIBSSH2_DIR}/lib -lssh2 | ||
} | ||
win32-msvc*{ | ||
INCLUDEPATH += $${LIBSSH2_DIR}/include | ||
LIBS += $${LIBSSH2_DIR}\lib\libssh2.lib | ||
} | ||
} | ||
|
||
unix:{ | ||
INCLUDEPATH += $${LIBSSH2_DIR}/include | ||
LIBS += -L$${LIBSSH2_DIR}/lib -lssh2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include "sshchannel.h" | ||
#include "sshclient.h" | ||
#include <QCoreApplication> | ||
|
||
Q_LOGGING_CATEGORY(sshchannel, "ssh.channel", QtWarningMsg) | ||
|
||
SshChannel::SshChannel(QString name, SshClient *client) | ||
: QObject(client) | ||
, m_sshClient(client) | ||
, m_name(name) | ||
{ | ||
qCDebug(sshchannel) << "createChannel:" << m_name; | ||
QObject::connect(m_sshClient, &SshClient::sshDataReceived, this, &SshChannel::sshDataReceived, Qt::QueuedConnection); | ||
} | ||
|
||
SshChannel::~SshChannel() | ||
{ | ||
qCDebug(sshchannel) << "destroyChannel:" << this; | ||
setChannelState(ChannelState::Free); | ||
} | ||
|
||
SshClient *SshChannel::sshClient() const | ||
{ | ||
return m_sshClient; | ||
} | ||
|
||
SshChannel::ChannelState SshChannel::channelState() const | ||
{ | ||
return m_channelState; | ||
} | ||
|
||
void SshChannel::setChannelState(const ChannelState &channelState) | ||
{ | ||
if(m_channelState != channelState) | ||
{ | ||
qCDebug(sshchannel) << m_name << "Change State:" << m_channelState << "->" << channelState; | ||
m_channelState = channelState; | ||
emit stateChanged(m_channelState); | ||
} | ||
} | ||
|
||
bool SshChannel::waitForState(SshChannel::ChannelState state) | ||
{ | ||
QEventLoop wait(this); | ||
QObject::connect(this, &SshChannel::stateChanged, &wait, &QEventLoop::quit); | ||
while(channelState() != ChannelState::Error && channelState() != ChannelState::Free && channelState() !=state) | ||
{ | ||
wait.exec(); | ||
} | ||
return channelState() == state; | ||
} | ||
|
||
|
||
QString SshChannel::name() const | ||
{ | ||
return m_name; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** | ||
* \file sshchannel.h | ||
* \brief Generic Channel SSH class | ||
* \author Fabien Proriol | ||
* \version 1.0 | ||
* \date 2018/03/22 | ||
* \details This class is a Generic class for all Ssh Channel | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <QObject> | ||
#include <QLoggingCategory> | ||
#include <QMutex> | ||
#include <libssh2.h> | ||
|
||
class SshClient; | ||
|
||
Q_DECLARE_LOGGING_CATEGORY(sshchannel) | ||
|
||
class SshChannel : public QObject | ||
{ | ||
Q_OBJECT | ||
friend class SshClient; | ||
|
||
public: | ||
QString name() const; | ||
virtual void close() = 0; | ||
|
||
enum ChannelState { | ||
Openning, | ||
Exec, | ||
Ready, | ||
Close, | ||
WaitClose, | ||
Freeing, | ||
Free, | ||
Error | ||
}; | ||
Q_ENUM(ChannelState) | ||
|
||
ChannelState channelState() const; | ||
void setChannelState(const ChannelState &channelState); | ||
bool waitForState(SshChannel::ChannelState state); | ||
|
||
SshClient *sshClient() const; | ||
|
||
protected: | ||
explicit SshChannel(QString name, SshClient *client); | ||
virtual ~SshChannel(); | ||
SshClient *m_sshClient {nullptr}; | ||
QString m_name; | ||
|
||
protected slots: | ||
virtual void sshDataReceived() {} | ||
|
||
private: | ||
ChannelState m_channelState {ChannelState::Openning}; | ||
|
||
signals: | ||
void stateChanged(ChannelState state); | ||
}; |
Oops, something went wrong.