[Ttssh2-commit] [6960] TELNET TERMINAL SPEED OPTION (RFC 1079) に対応 #37599

scmno****@osdn***** scmno****@osdn*****
2017年 10月 25日 (水) 02:53:34 JST


Revision: 6960
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/6960
Author:   doda
Date:     2017-10-25 02:53:34 +0900 (Wed, 25 Oct 2017)
Log Message:
-----------
TELNET TERMINAL SPEED OPTION (RFC 1079) に対応 #37599

FreeBSD の telnetd に -D report オプションを指定した状態で、TERMINAL
SPEED OPTION を受け取っているのを確認。ただし TTY のスピードは変わらず。

設定は SSH と共通で TerminalSpeed を使用する。
Transmit / Receive は送信側 (Tera Term) から見た方向なので、

・Transmit = SSH TTY Mode ISPEED
・Receive  = SSH TTY Mode OSPEED

としている。

Ticket Links:
------------
    http://sourceforge.jp/projects/ttssh2/tracker/detail/37599

Modified Paths:
--------------
    trunk/teraterm/teraterm/telnet.c
    trunk/teraterm/teraterm/vtwin.cpp

-------------- next part --------------
Modified: trunk/teraterm/teraterm/telnet.c
===================================================================
--- trunk/teraterm/teraterm/telnet.c	2017-10-24 17:53:30 UTC (rev 6959)
+++ trunk/teraterm/teraterm/telnet.c	2017-10-24 17:53:34 UTC (rev 6960)
@@ -102,6 +102,7 @@
   tr.HisOpt[SGA].Accept = TRUE;
   tr.HisOpt[ECHO].Accept = TRUE;
   tr.MyOpt[TERMTYPE].Accept = TRUE;
+  tr.MyOpt[TERMSPEED].Accept = TRUE;
   tr.MyOpt[NAWS].Accept = TRUE;
   tr.HisOpt[NAWS].Accept = TRUE;
   tr.WinSize.x = ts.TerminalWidth;
@@ -261,23 +262,10 @@
 			    (tr.SubOptBuff[0] == TERMTYPE) &&
 			    (tr.SubOptBuff[1] == 1))
 			{
-#if 1
 				_snprintf_s(TmpStr, sizeof(TmpStr), _TRUNCATE, "%c%c%c%c%s%c%c",
 				            IAC, SB, TERMTYPE, 0, ts.TermType, IAC, SE);
 				// 4 \x83o\x83C\x83g\x96ڂ\xC9 0 \x82\xAA\x93\xFC\x82\xE9\x82̂ŁA\x82\xB8\x82炵\x82Ē\xB7\x82\xB3\x82\xF0\x82Ƃ\xE9
 				i = strlen(TmpStr + 4) + 4;
-#else
-				TmpStr[0] = IAC;
-				TmpStr[1] = SB;
-				TmpStr[2] = TERMTYPE;
-				TmpStr[3] = 0;
-				strcpy(&TmpStr[4],ts.TermType);
-				i = 4 + strlen(ts.TermType);
-				TmpStr[i] = IAC;
-				i++;
-				TmpStr[i] = SE;
-				i++;
-#endif
 				CommRawOut(&cv,TmpStr,i);
 
 				if (tr.LogFile!=0)
@@ -291,6 +279,24 @@
 				tr.WinSize.y = tr.SubOptBuff[3]*256+ tr.SubOptBuff[4];
 				tr.ChangeWinSize = TRUE;
 			}
+			else if ((tr.MyOpt[TERMSPEED].Status == Yes) &&
+			         (tr.SubOptCount >= 2) &&
+			         (tr.SubOptBuff[0] == TERMSPEED) &&
+			         (tr.SubOptBuff[1] == 1))
+			{
+				_snprintf_s(TmpStr, sizeof(TmpStr),
+					_TRUNCATE,"%c%c%c%c%d,%d%c%c",
+					IAC, SB, TERMSPEED, 0,
+					ts.TerminalInputSpeed,
+					ts.TerminalOutputSpeed,
+					IAC,SE);
+				// 4 \x83o\x83C\x83g\x96ڂ\xC9 0 \x82\xAA\x93\xFC\x82\xE9\x82̂ŁA\x82\xB8\x82炵\x82Ē\xB7\x82\xB3\x82\xF0\x82Ƃ\xE9
+				i = strlen(TmpStr + 4) + 4;
+				CommRawOut(&cv, TmpStr, i);
+
+				if (tr.LogFile)
+					TelWriteLog(TmpStr, i);
+			}
 			tr.SubOptCount = 0;
 			TelStatus = TelIdle;
 			return ;

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2017-10-24 17:53:30 UTC (rev 6959)
+++ trunk/teraterm/teraterm/vtwin.cpp	2017-10-24 17:53:34 UTC (rev 6960)
@@ -3714,6 +3714,8 @@
 				TelEnableHisOpt(BINARY);
 			}
 
+			TelEnableMyOpt(TERMSPEED);
+
 			TelStartKeepAliveThread();
 		}
 		else if (!ts.DisableTCPEchoCR) {



Ttssh2-commit メーリングリストの案内