org.apache.sshd.common.util.buffer.Buffer.getUInt()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中org.apache.sshd.common.util.buffer.Buffer.getUInt()方法的一些代码示例,展示了Buffer.getUInt()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.getUInt()方法的具体详情如下:
包路径:org.apache.sshd.common.util.buffer.Buffer
类名称:Buffer
方法名:getUInt

Buffer.getUInt介绍

暂无

代码示例

代码示例来源:origin: org.apache.sshd/sshd-osgi

public int getInt() {
  return (int) getUInt();
}

代码示例来源:origin: org.apache.sshd/sshd-common

public int getInt() {
  return (int) getUInt();
}

代码示例来源:origin: org.apache.sshd/sshd-core

@Override
public void handleUnimplementedMessage(Session session, Buffer buffer) throws Exception {
  handleUnimplementedMessage(session, buffer, buffer.getUInt());
}

代码示例来源:origin: org.apache.sshd/sshd-osgi

@Override
  public boolean handleUnimplementedMessage(Session session, int cmd, Buffer buffer) throws Exception {
    boolean debugEnabled = log.isDebugEnabled();
    if (debugEnabled) {
      if (cmd == SshConstants.SSH_MSG_UNIMPLEMENTED) {
        long seqNo = buffer.getUInt();
        log.debug("handleUnimplementedMessage({}) SSH_MSG_UNIMPLEMENTED - seqNo={}", session, seqNo);
      } else {
        log.debug("handleUnimplementedMessage({}): {}", session, SshConstants.getCommandMessageName(cmd));
      }
    }

    return false;
  }
}

代码示例来源:origin: org.apache.sshd/sshd-core

protected RequestHandler.Result handleBreak(Buffer buffer, boolean wantReply) throws IOException {
  long breakLength = buffer.getUInt();
  if (log.isDebugEnabled()) {
    log.debug("handleBreak({}) length={}", this, breakLength);
  }
  getEnvironment().signal(Signal.INT);
  return RequestHandler.Result.ReplySuccess;
}

代码示例来源:origin: org.apache.sshd/sshd-sftp

/**
 * Decodes a {@link FileTime} value from a buffer
 *
 * @param buffer The source {@link Buffer}
 * @param version The encoding version
 * @param flags The encoding flags
 * @return The decoded value
 */
public static FileTime readTime(Buffer buffer, int version, int flags) {
  // for v3 see https://tools.ietf.org/html/draft-ietf-secsh-filexfer-02#page-8
  // for v6 see https://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#page-16
  long secs = (version >= SftpConstants.SFTP_V4) ? buffer.getLong() : buffer.getUInt();
  long millis = TimeUnit.SECONDS.toMillis(secs);
  if ((version >= SftpConstants.SFTP_V4) && ((flags & SftpConstants.SSH_FILEXFER_ATTR_SUBSECOND_TIMES) != 0)) {
    long nanoseconds = buffer.getUInt();
    millis += TimeUnit.NANOSECONDS.toMillis(nanoseconds);
  }
  return FileTime.from(millis, TimeUnit.MILLISECONDS);
}

代码示例来源:origin: org.apache.sshd/sshd-osgi

protected RequestHandler.Result handleBreak(Buffer buffer, boolean wantReply) throws IOException {
  long breakLength = buffer.getUInt();
  if (log.isDebugEnabled()) {
    log.debug("handleBreak({}) length={}", this, breakLength);
  }
  getEnvironment().signal(Signal.INT);
  return RequestHandler.Result.ReplySuccess;
}

代码示例来源:origin: org.apache.sshd/sshd-core

public void channelOpenConfirmation(Buffer buffer) throws IOException {
  Channel channel = getChannel(SshConstants.SSH_MSG_CHANNEL_OPEN_CONFIRMATION, buffer);
  if (channel == null) {
    return; // debug breakpoint
  }
  int sender = buffer.getInt();
  long rwsize = buffer.getUInt();
  long rmpsize = buffer.getUInt();
  if (log.isDebugEnabled()) {
    log.debug("channelOpenConfirmation({}) SSH_MSG_CHANNEL_OPEN_CONFIRMATION sender={}, window-size={}, packet-size={}",
         channel, sender, rwsize, rmpsize);
  }
  /*
   * NOTE: the 'sender' of the SSH_MSG_CHANNEL_OPEN_CONFIRMATION is the
   * recipient on the client side - see rfc4254 section 5.1:
   *
   *      'sender channel' is the channel number allocated by the other side
   *
   * in our case, the server
   */
  channel.handleOpenSuccess(sender, rwsize, rmpsize, buffer);
}

