package com.jscape.inet.proxy.socks.protocol.v5.marshaling;

import com.jscape.inet.proxy.socks.protocol.v5.messages.*;

/**
 * @author Alex Usun
 */
public class Messages {

    public static final CommandRequestCodec.Entry[] COMMAND_CODEC_ENTRIES = {
            new CommandRequestCodec.Entry(0x01, ConnectRequest.class, new ConnectRequestCodec()),
            new CommandRequestCodec.Entry(0x02, BindRequest.class, new BindRequestCodec()),
            new CommandRequestCodec.Entry(0x03, AssociateUdpRequest.class, new AssociateUdpRequestCodec()),
    };

    public static final MessageCodec.Entry[] ENTRIES = {
            new MessageCodec.Entry(AuthenticationMethodRequest.class, new AuthenticationMethodRequestCodec(), AuthenticationMethodRequest.class),
            new MessageCodec.Entry(AuthenticationMethodResponse.class, new AuthenticationMethodResponseCodec(), AuthenticationMethodResponse.class),
            new MessageCodec.Entry(PasswordAuthenticationRequest.class, new PasswordAuthenticationRequestCodec(), PasswordAuthenticationRequest.class),
            new MessageCodec.Entry(PasswordAuthenticationResponse.class, new PasswordAuthenticationResponseCodec(), PasswordAuthenticationResponse.class),
            new MessageCodec.Entry(CommandRequest.class, new CommandRequestCodec(COMMAND_CODEC_ENTRIES), ConnectRequest.class, BindRequest.class, AssociateUdpRequest.class),
            new MessageCodec.Entry(CommandResponse.class, new CommandResponseCodec(), CommandResponse.class),
    };

    public static MessageCodec init(MessageCodec codec) {
        return codec.set(ENTRIES);
    }

    private Messages() {
    }
}
