273
|
1
|
|
2 package ch.ethz.ssh2.channel;
|
|
3
|
|
4 import java.io.IOException;
|
|
5 import java.io.InputStream;
|
|
6 import java.io.OutputStream;
|
|
7
|
|
8 import ch.ethz.ssh2.ServerSession;
|
|
9 import ch.ethz.ssh2.ServerSessionCallback;
|
|
10
|
307
|
11 public class ServerSessionImpl implements ServerSession {
|
|
12 Channel c;
|
|
13 public ServerSessionCallback sscb;
|
273
|
14
|
307
|
15 public ServerSessionImpl(Channel c) {
|
|
16 this.c = c;
|
|
17 }
|
273
|
18
|
307
|
19 public int getState() {
|
|
20 return c.getState();
|
|
21 }
|
273
|
22
|
307
|
23 public InputStream getStdout() {
|
|
24 return c.getStdoutStream();
|
|
25 }
|
273
|
26
|
307
|
27 public InputStream getStderr() {
|
|
28 return c.getStderrStream();
|
|
29 }
|
273
|
30
|
307
|
31 public OutputStream getStdin() {
|
|
32 return c.getStdinStream();
|
|
33 }
|
273
|
34
|
307
|
35 public void close() {
|
|
36 try {
|
|
37 c.cm.closeChannel(c, "Closed due to server request", true);
|
|
38 }
|
|
39 catch (IOException ignored) {
|
|
40 }
|
|
41 }
|
273
|
42
|
307
|
43 public synchronized ServerSessionCallback getServerSessionCallback() {
|
|
44 return sscb;
|
|
45 }
|
273
|
46
|
307
|
47 public synchronized void setServerSessionCallback(ServerSessionCallback sscb) {
|
|
48 this.sscb = sscb;
|
|
49 }
|
273
|
50 }
|