PuttyIntf.h 5.3 KB

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