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 2916 - (show annotations) (download) (as text)
Sat Oct 21 13:32:37 2006 UTC (17 years, 5 months ago) by maya
Original Path: ttssh2/trunk/ttxssh/ttxssh.h
File MIME type: text/x-chdr
File size: 7765 byte(s)
圧縮アルゴリズムの定数を enum に変更した。

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
56 typedef struct _TInstVar FAR * PTInstVar;
57
58 #include "util.h"
59 #include "pkt.h"
60 #include "ssh.h"
61 #include "auth.h"
62 #include "crypt.h"
63 #include "hosts.h"
64 #include "fwd.h"
65
66 #include <openssl/dh.h>
67 #include <openssl/evp.h>
68 #include "buffer.h"
69
70 /* tttypes.h �����`���������� EM �}�N���� openssl/rsa.h (OpenSSL 0.9.8)�������v���g�^�C�v������
71 * �������������d�����������������A�r���h�G���[�������B���L3�w�b�_��include���u�����L�����������B
72 * (2005.7.9 yutaka)
73 */
74 #include "teraterm.h"
75 #include "tttypes.h"
76 #include "ttplugin.h"
77
78 HANDLE hInst; /* Instance handle of TTXSSH.DLL */
79
80 #define ID_ABOUTMENU 62501
81 #define ID_SSHAUTH 62502
82 #define ID_SSHSETUPMENU 62503
83 #define ID_SSHUNKNOWNHOST 62504
84 #define ID_SSHDIFFERENTHOST 62505
85 #define ID_SSHAUTHSETUPMENU 62506
86 #define ID_SSHASYNCMESSAGEBOX 62507
87 #define ID_SSHFWDSETUPMENU 62508
88 #define ID_SSHKEYGENMENU 62509
89
90 /*
91 These are the fields that WOULD go in Teraterm's 'ts' structure, if
92 we could put them there.
93 */
94 typedef struct _TS_SSH {
95 BOOL Enabled;
96 int CompressionLevel; /* 0 = NONE, else 1-9 */
97 char DefaultUserName[256];
98
99 /* this next option is a string of digits. Each digit represents a
100 cipher. The first digit is the most preferred cipher, and so on.
101 The digit SSH_CIPHER_NONE signifies that any ciphers after it are
102 disabled. */
103 char CipherOrder[16];
104
105 char KnownHostsFiles[2048];
106 int DefaultAuthMethod;
107 char DefaultRhostsLocalUserName[256];
108 char DefaultRhostsHostPrivateKeyFile[1024];
109 char DefaultRSAPrivateKeyFile[1024];
110
111 char DefaultForwarding[2048];
112 BOOL TryDefaultAuth;
113
114 int LogLevel; /* 0 = NONE, 100 = Verbose */
115 int WriteBufferSize;
116 int LocalForwardingIdentityCheck;
117
118 int ssh_protocol_version; // SSH version (2004.10.11 yutaka)
119 int ssh_heartbeat_overtime; // SSH heartbeat(keepalive) (2004.12.11 yutaka)
120 int ssh2_keyboard_interactive; // SSH2 keyboard-interactive (2005.1.23 yutaka)
121 int remember_password; // whether password will permanently store on heap memory (2006.8.5 yutaka)
122 } TS_SSH;
123
124 typedef struct _TInstVar {
125 PTTSet ts;
126 PComVar cv;
127
128 /* shared memory for settings across instances. Basically it's
129 a cache for the INI file.*/
130 TS_SSH FAR * ts_SSH;
131
132 int fatal_error;
133 int showing_err;
134 char FAR * err_msg;
135
136 Tconnect Pconnect;
137 Trecv Precv;
138 Tsend Psend;
139 TWSAAsyncSelect PWSAAsyncSelect;
140 TWSAGetLastError PWSAGetLastError;
141
142 PReadIniFile ReadIniFile;
143 PWriteIniFile WriteIniFile;
144 PParseParam ParseParam;
145
146 SOCKET socket;
147 HWND NotificationWindow;
148 unsigned int notification_msg;
149 long notification_events;
150 HICON OldSmallIcon;
151 HICON OldLargeIcon;
152
153 BOOL hostdlg_activated;
154 BOOL hostdlg_Enabled;
155
156 int protocol_major;
157 int protocol_minor;
158
159 PKTState pkt_state;
160 SSHState ssh_state;
161 AUTHState auth_state;
162 CRYPTState crypt_state;
163 HOSTSState hosts_state;
164 FWDState fwd_state;
165
166 /* The settings applied to the current session. The user may change
167 the settings but usually we don't want that to affect the session
168 in progress (race conditions). So user setup changes usually
169 modify the 'settings' field below. */
170 TS_SSH session_settings;
171
172 /* our copy of the global settings. This is synced up with the shared
173 memory only when we do a ReadIniFile or WriteIniFile
174 (i.e. the user loads or saves setup) */
175 TS_SSH settings;
176
177 // SSH2
178 DH *kexdh;
179 char server_version_string[128];
180 char client_version_string[128];
181 buffer_t *my_kex;
182 buffer_t *peer_kex;
183 enum kex_exchange kex_type; // KEX algorithm
184 enum hostkey_type hostkey_type;
185 SSHCipher ctos_cipher;
186 SSHCipher stoc_cipher;
187 enum hmac_type ctos_hmac;
188 enum hmac_type stoc_hmac;
189 enum compression_algorithm ctos_compression;
190 enum compression_algorithm stoc_compression;
191 int we_need;
192 int key_done;
193 int rekeying;
194 char *session_id;
195 int session_id_len;
196 Newkeys ssh2_keys[MODE_MAX];
197 EVP_CIPHER_CTX evpcip[MODE_MAX];
198 int userauth_success;
199 int shell_id;
200 /*int remote_id;*/
201 int session_nego_status;
202 /*
203 unsigned int local_window;
204 unsigned int local_window_max;
205 unsigned int local_consumed;
206 unsigned int local_maxpacket;
207 unsigned int remote_window;
208 unsigned int remote_maxpacket;
209 */
210 int client_key_bits;
211 int server_key_bits;
212 int kexgex_min;
213 int kexgex_bits;
214 int kexgex_max;
215 int ssh2_autologin;
216 int ask4passwd;
217 SSHAuthMethod ssh2_authmethod;
218 char ssh2_username[MAX_PATH];
219 char ssh2_password[MAX_PATH];
220 char ssh2_keyfile[MAX_PATH];
221 time_t ssh_heartbeat_tick;
222 HANDLE ssh_heartbeat_thread;
223 int keyboard_interactive_done;
224 int keyboard_interactive_password_input;
225 int userauth_retry_count;
226 buffer_t *decomp_buffer;
227 } TInstVar;
228
229 #define LOG_LEVEL_FATAL 5
230 #define LOG_LEVEL_ERROR 10
231 #define LOG_LEVEL_URGENT 20
232 #define LOG_LEVEL_WARNING 30
233 #define LOG_LEVEL_VERBOSE 100
234
235 #define SSHv1(pvar) ((pvar)->protocol_major == 1)
236 #define SSHv2(pvar) ((pvar)->protocol_major == 2)
237
238 void notify_established_secure_connection(PTInstVar pvar);
239 void notify_closed_connection(PTInstVar pvar);
240 void notify_nonfatal_error(PTInstVar pvar, char FAR * msg);
241 void notify_fatal_error(PTInstVar pvar, char FAR * msg);
242 void notify_verbose_message(PTInstVar pvar, char FAR * msg, int level);
243
244 void get_teraterm_dir_relative_name(char FAR * buf, int bufsize, char FAR * basename);
245 int copy_teraterm_dir_relative_path(char FAR * dest, int destsize, char FAR * basename);
246 void get_file_version(char *exefile, int *major, int *minor, int *release, int *build);
247 int uuencode(unsigned char *src, int srclen, unsigned char *target, int targsize);
248
249 #endif
250

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