ssh2.h 708 B

1234567891011121314151617181920212223242526272829303132
  1. #pragma once
  2. #ifndef __SSH2_20180627__
  3. #define __SSH2_20180627__
  4. #include "channel.h"
  5. class ssh2
  6. {
  7. public:
  8. ssh2(const string &srvIp, int srvPort = 22);
  9. ~ssh2(void);
  10. bool Connect(const string &userName, const string &userPwd);
  11. bool Disconnect(void);
  12. Channel* CreateChannel(const string &ptyType = "vanilla");
  13. public:
  14. static void S_KbdCallback(const char*, int, const char*, int, int, const LIBSSH2_USERAUTH_KBDINT_PROMPT*, LIBSSH2_USERAUTH_KBDINT_RESPONSE*, void **a);
  15. static string s_password;
  16. private:
  17. string m_srvIp;
  18. int m_srvPort;
  19. string m_userName;
  20. string m_password;
  21. int m_sock;
  22. LIBSSH2_SESSION *m_session;
  23. };
  24. #endif // __SSH2_20180627__