Home | History | Annotate | Download | only in channel

Lines Matching refs:Channel

6 package ch.ethz.ssh2.channel;
32 * ChannelManager. Please read the comments in Channel.java.
47 private final List<Channel> channels = new Vector<Channel>();
65 private Channel getChannel(int id)
69 for (Channel c : channels)
82 for (Channel c : channels)
93 private int addChannel(Channel c)
102 private void waitUntilChannelOpen(Channel c) throws IOException
108 while (c.state == Channel.STATE_OPENING)
120 if (c.state != Channel.STATE_OPEN)
129 throw new IOException("Could not open channel (" + detail + ")");
180 private void waitForChannelSuccessOrFailure(Channel c) throws IOException
190 if (c.state != Channel.STATE_OPEN)
197 throw new IOException("This SSH2 channel is not open (" + detail + ")");
246 List<Channel> channel_copy = new Vector<Channel>();
253 for (Channel c : channel_copy)
263 closeChannel(c, "Closing X11 channel since the corresponding session is closing", true);
286 List<Channel> channel_copy = new Vector<Channel>();
293 for (Channel c : channel_copy)
305 public void closeChannel(Channel c, String reason, boolean force) throws IOException
313 c.state = Channel.STATE_CLOSED;
337 log.debug("Sent SSH_MSG_CHANNEL_CLOSE (channel " + c.localID + ")");
340 public void sendEOF(Channel c) throws IOException
346 if (c.state != Channel.STATE_OPEN)
364 log.debug("Sent EOF (Channel " + c.localID + "/" + c.remoteID + ")");
367 public void sendOpenConfirmation(Channel c) throws IOException
373 if (c.state != Channel.STATE_OPENING)
376 c.state = Channel.STATE_OPEN;
389 public void sendData(Channel c, byte[] buffer, int pos, int len) throws IOException
404 if (c.state == Channel.STATE_CLOSED)
405 throw new ChannelClosedException("SSH channel is closed. (" + c.getReasonClosed() + ")");
407 if (c.state != Channel.STATE_OPEN)
408 throw new ChannelClosedException("SSH channel in strange state. (" + c.state + ")");
459 throw new ChannelClosedException("SSH channel is closed. (" + c.getReasonClosed() + ")");
568 public Channel openDirectTCPIPChannel(String host_to_connect, int port_to_connect, String originator_IP_address,
571 Channel c = new Channel(this);
589 public Channel openSessionChannel() throws IOException
591 Channel c = new Channel(this);
600 log.debug("Sending SSH_MSG_CHANNEL_OPEN (Channel " + c.localID + ")");
610 public void requestPTY(Channel c, String term, int term_width_characters, int term_height_characters,
617 if (c.state != Channel.STATE_OPEN)
618 throw new IOException("Cannot request PTY on this channel (" + c.getReasonClosed() + ")");
629 throw new IOException("Cannot request PTY on this channel (" + c.getReasonClosed() + ")");
643 public void requestX11(Channel c, boolean singleConnection, String x11AuthenticationProtocol,
650 if (c.state != Channel.STATE_OPEN)
651 throw new IOException("Cannot request X11 on this channel (" + c.getReasonClosed() + ")");
662 throw new IOException("Cannot request X11 on this channel (" + c.getReasonClosed() + ")");
667 log.debug("Requesting X11 forwarding (Channel " + c.localID + "/" + c.remoteID + ")");
679 public void requestSubSystem(Channel c, String subSystemName) throws IOException
685 if (c.state != Channel.STATE_OPEN)
686 throw new IOException("Cannot request subsystem on this channel (" + c.getReasonClosed() + ")");
696 throw new IOException("Cannot request subsystem on this channel (" + c.getReasonClosed() + ")");
710 public void requestExecCommand(Channel c, String cmd) throws IOException
718 public void requestExecCommand(Channel c, String cmd, String charsetName) throws IOException
724 if (c.state != Channel.STATE_OPEN)
725 throw new IOException("Cannot execute command on this channel (" + c.getReasonClosed() + ")");
735 throw new IOException("Cannot execute command on this channel (" + c.getReasonClosed() + ")");
740 log.debug("Executing command (channel " + c.localID + ", '" + cmd + "')");
752 public void requestShell(Channel c) throws IOException
758 if (c.state != Channel.STATE_OPEN)
759 throw new IOException("Cannot start shell on this channel (" + c.getReasonClosed() + ")");
769 throw new IOException("Cannot start shell on this channel (" + c.getReasonClosed() + ")");
792 Channel c = getChannel(id);
795 throw new IOException("Unexpected SSH_MSG_CHANNEL_EXTENDED_DATA message for non-existent channel " + id);
805 log.debug("Got SSH_MSG_CHANNEL_EXTENDED_DATA (channel " + id + ", " + len + ")");
809 if (c.state == Channel.STATE_CLOSED)
812 if (c.state != Channel.STATE_OPEN)
813 throw new IOException("Got SSH_MSG_CHANNEL_EXTENDED_DATA, but channel is not in correct state ("
831 * @param c Channel
836 public int waitForCondition(Channel c, long timeout, int condition_mask)
869 if (c.state == Channel.STATE_CLOSED)
912 public int getAvailable(Channel c, boolean extended) throws IOException
927 public int getChannelData(Channel c, boolean extended, byte[] target, int off, int len) throws IOException
947 * channel is already closed.
961 if ((c.EOF) || (c.state != Channel.STATE_OPEN))
1005 if (c.state != Channel.STATE_OPEN)
1008 if (c.localWindow < ((Channel.CHANNEL_BUFFER_SIZE + 1) / 2))
1010 int minFreeSpace = Math.min(Channel.CHANNEL_BUFFER_SIZE - c.stdoutWritepos,
1011 Channel.CHANNEL_BUFFER_SIZE - c.stderrWritepos);
1030 log.debug("Sending SSH_MSG_CHANNEL_WINDOW_ADJUST (channel " + localID + ", " + increment + ")");
1069 Channel c = getChannel(id);
1072 throw new IOException("Unexpected SSH_MSG_CHANNEL_DATA message for non-existent channel " + id);
1079 log.debug("Got SSH_MSG_CHANNEL_DATA (channel " + id + ", " + len + ")");
1083 if (c.state == Channel.STATE_CLOSED)
1086 if (c.state != Channel.STATE_OPEN)
1087 throw new IOException("Got SSH_MSG_CHANNEL_DATA, but channel is not in correct state (" + c.state + ")");
1109 Channel c = getChannel(id);
1112 throw new IOException("Unexpected SSH_MSG_CHANNEL_WINDOW_ADJUST message for non-existent channel " + id);
1129 log.debug("Got SSH_MSG_CHANNEL_WINDOW_ADJUST (channel " + id + ", " + windowChange + ")");
1138 int remoteID = tr.readUINT32(); /* sender channel */
1165 Channel c = new Channel(this);
1216 Channel c = new Channel(this);
1242 "Unknown channel type", "");
1247 log.warning("The peer tried to open an unsupported channel type (" + channelType + ")");
1257 Channel c = getChannel(id);
1260 throw new IOException("Unexpected SSH_MSG_CHANNEL_REQUEST message for non-existent channel " + id);
1266 log.debug("Got SSH_MSG_CHANNEL_REQUEST (channel " + id + ", '" + type + "')");
1285 log.debug("Got EXIT STATUS (channel " + id + ", status " + exit_status + ")");
1310 log.debug("Got EXIT SIGNAL (channel " + id + ", signal " + signame + ")");
1315 /* We simply ignore unknown channel requests, however, if the server wants a reply,
1333 log.debug("Channel request '" + type + "' is not known, ignoring it");
1343 Channel c = getChannel(id);
1346 throw new IOException("Unexpected SSH_MSG_CHANNEL_EOF message for non-existent channel " + id);
1355 log.debug("Got SSH_MSG_CHANNEL_EOF (channel " + id + ")");
1365 Channel c = getChannel(id);
1368 throw new IOException("Unexpected SSH_MSG_CHANNEL_CLOSE message for non-existent channel " + id);
1373 c.state = Channel.STATE_CLOSED;
1383 log.debug("Got SSH_MSG_CHANNEL_CLOSE (channel " + id + ")");
1393 Channel c = getChannel(id);
1396 throw new IOException("Unexpected SSH_MSG_CHANNEL_SUCCESS message for non-existent channel " + id);
1405 log.debug("Got SSH_MSG_CHANNEL_SUCCESS (channel " + id + ")");
1415 Channel c = getChannel(id);
1418 throw new IOException("Unexpected SSH_MSG_CHANNEL_FAILURE message for non-existent channel " + id);
1427 log.debug("Got SSH_MSG_CHANNEL_FAILURE (channel " + id + ")");
1434 Channel c = getChannel(sm.recipientChannelID);
1437 throw new IOException("Unexpected SSH_MSG_CHANNEL_OPEN_CONFIRMATION message for non-existent channel "
1442 if (c.state != Channel.STATE_OPENING)
1443 throw new IOException("Unexpected SSH_MSG_CHANNEL_OPEN_CONFIRMATION message for channel "
1449 c.state = Channel.STATE_OPEN;
1454 log.debug("Got SSH_MSG_CHANNEL_OPEN_CONFIRMATION (channel " + sm.recipientChannelID + " / remote: "
1466 int id = tr.readUINT32(); /* sender channel */
1468 Channel c = getChannel(id);
1471 throw new IOException("Unexpected SSH_MSG_CHANNEL_OPEN_FAILURE message for non-existent channel " + id);
1511 c.state = Channel.STATE_CLOSED;
1512 c.setReasonClosed("The server refused to open the channel (" + reasonCodeSymbolicName + ", '"
1518 log.debug("Got SSH_MSG_CHANNEL_OPEN_FAILURE (channel " + id + ")");
1589 for (Channel c : channels)
1594 c.state = Channel.STATE_CLOSED;
1657 throw new IOException("Cannot handle unknown channel message " + (msg[0] & 0xff));