package com.jscape.inet.ssh.protocol.v2.messages;

import com.jscape.inet.ssh.protocol.messages.Message;
import com.jscape.util.net.connection.MessageConnection;

/**
 * @author Alex Usun
 */
public class SshMsgChannelRequestBreak
        extends SshMsgChannelRequest<SshMsgChannelRequestBreak.Handler> {

    public final int breakLengthMillis;

    public SshMsgChannelRequestBreak(int recipientChannel, boolean wantReply, int breakLengthMillis) {
        super(recipientChannel, wantReply);

        this.breakLengthMillis = breakLengthMillis;
    }

    @Override
    public Class handlerClass() {
        return Handler.class;
    }

    @Override
    public void accept(Handler handler, MessageConnection<Message> connection) {
        handler.handle(this, connection);
    }

    @Override
    public String toString() {
        return "SshMsgChannelRequestBreak {"
                + "recipientChannel=" + this.recipientChannel
                + ", wantReply=" + this.wantReply
                + ", breakLengthMillis=" + this.breakLengthMillis
                + '}';
    }

    public interface Handler
            extends Message.HandlerBase {

        void handle(SshMsgChannelRequestBreak message, MessageConnection<Message> connection);

    }
}
