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

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

import java.math.BigInteger;

import static com.jscape.util.Parameters.assertNotNull;

/**
 * @author Alex Usun
 */
public class SshMsgKexDhGexGroup
        extends Message<SshMsgKexDhGexGroup.Handler> {

    public final BigInteger p;
    public final BigInteger g;

    public SshMsgKexDhGexGroup(BigInteger p, BigInteger g) {
        assertNotNull(p);
        this.p = p;

        assertNotNull(g);
        this.g = g;
    }

    @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 "SshMsgKexDhGexGroup {"
                + "p=" + this.p
                + ", g=" + this.g
                + '}';
    }

    public interface Handler
            extends Message.HandlerBase {

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

    }
}
