ssh_.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #include "ssh.c"
  2. #include "puttyexp.h"
  3. void ssh_close(void * handle)
  4. {
  5. ssh_do_close((Ssh)handle, FALSE);
  6. }
  7. int is_ssh(void * handle)
  8. {
  9. Plug fn = (Plug)handle;
  10. return (*fn)->closing == ssh_closing;
  11. }
  12. void call_ssh_timer(void * handle)
  13. {
  14. if (((Ssh)handle)->version == 2)
  15. {
  16. ssh2_timer(handle, GETTICKCOUNT());
  17. }
  18. }
  19. int get_ssh_version(void * handle)
  20. {
  21. return ((Ssh)handle)->version;
  22. }
  23. void * get_ssh_frontend(void * handle)
  24. {
  25. return ((Ssh)handle)->frontend;
  26. }
  27. int get_ssh1_compressing(void * handle)
  28. {
  29. return ((Ssh)handle)->v1_compressing;
  30. }
  31. const struct ssh_cipher * get_cipher(void * handle)
  32. {
  33. return ((Ssh)handle)->cipher;
  34. }
  35. const struct ssh2_cipher * get_cscipher(void * handle)
  36. {
  37. return ((Ssh)handle)->cscipher;
  38. }
  39. const struct ssh2_cipher * get_sccipher(void * handle)
  40. {
  41. return ((Ssh)handle)->sccipher;
  42. }
  43. const struct ssh_compress * get_cscomp(void * handle)
  44. {
  45. return ((Ssh)handle)->cscomp;
  46. }
  47. const struct ssh_compress * get_sccomp(void * handle)
  48. {
  49. return ((Ssh)handle)->sccomp;
  50. }
  51. int get_ssh_state(void * handle)
  52. {
  53. return ((Ssh)handle)->state;
  54. }
  55. int get_ssh_state_closed(void * handle)
  56. {
  57. return ((Ssh)handle)->state == SSH_STATE_CLOSED;
  58. }
  59. int get_ssh_state_session(void * handle)
  60. {
  61. return ((Ssh)handle)->state == SSH_STATE_SESSION;
  62. }
  63. int get_ssh_exitcode(void * handle)
  64. {
  65. return ssh_return_exitcode(handle);
  66. }
  67. const unsigned int * ssh2_remmaxpkt(void * handle)
  68. {
  69. return &((Ssh)handle)->mainchan->v.v2.remmaxpkt;
  70. }
  71. const unsigned int * ssh2_remwindow(void * handle)
  72. {
  73. return &((Ssh)handle)->mainchan->v.v2.remwindow;
  74. }
  75. void md5checksum(const char * buffer, int len, unsigned char output[16])
  76. {
  77. struct MD5Context md5c;
  78. MD5Init(&md5c);
  79. MD5Update(&md5c, buffer, len);
  80. MD5Final(output, &md5c);
  81. }