class BSN extends BasePacket {

    @Override
    public IPacket deserialize(byte[] data, int offset, int length)
            throws PacketParsingException {
        ByteBuffer bb = ByteBuffer.wrap(data, offset, length);

        int magic = bb.getInt();
        if (magic != BSN_MAGIC) {
            throw new PacketParsingException("Invalid BSN magic " + magic);
        }

        this.type = bb.getShort();
        this.version = bb.getShort();
        if (this.version != BSN_VERSION_CURRENT) {
            throw new PacketParsingException(
                    "Invalid BSN packet version " + this.version + ", should be "
                    + BSN_VERSION_CURRENT);
        }

        IPacket payload;
        if (typeClassMap.containsKey(this.type)) {
            Class<? extends IPacket> clazz = typeClassMap.get(this.type);
            try {
                payload = clazz.newInstance();
            } catch (Exception e) {
                throw new RuntimeException("Error parsing payload for BSN packet" + e);
            }
        } else {
            payload = new Data();
        }

        this.payload = payload.deserialize(data, bb.position(), bb.limit() - bb.position());
        this.payload.setParent(this);

        return this;
    }

    public  BSN();
    public  BSN(short type);

}