Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/ttssh2/ttxssh/ttxssh.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2816 - (show annotations) (download) (as text)
Sat Apr 23 17:26:57 2005 UTC (18 years, 11 months ago) by yutakakn
Original Path: ttssh2/trunk/ttxssh/ttxssh.h
File MIME type: text/x-chdr
File size: 9190 byte(s)
キー作成ダイアログの追加。

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 #ifdef 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 /* INET6 */
52 #include <stdlib.h>
53 #include <crtdbg.h>
54
55 #include "teraterm.h"
56 #include "tttypes.h"
57 #include "ttplugin.h"
58
59 typedef struct _TInstVar FAR * PTInstVar;
60
61 #include "util.h"
62 #include "pkt.h"
63 #include "ssh.h"
64 #include "auth.h"
65 #include "crypt.h"
66 #include "hosts.h"
67 #include "fwd.h"
68
69 #include <openssl/dh.h>
70 #include <openssl/evp.h>
71 #include "buffer.h"
72
73 HANDLE hInst; /* Instance handle of TTXSSH.DLL */
74
75 #define ID_ABOUTMENU 62501
76 #define ID_SSHAUTH 62502
77 #define ID_SSHSETUPMENU 62503
78 #define ID_SSHUNKNOWNHOST 62504
79 #define ID_SSHDIFFERENTHOST 62505
80 #define ID_SSHAUTHSETUPMENU 62506
81 #define ID_SSHASYNCMESSAGEBOX 62507
82 #define ID_SSHFWDSETUPMENU 62508
83 #define ID_SSHKEYGENMENU 62509
84
85 /*
86 These are the fields that WOULD go in Teraterm's 'ts' structure, if
87 we could put them there.
88 */
89 typedef struct _TS_SSH {
90 BOOL Enabled;
91 int CompressionLevel; /* 0 = NONE, else 1-9 */
92 char DefaultUserName[256];
93
94 /* this next option is a string of digits. Each digit represents a
95 cipher. The first digit is the most preferred cipher, and so on.
96 The digit SSH_CIPHER_NONE signifies that any ciphers after it are
97 disabled. */
98 char CipherOrder[16];
99
100 char KnownHostsFiles[2048];
101 int DefaultAuthMethod;
102 char DefaultRhostsLocalUserName[256];
103 char DefaultRhostsHostPrivateKeyFile[1024];
104 char DefaultRSAPrivateKeyFile[1024];
105
106 char DefaultForwarding[2048];
107 BOOL TryDefaultAuth;
108
109 int LogLevel; /* 0 = NONE, 100 = Verbose */
110 int WriteBufferSize;
111 int LocalForwardingIdentityCheck;
112
113 int ssh_protocol_version; // SSH version (2004.10.11 yutaka)
114 int ssh_heartbeat_overtime; // SSH heartbeat(keepalive) (2004.12.11 yutaka)
115 int ssh2_keyboard_interactive; // SSH2 keyboard-interactive (2005.1.23 yutaka)
116 } TS_SSH;
117
118 typedef struct _TInstVar {
119 PTTSet ts;
120 PComVar cv;
121
122 /* shared memory for settings across instances. Basically it's
123 a cache for the INI file.*/
124 TS_SSH FAR * ts_SSH;
125
126 int fatal_error;
127 int showing_err;
128 char FAR * err_msg;
129
130 Tconnect Pconnect;
131 Trecv Precv;
132 Tsend Psend;
133 TWSAAsyncSelect PWSAAsyncSelect;
134 TWSAGetLastError PWSAGetLastError;
135
136 PReadIniFile ReadIniFile;
137 PWriteIniFile WriteIniFile;
138 PParseParam ParseParam;
139
140 SOCKET socket;
141 HWND NotificationWindow;
142 unsigned int notification_msg;
143 long notification_events;
144 HICON OldSmallIcon;
145 HICON OldLargeIcon;
146
147 BOOL hostdlg_activated;
148 BOOL hostdlg_Enabled;
149
150 int protocol_major;
151 int protocol_minor;
152
153 PKTState pkt_state;
154 SSHState ssh_state;
155 AUTHState auth_state;
156 CRYPTState crypt_state;
157 HOSTSState hosts_state;
158 FWDState fwd_state;
159
160 /* The settings applied to the current session. The user may change
161 the settings but usually we don't want that to affect the session
162 in progress (race conditions). So user setup changes usually
163 modify the 'settings' field below. */
164 TS_SSH session_settings;
165
166 /* our copy of the global settings. This is synced up with the shared
167 memory only when we do a ReadIniFile or WriteIniFile
168 (i.e. the user loads or saves setup) */
169 TS_SSH settings;
170
171 // SSH2
172 DH *kexdh;
173 char server_version_string[128];
174 char client_version_string[128];
175 buffer_t *my_kex;
176 buffer_t *peer_kex;
177 enum kex_exchange kex_type; // KEX algorithm
178 enum hostkey_type hostkey_type;
179 SSHCipher ctos_cipher;
180 SSHCipher stoc_cipher;
181 enum hmac_type ctos_hmac;
182 enum hmac_type stoc_hmac;
183 int we_need;
184 int key_done;
185 int rekeying;
186 char *session_id;
187 int session_id_len;
188 Newkeys ssh2_keys[MODE_MAX];
189 EVP_CIPHER_CTX evpcip[MODE_MAX];
190 int userauth_success;
191 int shell_id;
192 /*int remote_id;*/
193 int session_nego_status;
194 /*
195 unsigned int local_window;
196 unsigned int local_window_max;
197 unsigned int local_consumed;
198 unsigned int local_maxpacket;
199 unsigned int remote_window;
200 unsigned int remote_maxpacket;
201 */
202 int client_key_bits;
203 int server_key_bits;
204 int kexgex_min;
205 int kexgex_bits;
206 int kexgex_max;
207 int ssh2_autologin;
208 SSHAuthMethod ssh2_authmethod;
209 char ssh2_username[MAX_PATH];
210 char ssh2_password[MAX_PATH];
211 char ssh2_keyfile[MAX_PATH];
212 time_t ssh_heartbeat_tick;
213 HANDLE ssh_heartbeat_thread;
214 int keyboard_interactive_done;
215 int keyboard_interactive_password_input;
216 int userauth_retry_count;
217
218 } TInstVar;
219
220 #define LOG_LEVEL_FATAL 5
221 #define LOG_LEVEL_ERROR 10
222 #define LOG_LEVEL_URGENT 20
223 #define LOG_LEVEL_WARNING 30
224 #define LOG_LEVEL_VERBOSE 100
225
226 #define SSHv1(pvar) ((pvar)->protocol_major == 1)
227 #define SSHv2(pvar) ((pvar)->protocol_major == 2)
228
229 void notify_established_secure_connection(PTInstVar pvar);
230 void notify_closed_connection(PTInstVar pvar);
231 void notify_nonfatal_error(PTInstVar pvar, char FAR * msg);
232 void notify_fatal_error(PTInstVar pvar, char FAR * msg);
233 void notify_verbose_message(PTInstVar pvar, char FAR * msg, int level);
234
235 void get_teraterm_dir_relative_name(char FAR * buf, int bufsize, char FAR * basename);
236 int copy_teraterm_dir_relative_path(char FAR * dest, int destsize, char FAR * basename);
237 void get_file_version(char *exefile, int *major, int *minor, int *release, int *build);
238
239 #endif
240
241 /*
242 * $Log: not supported by cvs2svn $
243 * Revision 1.11 2005/04/03 14:39:48 yutakakn
244 * SSH2 channel lookup�@�\�������i�|�[�g�t�H���[�f�B���O�������j�B
245 * TTSSH 2.10����������log dump�@�\���������ADH������������buffer free��
246 * �A�v���P�[�V�������������������o�O���C���B
247 *
248 * Revision 1.10 2005/03/12 15:07:34 yutakakn
249 * SSH2 keyboard-interactive�F����TIS�_�C�A���O�����������B
250 *
251 * Revision 1.9 2005/03/10 13:40:39 yutakakn
252 * ���������O�C���������s���������������ASSH2_MSG_SERVICE_REQUEST�����M��
253 * �����������������BOpenSSH�����x���������ATru64 UNIX�����T�[�o�G���[�������������������B
254 *
255 * Revision 1.8 2005/03/03 13:28:23 yutakakn
256 * �N���C�A���g��SSH�o�[�W������ ttxssh.dll �������������A�T�[�o�����������������B
257 *
258 * Revision 1.7 2005/01/27 13:30:33 yutakakn
259 * ���J���F���������O�C�����T�|�[�g�B
260 * /auth=publickey, /keyfile �I�v�V�������V�K���������B
261 * �����A�����������������T�|�[�g�B
262 *
263 * Revision 1.6 2005/01/24 14:07:07 yutakakn
264 * �Ekeyboard-interactive�F�����T�|�[�g�����B
265 * �@�����������Ateraterm.ini�� "KeyboardInteractive" �G���g�������������B
266 * �E�o�[�W�����_�C�A���O�� OpenSSL�o�[�W���� ������
267 *
268 * Revision 1.5 2004/12/27 14:05:08 yutakakn
269 * 'Auto window close'���L���������A���f�������������������������C�������B
270 * �@�E�X���b�h���I����������������������
271 * �@�E�m������SSH���\�[�X������
272 *
273 * Revision 1.4 2004/12/17 14:05:55 yutakakn
274 * �p�P�b�g���M����HMAC�`�F�b�N�������B
275 * KEX��������HMAC�A���S���Y���`�F�b�N�������B
276 *
277 * Revision 1.3 2004/12/11 07:31:00 yutakakn
278 * SSH heartbeat�X���b�h�����������B�����������AIP�}�X�J���[�h�������������A���[�^��
279 * NAT�e�[�u���N���A�������ASSH�R�l�N�V���������f�����������������������B
280 * ���������������Ateraterm.ini��TTSSH�Z�N�V�������AHeartBeat �G���g���������B
281 *
282 * Revision 1.2 2004/12/01 15:37:49 yutakakn
283 * SSH2�������O�C���@�\�������B
284 * �����A�p�X���[�h�F�������������B
285 * �E�R�}���h���C��
286 * /ssh /auth=�F�����\�b�h /user=���[�U�� /passwd=�p�X���[�h
287 *
288 */

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