玉兔远程控制 0.0.31
载入中...
搜索中...
未找到
ChannelSSHTunnelForward.h
1// Author: Kang Lin <kl222@126.com>
2
3#ifndef CHANNELSSHTUNNELFORWARD_H
4#define CHANNELSSHTUNNELFORWARD_H
5
6#include "ChannelSSHTunnel.h"
7
23{
24 Q_OBJECT
25public:
26 explicit CChannelSSHTunnelForward(QSharedPointer<CParameterChannelSSH> parameter,
27 QObject *parent = nullptr);
29
30 // QIODevice interface
31public:
32 virtual bool open(OpenMode mode) override;
33 virtual void close() override;
34 virtual int Process();
35
36 enum class SOCKET_TYPE{
37 UnixSocket,
38 Socket
39 };
40
41Q_SIGNALS:
42 void sigServer(QString szHost, quint16 nPort);
43 void sigServer(QString szUnixDomainSocket);
44
45private:
46 socket_t m_Listen;
47 socket_t m_Connector;
48
49 SOCKET_TYPE m_SocketType;
50
51 int CloseSocket(socket_t &s);
52 int AcceptConnect();
53 int ReadConnect();
54 int SSHReadyRead();
55 int OpenSocket();
56#if defined(HAVE_UNIX_DOMAIN_SOCKET)
57 int OpenUnixSocket();
58#endif
59 char* m_pBuffer;
60 const int m_BufferLength = 1024;
61};
62
63#endif // CHANNELSSHTUNNELFORWARD_H
包括 SSH 隧道和用于转发数据的本地 SOCKET 服务。 实现通过本地 SOCKET 与 SSH 隧道转发数据。适用于库没有实现传输层接口,只有 socket 的情况。
virtual bool open(OpenMode mode) override