00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 using System;
00031 using Tamir.SharpSsh.java.net;
00032 using Tamir.SharpSsh.java.lang;
00033
00034 namespace Tamir.SharpSsh.jsch
00035 {
00036 public class ChannelSubsystem : ChannelSession
00037 {
00038 bool xforwading=false;
00039 bool pty=false;
00040 bool want_reply=true;
00041 String subsystem="";
00042 public override void setXForwarding(bool foo){ xforwading=true; }
00043 public void setPty(bool foo){ pty=foo; }
00044 public void setWantReply(bool foo){ want_reply=foo; }
00045 public void setSubsystem(String foo){ subsystem=foo; }
00046 public override void start()
00047 {
00048 try
00049 {
00050 Request request;
00051 if(xforwading)
00052 {
00053 request=new RequestX11();
00054 request.request(session, this);
00055 }
00056 if(pty)
00057 {
00058 request=new RequestPtyReq();
00059 request.request(session, this);
00060 }
00061 request=new RequestSubsystem();
00062 ((RequestSubsystem)request).request(session, this, subsystem, want_reply);
00063 }
00064 catch(Exception e)
00065 {
00066 if(e is JSchException){ throw (JSchException)e; }
00067 throw new JSchException("ChannelSubsystem");
00068 }
00069 Thread thread=new Thread(this);
00070 thread.setName("Subsystem for "+session.host);
00071 thread.start();
00072 }
00073
00074 public override void init()
00075 {
00076 io.setInputStream(session.In);
00077 io.setOutputStream(session.Out);
00078 }
00079 public void setErrStream(System.IO.Stream outs)
00080 {
00081 setExtOutputStream(outs);
00082 }
00083 public java.io.InputStream getErrStream()
00084 {
00085 return getExtInputStream();
00086 }
00087 }
00088
00089 }