273
|
1 /*
|
|
2 * Copyright (c) 2012-2013 Christian Plattner. All rights reserved.
|
|
3 * Please refer to the LICENSE.txt for licensing details.
|
|
4 */
|
|
5
|
|
6 package ch.ethz.ssh2;
|
|
7
|
|
8 import java.io.IOException;
|
|
9
|
|
10 /**
|
|
11 * The interface for an object that receives events based on requests that
|
|
12 * a client sends on a session channel. Once the session channel has been set up,
|
|
13 * a program is started at the server end. The program can be a shell, an application
|
|
14 * program, or a subsystem with a host-independent name. Only one of these requests
|
|
15 * can succeed per channel.
|
|
16 * <p/>
|
|
17 * <b>CAUTION: These event methods are being called from the receiver thread. The receiving of
|
|
18 * messages will be blocked until your event handler returns. To signal to the client that you
|
|
19 * are willing to accept its request, return a {@link Runnable} object which will be executed
|
|
20 * in a new thread <i>after</i> the acknowledgment has been sent back to the client.</b>
|
|
21 * <p/>
|
|
22 * <b>If a method does not allow you to return a {@link Runnable}, then the
|
|
23 * SSH protocol does not allow to send a status back to the client (more exactly, the client cannot
|
|
24 * request an acknowledgment). In these cases, if you need to invoke
|
|
25 * methods on the {@link ServerSession} or plan to execute long-running activity, then please do this from within a new {@link Thread}.</b>
|
|
26 * <p/>
|
|
27 * If you want to signal a fatal error, then please throw an <code>IOException</code>. Currently, this will
|
|
28 * tear down the whole SSH connection.
|
|
29 *
|
|
30 * @see ServerSession
|
|
31 *
|
|
32 * @author Christian
|
|
33 *
|
|
34 */
|
|
35 public interface ServerSessionCallback
|
|
36 {
|
|
37 public Runnable requestPtyReq(ServerSession ss, PtySettings pty) throws IOException;
|
|
38
|
|
39 public Runnable requestEnv(ServerSession ss, String name, String value) throws IOException;
|
|
40
|
|
41 public Runnable requestShell(ServerSession ss) throws IOException;
|
|
42
|
|
43 public Runnable requestExec(ServerSession ss, String command) throws IOException;
|
|
44
|
|
45 public Runnable requestSubsystem(ServerSession ss, String subsystem) throws IOException;
|
|
46
|
|
47 /**
|
|
48 * When the window (terminal) size changes on the client side, it MAY send a message to the other side to inform it of the new dimensions.
|
|
49 *
|
|
50 * @param ss the corresponding session
|
|
51 * @param term_width_columns
|
|
52 * @param term_height_rows
|
|
53 * @param term_width_pixels
|
|
54 */
|
|
55 public void requestWindowChange(ServerSession ss, int term_width_columns, int term_height_rows,
|
|
56 int term_width_pixels, int term_height_pixels) throws IOException;
|
|
57
|
|
58 /**
|
|
59 * A signal can be delivered to the remote process/service. Some systems may not implement signals, in which case they SHOULD ignore this message.
|
|
60 *
|
|
61 * @param ss the corresponding session
|
|
62 * @param signal (a string without the "SIG" prefix)
|
|
63 * @return
|
|
64 * @throws IOException
|
|
65 */
|
|
66
|
|
67 }
|