[Ttssh2-commit] [4106] SSH2: Control menuのSend breakで、SSHとしての「ブレーク信号」を送信するようにした。

svnno****@sourc***** svnno****@sourc*****
2010年 9月 27日 (月) 19:26:38 JST


Revision: 4106
          http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=4106
Author:   yutakapon
Date:     2010-09-27 19:26:38 +0900 (Mon, 27 Sep 2010)

Log Message:
-----------
SSH2: Control menuのSend breakで、SSHとしての「ブレーク信号」を送信するようにした。

Modified Paths:
--------------
    trunk/ttssh2/ttxssh/ssh.c
    trunk/ttssh2/ttxssh/ssh.h
    trunk/ttssh2/ttxssh/ttxssh.c


-------------- next part --------------
Modified: trunk/ttssh2/ttxssh/ssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ssh.c	2010-09-23 10:42:03 UTC (rev 4105)
+++ trunk/ttssh2/ttxssh/ssh.c	2010-09-27 10:26:38 UTC (rev 4106)
@@ -2833,6 +2833,55 @@
 
 }
 
+// ƒuƒŒ[ƒNM†‚ð‘—‚éB
+// OpenSSH ‚Ì"~B"‚É‘Š“–‚·‚éB‚½‚¾‚µASSH2‚̂݁B
+// (2010.9.27 yutaka)
+int SSH_notify_break_signal(PTInstVar pvar)
+{
+	int ret = 0;
+
+	if (SSHv1(pvar)) {
+		// ‰½‚à‚µ‚È‚¢B
+
+	} else if (SSHv2(pvar)) { 
+		buffer_t *msg;
+		char *s;
+		unsigned char *outmsg;
+		int len;
+		Channel_t *c;
+
+		c = ssh2_channel_lookup(pvar->shell_id);
+		if (c == NULL)
+			goto error;
+
+		msg = buffer_init();
+		if (msg == NULL) {
+			goto error;
+		}
+		buffer_put_int(msg, c->remote_id);
+		s = "break";
+		buffer_put_string(msg, s, strlen(s));
+		buffer_put_char(msg, 0);  // wantconfirm
+		buffer_put_int(msg, 1000);  
+		len = buffer_len(msg);
+		outmsg = begin_send_packet(pvar, SSH2_MSG_CHANNEL_REQUEST, len);
+		memcpy(outmsg, buffer_ptr(msg), len);
+		finish_send_packet(pvar);
+		buffer_free(msg);
+
+		notify_verbose_message(pvar, "SSH2_MSG_CHANNEL_REQUEST was sent at SSH_notify_break_signal().", LOG_LEVEL_VERBOSE);
+
+		ret = 1;
+
+	} else {
+		// SSH‚Å‚È‚¢ê‡‚͉½‚à‚µ‚È‚¢B
+
+	}
+
+error:
+	return (ret);
+}
+
 int SSH_get_min_packet_size(PTInstVar pvar)
 {
 	if (SSHv1(pvar)) {

Modified: trunk/ttssh2/ttxssh/ssh.h
===================================================================
--- trunk/ttssh2/ttxssh/ssh.h	2010-09-23 10:42:03 UTC (rev 4105)
+++ trunk/ttssh2/ttxssh/ssh.h	2010-09-27 10:26:38 UTC (rev 4106)
@@ -561,5 +561,6 @@
 RSA *duplicate_RSA(RSA *src);
 DSA *duplicate_DSA(DSA *src);
 char *key_fingerprint(Key *key, enum fp_rep dgst_rep);
+int SSH_notify_break_signal(PTInstVar pvar);
 
 #endif

Modified: trunk/ttssh2/ttxssh/ttxssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.c	2010-09-23 10:42:03 UTC (rev 4105)
+++ trunk/ttssh2/ttxssh/ttxssh.c	2010-09-27 10:26:38 UTC (rev 4106)
@@ -3947,6 +3947,12 @@
 	}
 
 	switch (cmd) {
+	case 50430: // FIXME: ID_CONTROL_SENDBREAK(tt_res.h)‚ðŽw’肵‚½‚¢‚ªAƒwƒbƒ_‚ðinclude‚·‚é‚ƁA‘½d’è‹`‚Æ‚È‚éB
+		if (SSH_notify_break_signal(pvar))
+			return 1;
+		else
+			return 0;  // SSH2‚ŏˆ—‚³‚ê‚È‚©‚Á‚½ê‡‚́A–{—ˆ‚Ì“®ì‚ðs‚¤‚ׂ­Aƒ[ƒ‚ð•Ô‚·B
+
 	case ID_SSHSCPMENU:
 		if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SSHSCP), hWin, TTXScpDialog,
 			(LPARAM) pvar) == -1) {



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