Develop and Download Open Source Software

Browse Subversion Repository

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7773 - (hide annotations) (download) (as text)
Sun Jun 16 03:24:59 2019 UTC (4 years, 9 months ago) by maya
Original Path: trunk/ttssh2/ttxssh/ttxssh.h
File MIME type: text/x-chdr
File size: 11227 byte(s)
warning C4005 が出るので修正

少なくとも Visual Studio 2013 には _Printf_format_string_ がある
根拠なくバージョンを指定しないでほしい
1 maya 3227 /*
2 doda 6841 * Copyright (c) 1998-2001, Robert O'Callahan
3 zmatsuo 7479 * (C) 2004-2019 TeraTerm Project
4 doda 6841 * All rights reserved.
5     *
6     * Redistribution and use in source and binary forms, with or without
7     * modification, are permitted provided that the following conditions
8     * are met:
9     *
10     * 1. Redistributions of source code must retain the above copyright
11     * notice, this list of conditions and the following disclaimer.
12     * 2. Redistributions in binary form must reproduce the above copyright
13     * notice, this list of conditions and the following disclaimer in the
14     * documentation and/or other materials provided with the distribution.
15     * 3. The name of the author may not be used to endorse or promote products
16     * derived from this software without specific prior written permission.
17     *
18     * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
19     * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20     * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21     * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22     * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23     * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24     * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25     * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27     * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28     */
29 maya 3227
30     /*
31     This code is copyright (C) 1998-1999 Robert O'Callahan.
32     See LICENSE.TXT for the license.
33     */
34    
35     #ifndef __TTXSSH_H
36     #define __TTXSSH_H
37    
38     #pragma warning(3 : 4035)
39    
40 yutakapon 6286 /* VS2015(VC14.0)�����AWSASocketA(), inet_ntoa() ������API��deprecated��������
41     * �x�������������A�x�����}�~�����B�����������u���������AVS2005(VC8.0)���r���h
42     * �����������������A�x�����}�~���������������B
43     */
44     #if _MSC_VER >= 1800 // VSC2013(VC12.0) or later
45     #ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
46     #define _WINSOCK_DEPRECATED_NO_WARNINGS
47     #endif
48     #endif
49    
50 maya 3227 #include <winsock2.h>
51     #include <ws2tcpip.h>
52 zmatsuo 7479 #include <wspiapi.h>
53 maya 3227 /* actual body of in6addr_any and in6addr_loopback is disappeared?? */
54     #undef IN6_IS_ADDR_LOOPBACK
55     #define IN6_IS_ADDR_LOOPBACK(a) \
56     ((*(unsigned int *)(&(a)->s6_addr[0]) == 0) && \
57     (*(unsigned int *)(&(a)->s6_addr[4]) == 0) && \
58     (*(unsigned int *)(&(a)->s6_addr[8]) == 0) && \
59     (*(unsigned int *)(&(a)->s6_addr[12]) == ntohl(1)))
60     /* work around for MS Platform SDK Oct 2000 */
61     #include <malloc.h> /* prevent of conflict stdlib.h */
62     #include <stdlib.h>
63 doda 6051 #include <stdarg.h>
64 maya 3227 #include <crtdbg.h>
65    
66     #include "i18n.h"
67 maya 3295 #include "ttlib.h"
68 maya 3227
69 doda 6801 typedef struct _TInstVar *PTInstVar;
70 maya 3227
71 doda 6834 #include "ttxssh-version.h"
72 maya 3227 #include "util.h"
73     #include "pkt.h"
74     #include "ssh.h"
75     #include "auth.h"
76     #include "crypt.h"
77     #include "hosts.h"
78     #include "fwd.h"
79    
80     #include <openssl/dh.h>
81 maya 4314 #include <openssl/ec.h>
82 maya 3227 #include <openssl/evp.h>
83     #include "buffer.h"
84    
85     /* tttypes.h �����`���������� EM �}�N���� openssl/rsa.h (OpenSSL 0.9.8)�������v���g�^�C�v������
86     * �������������d�����������������A�r���h�G���[�������B���L3�w�b�_��include���u�����L�����������B
87     * (2005.7.9 yutaka)
88     */
89     #include "teraterm.h"
90     #include "tttypes.h"
91     #include "ttplugin.h"
92    
93 maya 7773 #if defined(_MSC_VER) && !defined(_Printf_format_string_)
94     // ���`�������������������������������������`��������
95 zmatsuo 7648 #define _Printf_format_string_
96     #endif
97    
98 maya 3227 HANDLE hInst; /* Instance handle of TTXSSH.DLL */
99    
100     #define ID_SSHSCPMENU 52110
101     #define ID_SSHSETUPMENU 52310
102     #define ID_SSHAUTHSETUPMENU 52320
103     #define ID_SSHFWDSETUPMENU 52330
104     #define ID_SSHKEYGENMENU 52340
105     #define ID_ABOUTMENU 52910
106    
107     #define ID_SSHAUTH 62501
108     #define ID_SSHUNKNOWNHOST 62502
109 maya 4330 #define ID_SSHDIFFERENTKEY 62503
110 maya 3227 #define ID_SSHASYNCMESSAGEBOX 62504
111    
112     #define OPTION_NONE 0
113     #define OPTION_CLEAR 1
114     #define OPTION_REPLACE 2
115    
116     /*
117 yutakapon 5620 * DisablePopupMessage �p���r�b�g���`
118     */
119     #define POPUP_MSG_default 0
120     #define POPUP_MSG_FWD_received_data (1 << 0)
121    
122 yutakapon 5849
123 yutakapon 5620 /*
124 yutakapon 5849 * Host key rotation
125     */
126 doda 5887 #define SSH_UPDATE_HOSTKEYS_NO 0
127     #define SSH_UPDATE_HOSTKEYS_YES 1
128     #define SSH_UPDATE_HOSTKEYS_ASK 2
129 yutakapon 5901 #define SSH_UPDATE_HOSTKEYS_MAX 3
130 yutakapon 5849
131 doda 5928 /*
132     * Server compatibility flag
133     */
134     #define SSH_BUG_DHGEX_LARGE 0x00000001
135 yutakapon 5849
136 doda 5928
137 yutakapon 5849 /*
138 maya 3227 These are the fields that WOULD go in Tera Term's 'ts' structure, if
139     we could put them there.
140     */
141     typedef struct _TS_SSH {
142     BOOL Enabled;
143     int CompressionLevel; /* 0 = NONE, else 1-9 */
144 zmatsuo 7632
145     int DefaultUserType; /* 0/1/2 = no input/DefaultUserName/Windows logon user */
146 maya 3227 char DefaultUserName[256];
147    
148     /* this next option is a string of digits. Each digit represents a
149     cipher. The first digit is the most preferred cipher, and so on.
150     The digit SSH_CIPHER_NONE signifies that any ciphers after it are
151     disabled. */
152 doda 7455 char CipherOrder[SSH_CIPHER_MAX+2];
153 maya 3227
154     char KnownHostsFiles[2048];
155     int DefaultAuthMethod;
156     char DefaultRhostsLocalUserName[256];
157     char DefaultRhostsHostPrivateKeyFile[1024];
158     char DefaultRSAPrivateKeyFile[1024];
159    
160 doda 6831 char DefaultForwarding[4096];
161 maya 3227 BOOL TryDefaultAuth;
162    
163     int LogLevel; /* 0 = NONE, 100 = Verbose */
164     int WriteBufferSize;
165    
166     int ssh_protocol_version; // SSH version (2004.10.11 yutaka)
167     int ssh_heartbeat_overtime; // SSH heartbeat(keepalive) (2004.12.11 yutaka)
168     // whether password will permanently store on heap memory (2006.8.5 yutaka)
169     int remember_password;
170    
171     // try auth with "none" method for disable unsupported on dialog (2007.9.24 maya)
172     BOOL CheckAuthListFirst;
173    
174     // Enable connection to the server that has RSA key length less than 768 bit (2008.9.11 maya)
175     BOOL EnableRsaShortKeyServer;
176    
177     // Enable Agent forwarding
178     BOOL ForwardAgent;
179 maya 4229
180     // Confirm Agent forwarding
181     BOOL ForwardAgentConfirm;
182 yutakapon 4367
183 doda 6663 // Confirm Agent forwarding
184     BOOL ForwardAgentNotify;
185    
186 yutakapon 4367 // KEX order(derived from teraterm.ini)
187     char KexOrder[KEX_DH_MAX+1];
188     char HostKeyOrder[KEY_MAX+1];
189     char MacOrder[HMAC_MAX+1];
190     char CompOrder[COMP_MAX+1];
191 doda 4531
192     BOOL VerifyHostKeyDNS;
193 doda 5261
194     int IconID;
195 yutakapon 5620
196     int DisablePopupMessage;
197 doda 5793
198     char X11Display[128];
199 yutakapon 5839
200 yutakapon 5901 int UpdateHostkeys;
201 doda 5900
202     int GexMinimalGroupSize;
203 doda 7048
204     int AuthBanner;
205 maya 3227 } TS_SSH;
206    
207     typedef struct _TInstVar {
208     PTTSet ts;
209     PComVar cv;
210    
211     /* shared memory for settings across instances. Basically it's
212     a cache for the INI file.*/
213 doda 6801 TS_SSH *ts_SSH;
214 maya 3227
215     int fatal_error;
216     int showing_err;
217 doda 6801 char *err_msg;
218 maya 3227
219     Tconnect Pconnect;
220     Trecv Precv;
221     Tsend Psend;
222     TWSAAsyncSelect PWSAAsyncSelect;
223     TWSAGetLastError PWSAGetLastError;
224    
225     PReadIniFile ReadIniFile;
226     PWriteIniFile WriteIniFile;
227     PParseParam ParseParam;
228    
229 doda 4463 HMENU FileMenu;
230    
231 maya 3227 SOCKET socket;
232     HWND NotificationWindow;
233     unsigned int notification_msg;
234     long notification_events;
235     HICON OldSmallIcon;
236     HICON OldLargeIcon;
237    
238     BOOL hostdlg_activated;
239     BOOL hostdlg_Enabled;
240    
241     int protocol_major;
242     int protocol_minor;
243    
244     PKTState pkt_state;
245     SSHState ssh_state;
246     AUTHState auth_state;
247     CRYPTState crypt_state;
248     HOSTSState hosts_state;
249     FWDState fwd_state;
250    
251     /* The settings applied to the current session. The user may change
252     the settings but usually we don't want that to affect the session
253     in progress (race conditions). So user setup changes usually
254     modify the 'settings' field below. */
255     TS_SSH session_settings;
256    
257     /* our copy of the global settings. This is synced up with the shared
258     memory only when we do a ReadIniFile or WriteIniFile
259     (i.e. the user loads or saves setup) */
260     TS_SSH settings;
261    
262     // SSH2
263     DH *kexdh;
264     char server_version_string[128];
265     char client_version_string[128];
266     buffer_t *my_kex;
267     buffer_t *peer_kex;
268 maya 4378 kex_algorithm kex_type; // KEX algorithm
269     ssh_keytype hostkey_type;
270 doda 7004 SSH2Cipher *ciphers[MODE_MAX];
271 doda 7006 SSH2Mac *macs[MODE_MAX];
272 maya 4378 compression_type ctos_compression;
273     compression_type stoc_compression;
274 maya 3227 int we_need;
275     int key_done;
276     int rekeying;
277     char *session_id;
278     int session_id_len;
279 doda 7001 SSHKeys ssh2_keys[MODE_MAX];
280 maya 3227 EVP_CIPHER_CTX evpcip[MODE_MAX];
281     int userauth_success;
282     int shell_id;
283     /*int remote_id;*/
284     int session_nego_status;
285     /*
286     unsigned int local_window;
287     unsigned int local_window_max;
288     unsigned int local_consumed;
289     unsigned int local_maxpacket;
290     unsigned int remote_window;
291     unsigned int remote_maxpacket;
292     */
293     int client_key_bits;
294     int server_key_bits;
295     int kexgex_min;
296     int kexgex_bits;
297     int kexgex_max;
298     int ssh2_autologin;
299     int ask4passwd;
300     SSHAuthMethod ssh2_authmethod;
301     char ssh2_username[MAX_PATH];
302     char ssh2_password[MAX_PATH];
303     char ssh2_keyfile[MAX_PATH];
304     time_t ssh_heartbeat_tick;
305     HANDLE ssh_heartbeat_thread;
306     int keyboard_interactive_password_input;
307     int userauth_retry_count;
308     buffer_t *decomp_buffer;
309 doda 7049 buffer_t *authbanner_buffer;
310 maya 3227 char *ssh2_authlist;
311     BOOL tryed_ssh2_authlist;
312     HWND ssh_hearbeat_dialog;
313    
314     /* Pageant �������M�p */
315     unsigned char *pageant_key;
316     unsigned char *pageant_curkey;
317     int pageant_keylistlen;
318     int pageant_keycount;
319     int pageant_keycurrent;
320     BOOL pageant_keyfinal;// SSH2 PK_OK ������������ TRUE ������
321    
322     // agent forward
323     BOOL agentfwd_enable;
324 doda 3579
325     BOOL origDisableTCPEchoCR;
326 yutakapon 3631
327     BOOL nocheck_known_hosts;
328 maya 4314
329     EC_KEY *ecdh_client_key;
330 doda 4559
331     int dns_key_check;
332 doda 5928
333     unsigned int server_compat_flag;
334 yutakapon 5931
335     void *hostkey_ctx;
336 doda 6717
337     BOOL use_subsystem;
338     char subsystem_name[256];
339 doda 7363
340     BOOL nosession;
341 zmatsuo 7714
342     // dialog resource
343     HFONT hFontFixed; // hosts.c�����_�C�A���O�p
344    
345 maya 3227 } TInstVar;
346    
347 doda 6834 // �o�[�W���������������������X�������B ��: TTSSH_2-81_TS_data
348     #define TTSSH_FILEMAPNAME "TTSSH_" TTSSH_VERSION_STR("-") "_TS_data"
349 doda 6830
350 maya 3227 #define LOG_LEVEL_FATAL 5
351     #define LOG_LEVEL_ERROR 10
352     #define LOG_LEVEL_WARNING 30
353 doda 6655 #define LOG_LEVEL_NOTICE 50
354 doda 5927 #define LOG_LEVEL_INFO 80
355 maya 3227 #define LOG_LEVEL_VERBOSE 100
356     #define LOG_LEVEL_SSHDUMP 200
357    
358     #define SSHv1(pvar) ((pvar)->protocol_major == 1)
359     #define SSHv2(pvar) ((pvar)->protocol_major == 2)
360    
361 doda 6823 #define LogLevel(pvar, level) ((pvar)->settings.LogLevel >= (level))
362 doda 6813
363 maya 3227 void notify_established_secure_connection(PTInstVar pvar);
364 doda 6801 void notify_closed_connection(PTInstVar pvar, char *send_msg);
365     void notify_nonfatal_error(PTInstVar pvar, char *msg);
366     void notify_fatal_error(PTInstVar pvar, char *msg, BOOL send_disconnect);
367 doda 6809 void logputs(int level, char *msg);
368 zmatsuo 7648 #if defined(_MSC_VER)
369     void logprintf(int level, _Printf_format_string_ const char *fmt, ...);
370     void logprintf_hexdump(int level, const char *data, int len, _Printf_format_string_ const char *fmt, ...);
371     #elif defined(__GNUC__)
372     void logprintf(int level, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
373     void logprintf_hexdump(int level, const char *data, int len, const char *fmt, ...) __attribute__ ((format (printf, 4, 5)));
374     #else
375     void logprintf(int level, const char *fmt, ...);
376     void logprintf_hexdump(int level, const char *data, int len, const char *fmt, ...);
377     #endif
378 maya 3227
379 doda 6801 void get_teraterm_dir_relative_name(char *buf, int bufsize, char *basename);
380     int copy_teraterm_dir_relative_path(char *dest, int destsize, char *basename);
381 maya 3227 int uuencode(unsigned char *src, int srclen, unsigned char *target, int targsize);
382    
383     #endif

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