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

import com.jscape.inet.proxy.socks.protocol.v4.messages.BindRequest;
import com.jscape.inet.proxy.socks.protocol.v4.messages.CommandRequest;
import com.jscape.inet.proxy.socks.protocol.v4.messages.ConnectRequest;
import com.jscape.inet.proxy.socks.protocol.v4.messages.CommandResponse;

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

    public static final CommandRequestCodec.Entry[] COMMAND_CODEC_ENTRIES = {
            new CommandRequestCodec.Entry(1, ConnectRequest.class, new ConnectRequestCodec()),
            new CommandRequestCodec.Entry(2, BindRequest.class, new BindRequestCodec())
    };

    public static final MessageCodec.Entry[] ENTRIES = {
            new MessageCodec.Entry(CommandRequest.class, new CommandRequestCodec(COMMAND_CODEC_ENTRIES), ConnectRequest.class, BindRequest.class),
            new MessageCodec.Entry(CommandResponse.class, new CommandResponseCodec(), CommandResponse.class)
    };

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

    private Messages() {
    }
}
