sshsendfacility_p.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /**************************************************************************
  2. **
  3. ** This file is part of Qt Creator
  4. **
  5. ** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
  6. **
  7. ** Contact: http://www.qt-project.org/
  8. **
  9. **
  10. ** GNU Lesser General Public License Usage
  11. **
  12. ** This file may be used under the terms of the GNU Lesser General Public
  13. ** License version 2.1 as published by the Free Software Foundation and
  14. ** appearing in the file LICENSE.LGPL included in the packaging of this file.
  15. ** Please review the following information to ensure the GNU Lesser General
  16. ** Public License version 2.1 requirements will be met:
  17. ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
  18. **
  19. ** In addition, as a special exception, Nokia gives you certain additional
  20. ** rights. These rights are described in the Nokia Qt LGPL Exception
  21. ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
  22. **
  23. ** Other Usage
  24. **
  25. ** Alternatively, this file may be used in accordance with the terms and
  26. ** conditions contained in a signed written agreement between you and Nokia.
  27. **
  28. **
  29. **************************************************************************/
  30. #ifndef SSHCONNECTIONOUTSTATE_P_H
  31. #define SSHCONNECTIONOUTSTATE_P_H
  32. #include "sshcryptofacility_p.h"
  33. #include "sshoutgoingpacket_p.h"
  34. #include <QStringList>
  35. QT_BEGIN_NAMESPACE
  36. class QTcpSocket;
  37. QT_END_NAMESPACE
  38. namespace QSsh {
  39. class SshPseudoTerminal;
  40. namespace Internal {
  41. class SshKeyExchange;
  42. class SshSendFacility
  43. {
  44. public:
  45. SshSendFacility(QTcpSocket *socket);
  46. void reset();
  47. void recreateKeys(const SshKeyExchange &keyExchange);
  48. void createAuthenticationKey(const QByteArray &privKeyFileContents);
  49. QByteArray sessionId() const { return m_encrypter.sessionId(); }
  50. QByteArray sendKeyExchangeInitPacket();
  51. void sendKeyDhInitPacket(const Botan::BigInt &e);
  52. void sendKeyEcdhInitPacket(const QByteArray &clientQ);
  53. void sendNewKeysPacket();
  54. void sendDisconnectPacket(SshErrorCode reason,
  55. const QByteArray &reasonString);
  56. void sendMsgUnimplementedPacket(quint32 serverSeqNr);
  57. void sendUserAuthServiceRequestPacket();
  58. void sendUserAuthByPasswordRequestPacket(const QByteArray &user,
  59. const QByteArray &service, const QByteArray &pwd);
  60. void sendUserAuthByPublicKeyRequestPacket(const QByteArray &user,
  61. const QByteArray &service, const QByteArray &key, const QByteArray &signature);
  62. void sendQueryPublicKeyPacket(const QByteArray &user, const QByteArray &service,
  63. const QByteArray &publicKey);
  64. void sendUserAuthByKeyboardInteractiveRequestPacket(const QByteArray &user,
  65. const QByteArray &service);
  66. void sendUserAuthInfoResponsePacket(const QStringList &responses);
  67. void sendRequestFailurePacket();
  68. void sendIgnorePacket();
  69. void sendInvalidPacket();
  70. void sendSessionPacket(quint32 channelId, quint32 windowSize,
  71. quint32 maxPacketSize);
  72. void sendDirectTcpIpPacket(quint32 channelId, quint32 windowSize, quint32 maxPacketSize,
  73. const QByteArray &remoteHost, quint32 remotePort, const QByteArray &localIpAddress,
  74. quint32 localPort);
  75. void sendTcpIpForwardPacket(const QByteArray &bindAddress, quint32 bindPort);
  76. void sendCancelTcpIpForwardPacket(const QByteArray &bindAddress, quint32 bindPort);
  77. void sendPtyRequestPacket(quint32 remoteChannel,
  78. const SshPseudoTerminal &terminal);
  79. void sendEnvPacket(quint32 remoteChannel, const QByteArray &var,
  80. const QByteArray &value);
  81. void sendX11ForwardingPacket(quint32 remoteChannel, const QByteArray &protocol,
  82. const QByteArray &cookie, quint32 screenNumber);
  83. void sendExecPacket(quint32 remoteChannel, const QByteArray &command);
  84. void sendShellPacket(quint32 remoteChannel);
  85. void sendSftpPacket(quint32 remoteChannel);
  86. void sendWindowAdjustPacket(quint32 remoteChannel, quint32 bytesToAdd);
  87. void sendChannelDataPacket(quint32 remoteChannel, const QByteArray &data);
  88. void sendChannelSignalPacket(quint32 remoteChannel,
  89. const QByteArray &signalName);
  90. void sendChannelEofPacket(quint32 remoteChannel);
  91. void sendChannelClosePacket(quint32 remoteChannel);
  92. void sendChannelOpenConfirmationPacket(quint32 remoteChannel, quint32 localChannel,
  93. quint32 localWindowSize, quint32 maxPackeSize);
  94. void sendChannelOpenFailurePacket(quint32 remoteChannel, quint32 reason,
  95. const QByteArray &reasonString);
  96. quint32 nextClientSeqNr() const { return m_clientSeqNr; }
  97. bool encrypterIsValid() const { return m_encrypter.isValid(); }
  98. private:
  99. void sendPacket();
  100. quint32 m_clientSeqNr;
  101. SshEncryptionFacility m_encrypter;
  102. QTcpSocket *m_socket;
  103. SshOutgoingPacket m_outgoingPacket;
  104. };
  105. } // namespace Internal
  106. } // namespace QSsh
  107. #endif // SSHCONNECTIONOUTSTATE_P_H