Develop and Download Open Source Software

Browse Subversion Repository

Contents of /branches/ssh_chacha20poly1305/ttssh2/ttxssh/ttxssh.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3078 - (show annotations) (download) (as text)
Wed Dec 26 12:17:29 2007 UTC (16 years, 3 months ago) by yutakapon
Original Path: ttssh2/trunk/ttxssh/ttxssh.h
File MIME type: text/x-chdr
File size: 7822 byte(s)
SSHハートビートスレッドのパケット送信をモードレスダイアログ内で行うことで、
コンテキストの乱れを発生させないようにする。

1 /*
2 Copyright (c) 1998-2001, Robert O'Callahan
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without modification,
6 are permitted provided that the following conditions are met:
7
8 Redistributions of source code must retain the above copyright notice, this list of
9 conditions and the following disclaimer.
10
11 Redistributions in binary form must reproduce the above copyright notice, this list
12 of conditions and the following disclaimer in the documentation and/or other materials
13 provided with the distribution.
14
15 The name of Robert O'Callahan may not be used to endorse or promote products derived from
16 this software without specific prior written permission.
17
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
19 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21 THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 /*
30 This code is copyright (C) 1998-1999 Robert O'Callahan.
31 See LICENSE.TXT for the license.
32 */
33
34 #ifndef __TTXSSH_H
35 #define __TTXSSH_H
36
37 #pragma warning(3 : 4035)
38
39 #ifndef NO_INET6
40 #include <winsock2.h>
41 #include <ws2tcpip.h>
42 /* actual body of in6addr_any and in6addr_loopback is disappeared?? */
43 #undef IN6_IS_ADDR_LOOPBACK
44 #define IN6_IS_ADDR_LOOPBACK(a) \
45 ((*(unsigned int *)(&(a)->s6_addr[0]) == 0) && \
46 (*(unsigned int *)(&(a)->s6_addr[4]) == 0) && \
47 (*(unsigned int *)(&(a)->s6_addr[8]) == 0) && \
48 (*(unsigned int *)(&(a)->s6_addr[12]) == ntohl(1)))
49 /* work around for MS Platform SDK Oct 2000 */
50 #include <malloc.h> /* prevent of conflict stdlib.h */
51 #endif /* NO_INET6 */
52 #include <stdlib.h>
53 #include <crtdbg.h>
54
55 #include "i18n.h"
56
57
58 typedef struct _TInstVar FAR * PTInstVar;
59
60 #include "util.h"
61 #include "pkt.h"
62 #include "ssh.h"
63 #include "auth.h"
64 #include "crypt.h"
65 #include "hosts.h"
66 #include "fwd.h"
67
68 #include <openssl/dh.h>
69 #include <openssl/evp.h>
70 #include "buffer.h"
71
72 /* tttypes.h �����`���������� EM �}�N���� openssl/rsa.h (OpenSSL 0.9.8)�������v���g�^�C�v������
73 * �������������d�����������������A�r���h�G���[�������B���L3�w�b�_��include���u�����L�����������B
74 * (2005.7.9 yutaka)
75 */
76 #include "teraterm.h"
77 #include "tttypes.h"
78 #include "ttplugin.h"
79
80 HANDLE hInst; /* Instance handle of TTXSSH.DLL */
81
82 #define ID_SSHSCPMENU 52110
83 #define ID_SSHSETUPMENU 52310
84 #define ID_SSHAUTHSETUPMENU 52320
85 #define ID_SSHFWDSETUPMENU 52330
86 #define ID_SSHKEYGENMENU 52340
87 #define ID_ABOUTMENU 52910
88
89 #define ID_SSHAUTH 62501
90 #define ID_SSHUNKNOWNHOST 62502
91 #define ID_SSHDIFFERENTHOST 62503
92 #define ID_SSHASYNCMESSAGEBOX 62504
93
94 /*
95 These are the fields that WOULD go in Teraterm's 'ts' structure, if
96 we could put them there.
97 */
98 typedef struct _TS_SSH {
99 BOOL Enabled;
100 int CompressionLevel; /* 0 = NONE, else 1-9 */
101 char DefaultUserName[256];
102
103 /* this next option is a string of digits. Each digit represents a
104 cipher. The first digit is the most preferred cipher, and so on.
105 The digit SSH_CIPHER_NONE signifies that any ciphers after it are
106 disabled. */
107 char CipherOrder[16];
108
109 char KnownHostsFiles[2048];
110 int DefaultAuthMethod;
111 char DefaultRhostsLocalUserName[256];
112 char DefaultRhostsHostPrivateKeyFile[1024];
113 char DefaultRSAPrivateKeyFile[1024];
114
115 char DefaultForwarding[2048];
116 BOOL TryDefaultAuth;
117
118 int LogLevel; /* 0 = NONE, 100 = Verbose */
119 int WriteBufferSize;
120 int LocalForwardingIdentityCheck;
121
122 int ssh_protocol_version; // SSH version (2004.10.11 yutaka)
123 int ssh_heartbeat_overtime; // SSH heartbeat(keepalive) (2004.12.11 yutaka)
124 // whether password will permanently store on heap memory (2006.8.5 yutaka)
125 int remember_password;
126
127 // try auth with "none" method for disable unsupported on dialog (2007.9.24 maya)
128 BOOL CheckAuthListFirst;
129 } TS_SSH;
130
131 typedef struct _TInstVar {
132 PTTSet ts;
133 PComVar cv;
134
135 /* shared memory for settings across instances. Basically it's
136 a cache for the INI file.*/
137 TS_SSH FAR * ts_SSH;
138
139 int fatal_error;
140 int showing_err;
141 char FAR * err_msg;
142
143 Tconnect Pconnect;
144 Trecv Precv;
145 Tsend Psend;
146 TWSAAsyncSelect PWSAAsyncSelect;
147 TWSAGetLastError PWSAGetLastError;
148
149 PReadIniFile ReadIniFile;
150 PWriteIniFile WriteIniFile;
151 PParseParam ParseParam;
152
153 SOCKET socket;
154 HWND NotificationWindow;
155 unsigned int notification_msg;
156 long notification_events;
157 HICON OldSmallIcon;
158 HICON OldLargeIcon;
159
160 BOOL hostdlg_activated;
161 BOOL hostdlg_Enabled;
162
163 int protocol_major;
164 int protocol_minor;
165
166 PKTState pkt_state;
167 SSHState ssh_state;
168 AUTHState auth_state;
169 CRYPTState crypt_state;
170 HOSTSState hosts_state;
171 FWDState fwd_state;
172
173 /* The settings applied to the current session. The user may change
174 the settings but usually we don't want that to affect the session
175 in progress (race conditions). So user setup changes usually
176 modify the 'settings' field below. */
177 TS_SSH session_settings;
178
179 /* our copy of the global settings. This is synced up with the shared
180 memory only when we do a ReadIniFile or WriteIniFile
181 (i.e. the user loads or saves setup) */
182 TS_SSH settings;
183
184 // SSH2
185 DH *kexdh;
186 char server_version_string[128];
187 char client_version_string[128];
188 buffer_t *my_kex;
189 buffer_t *peer_kex;
190 enum kex_exchange kex_type; // KEX algorithm
191 enum hostkey_type hostkey_type;
192 SSHCipher ctos_cipher;
193 SSHCipher stoc_cipher;
194 enum hmac_type ctos_hmac;
195 enum hmac_type stoc_hmac;
196 enum compression_algorithm ctos_compression;
197 enum compression_algorithm stoc_compression;
198 int we_need;
199 int key_done;
200 int rekeying;
201 char *session_id;
202 int session_id_len;
203 Newkeys ssh2_keys[MODE_MAX];
204 EVP_CIPHER_CTX evpcip[MODE_MAX];
205 int userauth_success;
206 int shell_id;
207 /*int remote_id;*/
208 int session_nego_status;
209 /*
210 unsigned int local_window;
211 unsigned int local_window_max;
212 unsigned int local_consumed;
213 unsigned int local_maxpacket;
214 unsigned int remote_window;
215 unsigned int remote_maxpacket;
216 */
217 int client_key_bits;
218 int server_key_bits;
219 int kexgex_min;
220 int kexgex_bits;
221 int kexgex_max;
222 int ssh2_autologin;
223 int ask4passwd;
224 SSHAuthMethod ssh2_authmethod;
225 char ssh2_username[MAX_PATH];
226 char ssh2_password[MAX_PATH];
227 char ssh2_keyfile[MAX_PATH];
228 time_t ssh_heartbeat_tick;
229 HANDLE ssh_heartbeat_thread;
230 int keyboard_interactive_password_input;
231 int userauth_retry_count;
232 buffer_t *decomp_buffer;
233 char *ssh2_authlist;
234 BOOL tryed_ssh2_authlist;
235 HWND ssh_hearbeat_dialog;
236 } TInstVar;
237
238 #define LOG_LEVEL_FATAL 5
239 #define LOG_LEVEL_ERROR 10
240 #define LOG_LEVEL_URGENT 20
241 #define LOG_LEVEL_WARNING 30
242 #define LOG_LEVEL_VERBOSE 100
243
244 #define SSHv1(pvar) ((pvar)->protocol_major == 1)
245 #define SSHv2(pvar) ((pvar)->protocol_major == 2)
246
247 void notify_established_secure_connection(PTInstVar pvar);
248 void notify_closed_connection(PTInstVar pvar);
249 void notify_nonfatal_error(PTInstVar pvar, char FAR * msg);
250 void notify_fatal_error(PTInstVar pvar, char FAR * msg);
251 void notify_verbose_message(PTInstVar pvar, char FAR * msg, int level);
252
253 void get_teraterm_dir_relative_name(char FAR * buf, int bufsize, char FAR * basename);
254 int copy_teraterm_dir_relative_path(char FAR * dest, int destsize, char FAR * basename);
255 void get_file_version(char *exefile, int *major, int *minor, int *release, int *build);
256 int uuencode(unsigned char *src, int srclen, unsigned char *target, int targsize);
257
258 #endif

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26