svnno****@sourc*****
svnno****@sourc*****
2016年 2月 26日 (金) 17:37:33 JST
Revision: 6319 http://sourceforge.jp/projects/ttssh2/scm/svn/commits/6319 Author: maya Date: 2016-02-26 17:37:33 +0900 (Fri, 26 Feb 2016) Log Message: ----------- YMDOEM, ZMODEM のタイムアウトを指定できるようにした https://osdn.jp/ticket/browse.php?group_id=1412&tid=33055 Modified Paths: -------------- trunk/installer/release/TERATERM.INI trunk/teraterm/common/ttftypes.h trunk/teraterm/common/tttypes.h trunk/teraterm/ttpfile/ymodem.c trunk/teraterm/ttpfile/zmodem.c trunk/teraterm/ttpset/ttset.c -------------- next part -------------- Modified: trunk/installer/release/TERATERM.INI =================================================================== --- trunk/installer/release/TERATERM.INI 2016-02-24 14:35:10 UTC (rev 6318) +++ trunk/installer/release/TERATERM.INI 2016-02-26 08:37:33 UTC (rev 6319) @@ -712,6 +712,9 @@ ; YMODEM receive command YmodemRcvCommand= +; YMODEM Timeout +YmodemTimeouts=10,3,10,20,60 + ; ZMODEM auto receive ZmodemAuto=off @@ -728,6 +731,9 @@ ; ZMODEM receive command ZmodemRcvCommand=rz +; ZMODEM Timeout +ZmodemTimeouts=10,0,10,3 + ;------ end of special options [TTSSH] Modified: trunk/teraterm/common/ttftypes.h =================================================================== --- trunk/teraterm/common/ttftypes.h 2016-02-24 14:35:10 UTC (rev 6318) +++ trunk/teraterm/common/ttftypes.h 2016-02-26 08:37:33 UTC (rev 6319) @@ -216,6 +216,9 @@ BOOL CRRecv; int TOutShort; int TOutLong; + int TOutInit; + int TOutInitCRC; + int TOutVLong; int SendFileInfo; int SendEot; int LastSendEot; @@ -253,6 +256,8 @@ WORD CRC; LONG CRC3, Pos, LastPos, WinSize; BYTE LastSent; + int TOutInit; + int TOutFin; } TZVar; typedef TZVar far *PZVar; Modified: trunk/teraterm/common/tttypes.h =================================================================== --- trunk/teraterm/common/tttypes.h 2016-02-24 14:35:10 UTC (rev 6318) +++ trunk/teraterm/common/tttypes.h 2016-02-26 08:37:33 UTC (rev 6319) @@ -596,6 +596,15 @@ int XmodemTimeOutShort; int XmodemTimeOutLong; int XmodemTimeOutVLong; + int YmodemTimeOutInit; + int YmodemTimeOutInitCRC; + int YmodemTimeOutShort; + int YmodemTimeOutLong; + int YmodemTimeOutVLong; + int ZmodemTimeOutNormal; + int ZmodemTimeOutTCPIP; + int ZmodemTimeOutInit; + int ZmodemTimeOutFin; }; typedef struct tttset TTTSet, *PTTSet; Modified: trunk/teraterm/ttpfile/ymodem.c =================================================================== --- trunk/teraterm/ttpfile/ymodem.c 2016-02-24 14:35:10 UTC (rev 6318) +++ trunk/teraterm/ttpfile/ymodem.c 2016-02-26 08:37:33 UTC (rev 6319) @@ -21,12 +21,6 @@ #include "ymodem.h" -#define TimeOutInit 10 -#define TimeOutC 3 -#define TimeOutShort 10 -#define TimeOutLong 20 -#define TimeOutVeryLong 60 - // \x83f\x81[\x83^\x93]\x91\x97\x83T\x83C\x83Y\x81BYMODEM\x82ł\xCD 128 or 1024 byte \x82\xF0\x83T\x83|\x81[\x83g\x82\xB7\x82\xE9\x81B #define SOH_DATALEN 128 #define STX_DATALEN 1024 @@ -137,13 +131,13 @@ { b = NAK; if ((yv->PktNum==0) && (yv->PktNumOffset==0)) - t = TimeOutInit; + t = yv->TOutInit; else t = yv->TOutLong; } else { b = 'C'; - t = TimeOutC; + t = yv->TOutInitCRC; } YWrite(fv,yv,cv,&b,1); yv->PktReadMode = XpktSOH; @@ -179,13 +173,13 @@ { b = NAK; if ((yv->PktNum==0) && (yv->PktNumOffset==0)) - t = TimeOutInit; + t = yv->TOutInit; else t = yv->TOutLong; } else { b = 'C'; - t = TimeOutC; + t = yv->TOutInitCRC; } YWrite(fv,yv,cv,&b,1); yv->PktReadMode = XpktSOH; @@ -290,14 +284,18 @@ initialize_file_info(fv, yv); + yv->TOutInit = ts->YmodemTimeOutInit; + yv->TOutInitCRC = ts->YmodemTimeOutInitCRC; + yv->TOutVLong = ts->YmodemTimeOutVLong; + if (cv->PortType==IdTCPIP) { - yv->TOutShort = TimeOutVeryLong; - yv->TOutLong = TimeOutVeryLong; + yv->TOutShort = ts->YmodemTimeOutVLong; + yv->TOutLong = ts->YmodemTimeOutVLong; } else { - yv->TOutShort = TimeOutShort; - yv->TOutLong = TimeOutLong; + yv->TOutShort = ts->YmodemTimeOutShort; + yv->TOutLong = ts->YmodemTimeOutLong; } YSetOpt(fv,yv,yv->YOpt); @@ -334,7 +332,7 @@ YWrite(fv,yv,cv, inistr , strlen(inistr)); } - FTSetTimeOut(fv,TimeOutVeryLong); + FTSetTimeOut(fv, yv->TOutVLong); break; case IdYReceive: @@ -740,7 +738,7 @@ } // reset timeout timer - FTSetTimeOut(fv, TimeOutVeryLong); + FTSetTimeOut(fv, yv->TOutVLong); #if 0 // \x8C㑱\x82̃T\x81[\x83o\x82\xA9\x82\xE7\x82̃f\x81[\x83^\x82\xF0\x93ǂݎ̂Ă\xE9\x81B do Modified: trunk/teraterm/ttpfile/zmodem.c =================================================================== --- trunk/teraterm/ttpfile/zmodem.c 2016-02-24 14:35:10 UTC (rev 6318) +++ trunk/teraterm/ttpfile/zmodem.c 2016-02-26 08:37:33 UTC (rev 6319) @@ -35,10 +35,10 @@ #include "ttcommon.h" #include "ttlib.h" -#define NormalTimeOut 10 -#define TCPIPTimeOut 0 -#define IniTimeOut 10 -#define FinTimeOut 3 +//#define NormalTimeOut 10 +//#define TCPIPTimeOut 0 +//#define IniTimeOut 10 +//#define FinTimeOut 3 #define ZPAD '*' #define ZDLE 0x18 @@ -376,7 +376,7 @@ if (zv->CtlEsc) zv->TxHdr[ZF0] = zv->TxHdr[ZF0] | ESCCTL; ZShHdr(zv, ZRINIT); - FTSetTimeOut(fv, IniTimeOut); + FTSetTimeOut(fv, zv->TOutInit); } void ZSendRQInit(PFileVar fv, PZVar zv, PComVar cv) @@ -663,12 +663,15 @@ if (zv->MaxDataLen < 64) zv->MaxDataLen = 64; + zv->TOutInit = ts->ZmodemTimeOutInit; + zv->TOutFin = ts->ZmodemTimeOutFin; + /* Time out & Max block size */ if (cv->PortType == IdTCPIP) { - zv->TimeOut = TCPIPTimeOut; + zv->TimeOut = ts->ZmodemTimeOutTCPIP; Max = 1024; } else { - zv->TimeOut = NormalTimeOut; + zv->TimeOut = ts->ZmodemTimeOutNormal; if (ts->Baud <= 110) { Max = 64; } @@ -835,7 +838,7 @@ case ZSINIT: zv->ZPktState = Z_PktGetData; if (zv->ZState == Z_RecvInit) - FTSetTimeOut(fv, IniTimeOut); + FTSetTimeOut(fv, zv->TOutInit); break; case ZACK: switch (zv->ZState) { @@ -857,7 +860,7 @@ zv->ZPktState = Z_PktGetData; if ((zv->ZState == Z_RecvInit) || (zv->ZState == Z_RecvInit2)) { zv->BinFlag = zv->RxHdr[ZF0] != ZCNL; - FTSetTimeOut(fv, IniTimeOut); + FTSetTimeOut(fv, zv->TOutInit); } break; case ZSKIP: @@ -898,7 +901,7 @@ zv->ZState = Z_RecvFIN; ZSendFIN(zv); zv->CanCount = 2; - FTSetTimeOut(fv, FinTimeOut); + FTSetTimeOut(fv, zv->TOutFin); } else { zv->ZState = Z_End; ZWrite(fv, zv, cv, "OO", 2); Modified: trunk/teraterm/ttpset/ttset.c =================================================================== --- trunk/teraterm/ttpset/ttset.c 2016-02-24 14:35:10 UTC (rev 6318) +++ trunk/teraterm/ttpset/ttset.c 2016-02-26 08:37:33 UTC (rev 6319) @@ -1867,6 +1867,39 @@ if (ts->XmodemTimeOutVLong < 1) ts->XmodemTimeOutVLong = 1; + // Ymodem Timeout + GetPrivateProfileString(Section, "YmodemTimeouts", "10,3,10,20,60", Temp, sizeof(Temp), FName); + ts->YmodemTimeOutInit = GetNthNum2(Temp, 1, 10); + if (ts->YmodemTimeOutInit < 1) + ts->YmodemTimeOutInit = 1; + ts->YmodemTimeOutInitCRC = GetNthNum2(Temp, 2, 3); + if (ts->YmodemTimeOutInitCRC < 1) + ts->YmodemTimeOutInitCRC = 1; + ts->YmodemTimeOutShort = GetNthNum2(Temp, 3, 10); + if (ts->YmodemTimeOutShort < 1) + ts->YmodemTimeOutShort = 1; + ts->YmodemTimeOutLong = GetNthNum2(Temp, 4, 20); + if (ts->YmodemTimeOutLong < 1) + ts->YmodemTimeOutLong = 1; + ts->YmodemTimeOutVLong = GetNthNum2(Temp, 5, 60); + if (ts->YmodemTimeOutVLong < 1) + ts->YmodemTimeOutVLong = 1; + + // Zmodem Timeout + GetPrivateProfileString(Section, "ZmodemTimeouts", "10,0,10,3", Temp, sizeof(Temp), FName); + ts->ZmodemTimeOutNormal = GetNthNum2(Temp, 1, 10); + if (ts->ZmodemTimeOutNormal < 1) + ts->ZmodemTimeOutNormal = 1; + ts->ZmodemTimeOutTCPIP = GetNthNum2(Temp, 2, 0); + if (ts->ZmodemTimeOutTCPIP < 0) + ts->ZmodemTimeOutTCPIP = 0; + ts->ZmodemTimeOutInit = GetNthNum2(Temp, 3, 10); + if (ts->ZmodemTimeOutInit < 1) + ts->ZmodemTimeOutInit = 1; + ts->ZmodemTimeOutFin = GetNthNum2(Temp, 4, 3); + if (ts->ZmodemTimeOutFin < 1) + ts->ZmodemTimeOutFin = 1; + GetPrivateProfileString(Section, "VTPos", "-2147483648,-2147483648", Temp, sizeof(Temp), FName); /* default: random position */ GetNthNum(Temp, 1, (int far *) (&ts->VTPos.x)); GetNthNum(Temp, 2, (int far *) (&ts->VTPos.y)); @@ -3100,6 +3133,25 @@ ); WritePrivateProfileString(Section, "XmodemTimeouts", Temp, FName); + // Ymodem Timeout + _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d,%d,%d,%d", + ts->YmodemTimeOutInit, + ts->YmodemTimeOutInitCRC, + ts->YmodemTimeOutShort, + ts->YmodemTimeOutLong, + ts->YmodemTimeOutVLong + ); + WritePrivateProfileString(Section, "YmodemTimeouts", Temp, FName); + + // Zmodem Timeout + _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%d,%d,%d,%d", + ts->ZmodemTimeOutNormal, + ts->ZmodemTimeOutTCPIP, + ts->ZmodemTimeOutInit, + ts->ZmodemTimeOutFin + ); + WritePrivateProfileString(Section, "ZmodemTimeouts", Temp, FName); + // CygTerm Configuration File WriteCygtermConfFile(ts); }