protected void sendEof() throws IOException { if (isClosing()) { if (log.isDebugEnabled()) { log.debug("sendEof({}) already closing or closed", this); } return; } if (eofSent.getAndSet(true)) { if (log.isDebugEnabled()) { log.debug("sendEof({}) already sent", this); } return; } if (log.isDebugEnabled()) { log.debug("sendEof({}) SSH_MSG_CHANNEL_EOF", this); } Session s = getSession(); Buffer buffer = s.createBuffer(SshConstants.SSH_MSG_CHANNEL_EOF, Short.SIZE); buffer.putInt(getRecipient()); writePacket(buffer); }
protected void sendEof() throws IOException { if (isClosing()) { if (log.isDebugEnabled()) { log.debug("sendEof({}) already closing or closed", this); } return; } if (eofSent.getAndSet(true)) { if (log.isDebugEnabled()) { log.debug("sendEof({}) already sent", this); } return; } if (log.isDebugEnabled()) { log.debug("sendEof({}) SSH_MSG_CHANNEL_EOF", this); } Session s = getSession(); Buffer buffer = s.createBuffer(SshConstants.SSH_MSG_CHANNEL_EOF, Short.SIZE); buffer.putInt(getRecipient()); writePacket(buffer); }
protected void sendWindowAdjust(long len) throws IOException { if (log.isDebugEnabled()) { log.debug("sendWindowAdjust({}) SSH_MSG_CHANNEL_WINDOW_ADJUST len={}", this, len); } Session s = getSession(); Buffer buffer = s.createBuffer(SshConstants.SSH_MSG_CHANNEL_WINDOW_ADJUST, Short.SIZE); buffer.putInt(getRecipient()); buffer.putInt(len); writePacket(buffer); }
protected void sendWindowAdjust(long len) throws IOException { if (log.isDebugEnabled()) { log.debug("sendWindowAdjust({}) SSH_MSG_CHANNEL_WINDOW_ADJUST len={}", this, len); } Session s = getSession(); Buffer buffer = s.createBuffer(SshConstants.SSH_MSG_CHANNEL_WINDOW_ADJUST, Short.SIZE); buffer.putInt(getRecipient()); buffer.putInt(len); writePacket(buffer); }
@Override public void handleExtendedData(Buffer buffer) throws IOException { int ex = buffer.getInt(); // Only accept extended data for stderr if (ex != SshConstants.SSH_EXTENDED_DATA_STDERR) { if (log.isDebugEnabled()) { log.debug("handleExtendedData({}) SSH_MSG_CHANNEL_FAILURE - non STDERR type: {}", this, ex); } Session s = getSession(); Buffer rsp = s.createBuffer(SshConstants.SSH_MSG_CHANNEL_FAILURE, Integer.BYTES); rsp.putInt(getRecipient()); writePacket(rsp); return; } long len = validateIncomingDataSize(SshConstants.SSH_MSG_CHANNEL_EXTENDED_DATA, buffer.getUInt()); if (log.isDebugEnabled()) { log.debug("handleExtendedData({}) SSH_MSG_CHANNEL_EXTENDED_DATA len={}", this, len); } if (log.isTraceEnabled()) { BufferUtils.dumpHex(getSimplifiedLogger(), BufferUtils.DEFAULT_HEXDUMP_LEVEL, "handleExtendedData(" + this + ")", this, BufferUtils.DEFAULT_HEX_SEPARATOR, buffer.array(), buffer.rpos(), (int) len); } if (isEofSignalled()) { // TODO consider throwing an exception log.warn("handleExtendedData({}) extra {} bytes sent after EOF", this, len); } doWriteExtendedData(buffer.array(), buffer.rpos(), len); }
@Override public void handleExtendedData(Buffer buffer) throws IOException { int ex = buffer.getInt(); // Only accept extended data for stderr if (ex != SshConstants.SSH_EXTENDED_DATA_STDERR) { if (log.isDebugEnabled()) { log.debug("handleExtendedData({}) SSH_MSG_CHANNEL_FAILURE - non STDERR type: {}", this, ex); } Session s = getSession(); Buffer rsp = s.createBuffer(SshConstants.SSH_MSG_CHANNEL_FAILURE, Integer.BYTES); rsp.putInt(getRecipient()); writePacket(rsp); return; } long len = validateIncomingDataSize(SshConstants.SSH_MSG_CHANNEL_EXTENDED_DATA, buffer.getUInt()); if (log.isDebugEnabled()) { log.debug("handleExtendedData({}) SSH_MSG_CHANNEL_EXTENDED_DATA len={}", this, len); } if (log.isTraceEnabled()) { BufferUtils.dumpHex(getSimplifiedLogger(), BufferUtils.DEFAULT_HEXDUMP_LEVEL, "handleExtendedData(" + this + ")", this, BufferUtils.DEFAULT_HEX_SEPARATOR, buffer.array(), buffer.rpos(), (int) len); } if (isEofSignalled()) { // TODO consider throwing an exception log.warn("handleExtendedData({}) extra {} bytes sent after EOF", this, len); } doWriteExtendedData(buffer.array(), buffer.rpos(), len); }