PuttyIntf.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //---------------------------------------------------------------------------
  2. #ifndef PuttyIntfH
  3. #define PuttyIntfH
  4. #ifdef PUTTY_PUTTY_H
  5. #error Should be included sooner than "Putty.h" !!
  6. #endif
  7. //---------------------------------------------------------------------------
  8. struct charset_spec;
  9. #include "charset\Charset.h"
  10. //---------------------------------------------------------------------------
  11. typedef UINT_PTR SOCKET;
  12. //---------------------------------------------------------------------------
  13. extern "C"
  14. {
  15. void sk_init();
  16. int select_result(WPARAM wParam, LPARAM lParam);
  17. int socket_writable(SOCKET skt);
  18. void random_ref(void);
  19. void random_unref(void);
  20. void random_save_seed(void);
  21. int verify_host_key(char * hostname, int port, char * keytype, char * key);
  22. void store_host_key(char * hostname, int port, char * keytype, char * key);
  23. void * saferealloc(void * ptr, size_t n, size_t size);
  24. void * safemalloc(size_t n, size_t size);
  25. void safefree(void * ptr);
  26. void noise_regular(void);
  27. void * log_init(void * frontend, void * cfg);
  28. void putty_mungestr(const char * in, char * out);
  29. void putty_unmungestr(const char * in, char * out, int outlen);
  30. char * seedpath_ptr();
  31. int seedpath_size();
  32. void putty_get_seedpath(void);
  33. void agent_schedule_callback(void (* callback)(void *, void *, int),
  34. void * callback_ctx, void * data, int len);
  35. void read_utf8(charset_spec const *charset, long int input_chr,
  36. charset_state *state, void (*emit)(void *ctx, long int output), void *emitctx);
  37. void write_utf8(charset_spec const *charset, long int input_chr,
  38. charset_state *state, void (*emit)(void *ctx, long int output), void *emitctx);
  39. // -------------
  40. void ssh_close(void * handle);
  41. int get_ssh_version(void * handle);
  42. void call_ssh_timer(void * handle);
  43. int is_ssh(void * handle);
  44. void * get_ssh_frontend(void * handle);
  45. int get_ssh1_compressing(void * handle);
  46. const struct ssh_cipher * get_cipher(void * handle);
  47. const struct ssh2_cipher * get_cscipher(void * handle);
  48. const struct ssh2_cipher * get_sccipher(void * handle);
  49. const struct ssh_compress * get_cscomp(void * handle);
  50. const struct ssh_compress * get_sccomp(void * handle);
  51. int get_ssh_state(void * handle);
  52. int get_ssh_state_closed(void * handle);
  53. int get_ssh_exitcode(void * handle);
  54. int ssh_fallback_cmd(void * handle);
  55. const unsigned int * ssh2_remmaxpkt(void * handle);
  56. const unsigned int * ssh2_remwindow(void * handle);
  57. // -------------
  58. int from_backend(void * frontend, int is_stderr, char * data, int datalen);
  59. // from ssh.h for key generation
  60. struct RSAKey;
  61. struct dss_key;
  62. typedef void (* progfn_t) (void * param, int action, int phase, int progress);
  63. void random_add_heavynoise(void * noise, int length);
  64. int dsa_generate(struct dss_key * key, int bits, progfn_t pfn, void * pfnparam);
  65. int rsa_generate(struct RSAKey * key, int bits, progfn_t pfn, void * pfnparam);
  66. void rsa_fingerprint(char * str, int len, struct RSAKey * key);
  67. void base64_encode_atom(unsigned char * data, int n, char * out);
  68. int ssh2_save_userkey(char * filename, struct ssh2_userkey * key, char * passphrase);
  69. int export_ssh2(char * filename, int type, struct ssh2_userkey * key, char * passphrase);
  70. int saversakey(char * filename, struct RSAKey * key, char * passphrase);
  71. // -------------
  72. void SSHVerifyHostKey(void * frontend, char * host, int port, char * keytype,
  73. char * keystr, char * fingerprint);
  74. void SSHLogEvent(void * frontend, const char * string);
  75. void SSHConnectionFatal(void * frontend, char * string);
  76. void SSHFatalError(char * string);
  77. void SSHAskAlg(void * frontend, const char * AlgType, const char * AlgName);
  78. void SSHOldKeyfileWarning(void);
  79. long RegOpenWinSCPKey(HKEY hKey, const char * lpSubKey, HKEY * phkResult);
  80. long RegCreateWinSCPKey(HKEY hKey, const char * lpSubKey, HKEY * phkResult);
  81. long RegQueryWinSCPValueEx(HKEY Key, const char * ValueName, unsigned long * Reserved,
  82. unsigned long * Type, unsigned char * Data, unsigned long * DataSize);
  83. long RegSetWinSCPValueEx(HKEY Key, const char * ValueName, unsigned long Reserved,
  84. unsigned long Type, const unsigned char * Data, unsigned long DataSize);
  85. long RegCloseWinSCPKey(HKEY Key);
  86. }
  87. //---------------------------------------------------------------------------
  88. extern const struct ssh_compress ssh_zlib;
  89. extern const struct ssh_cipher ssh_3des;
  90. extern const struct ssh_cipher ssh_des;
  91. extern const struct ssh_cipher ssh_blowfish_ssh1;
  92. extern const struct ssh2_ciphers ssh2_3des;
  93. extern const struct ssh2_ciphers ssh2_des;
  94. extern const struct ssh2_ciphers ssh2_aes;
  95. extern const struct ssh2_ciphers ssh2_blowfish;
  96. //---------------------------------------------------------------------------
  97. #define MPEXT
  98. #include "Putty.h"
  99. #include <SSH.h>
  100. #include <Proxy.h>
  101. //---------------------------------------------------------------------------
  102. #endif