• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision6738 (tree)
Time2017-05-20 15:38:01
Author(del#1144)

Log Message

NO_INET6 マクロを削除

Change Summary

Incremental Difference

--- trunk/teraterm/common/teraterm.h (revision 6737)
+++ trunk/teraterm/common/teraterm.h (revision 6738)
@@ -5,11 +5,9 @@
55
66 #pragma once
77
8-#ifndef NO_INET6
98 #ifndef _WINSOCKAPI_
109 #define _WINSOCKAPI_ /* Prevent inclusion of winsock.h in windows.h */
1110 #endif /* _WINSOCKAPI_ */
12-#endif /* NO_INET6 */
1311 #include <windows.h>
1412
1513 /* _MSC_VER の値
--- trunk/teraterm/common/tttypes.h (revision 6737)
+++ trunk/teraterm/common/tttypes.h (revision 6738)
@@ -131,9 +131,7 @@
131131
132132 #define HostNameMaxLength 1024
133133 //#define HostNameMaxLength 80
134-#ifndef NO_INET6
135134 #define ProtocolFamilyMaxLength 80
136-#endif /* NO_INET6 */
137135
138136 /* internal WM_USER messages */
139137 #define WM_USER_ACCELCOMMAND WM_USER+1
@@ -488,10 +486,8 @@
488486 WORD EnableContinuedLineCopy;
489487 #endif /* NO_COPYLINE_FIX */
490488 COLORREF ANSIColor[16];
491-#ifndef NO_INET6
492489 /* protocol used in connect() */
493490 int ProtocolFamily;
494-#endif /* NO_INET6 */
495491 char MouseCursorName[16];
496492 int AlphaBlend;
497493 char CygwinDirectory[MAX_PATH];
@@ -755,9 +751,7 @@
755751 WORD Telnet; // non-zero: enable telnet
756752 WORD TelPort; // default TCP port# for telnet
757753 WORD TCPPort; // TCP port #
758-#ifndef NO_INET6
759754 WORD ProtocolFamily; // Protocol Family (AF_INET/AF_INET6/AF_UNSPEC)
760-#endif /* NO_INET6 */
761755 WORD ComPort; // serial port #
762756 WORD MaxComPort; // max serial port #
763757 } TGetHNRec;
@@ -1013,12 +1007,10 @@
10131007 BOOL ProtoFlag;
10141008 /* message flag */
10151009 WORD NoMsg;
1016-#ifndef NO_INET6
10171010 /* if TRUE, teraterm trys to connect other protocol family */
10181011 BOOL RetryWithOtherProtocol;
10191012 struct addrinfo FAR * res0;
10201013 struct addrinfo FAR * res;
1021-#endif /* NO_INET6 */
10221014 char *Locale;
10231015 int *CodePage;
10241016 int *ConnetingTimeout;
--- trunk/teraterm/teraterm/commlib.c (revision 6737)
+++ trunk/teraterm/teraterm/commlib.c (revision 6738)
@@ -16,15 +16,12 @@
1616 #include "ttplug.h" /* TTPLUG */
1717
1818 #include "commlib.h"
19-#ifndef NO_INET6
2019 #include <winsock2.h>
2120 #include <ws2tcpip.h>
22-#endif /* NO_INET6 */
2321 #include <stdio.h> /* for _snprintf() */
2422 #include <time.h>
2523 #include <locale.h>
2624
27-#ifndef NO_INET6
2825 static SOCKET OpenSocket(PComVar);
2926 static void AsyncConnect(PComVar);
3027 static int CloseSocket(SOCKET);
@@ -74,7 +71,6 @@
7471 {
7572 return Pclosesocket(s);
7673 }
77-#endif /* NO_INET6 */
7874
7975 #define CommInQueSize 8192
8076 #define CommOutQueSize 2048
@@ -258,26 +254,14 @@
258254
259255 void CommOpen(HWND HW, PTTSet ts, PComVar cv)
260256 {
261-#ifdef NO_INET6
262- int Err;
263-#endif /* NO_INET6 */
264257 char ErrMsg[21+256];
265258 char P[50+256];
266259
267260 MSG Msg;
268-#ifndef NO_INET6
269261 ADDRINFO hints;
270262 char pname[NI_MAXSERV];
271-#else
272- char HEntBuff[MAXGETHOSTSTRUCT];
273- u_long addr;
274- SOCKADDR_IN saddr;
275-#endif /* NO_INET6 */
276263
277264 BOOL InvalidHost;
278-#ifdef NO_INET6
279- BOOL BBuf;
280-#endif /* NO_INET6 */
281265
282266 char uimsg[MAX_UIMSG];
283267
@@ -299,9 +283,7 @@
299283 cv->PortType = ts->PortType;
300284 cv->ComPort = 0;
301285 cv->RetryCount = 0;
302-#ifndef NO_INET6
303286 cv->RetryWithOtherProtocol = TRUE;
304-#endif /* NO_INET6 */
305287 cv->s = INVALID_SOCKET;
306288 cv->ComID = INVALID_HANDLE_VALUE;
307289 cv->CanSend = TRUE;
@@ -365,7 +347,6 @@
365347 else {
366348 TTXOpenTCP(); /* TTPLUG */
367349 cv->Open = TRUE;
368-#ifndef NO_INET6
369350 /* resolving address */
370351 memset(&hints, 0, sizeof(hints));
371352 hints.ai_family = ts->ProtocolFamily;
@@ -430,105 +411,7 @@
430411 break; /* break for-loop immediately */
431412 }
432413 break;
433-#else
434- if ((ts->HostName[0] >= 0x30) && (ts->HostName[0] <= 0x39))
435- {
436- addr = Pinet_addr(ts->HostName);
437- InvalidHost = (addr == 0xffffffff);
438- }
439- else {
440- HAsync = PWSAAsyncGetHostByName(HW,WM_USER_GETHOST,
441- ts->HostName,HEntBuff,sizeof(HEntBuff));
442- if (HAsync == 0)
443- InvalidHost = TRUE;
444- else {
445- cv->ComPort = 1; // set "getting host" flag
446- // (see CVTWindow::OnSysCommand())
447- do {
448- if (GetMessage(&Msg,0,0,0))
449- {
450- if ((Msg.hwnd==HW) &&
451- ((Msg.message == WM_SYSCOMMAND) &&
452- ((Msg.wParam & 0xfff0) == SC_CLOSE) ||
453- (Msg.message == WM_COMMAND) &&
454- (LOWORD(Msg.wParam) == ID_FILE_EXIT) ||
455- (Msg.message == WM_CLOSE)))
456- { /* Exit when the user closes Tera Term */
457- PWSACancelAsyncRequest(HAsync);
458- HAsync = 0;
459- cv->ComPort = 0; // clear "getting host" flag
460- PostMessage(HW,Msg.message,Msg.wParam,Msg.lParam);
461- return;
462- }
463- if (Msg.message != WM_USER_GETHOST)
464- { /* Prosess messages */
465- TranslateMessage(&Msg);
466- DispatchMessage(&Msg);
467- }
468- }
469- else {
470- return;
471- }
472- } while (Msg.message!=WM_USER_GETHOST);
473- cv->ComPort = 0; // clear "getting host" flag
474- HAsync = 0;
475- InvalidHost = WSAGETASYNCERROR(Msg.lParam) != 0;
476- if (! InvalidHost)
477- {
478- if (((PHOSTENT)HEntBuff)->h_addr_list != NULL)
479- memcpy(&addr,
480- ((PHOSTENT)HEntBuff)->h_addr_list[0],sizeof(addr));
481- else
482- InvalidHost = TRUE;
483- }
484- }
485414
486- }
487-
488- if (InvalidHost)
489- {
490- if (cv->NoMsg==0) {
491- get_lang_msg("MSG_TT_ERROR", uimsg, sizeof(uimsg), "Tera Term: Error", ts->UILanguageFile);
492- get_lang_msg("MSG_INVALID_HOST_ERROR", ts->UIMsg, sizeof(ts->UIMsg), "Invalid host", ts->UILanguageFile);
493- MessageBox(cv->HWin, ts->UIMsg, uimsg, MB_TASKMODAL | MB_ICONEXCLAMATION);
494- }
495- }
496- else {
497- cv->s= Psocket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
498- if (cv->s==INVALID_SOCKET)
499- {
500- InvalidHost = TRUE;
501- if (cv->NoMsg==0) {
502- get_lang_msg("MSG_TT_ERROR", uimsg, sizeof(uimsg), "Tera Term: Error", ts->UILanguageFile);
503- get_lang_msg("MSG_COMM_TIMEOUT_ERROR", ts->UIMsg, sizeof(ts->UIMsg), "Cannot connect the host", ts->UILanguageFile);
504- MessageBox(cv->HWin, ts->UIMsg, uimsg, MB_TASKMODAL | MB_ICONEXCLAMATION);
505- }
506- }
507- else {
508- BBuf = TRUE;
509- Psetsockopt(cv->s,(int)SOL_SOCKET,SO_OOBINLINE,(char FAR *)&BBuf,sizeof(BBuf));
510-
511- PWSAAsyncSelect(cv->s,cv->HWin,WM_USER_COMMOPEN, FD_CONNECT);
512- saddr.sin_family = AF_INET;
513- saddr.sin_port = Phtons(ts->TCPPort);
514- saddr.sin_addr.s_addr = addr;
515- memset(saddr.sin_zero,0,8);
516-
517- Err = Pconnect(cv->s,(LPSOCKADDR)&saddr,sizeof(saddr));
518- if (Err!=0 ) Err = PWSAGetLastError();
519- if (Err==WSAEWOULDBLOCK )
520- {
521- /* Do nothing */
522- }
523- else if (Err!=0 )
524- PostMessage(cv->HWin, WM_USER_COMMOPEN,0,
525- MAKELONG(FD_CONNECT,Err));
526- }
527- }
528- }
529- break;
530-#endif /* NO_INET6 */
531-
532415 case IdSerial:
533416 InitFileIO(IdSerial); /* TTPLUG */
534417 TTXOpenFile(); /* TTPLUG */
@@ -630,9 +513,7 @@
630513
631514 } /* end of "switch" */
632515
633-#ifndef NO_INET6
634516 BreakSC:
635-#endif /* NO_INET6 */
636517 if (InvalidHost) {
637518 PostMessage(cv->HWin, WM_USER_COMMNOTIFY, 0, FD_CLOSE);
638519 if ( (ts->PortType==IdTCPIP) && cv->Open ) {
@@ -757,7 +638,6 @@
757638 _snprintf_s(ErrMsg, sizeof(ErrMsg), _TRUNCATE, "%s", ts->UIMsg);
758639 }
759640 if (HIWORD(lParam)>0) {
760-#ifndef NO_INET6
761641 /* connect() failed */
762642 if (cv->res->ai_next != NULL) {
763643 /* try to connect with other protocol */
@@ -784,20 +664,10 @@
784664 cv->RetryWithOtherProtocol = FALSE;
785665 return;
786666 }
787-#else
788- if (cv->NoMsg==0) {
789- get_lang_msg("MSG_TT_ERROR", uimsg, sizeof(uimsg), "Tera Term: Error", ts->UILanguageFile);
790- MessageBox(cv->HWin, ErrMsg, uimsg, MB_TASKMODAL | MB_ICONEXCLAMATION);
791- }
792- PostMessage(cv->HWin, WM_USER_COMMNOTIFY, 0, FD_CLOSE);
793- return;
794-#endif /* NO_INET6 */
795667 }
796668
797-#ifndef NO_INET6
798669 /* here is connection established */
799670 cv->RetryWithOtherProtocol = FALSE;
800-#endif /* NO_INET6 */
801671 PWSAAsyncSelect(cv->s,cv->HWin,WM_USER_COMMNOTIFY, FD_READ | FD_OOB | FD_CLOSE);
802672 TCPIPClosed = FALSE;
803673 break;
@@ -891,9 +761,7 @@
891761 PWSACancelAsyncRequest(HAsync);
892762 }
893763 HAsync = 0;
894-#ifndef NO_INET6
895764 Pfreeaddrinfo(cv->res0);
896-#endif /* NO_INET6 */
897765 if ( cv->s!=INVALID_SOCKET ) {
898766 Pclosesocket(cv->s);
899767 }
--- trunk/teraterm/teraterm/ttwsk.c (revision 6737)
+++ trunk/teraterm/teraterm/ttwsk.c (revision 6738)
@@ -6,9 +6,7 @@
66
77 #include "teraterm.h"
88 #include "ttwsk.h"
9-#ifndef NO_INET6
109 #include "WSAAsyncGetAddrInfo.h"
11-#endif /* NO_INET6 */
1210
1311 static HANDLE HWinsock = NULL;
1412
@@ -152,13 +150,11 @@
152150 PWSACleanup = (TWSACleanup)GetProcAddress(HWinsock, MAKEINTRESOURCE(IdWSACLEANUP));
153151 if (PWSACleanup==NULL) Err = TRUE;
154152
155-#ifndef NO_INET6
156153 // Pgetaddrinfo = (Tgetaddrinfo)GetProcAddress(HWinsock, "getaddrinfo");
157154 // if (Pgetaddrinfo==NULL) Err = TRUE;
158155
159156 Pfreeaddrinfo = freeaddrinfo;
160157 PWSAAsyncGetAddrInfo = WSAAsyncGetAddrInfo;
161-#endif /* NO_INET6 */
162158
163159 if (Err)
164160 {
--- trunk/teraterm/teraterm/vtwin.cpp (revision 6737)
+++ trunk/teraterm/teraterm/vtwin.cpp (revision 6738)
@@ -29,12 +29,8 @@
2929 #include "ttlib.h"
3030 #include "helpid.h"
3131 #include "teraprn.h"
32-#ifndef NO_INET6
3332 #include <winsock2.h>
3433 #include <ws2tcpip.h>
35-#else
36-#include <winsock.h>
37-#endif /* NO_INET6 */
3834 #include "ttplug.h" /* TTPLUG */
3935
4036 #include <stdio.h>
@@ -3643,7 +3639,6 @@
36433639 AutoDisconnectedPort = -1;
36443640
36453641 CommStart(&cv,lParam,&ts);
3646-#ifndef NO_INET6
36473642 if (ts.PortType == IdTCPIP && cv.RetryWithOtherProtocol == TRUE) {
36483643 Connecting = TRUE;
36493644 }
@@ -3650,9 +3645,7 @@
36503645 else {
36513646 Connecting = FALSE;
36523647 }
3653-#else
3654- Connecting = FALSE;
3655-#endif /* NO_INET6 */
3648+
36563649 ChangeTitle();
36573650 if (! cv.Ready) {
36583651 return 0;
@@ -3853,9 +3846,7 @@
38533846 GetHNRec.Telnet = ts.Telnet;
38543847 GetHNRec.TelPort = ts.TelPort;
38553848 GetHNRec.TCPPort = ts.TCPPort;
3856-#ifndef NO_INET6
38573849 GetHNRec.ProtocolFamily = ts.ProtocolFamily;
3858-#endif /* NO_INET6 */
38593850 GetHNRec.ComPort = ts.ComPort;
38603851 GetHNRec.MaxComPort = ts.MaxComPort;
38613852
@@ -3881,9 +3872,7 @@
38813872 ts.PortType = GetHNRec.PortType;
38823873 ts.Telnet = GetHNRec.Telnet;
38833874 ts.TCPPort = GetHNRec.TCPPort;
3884-#ifndef NO_INET6
38853875 ts.ProtocolFamily = GetHNRec.ProtocolFamily;
3886-#endif /* NO_INET6 */
38873876 ts.ComPort = GetHNRec.ComPort;
38883877
38893878 if ((GetHNRec.PortType==IdTCPIP) &&
@@ -3924,7 +3913,6 @@
39243913 _snprintf_s(tcpport, sizeof(tcpport), _TRUNCATE, "%d", GetHNRec.TCPPort);
39253914 strncat_s(Command,sizeof(Command),tcpport,_TRUNCATE);
39263915 }
3927-#ifndef NO_INET6
39283916 /********************************/
39293917 /* ここにプロトコル処理を入れる */
39303918 /********************************/
@@ -3933,7 +3921,6 @@
39333921 } else if (GetHNRec.ProtocolFamily == AF_INET6) {
39343922 strncat_s(Command,sizeof(Command)," /6",_TRUNCATE);
39353923 }
3936-#endif /* NO_INET6 */
39373924 strncat_s(Command,sizeof(Command)," ",_TRUNCATE);
39383925 strncat_s(Command,sizeof(Command),Command2,_TRUNCATE);
39393926 }
--- trunk/teraterm/ttpdlg/ttdlg.c (revision 6737)
+++ trunk/teraterm/ttpdlg/ttdlg.c (revision 6738)
@@ -24,10 +24,8 @@
2424 #include "oniguruma.h"
2525 #undef ONIG_EXTERN
2626
27-#ifndef NO_INET6
2827 #include <winsock2.h>
2928 static char FAR * ProtocolFamilyList[] = { "UNSPEC", "IPv6", "IPv4", NULL };
30-#endif /* NO_INET6 */
3129
3230 #undef EFFECT_ENABLED // エフェクトの有効可否
3331 #undef TEXTURE_ENABLED // テクスチャの有効可否
@@ -2054,7 +2052,6 @@
20542052 SetRB(Dialog,GetHNRec->Telnet,IDC_HOSTTELNET,IDC_HOSTTELNET);
20552053 SendDlgItemMessage(Dialog, IDC_HOSTTCPPORT, EM_LIMITTEXT,5,0);
20562054 SetDlgItemInt(Dialog,IDC_HOSTTCPPORT,GetHNRec->TCPPort,FALSE);
2057-#ifndef NO_INET6
20582055 for (i=0; ProtocolFamilyList[i]; ++i) {
20592056 SendDlgItemMessage(Dialog, IDC_HOSTTCPPROTOCOL, CB_ADDSTRING,
20602057 0, (LPARAM)ProtocolFamilyList[i]);
@@ -2062,9 +2059,7 @@
20622059 SendDlgItemMessage(Dialog, IDC_HOSTTCPPROTOCOL, EM_LIMITTEXT,
20632060 ProtocolFamilyMaxLength-1, 0);
20642061 SendDlgItemMessage(Dialog, IDC_HOSTTCPPROTOCOL, CB_SETCURSEL,0,0);
2065-#endif /* NO_INET6 */
20662062
2067-
20682063 j = 0;
20692064 w = 1;
20702065 if ((comports=DetectComPorts(ComPortTable, GetHNRec->MaxComPort, ComPortDesc)) >= 0) {
@@ -2119,16 +2114,9 @@
21192114 if ( GetHNRec->PortType==IdTCPIP ) {
21202115 DisableDlgItem(Dialog,IDC_HOSTCOMLABEL,IDC_HOSTCOM);
21212116 }
2122-#ifndef INET6
21232117 else {
21242118 DisableDlgItem(Dialog,IDC_HOSTNAMELABEL,IDC_HOSTTCPPORT);
21252119 }
2126-#else
2127- else {
2128- DisableDlgItem(Dialog,IDC_HOSTNAMELABEL,IDC_HOSTTCPPORT);
2129- DisableDlgItem(Dialog,IDC_HOSTTCPPROTOCOLLABEL,IDC_HOSTTCPPROTOCOL);
2130- }
2131-#endif /* NO_INET6 */
21322120
21332121 return TRUE;
21342122
@@ -2137,9 +2125,7 @@
21372125 case IDOK:
21382126 GetHNRec = (PGetHNRec)GetWindowLong(Dialog,DWL_USER);
21392127 if ( GetHNRec!=NULL ) {
2140-#ifndef NO_INET6
21412128 char afstr[BUFSIZ];
2142-#endif /* NO_INET6 */
21432129 GetRB(Dialog,&GetHNRec->PortType,IDC_HOSTTCPIP,IDC_HOSTSERIAL);
21442130 if ( GetHNRec->PortType==IdTCPIP ) {
21452131 GetDlgItemText(Dialog, IDC_HOSTNAME, GetHNRec->HostName, HostNameMaxLength);
@@ -2152,7 +2138,6 @@
21522138 if (Ok) {
21532139 GetHNRec->TCPPort = i;
21542140 }
2155-#ifndef NO_INET6
21562141 #define getaf(str) \
21572142 ((strcmp((str), "IPv6") == 0) ? AF_INET6 : \
21582143 ((strcmp((str), "IPv4") == 0) ? AF_INET : AF_UNSPEC))
@@ -2159,7 +2144,6 @@
21592144 memset(afstr, 0, sizeof(afstr));
21602145 GetDlgItemText(Dialog, IDC_HOSTTCPPROTOCOL, afstr, sizeof(afstr));
21612146 GetHNRec->ProtocolFamily = getaf(afstr);
2162-#endif /* NO_INET6 */
21632147 memset(EntName,0,sizeof(EntName));
21642148 GetDlgItemText(Dialog, IDC_HOSTCOM, EntName, sizeof(EntName)-1);
21652149 if (strncmp(EntName, "COM", 3) == 0 && EntName[3] != '\0') {
@@ -2195,9 +2179,7 @@
21952179
21962180 case IDC_HOSTTCPIP:
21972181 EnableDlgItem(Dialog,IDC_HOSTNAMELABEL,IDC_HOSTTCPPORT);
2198-#ifndef NO_INET6
21992182 EnableDlgItem(Dialog,IDC_HOSTTCPPROTOCOLLABEL,IDC_HOSTTCPPROTOCOL);
2200-#endif /* NO_INET6 */
22012183 DisableDlgItem(Dialog,IDC_HOSTCOMLABEL,IDC_HOSTCOM);
22022184 return TRUE;
22032185
@@ -2204,9 +2186,7 @@
22042186 case IDC_HOSTSERIAL:
22052187 EnableDlgItem(Dialog,IDC_HOSTCOMLABEL,IDC_HOSTCOM);
22062188 DisableDlgItem(Dialog,IDC_HOSTNAMELABEL,IDC_HOSTTCPPORT);
2207-#ifndef NO_INET6
22082189 DisableDlgItem(Dialog,IDC_HOSTTCPPROTOCOLLABEL,IDC_HOSTTCPPROTOCOL);
2209-#endif /* NO_INET6 */
22102190 break;
22112191
22122192 case IDC_HOSTTELNET:
--- trunk/teraterm/ttpset/ttset.c (revision 6737)
+++ trunk/teraterm/ttpset/ttset.c (revision 6738)
@@ -4,10 +4,8 @@
44 /* IPv6 modification is Copyright(C) 2000 Jun-ya kato <kato@win6.jp> */
55
66 /* TTSET.DLL, setup file routines*/
7-#ifndef NO_INET6
87 #include <winsock2.h>
98 #include <ws2tcpip.h>
10-#endif /* NO_INET6 */
119 #include "teraterm.h"
1210 #include "tttypes.h"
1311 #include <stdio.h>
@@ -3615,7 +3613,6 @@
36153613 return (strlen(Temp) > 0);
36163614 }
36173615 #endif
3618-#ifndef NO_INET6
36193616 static void ParseHostName(char *HostStr, WORD * port)
36203617 {
36213618 /*
@@ -3700,7 +3697,6 @@
37003697 *port = 23;
37013698 }
37023699 }
3703-#endif /* NO_INET6 */
37043700
37053701
37063702 void FAR PASCAL ParseParam(PCHAR Param, PTTSet ts, PCHAR DDETopic)
@@ -3707,9 +3703,6 @@
37073703 {
37083704 int i, pos, c;
37093705 //int param_top;
3710-#ifdef NO_INET6
3711- BYTE b;
3712-#endif /* NO_INET6 */
37133706 char Temp[MaxStrLen]; // ttpmacroから呼ばれることを想定しMaxStrLenサイズとする
37143707 char Temp2[MaxStrLen];
37153708 char TempDir[MAXPATHLEN];
@@ -3729,11 +3722,6 @@
37293722 /* Set AutoConnect true as default (2008.2.16 by steven)*/
37303723 ts->ComAutoConnect = TRUE;
37313724
3732-#ifndef NO_INET6
3733- /* user specifies the protocol connecting to the host */
3734- /* ts->ProtocolFamily = AF_UNSPEC; */
3735-#endif /* NO_INET6 */
3736-
37373725 /* Get command line parameters */
37383726 if (DDETopic != NULL)
37393727 DDETopic[0] = 0;
@@ -3947,12 +3935,10 @@
39473935 ts->VTPos.x = 0;
39483936 }
39493937 }
3950-#ifndef NO_INET6
39513938 else if (_stricmp(Temp, "/4") == 0) /* Protocol Tera Term speaking */
39523939 ts->ProtocolFamily = AF_INET;
39533940 else if (_stricmp(Temp, "/6") == 0)
39543941 ts->ProtocolFamily = AF_INET6;
3955-#endif
39563942 else if (_stricmp(Temp, "/DUPLICATE") == 0) { // duplicate session (2004.12.7. yutaka)
39573943 ts->DuplicateSession = 1;
39583944
@@ -3995,28 +3981,7 @@
39953981 ts->MacroFN[0] = 0;
39963982
39973983 if ((ts->HostName[0] != 0) && (ParamPort == IdTCPIP)) {
3998-#ifndef NO_INET6
39993984 ParseHostName(ts->HostName, &ParamTCP);
4000-#else /* NO_INET6 */
4001- if ((_strnicmp(ts->HostName, "telnet://", 9) == 0) ||
4002- (_strnicmp(ts->HostName, "tn3270://", 9) == 0)) {
4003- memmove(ts->HostName, &(ts->HostName[9]),
4004- strlen(ts->HostName) - 8);
4005- i = strlen(ts->HostName);
4006- if ((i > 0) && (ts->HostName[i - 1] == '/'))
4007- ts->HostName[i - 1] = 0;
4008- }
4009- i = 0;
4010- do {
4011- b = ts->HostName[i];
4012- i++;
4013- } while ((b != 0) && (b != ':'));
4014- if (b == ':') {
4015- ts->HostName[i - 1] = 0;
4016- if (sscanf(&(ts->HostName[i]), "%d", &ParamTCP) != 1)
4017- ParamTCP = 0;
4018- }
4019-#endif /* NO_INET6 */
40203985 }
40213986
40223987 switch (ParamPort) {
--- trunk/ttssh2/ttxssh/fwd.c (revision 6737)
+++ trunk/ttssh2/ttxssh/fwd.c (revision 6738)
@@ -40,9 +40,7 @@
4040 #include "ttcommon.h"
4141
4242 #include <assert.h>
43-#ifndef NO_INET6
4443 #include "WSAAsyncGetAddrInfo.h"
45-#endif /* NO_INET6 */
4644
4745 #define WM_SOCK_ACCEPT (WM_APP+9999)
4846 #define WM_SOCK_IO (WM_APP+9998)
@@ -56,14 +54,11 @@
5654 static int find_request_num(PTInstVar pvar, SOCKET s)
5755 {
5856 int i;
59-#ifndef NO_INET6
6057 int j;
61-#endif /* NO_INET6 */
6258
6359 if (s == INVALID_SOCKET)
6460 return -1;
6561
66-#ifndef NO_INET6
6762 for (i = 0; i < pvar->fwd_state.num_requests; i++) {
6863 for (j = 0; j < pvar->fwd_state.requests[i].num_listening_sockets;
6964 ++j) {
@@ -73,14 +68,6 @@
7368 }
7469 }
7570 }
76-#else
77- for (i = 0; i < pvar->fwd_state.num_requests; i++) {
78- if ((pvar->fwd_state.requests[i].status & FWD_DELETED) == 0
79- && pvar->fwd_state.requests[i].listening_socket == s) {
80- return i;
81- }
82- }
83-#endif /* NO_INET6 */
8471
8572 return -1;
8673 }
@@ -119,7 +106,6 @@
119106 return -1;
120107 }
121108
122-#ifndef NO_INET6
123109 static int find_listening_socket_num(PTInstVar pvar, int request_num,
124110 SOCKET s)
125111 {
@@ -133,7 +119,6 @@
133119 /* not found */
134120 return -1;
135121 }
136-#endif /* NO_INET6 */
137122
138123 static void drain_matching_messages(HWND wnd, UINT msg, WPARAM wParam)
139124 {
@@ -222,15 +207,10 @@
222207
223208 static void request_error(PTInstVar pvar, int request_num, int err)
224209 {
225-#ifndef NO_INET6
226210 SOCKET FAR *s =
227211 pvar->fwd_state.requests[request_num].listening_sockets;
228212 int i;
229-#else
230- SOCKET s = pvar->fwd_state.requests[request_num].listening_socket;
231-#endif /* NO_INET6 */
232213
233-#ifndef NO_INET6
234214 for (i = 0;
235215 i < pvar->fwd_state.requests[request_num].num_listening_sockets;
236216 ++i) {
@@ -240,13 +220,6 @@
240220 INVALID_SOCKET;
241221 }
242222 }
243-#else
244- if (s != INVALID_SOCKET) {
245- safe_closesocket(pvar, s);
246- pvar->fwd_state.requests[request_num].listening_socket =
247- INVALID_SOCKET;
248- }
249-#endif /* NO_INET6 */
250223
251224 UTIL_get_lang_msg("MSG_FWD_REQUEST_ERROR", pvar,
252225 "Communications error while listening for a connection to forward.\n"
@@ -288,13 +261,9 @@
288261 safe_WSACancelAsyncRequest(pvar, request->to_host_lookup_handle);
289262 request->to_host_lookup_handle = 0;
290263 }
291-#ifndef NO_INET6
264+
292265 /*****/
293266 /* freeaddrinfo(); */
294-#else
295- free(request->to_host_hostent_buf);
296- request->to_host_hostent_buf = NULL;
297-#endif /* NO_INET6 */
298267 }
299268
300269 void FWD_free_channel(PTInstVar pvar, uint32 local_channel_num)
@@ -586,7 +555,7 @@
586555 FWDChannel FAR *channel = pvar->fwd_state.channels + channel_num;
587556 FWDRequest FAR *request =
588557 pvar->fwd_state.requests + channel->request_num;
589-#ifndef NO_INET6
558+
590559 for (channel->to_host_addrs = request->to_host_addrs;
591560 channel->to_host_addrs;
592561 channel->to_host_addrs = channel->to_host_addrs->ai_next) {
@@ -619,74 +588,30 @@
619588 }
620589
621590 channel_opening_error(pvar, channel_num, WSAGetLastError());
622-#else
623- struct sockaddr_in addr;
624-
625- addr.sin_family = AF_INET;
626- addr.sin_port = htons((unsigned short) request->spec.to_port);
627- addr.sin_addr.s_addr = htonl(request->to_host_addr);
628-
629- if ((channel->local_socket =
630- socket(AF_INET, SOCK_STREAM, 0)) != INVALID_SOCKET
631- && WSAAsyncSelect(channel->local_socket, make_accept_wnd(pvar),
632- WM_SOCK_IO,
633- FD_CONNECT | FD_READ | FD_CLOSE | FD_WRITE) !=
634- SOCKET_ERROR) {
635- if (connect
636- (channel->local_socket, (struct sockaddr FAR *) &addr,
637- sizeof(addr)) != SOCKET_ERROR) {
638- connected_local_connection(pvar, channel_num);
639- return;
640- } else if (WSAGetLastError() == WSAEWOULDBLOCK) {
641- /* do nothing, we'll just wait */
642- return;
643- }
644- }
645-
646- channel_opening_error(pvar, channel_num, WSAGetLastError());
647-#endif /* NO_INET6 */
648591 }
649592
650-#ifndef NO_INET6
651593 static void accept_local_connection(PTInstVar pvar, int request_num,
652594 int listening_socket_num)
653595 {
654-#else
655-static void accept_local_connection(PTInstVar pvar, int request_num)
656-{
657-#endif /* NO_INET6 */
658596 int channel_num;
659597 SOCKET s;
660-#ifndef NO_INET6
661598 struct sockaddr_storage addr;
662599 char hname[NI_MAXHOST];
663600 char strport[NI_MAXSERV]; // ws2tcpip.h
664-#else
665- struct sockaddr addr;
666-#endif /* NO_INET6 */
667601 int addrlen = sizeof(addr);
668602 char buf[1024];
669-#ifndef INET6
670603 BYTE FAR *IP;
671-#endif /* NO_INET6 */
672604 FWDChannel FAR *channel;
673605 FWDRequest FAR *request = &pvar->fwd_state.requests[request_num];
674606 BOOL is_localhost = FALSE;
675607
676-#ifndef NO_INET6
677608 s = accept(request->listening_sockets[listening_socket_num],
678609 (struct sockaddr FAR *) &addr, &addrlen);
679-#else
680- s = accept(request->listening_socket, &addr, &addrlen);
681-#endif /* NO_INET6 */
682610 if (s == INVALID_SOCKET)
683611 return;
684612
685-#ifndef INET6
686613 IP = (BYTE FAR *) & ((struct sockaddr_in *) (&addr))->sin_addr.s_addr;
687-#endif
688614
689-#ifndef NO_INET6
690615 // SSH2 port-forwardingに接続元のリモートポートが必要。(2005.2.27 yutaka)
691616 if (getnameinfo
692617 ((struct sockaddr FAR *) &addr, addrlen, hname, sizeof(hname),
@@ -697,21 +622,9 @@
697622 "Host %s connecting to port %d; forwarding to %s:%d",
698623 hname, request->spec.from_port, request->spec.to_host,
699624 request->spec.to_port);
700-#else
701- _snprintf(buf, sizeof(buf),
702- "Host %d.%d.%d.%d connecting to port %d; forwarding to %s:%d",
703- IP[0], IP[1], IP[2], IP[3], request->spec.from_port,
704- request->spec.to_host, request->spec.to_port);
705- buf[NUM_ELEM(buf) - 1] = 0;
706-#endif /* NO_INET6 */
707625 notify_verbose_message(pvar, buf, LOG_LEVEL_VERBOSE);
708626
709-#ifndef NO_INET6
710627 strncpy_s(buf, sizeof(buf), hname, _TRUNCATE);
711-#else
712- _snprintf(buf, sizeof(buf), "%d.%d.%d.%d", IP[0], IP[1], IP[2], IP[3]);
713- buf[NUM_ELEM(buf) - 1] = 0;
714-#endif
715628
716629 channel_num = alloc_channel(pvar, FWD_LOCAL_CONNECTED, request_num);
717630 channel = pvar->fwd_state.channels + channel_num;
@@ -809,13 +722,6 @@
809722 {
810723 int i;
811724
812-#ifdef NO_INET6
813- pvar->fwd_state.requests[request_num].to_host_addr =
814- ntohl(*(uint32 FAR *)
815- ((HOSTENT FAR *) pvar->fwd_state.requests[request_num].
816- to_host_hostent_buf)->h_addr_list[0]);
817-#endif /* NO_INET6 */
818-
819725 for (i = 0; i < pvar->fwd_state.num_channels; i++) {
820726 if (pvar->fwd_state.channels[i].request_num == request_num) {
821727 make_local_connection(pvar, i);
@@ -844,12 +750,9 @@
844750 if (HIWORD(lParam) != 0) {
845751 request_error(pvar, request_num, HIWORD(lParam));
846752 } else {
847-#ifndef NO_INET6
848753 int listening_socket_num;
849-#endif /* NO_INET6 */
850754 switch (LOWORD(lParam)) {
851755 case FD_ACCEPT:
852-#ifndef NO_INET6
853756 listening_socket_num =
854757 find_listening_socket_num(pvar, request_num,
855758 (SOCKET) wParam);
@@ -857,9 +760,6 @@
857760 return FALSE;
858761 accept_local_connection(pvar, request_num,
859762 listening_socket_num);
860-#else
861- accept_local_connection(pvar, request_num);
862-#endif /* NO_INET6 */
863763 break;
864764 }
865765 }
@@ -879,27 +779,18 @@
879779 found_to_host_addr(pvar, request_num);
880780 }
881781 pvar->fwd_state.requests[request_num].to_host_lookup_handle = 0;
882-#ifdef NO_INET6
883- free(pvar->fwd_state.requests[request_num].
884- to_host_hostent_buf);
885- pvar->fwd_state.requests[request_num].to_host_hostent_buf =
886- NULL;
887-#endif /* NO_INET6 */
888782 return TRUE;
889783 }
890784
891785 case WM_SOCK_IO:{
892786 int channel_num = find_channel_num(pvar, (SOCKET) wParam);
893-#ifndef NO_INET6
894787 FWDChannel FAR *channel =
895788 pvar->fwd_state.channels + channel_num;
896-#endif /* NO_INET6 */
897789
898790 if (channel_num < 0)
899791 return TRUE;
900792
901793 if (HIWORD(lParam) != 0) {
902-#ifndef NO_INET6
903794 if (LOWORD(lParam) == FD_CONNECT) {
904795 if (channel->to_host_addrs->ai_next == NULL) {
905796 /* all protocols were failed */
@@ -951,15 +842,6 @@
951842 HIWORD(lParam));
952843 return TRUE;
953844 }
954-#else
955- if (LOWORD(lParam) == FD_CONNECT) {
956- channel_opening_error(pvar, channel_num,
957- HIWORD(lParam));
958- } else {
959- channel_error(pvar, "accessing", channel_num,
960- HIWORD(lParam));
961- }
962-#endif /* NO_INET6 */
963845 } else {
964846 switch (LOWORD(lParam)) {
965847 case FD_CONNECT:
@@ -1074,25 +956,15 @@
1074956 It returns the listening socket for the request, if there is one.
1075957 The caller must close this socket if it is not INVALID_SOCKET.
1076958 */
1077-#ifndef NO_INET6
1078959 static SOCKET FAR *delete_request(PTInstVar pvar, int request_num,
1079960 int *p_num_listening_sockets)
1080961 {
1081-#else
1082-static SOCKET delete_request(PTInstVar pvar, int request_num)
1083-{
1084-#endif /* NO_INET6 */
1085962 FWDRequest FAR *request = pvar->fwd_state.requests + request_num;
1086-#ifndef NO_INET6
1087963 SOCKET FAR *lp_listening_sockets;
1088-#else
1089- SOCKET result = INVALID_SOCKET;
1090-#endif /* NO_INET6 */
1091964
1092965 /* safe to shut down the listening socket here. Any pending connections
1093966 that haven't yet been turned into channels will be broken, but that's
1094967 just tough luck. */
1095-#ifndef NO_INET6
1096968 *p_num_listening_sockets = request->num_listening_sockets;
1097969 lp_listening_sockets = request->listening_sockets;
1098970 if (request->listening_sockets != NULL) {
@@ -1107,20 +979,6 @@
1107979 }
1108980
1109981 return lp_listening_sockets;
1110-#else
1111- if (request->listening_socket != INVALID_SOCKET) {
1112- result = request->listening_socket;
1113- request->listening_socket = INVALID_SOCKET;
1114- }
1115-
1116- request->status |= FWD_DELETED;
1117-
1118- if (request->num_channels == 0) {
1119- really_delete_request(pvar, request_num);
1120- }
1121-
1122- return result;
1123-#endif /* NO_INET6 */
1124982 }
1125983
1126984 static BOOL are_specs_identical(FWDRequestSpec FAR * spec1,
@@ -1139,7 +997,6 @@
1139997 FWDRequest FAR *request = pvar->fwd_state.requests + request_num;
1140998
1141999 if (request->spec.type == FWD_LOCAL_TO_REMOTE) {
1142-#ifndef NO_INET6
11431000 struct addrinfo hints;
11441001 struct addrinfo FAR *res;
11451002 struct addrinfo FAR *res0;
@@ -1211,50 +1068,16 @@
12111068 }
12121069
12131070 return TRUE;
1214-#else
1215- SOCKET s = socket(AF_INET, SOCK_STREAM, 0);
1216- struct sockaddr_in addr;
1217-
1218- addr.sin_family = AF_INET;
1219- addr.sin_port = htons((unsigned short) request->spec.from_port);
1220- addr.sin_addr.s_addr = htonl(INADDR_ANY);
1221-
1222- request->listening_socket = s;
1223- if (s == INVALID_SOCKET
1224- || WSAAsyncSelect(s, make_accept_wnd(pvar), WM_SOCK_ACCEPT,
1225- FD_ACCEPT | FD_READ | FD_CLOSE | FD_WRITE) ==
1226- SOCKET_ERROR
1227- || bind(s, (struct sockaddr FAR *) &addr,
1228- sizeof(addr)) == SOCKET_ERROR
1229- || listen(s, SOMAXCONN) == SOCKET_ERROR) {
1230- if (report_error) {
1231- notify_nonfatal_error(pvar,
1232- "Some socket(s) required for port forwarding could not be initialized.\n"
1233- "Some port forwarding services may not be available.");
1234- }
1235- return FALSE;
1236- }
1237- }
1238-
1239- return TRUE;
1240-#endif /* NO_INET6 */
12411071 }
12421072
12431073 /* This function will only be called on a request when all its channels are
12441074 closed. */
1245-#ifndef NO_INET6
12461075 static BOOL init_request(PTInstVar pvar, int request_num,
12471076 BOOL report_error, SOCKET FAR * listening_sockets,
12481077 int num_listening_sockets)
12491078 {
1250-#else
1251-static BOOL init_request(PTInstVar pvar, int request_num,
1252- BOOL report_error, SOCKET listening_socket)
1253-{
1254-#endif /* NO_INET6 */
12551079 FWDRequest FAR *request = pvar->fwd_state.requests + request_num;
12561080
1257-#ifndef NO_INET6
12581081 request->num_listening_sockets = 0;
12591082 request->listening_sockets = NULL;
12601083 request->to_host_addrs = NULL;
@@ -1274,26 +1097,6 @@
12741097 assert(listening_sockets == NULL);
12751098 return TRUE;
12761099 }
1277-#else
1278- request->listening_socket = INVALID_SOCKET;
1279- request->to_host_addr = 0;
1280- request->to_host_hostent_buf = NULL;
1281- request->to_host_lookup_handle = 0;
1282- request->status = 0;
1283-
1284- if (pvar->fwd_state.in_interactive_mode) {
1285- if (listening_socket != INVALID_SOCKET) {
1286- request->listening_socket = listening_socket;
1287- return TRUE;
1288- } else {
1289- return interactive_init_request(pvar, request_num,
1290- report_error);
1291- }
1292- } else {
1293- assert(listening_socket == INVALID_SOCKET);
1294- return TRUE;
1295- }
1296-#endif /* NO_INET6 */
12971100 }
12981101
12991102 void FWD_set_request_specs(PTInstVar pvar, FWDRequestSpec FAR * specs,
@@ -1302,15 +1105,11 @@
13021105 FWDRequestSpec FAR *new_specs =
13031106 (FWDRequestSpec FAR *) malloc(sizeof(FWDRequestSpec) * num_specs);
13041107 char FAR *specs_accounted_for;
1305-#ifndef NO_INET6
13061108 typedef struct _saved_sockets {
13071109 SOCKET FAR *listening_sockets;
13081110 int num_listening_sockets;
13091111 } saved_sockets_t;
13101112 saved_sockets_t FAR *ptr_to_saved_sockets;
1311-#else
1312- SOCKET FAR *saved_sockets;
1313-#endif /* NO_INET6 */
13141113 int i;
13151114 int num_new_requests = num_specs;
13161115 int num_free_requests = 0;
@@ -1331,22 +1130,14 @@
13311130 }
13321131
13331132 specs_accounted_for = (char FAR *) malloc(sizeof(char) * num_specs);
1334-#ifndef NO_INET6
13351133 ptr_to_saved_sockets =
13361134 (saved_sockets_t FAR *) malloc(sizeof(saved_sockets_t) *
13371135 num_specs);
1338-#else
1339- saved_sockets = (SOCKET FAR *) malloc(sizeof(SOCKET) * num_specs);
1340-#endif /* NO_INET6 */
13411136
13421137 memset(specs_accounted_for, 0, num_specs);
13431138 for (i = 0; i < num_specs; i++) {
1344-#ifndef NO_INET6
13451139 ptr_to_saved_sockets[i].listening_sockets = NULL;
13461140 ptr_to_saved_sockets[i].num_listening_sockets = 0;
1347-#else
1348- saved_sockets[i] = INVALID_SOCKET;
1349-#endif /* NO_INET6 */
13501141 }
13511142
13521143 for (i = pvar->fwd_state.num_requests - 1; i >= 0; i--) {
@@ -1362,16 +1153,11 @@
13621153 specs_accounted_for[new_spec - new_specs] = 1;
13631154 num_new_requests--;
13641155 } else {
1365-#ifndef NO_INET6
13661156 int num_listening_sockets;
13671157 SOCKET FAR *listening_sockets;
13681158 listening_sockets =
13691159 delete_request(pvar, i, &num_listening_sockets);
1370-#else
1371- SOCKET listening_socket = delete_request(pvar, i);
1372-#endif /* NO_INET6 */
13731160
1374-#ifndef NO_INET6
13751161 if (new_spec != NULL) {
13761162 ptr_to_saved_sockets[new_spec - new_specs].
13771163 listening_sockets = listening_sockets;
@@ -1383,13 +1169,6 @@
13831169 for (i = 0; i < num_listening_sockets; ++i)
13841170 safe_closesocket(pvar, listening_sockets[i]);
13851171 }
1386-#else
1387- if (new_spec != NULL) {
1388- saved_sockets[new_spec - new_specs] = listening_socket;
1389- } else if (listening_socket != INVALID_SOCKET) {
1390- safe_closesocket(pvar, listening_socket);
1391- }
1392-#endif /* NO_INET6 */
13931172
13941173 if (pvar->fwd_state.requests[i].num_channels == 0) {
13951174 num_free_requests++;
@@ -1427,14 +1206,9 @@
14271206 assert(free_request < pvar->fwd_state.num_requests);
14281207
14291208 pvar->fwd_state.requests[free_request].spec = new_specs[i];
1430-#ifndef NO_INET6
14311209 if (!init_request(pvar, free_request, report_err,
14321210 ptr_to_saved_sockets[i].listening_sockets,
14331211 ptr_to_saved_sockets[i].num_listening_sockets)) {
1434-#else
1435- if (!init_request
1436- (pvar, free_request, report_err, saved_sockets[i])) {
1437-#endif /* NO_INET6 */
14381212 report_err = FALSE;
14391213 }
14401214
@@ -1442,11 +1216,7 @@
14421216 }
14431217 }
14441218
1445-#ifndef NO_INET6
14461219 free(ptr_to_saved_sockets);
1447-#else
1448- free(saved_sockets);
1449-#endif /* NO_INET6 */
14501220 free(specs_accounted_for);
14511221 free(new_specs);
14521222 }
@@ -1541,28 +1311,13 @@
15411311 int channel_num;
15421312 FWDChannel FAR *channel;
15431313 FWDRequest FAR *request = pvar->fwd_state.requests + request_num;
1544-#ifndef NO_INET6
15451314 struct addrinfo hints;
15461315 char pname[NI_MAXSERV];
1547-#endif /* NO_INET6 */
15481316
1549-#ifndef NO_INET6
15501317 if (request->to_host_addrs == NULL
15511318 && request->to_host_lookup_handle == 0) {
15521319 HANDLE task_handle;
1553-#else
1554- if (request->to_host_addr == 0 && request->to_host_lookup_handle == 0) {
1555- HANDLE task_handle;
1556-#endif /* NO_INET6 */
15571320
1558-#ifdef NO_INET6
1559- if (request->to_host_hostent_buf == NULL) {
1560- request->to_host_hostent_buf =
1561- (char FAR *) malloc(MAXGETHOSTSTRUCT);
1562- }
1563-#endif /* NO_INET6 */
1564-
1565-#ifndef NO_INET6
15661321 _snprintf_s(pname, sizeof(pname), _TRUNCATE, "%d", request->spec.to_port);
15671322 memset(&hints, 0, sizeof(hints));
15681323 hints.ai_family = AF_UNSPEC;
@@ -1571,13 +1326,6 @@
15711326 WSAAsyncGetAddrInfo(make_accept_wnd(pvar), WM_SOCK_GOTNAME,
15721327 request->spec.to_host, pname, &hints,
15731328 &request->to_host_addrs);
1574-#else
1575- task_handle =
1576- WSAAsyncGetHostByName(make_accept_wnd(pvar), WM_SOCK_GOTNAME,
1577- request->spec.to_host,
1578- request->to_host_hostent_buf,
1579- MAXGETHOSTSTRUCT);
1580-#endif /* NO_INET6 */
15811329
15821330 if (task_handle == 0) {
15831331 SSH_fail_channel_open(pvar, remote_channel_num);
@@ -1589,13 +1337,7 @@
15891337 pvar->ts->UIMsg,
15901338 request->spec.to_host, request->spec.to_port_name);
15911339 notify_nonfatal_error(pvar, buf);
1592-#ifndef NO_INET6
1593- /*****/
15941340 freeaddrinfo(request->to_host_addrs);
1595-#else
1596- free(request->to_host_hostent_buf);
1597- request->to_host_hostent_buf = NULL;
1598-#endif /* NO_INET6 */
15991341 return;
16001342 } else {
16011343 request->to_host_lookup_handle = task_handle;
@@ -1617,15 +1359,9 @@
16171359 *chan_num = channel_num;
16181360 }
16191361
1620-#ifndef NO_INET6
16211362 if (request->to_host_addrs != NULL) {
16221363 make_local_connection(pvar, channel_num);
16231364 }
1624-#else
1625- if (request->to_host_addr != 0) {
1626- make_local_connection(pvar, channel_num);
1627- }
1628-#endif /* NO_INET6 */
16291365 }
16301366
16311367 void FWD_open(PTInstVar pvar, uint32 remote_channel_num,
@@ -1889,7 +1625,7 @@
18891625 }
18901626 free(pvar->fwd_state.channels);
18911627 }
1892-#ifndef NO_INET6
1628+
18931629 if (pvar->fwd_state.requests != NULL) {
18941630 for (i = 0; i < pvar->fwd_state.num_requests; i++) {
18951631 int j;
@@ -1906,19 +1642,7 @@
19061642 }
19071643 free(pvar->fwd_state.requests);
19081644 }
1909-#else
1910- if (pvar->fwd_state.requests != NULL) {
1911- for (i = 0; i < pvar->fwd_state.num_requests; i++) {
1912- SOCKET s = delete_request(pvar, i);
19131645
1914- if (s != INVALID_SOCKET) {
1915- closesocket(s);
1916- }
1917- }
1918- free(pvar->fwd_state.requests);
1919- }
1920-#endif /* NO_INET6 */
1921-
19221646 free(pvar->fwd_state.local_host_IP_numbers);
19231647 free(pvar->fwd_state.server_listening_specs);
19241648
--- trunk/ttssh2/ttxssh/fwd.h (revision 6737)
+++ trunk/ttssh2/ttxssh/fwd.h (revision 6738)
@@ -63,9 +63,7 @@
6363
6464 void FAR * filter_closure;
6565 FWDFilter filter;
66-#ifndef NO_INET6
6766 struct addrinfo FAR * to_host_addrs;
68-#endif /* NO_INET6 */
6967
7068 // for agent forwarding
7169 buffer_t *agent_msg;
@@ -98,20 +96,11 @@
9896
9997 #define FWD_DELETED 0x01
10098
101-#ifndef NO_INET6
10299 #define MAX_LISTENING_SOCKETS 4096
103-#endif
104100 typedef struct {
105-#ifndef NO_INET6
106101 int num_listening_sockets;
107102 SOCKET FAR * listening_sockets;
108103 struct addrinfo FAR * to_host_addrs;
109-#else
110- SOCKET listening_socket;
111-
112- uint32 to_host_addr;
113- char FAR * to_host_hostent_buf;
114-#endif /* NO_INET6 */
115104 HANDLE to_host_lookup_handle;
116105
117106 int num_channels;
@@ -130,11 +119,7 @@
130119 FWDRequest FAR * requests;
131120 int num_channels;
132121 FWDChannel FAR * channels;
133-#ifndef NO_INET6
134122 struct sockaddr_storage FAR * local_host_IP_numbers;
135-#else
136- uint32 * local_host_IP_numbers;
137-#endif /* NO_INET6 */
138123 struct _X11AuthData FAR * X11_auth_data;
139124 BOOL in_interactive_mode;
140125 } FWDState;
--- trunk/ttssh2/ttxssh/ttxssh.c (revision 6737)
+++ trunk/ttssh2/ttxssh/ttxssh.c (revision 6738)
@@ -53,12 +53,8 @@
5353 #include "resource.h"
5454 #include <commctrl.h>
5555 #include <commdlg.h>
56-#ifndef NO_INET6
5756 #include <winsock2.h>
5857 static char FAR *ProtocolFamilyList[] = { "UNSPEC", "IPv6", "IPv4", NULL };
59-#else
60-#include <winsock.h>
61-#endif /* NO_INET6 */
6258
6359 #include <Lmcons.h>
6460
@@ -666,7 +662,6 @@
666662 static unsigned short find_local_port(PTInstVar pvar)
667663 {
668664 int tries;
669-#ifndef NO_INET6
670665 SOCKET connecter;
671666 struct addrinfo hints;
672667 struct addrinfo FAR *res;
@@ -673,7 +668,6 @@
673668 struct addrinfo FAR *res0;
674669 unsigned short port;
675670 char pname[NI_MAXHOST];
676-#endif /* NO_INET6 */
677671
678672 if (pvar->session_settings.DefaultAuthMethod != SSH_AUTH_RHOSTS) {
679673 return 0;
@@ -686,7 +680,6 @@
686680 */
687681 srand((unsigned) GetTickCount());
688682
689-#ifndef NO_INET6
690683 for (tries = 20; tries > 0; tries--) {
691684 memset(&hints, 0, sizeof(hints));
692685 hints.ai_family = pvar->ts->ProtocolFamily;
@@ -727,34 +720,6 @@
727720 }
728721
729722 return 0;
730-#else
731- for (tries = 20; tries > 0; tries--) {
732- SOCKET connecter = socket(AF_INET, SOCK_STREAM, 0);
733- struct sockaddr_in connecter_addr;
734-
735- connecter_addr.sin_family = AF_INET;
736- connecter_addr.sin_port = (unsigned) rand() % 512 + 512;
737- connecter_addr.sin_addr.s_addr = htonl(INADDR_ANY);
738-
739- if (connecter == INVALID_SOCKET) {
740- return 0;
741- }
742-
743- if (bind
744- (connecter, (struct sockaddr FAR *) &connecter_addr,
745- sizeof(connecter_addr)) != SOCKET_ERROR) {
746- closesocket(connecter);
747- return connecter_addr.sin_port;
748- } else if (WSAGetLastError() != WSAEADDRINUSE) {
749- closesocket(connecter);
750- return 0;
751- }
752-
753- closesocket(connecter);
754- }
755-
756- return 0;
757-#endif /* NO_INET6 */
758723 }
759724
760725 static int PASCAL FAR TTXconnect(SOCKET s,
@@ -761,7 +726,6 @@
761726 const struct sockaddr FAR * name,
762727 int namelen)
763728 {
764-#ifndef NO_INET6
765729 if (pvar->socket == INVALID_SOCKET || pvar->socket != s) {
766730 struct sockaddr_storage ss;
767731 int len;
@@ -792,21 +756,7 @@
792756
793757 bind(s, (struct sockaddr FAR *) &ss, len);
794758 }
795-#else
796- if (pvar->socket == INVALID_SOCKET) {
797- struct sockaddr_in addr;
798759
799- pvar->socket = s;
800-
801- addr.sin_family = AF_INET;
802- addr.sin_port = htons(find_local_port(pvar));
803- addr.sin_addr.s_addr = INADDR_ANY;
804- memset(addr.sin_zero, 0, sizeof(addr.sin_zero));
805-
806- bind(s, (struct sockaddr FAR *) &addr, sizeof(addr));
807- }
808-#endif /* NO_INET6 */
809-
810760 return (pvar->Pconnect) (s, name, namelen);
811761 }
812762
@@ -1380,7 +1330,6 @@
13801330 Telnet ? IDC_HOSTTELNET : IDC_HOSTOTHER);
13811331 SendDlgItemMessage(dlg, IDC_HOSTTCPPORT, EM_LIMITTEXT, 5, 0);
13821332 SetDlgItemInt(dlg, IDC_HOSTTCPPORT, GetHNRec->TCPPort, FALSE);
1383-#ifndef NO_INET6
13841333 for (i = 0; ProtocolFamilyList[i]; ++i) {
13851334 SendDlgItemMessage(dlg, IDC_HOSTTCPPROTOCOL, CB_ADDSTRING,
13861335 0, (LPARAM) ProtocolFamilyList[i]);
@@ -1388,7 +1337,6 @@
13881337 SendDlgItemMessage(dlg, IDC_HOSTTCPPROTOCOL, EM_LIMITTEXT,
13891338 ProtocolFamilyMaxLength - 1, 0);
13901339 SendDlgItemMessage(dlg, IDC_HOSTTCPPROTOCOL, CB_SETCURSEL, 0, 0);
1391-#endif /* NO_INET6 */
13921340
13931341 /////// SSH version
13941342 for (i = 0; ssh_version[i]; ++i) {
@@ -1472,7 +1420,6 @@
14721420
14731421 enable_dlg_items(dlg, IDC_HISTORY, IDC_HISTORY, TRUE); // enabled
14741422 }
1475-#ifndef NO_INET6
14761423 else {
14771424 enable_dlg_items(dlg, IDC_HOSTNAMELABEL, IDC_HOSTTCPPORT,
14781425 FALSE);
@@ -1484,11 +1431,6 @@
14841431
14851432 enable_dlg_items(dlg, IDC_HISTORY, IDC_HISTORY, FALSE); // disabled
14861433 }
1487-#else
1488- else
1489- enable_dlg_items(dlg, IDC_HOSTNAMELABEL, IDC_HOSTTCPPORT,
1490- FALSE);
1491-#endif /* NO_INET6 */
14921434
14931435 // Host dialogにフォーカスをあてる (2004.10.2 yutaka)
14941436 if (GetHNRec->PortType == IdTCPIP) {
@@ -1539,9 +1481,7 @@
15391481 GetHNRec = (PGetHNRec) GetWindowLong(dlg, DWL_USER);
15401482 if (GetHNRec != NULL) {
15411483 if (IsDlgButtonChecked(dlg, IDC_HOSTTCPIP)) {
1542-#ifndef NO_INET6
15431484 char afstr[BUFSIZ];
1544-#endif /* NO_INET6 */
15451485 i = GetDlgItemInt(dlg, IDC_HOSTTCPPORT, &Ok, FALSE);
15461486 if (Ok) {
15471487 GetHNRec->TCPPort = i;
@@ -1552,7 +1492,6 @@
15521492 "Tera Term", MB_OK | MB_ICONEXCLAMATION);
15531493 return TRUE;
15541494 }
1555-#ifndef NO_INET6
15561495 #define getaf(str) \
15571496 ((strcmp((str), "IPv6") == 0) ? AF_INET6 : \
15581497 ((strcmp((str), "IPv4") == 0) ? AF_INET : AF_UNSPEC))
@@ -1560,7 +1499,6 @@
15601499 GetDlgItemText(dlg, IDC_HOSTTCPPROTOCOL, afstr,
15611500 sizeof(afstr));
15621501 GetHNRec->ProtocolFamily = getaf(afstr);
1563-#endif /* NO_INET6 */
15641502 GetHNRec->PortType = IdTCPIP;
15651503 GetDlgItemText(dlg, IDC_HOSTNAME, GetHNRec->HostName,
15661504 HostNameMaxLength);
@@ -1628,10 +1566,8 @@
16281566 case IDC_HOSTTCPIP:
16291567 enable_dlg_items(dlg, IDC_HOSTNAMELABEL, IDC_HOSTTCPPORT,
16301568 TRUE);
1631-#ifndef NO_INET6
16321569 enable_dlg_items(dlg, IDC_HOSTTCPPROTOCOLLABEL,
16331570 IDC_HOSTTCPPROTOCOL, TRUE);
1634-#endif /* NO_INET6 */
16351571 enable_dlg_items(dlg, IDC_HOSTCOMLABEL, IDC_HOSTCOM, FALSE);
16361572
16371573 enable_dlg_items(dlg, IDC_SSH_VERSION_LABEL, IDC_SSH_VERSION_LABEL, TRUE); // disabled (2004.11.23 yutaka)
@@ -1649,10 +1585,8 @@
16491585 enable_dlg_items(dlg, IDC_HOSTCOMLABEL, IDC_HOSTCOM, TRUE);
16501586 enable_dlg_items(dlg, IDC_HOSTNAMELABEL, IDC_HOSTTCPPORT,
16511587 FALSE);
1652-#ifndef NO_INET6
16531588 enable_dlg_items(dlg, IDC_HOSTTCPPROTOCOLLABEL,
16541589 IDC_HOSTTCPPROTOCOL, FALSE);
1655-#endif /* NO_INET6 */
16561590 enable_dlg_items(dlg, IDC_SSH_VERSION, IDC_SSH_VERSION, FALSE); // disabled
16571591 enable_dlg_items(dlg, IDC_SSH_VERSION_LABEL, IDC_SSH_VERSION_LABEL, FALSE); // disabled (2004.11.23 yutaka)
16581592
@@ -2108,12 +2042,8 @@
21082042 option[hostlen] = 0;
21092043
21102044 // ポート指定が無い時は":22"を足す
2111-#ifndef NO_INET6
21122045 if (option[0] == '[' && option[hostlen-1] == ']' || // IPv6 raw address without port
21132046 option[0] != '[' && _mbschr(option, ':') == NULL) { // hostname or IPv4 raw address without port
2114-#else
2115- if (_mbschr(option, ':') == NULL) {
2116-#endif /* NO_INET6 */
21172047 memcpy_s(option+hostlen, optlen-hostlen, ":22", 3);
21182048 hostlen += 3;
21192049 }
--- trunk/ttssh2/ttxssh/ttxssh.h (revision 6737)
+++ trunk/ttssh2/ttxssh/ttxssh.h (revision 6738)
@@ -46,7 +46,6 @@
4646 #endif
4747 #endif
4848
49-#ifndef NO_INET6
5049 #include <winsock2.h>
5150 #include <ws2tcpip.h>
5251 /* actual body of in6addr_any and in6addr_loopback is disappeared?? */
@@ -58,7 +57,6 @@
5857 (*(unsigned int *)(&(a)->s6_addr[12]) == ntohl(1)))
5958 /* work around for MS Platform SDK Oct 2000 */
6059 #include <malloc.h> /* prevent of conflict stdlib.h */
61-#endif /* NO_INET6 */
6260 #include <stdlib.h>
6361 #include <stdarg.h>
6462 #include <crtdbg.h>
Show on old repository browser