代码示例来源:origin: org.apache.sshd/sshd-osgi

public void channelOpenConfirmation(Buffer buffer) throws IOException {
  Channel channel = getChannel(SshConstants.SSH_MSG_CHANNEL_OPEN_CONFIRMATION, buffer);
  if (channel == null) {
    return; // debug breakpoint
  }
  int sender = buffer.getInt();
  long rwsize = buffer.getUInt();
  long rmpsize = buffer.getUInt();
  if (log.isDebugEnabled()) {
    log.debug("channelOpenConfirmation({}) SSH_MSG_CHANNEL_OPEN_CONFIRMATION sender={}, window-size={}, packet-size={}",
       channel, sender, rwsize, rmpsize);
  }
  /*
   * NOTE: the 'sender' of the SSH_MSG_CHANNEL_OPEN_CONFIRMATION is the
   * recipient on the client side - see rfc4254 section 5.1:
   *
   *      'sender channel' is the channel number allocated by the other side
   *
   * in our case, the server
   */
  channel.handleOpenSuccess(sender, rwsize, rmpsize, buffer);
}

代码示例来源:origin: org.apache.sshd/sshd-core

@Override
public void handleData(Buffer buffer) throws IOException {
  long len = validateIncomingDataSize(SshConstants.SSH_MSG_CHANNEL_DATA, buffer.getUInt());
  if (log.isDebugEnabled()) {
    log.debug("handleData({}) SSH_MSG_CHANNEL_DATA len={}", this, len);
  }
  if (log.isTraceEnabled()) {
    BufferUtils.dumpHex(getSimplifiedLogger(), BufferUtils.DEFAULT_HEXDUMP_LEVEL, "handleData(" + this + ")",
        this, BufferUtils.DEFAULT_HEX_SEPARATOR, buffer.array(), buffer.rpos(), (int) len);
  }
  if (isEofSignalled()) {
    // TODO consider throwing an exception
    log.warn("handleData({}) extra {} bytes sent after EOF", this, len);
  }
  doWriteData(buffer.array(), buffer.rpos(), len);
}

代码示例来源:origin: org.apache.sshd/sshd-osgi

@Override
public void handleData(Buffer buffer) throws IOException {
  long len = validateIncomingDataSize(SshConstants.SSH_MSG_CHANNEL_DATA, buffer.getUInt());
  if (log.isDebugEnabled()) {
    log.debug("handleData({}) SSH_MSG_CHANNEL_DATA len={}", this, len);
  }
  if (log.isTraceEnabled()) {
    BufferUtils.dumpHex(getSimplifiedLogger(), BufferUtils.DEFAULT_HEXDUMP_LEVEL, "handleData(" + this + ")",
      this, BufferUtils.DEFAULT_HEX_SEPARATOR, buffer.array(), buffer.rpos(), (int) len);
  }
  if (isEofSignalled()) {
    // TODO consider throwing an exception
    log.warn("handleData({}) extra {} bytes sent after EOF", this, len);
  }
  doWriteData(buffer.array(), buffer.rpos(), len);
}

代码示例来源:origin: org.apache.sshd/sshd-core

long reserved = buffer.getUInt();
if (reserved != 0) {
  if (traceEnabled) {

代码示例来源:origin: org.apache.sshd/sshd-osgi

long reserved = buffer.getUInt();
if (reserved != 0) {
  if (traceEnabled) {

代码示例来源:origin: org.apache.sshd/sshd-core

@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);
}

代码示例来源:origin: org.apache.sshd/sshd-osgi

@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);
}

代码示例来源:origin: org.apache.sshd/sshd-core

protected void channelOpen(Buffer buffer) throws Exception {
  String type = buffer.getString();
  int sender = buffer.getInt();
  long rwsize = buffer.getUInt();
  long rmpsize = buffer.getUInt();

代码示例来源:origin: org.apache.sshd/sshd-osgi

protected void channelOpen(Buffer buffer) throws Exception {
  String type = buffer.getString();
  int sender = buffer.getInt();
  long rwsize = buffer.getUInt();
  long rmpsize = buffer.getUInt();

相关文章