Package net.schmizz.sshj.common

Examples of net.schmizz.sshj.common.SSHPacket


    public Promise<SSHPacket, ConnectionException> sendGlobalRequest(String name, boolean wantReply,
                                                                     byte[] specifics)
            throws TransportException {
        synchronized (globalReqPromises) {
            log.info("Making global request for `{}`", name);
            trans.write(new SSHPacket(Message.GLOBAL_REQUEST).putString(name)
                                                             .putBoolean(wantReply)
                                                             .putRawBytes(specifics));

            Promise<SSHPacket, ConnectionException> promise = null;
            if (wantReply) {
View Full Code Here


    }

    @Override
    public void sendOpenFailure(int recipient, Reason reason, String message)
            throws TransportException {
        trans.write(new SSHPacket(Message.CHANNEL_OPEN_FAILURE)
                            .putUInt32(recipient)
                            .putUInt32(reason.getCode())
                            .putString(message));
    }
View Full Code Here

     * @throws TransportException if there is an error while sending the request
     */
    private void sendServiceRequest(String serviceName)
            throws TransportException {
        log.debug("Sending SSH_MSG_SERVICE_REQUEST for {}", serviceName);
        write(new SSHPacket(Message.SERVICE_REQUEST).putString(serviceName));
    }
View Full Code Here

    @Override
    public long sendUnimplemented()
            throws TransportException {
        final long seq = decoder.getSequenceNumber();
        log.info("Sending SSH_MSG_UNIMPLEMENTED for packet #{}", seq);
        return write(new SSHPacket(Message.UNIMPLEMENTED).putUInt32(seq));
    }
View Full Code Here

    private void sendDisconnect(DisconnectReason reason, String message) {
        if (message == null)
            message = "";
        log.debug("Sending SSH_MSG_DISCONNECT: reason=[{}], msg=[{}]", reason, message);
        try {
            write(new SSHPacket(Message.DISCONNECT)
                          .putUInt32(reason.toInt())
                          .putString(message)
                          .putString(""));
        } catch (IOException worthless) {
            log.debug("Error writing packet: {}", worthless.toString());
View Full Code Here

                        checkMAC(inputBuffer.array());

                    // Exclude the padding & MAC
                    inputBuffer.wpos(packetLength + 4 - inputBuffer.readByte());

                    final SSHPacket plain = usingCompression() ? decompressed() : inputBuffer;

                    if (log.isTraceEnabled())
                        log.trace("Received packet #{}: {}", seq, plain.printHex());

                    packetHandler.handle(plain.readMessageID(), plain); // Process the decoded packet

                    inputBuffer.clear();
                    packetLength = -1;

                } else
View Full Code Here

     * @throws ConnectionException if there is an error requesting the forwarding
     * @throws TransportException
     */
    public Forward bind(Forward forward, ConnectListener listener)
            throws ConnectionException, TransportException {
        SSHPacket reply = req(PF_REQ, forward);
        if (forward.port == 0)
            try {
                forward.port = reply.readUInt32AsInt();
            } catch (Buffer.BufferException e) {
                throw new ConnectionException(e);
            }
        log.info("Remote end listening on {}", forward);
        listeners.put(forward, listener);
View Full Code Here

            throws TransportException {
        synchronized (win) {
            final int adjustment = win.neededAdjustment();
            if (adjustment > 0) {
                log.info("Sending SSH_MSG_CHANNEL_WINDOW_ADJUST to #{} for {} bytes", chan.getRecipient(), adjustment);
                trans.write(new SSHPacket(Message.CHANNEL_WINDOW_ADJUST)
                                    .putUInt32(chan.getRecipient()).putUInt32(adjustment));
                win.expand(adjustment);
            }
        }
    }
View Full Code Here

    }

    private void sendNewKeys()
            throws TransportException {
        log.info("Sending SSH_MSG_NEWKEYS");
        transport.write(new SSHPacket(Message.NEWKEYS));
    }
View Full Code Here

        }
        finishOff();
    }

    protected SSHPacket buildOpenReq() {
        return new SSHPacket(Message.CHANNEL_OPEN)
                .putString(getType())
                .putUInt32(getID())
                .putUInt32(getLocalWinSize())
                .putUInt32(getLocalMaxPacketSize());
    }
View Full Code Here

TOP

Related Classes of net.schmizz.sshj.common.SSHPacket

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.