00001 /* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */ 00002 /* 00003 Copyright (c) 2002-2011 ymnk, JCraft,Inc. All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without 00006 modification, are permitted provided that the following conditions are met: 00007 00008 1. Redistributions of source code must retain the above copyright notice, 00009 this list of conditions and the following disclaimer. 00010 00011 2. Redistributions in binary form must reproduce the above copyright 00012 notice, this list of conditions and the following disclaimer in 00013 the documentation and/or other materials provided with the distribution. 00014 00015 3. The names of the authors may not be used to endorse or promote products 00016 derived from this software without specific prior written permission. 00017 00018 THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 00019 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00020 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, 00021 INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, 00022 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00023 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 00024 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00025 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00026 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00027 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00028 */ 00029 00030 package com.jcraft.jsch; 00031 00032 class RequestPtyReq extends Request{ 00033 private String ttype="vt100"; 00034 private int tcol=80; 00035 private int trow=24; 00036 private int twp=640; 00037 private int thp=480; 00038 00039 private byte[] terminal_mode=Util.empty; 00040 00041 void setCode(String cookie){ 00042 } 00043 00044 void setTType(String ttype){ 00045 this.ttype=ttype; 00046 } 00047 00048 void setTerminalMode(byte[] terminal_mode){ 00049 this.terminal_mode=terminal_mode; 00050 } 00051 00052 void setTSize(int tcol, int trow, int twp, int thp){ 00053 this.tcol=tcol; 00054 this.trow=trow; 00055 this.twp=twp; 00056 this.thp=thp; 00057 } 00058 00059 public void request(Session session, Channel channel) throws Exception{ 00060 super.request(session, channel); 00061 00062 Buffer buf=new Buffer(); 00063 Packet packet=new Packet(buf); 00064 00065 packet.reset(); 00066 buf.putByte((byte) Session.SSH_MSG_CHANNEL_REQUEST); 00067 buf.putInt(channel.getRecipient()); 00068 buf.putString(Util.str2byte("pty-req")); 00069 buf.putByte((byte)(waitForReply() ? 1 : 0)); 00070 buf.putString(Util.str2byte(ttype)); 00071 buf.putInt(tcol); 00072 buf.putInt(trow); 00073 buf.putInt(twp); 00074 buf.putInt(thp); 00075 buf.putString(terminal_mode); 00076 write(packet); 00077 } 00078 }