Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /trunk/ttssh2/ttxssh/ttxssh.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2937 - (hide annotations) (download) (as text)
Thu Nov 23 02:19:30 2006 UTC (17 years, 4 months ago) by maya
Original Path: ttssh2/trunk/ttxssh/ttxssh.h
File MIME type: text/x-chdr
File size: 7803 byte(s)
表示メッセージを言語ファイルから読み込みむコードの作成を開始した。

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

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