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 6286 - (show annotations) (download) (as text)
Mon Feb 1 15:14:14 2016 UTC (8 years, 2 months ago) by yutakapon
File MIME type: text/x-chdr
File size: 10148 byte(s)
チケット #35744 VS2015の警告除去

下記ブランチからマージした。
svn+ssh://yutakapon@svn.sourceforge.jp/svnroot/ttssh2/branches/vs2015_warn
リビジョン6194 - 6260

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 /* VS2015(VC14.0)�����AWSASocketA(), inet_ntoa() ������API��deprecated��������
40 * �x�������������A�x�����}�~�����B�����������u���������AVS2005(VC8.0)���r���h
41 * �����������������A�x�����}�~���������������B
42 */
43 #if _MSC_VER >= 1800 // VSC2013(VC12.0) or later
44 #ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
45 #define _WINSOCK_DEPRECATED_NO_WARNINGS
46 #endif
47 #endif
48
49 #ifndef NO_INET6
50 #include <winsock2.h>
51 #include <ws2tcpip.h>
52 /* actual body of in6addr_any and in6addr_loopback is disappeared?? */
53 #undef IN6_IS_ADDR_LOOPBACK
54 #define IN6_IS_ADDR_LOOPBACK(a) \
55 ((*(unsigned int *)(&(a)->s6_addr[0]) == 0) && \
56 (*(unsigned int *)(&(a)->s6_addr[4]) == 0) && \
57 (*(unsigned int *)(&(a)->s6_addr[8]) == 0) && \
58 (*(unsigned int *)(&(a)->s6_addr[12]) == ntohl(1)))
59 /* work around for MS Platform SDK Oct 2000 */
60 #include <malloc.h> /* prevent of conflict stdlib.h */
61 #endif /* NO_INET6 */
62 #include <stdlib.h>
63 #include <stdarg.h>
64 #include <crtdbg.h>
65
66 #include "i18n.h"
67 #include "ttlib.h"
68
69 typedef struct _TInstVar FAR * PTInstVar;
70
71 #include "util.h"
72 #include "pkt.h"
73 #include "ssh.h"
74 #include "auth.h"
75 #include "crypt.h"
76 #include "hosts.h"
77 #include "fwd.h"
78
79 #include <openssl/dh.h>
80 #include <openssl/ec.h>
81 #include <openssl/evp.h>
82 #include "buffer.h"
83
84 /* tttypes.h �����`���������� EM �}�N���� openssl/rsa.h (OpenSSL 0.9.8)�������v���g�^�C�v������
85 * �������������d�����������������A�r���h�G���[�������B���L3�w�b�_��include���u�����L�����������B
86 * (2005.7.9 yutaka)
87 */
88 #include "teraterm.h"
89 #include "tttypes.h"
90 #include "ttplugin.h"
91
92 HANDLE hInst; /* Instance handle of TTXSSH.DLL */
93
94 #define ID_SSHSCPMENU 52110
95 #define ID_SSHSETUPMENU 52310
96 #define ID_SSHAUTHSETUPMENU 52320
97 #define ID_SSHFWDSETUPMENU 52330
98 #define ID_SSHKEYGENMENU 52340
99 #define ID_ABOUTMENU 52910
100
101 #define ID_SSHAUTH 62501
102 #define ID_SSHUNKNOWNHOST 62502
103 #define ID_SSHDIFFERENTKEY 62503
104 #define ID_SSHASYNCMESSAGEBOX 62504
105
106 #define OPTION_NONE 0
107 #define OPTION_CLEAR 1
108 #define OPTION_REPLACE 2
109
110 /*
111 * DisablePopupMessage �p���r�b�g���`
112 */
113 #define POPUP_MSG_default 0
114 #define POPUP_MSG_FWD_received_data (1 << 0)
115
116
117 /*
118 * Host key rotation
119 */
120 #define SSH_UPDATE_HOSTKEYS_NO 0
121 #define SSH_UPDATE_HOSTKEYS_YES 1
122 #define SSH_UPDATE_HOSTKEYS_ASK 2
123 #define SSH_UPDATE_HOSTKEYS_MAX 3
124
125 /*
126 * Server compatibility flag
127 */
128 #define SSH_BUG_DHGEX_LARGE 0x00000001
129
130
131 /*
132 These are the fields that WOULD go in Tera Term's 'ts' structure, if
133 we could put them there.
134 */
135 typedef struct _TS_SSH {
136 BOOL Enabled;
137 int CompressionLevel; /* 0 = NONE, else 1-9 */
138 char DefaultUserName[256];
139
140 /* this next option is a string of digits. Each digit represents a
141 cipher. The first digit is the most preferred cipher, and so on.
142 The digit SSH_CIPHER_NONE signifies that any ciphers after it are
143 disabled. */
144 char CipherOrder[SSH_CIPHER_MAX+1];
145
146 char KnownHostsFiles[2048];
147 int DefaultAuthMethod;
148 char DefaultRhostsLocalUserName[256];
149 char DefaultRhostsHostPrivateKeyFile[1024];
150 char DefaultRSAPrivateKeyFile[1024];
151
152 char DefaultForwarding[2048];
153 BOOL TryDefaultAuth;
154
155 int LogLevel; /* 0 = NONE, 100 = Verbose */
156 int WriteBufferSize;
157
158 int ssh_protocol_version; // SSH version (2004.10.11 yutaka)
159 int ssh_heartbeat_overtime; // SSH heartbeat(keepalive) (2004.12.11 yutaka)
160 // whether password will permanently store on heap memory (2006.8.5 yutaka)
161 int remember_password;
162
163 // try auth with "none" method for disable unsupported on dialog (2007.9.24 maya)
164 BOOL CheckAuthListFirst;
165
166 // Enable connection to the server that has RSA key length less than 768 bit (2008.9.11 maya)
167 BOOL EnableRsaShortKeyServer;
168
169 // Enable Agent forwarding
170 BOOL ForwardAgent;
171
172 // Confirm Agent forwarding
173 BOOL ForwardAgentConfirm;
174
175 // KEX order(derived from teraterm.ini)
176 char KexOrder[KEX_DH_MAX+1];
177 char HostKeyOrder[KEY_MAX+1];
178 char MacOrder[HMAC_MAX+1];
179 char CompOrder[COMP_MAX+1];
180
181 BOOL VerifyHostKeyDNS;
182
183 int IconID;
184
185 int DisablePopupMessage;
186
187 char X11Display[128];
188
189 int UpdateHostkeys;
190
191 int GexMinimalGroupSize;
192 } TS_SSH;
193
194 typedef struct _TInstVar {
195 PTTSet ts;
196 PComVar cv;
197
198 /* shared memory for settings across instances. Basically it's
199 a cache for the INI file.*/
200 TS_SSH FAR * ts_SSH;
201
202 int fatal_error;
203 int showing_err;
204 char FAR * err_msg;
205
206 Tconnect Pconnect;
207 Trecv Precv;
208 Tsend Psend;
209 TWSAAsyncSelect PWSAAsyncSelect;
210 TWSAGetLastError PWSAGetLastError;
211
212 PReadIniFile ReadIniFile;
213 PWriteIniFile WriteIniFile;
214 PParseParam ParseParam;
215
216 HMENU FileMenu;
217
218 SOCKET socket;
219 HWND NotificationWindow;
220 unsigned int notification_msg;
221 long notification_events;
222 HICON OldSmallIcon;
223 HICON OldLargeIcon;
224
225 BOOL hostdlg_activated;
226 BOOL hostdlg_Enabled;
227
228 int protocol_major;
229 int protocol_minor;
230
231 PKTState pkt_state;
232 SSHState ssh_state;
233 AUTHState auth_state;
234 CRYPTState crypt_state;
235 HOSTSState hosts_state;
236 FWDState fwd_state;
237
238 /* The settings applied to the current session. The user may change
239 the settings but usually we don't want that to affect the session
240 in progress (race conditions). So user setup changes usually
241 modify the 'settings' field below. */
242 TS_SSH session_settings;
243
244 /* our copy of the global settings. This is synced up with the shared
245 memory only when we do a ReadIniFile or WriteIniFile
246 (i.e. the user loads or saves setup) */
247 TS_SSH settings;
248
249 // SSH2
250 DH *kexdh;
251 char server_version_string[128];
252 char client_version_string[128];
253 buffer_t *my_kex;
254 buffer_t *peer_kex;
255 kex_algorithm kex_type; // KEX algorithm
256 ssh_keytype hostkey_type;
257 SSHCipher ctos_cipher;
258 SSHCipher stoc_cipher;
259 hmac_type ctos_hmac;
260 hmac_type stoc_hmac;
261 compression_type ctos_compression;
262 compression_type stoc_compression;
263 int we_need;
264 int key_done;
265 int rekeying;
266 char *session_id;
267 int session_id_len;
268 Newkeys ssh2_keys[MODE_MAX];
269 EVP_CIPHER_CTX evpcip[MODE_MAX];
270 int userauth_success;
271 int shell_id;
272 /*int remote_id;*/
273 int session_nego_status;
274 /*
275 unsigned int local_window;
276 unsigned int local_window_max;
277 unsigned int local_consumed;
278 unsigned int local_maxpacket;
279 unsigned int remote_window;
280 unsigned int remote_maxpacket;
281 */
282 int client_key_bits;
283 int server_key_bits;
284 int kexgex_min;
285 int kexgex_bits;
286 int kexgex_max;
287 int ssh2_autologin;
288 int ask4passwd;
289 SSHAuthMethod ssh2_authmethod;
290 char ssh2_username[MAX_PATH];
291 char ssh2_password[MAX_PATH];
292 char ssh2_keyfile[MAX_PATH];
293 time_t ssh_heartbeat_tick;
294 HANDLE ssh_heartbeat_thread;
295 int keyboard_interactive_password_input;
296 int userauth_retry_count;
297 buffer_t *decomp_buffer;
298 char *ssh2_authlist;
299 BOOL tryed_ssh2_authlist;
300 HWND ssh_hearbeat_dialog;
301
302 /* Pageant �������M�p */
303 unsigned char *pageant_key;
304 unsigned char *pageant_curkey;
305 int pageant_keylistlen;
306 int pageant_keycount;
307 int pageant_keycurrent;
308 BOOL pageant_keyfinal;// SSH2 PK_OK ������������ TRUE ������
309
310 // agent forward
311 BOOL agentfwd_enable;
312
313 BOOL origDisableTCPEchoCR;
314
315 BOOL nocheck_known_hosts;
316
317 EC_KEY *ecdh_client_key;
318
319 int dns_key_check;
320
321 unsigned int server_compat_flag;
322
323 void *hostkey_ctx;
324 } TInstVar;
325
326 #define LOG_LEVEL_FATAL 5
327 #define LOG_LEVEL_ERROR 10
328 #define LOG_LEVEL_URGENT 20
329 #define LOG_LEVEL_WARNING 30
330 #define LOG_LEVEL_NOTIFY 50
331 #define LOG_LEVEL_INFO 80
332 #define LOG_LEVEL_VERBOSE 100
333 #define LOG_LEVEL_SSHDUMP 200
334
335 #define SSHv1(pvar) ((pvar)->protocol_major == 1)
336 #define SSHv2(pvar) ((pvar)->protocol_major == 2)
337
338 void notify_established_secure_connection(PTInstVar pvar);
339 void notify_closed_connection(PTInstVar pvar, char FAR * send_msg);
340 void notify_nonfatal_error(PTInstVar pvar, char FAR * msg);
341 void notify_fatal_error(PTInstVar pvar, char FAR * msg, BOOL send_disconnect);
342 void notify_verbose_message(PTInstVar pvar, char FAR * msg, int level);
343 void logprintf(PTInstVar pvar, int level, char *fmt, ...);
344
345 void get_teraterm_dir_relative_name(char FAR * buf, int bufsize, char FAR * basename);
346 int copy_teraterm_dir_relative_path(char FAR * dest, int destsize, char FAR * basename);
347 void get_file_version(char *exefile, int *major, int *minor, int *release, int *build);
348 int uuencode(unsigned char *src, int srclen, unsigned char *target, int targsize);
349
350 #endif

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