#ifndef BINARYVERIFIER_H
#define BINARYVERIFIER_H

#include <QString>

class BinaryInfo
{
public:
    enum Format
    {
        Binary,
        ELF,
        Bitstream
    };

    enum Architecture
    {
        None,
        ARM,
        C6000,
        Xilinx
    };

    QString name() const {return m_name;}

    Architecture architecture() const {return m_arch;}
    Format format() const { return m_ftm;}

    unsigned int size() const;

    QString archName() const { return m_archName;}

    BinaryInfo():
        m_arch(None),
        m_ftm(Binary),
        m_hasInfo(false),
        m_archName("Unknown"),
        m_fmtName("Unknown"),
        m_pn("N/A"),
        m_generator("Unknown")
    {
    }

public:
   Architecture m_arch;
   Format m_ftm;

   bool m_hasInfo;

   QString m_archName;
   QString m_fmtName;

   QString m_host;

   QString m_ibc;
   QString m_partType;

   QString m_pn;

   QString m_generator;

   QString m_name;
   QString m_version;
   QString m_bid;
   QString m_date;
   QString m_md5;
   QString m_usr;
};

class BinaryFileInfo
{
public:
    BinaryFileInfo():
        compressed_size(0),
        uncompressed_size(0)
    {
    }

    QString sourcefile;
    QString filename;

    QString errStr;

    unsigned int compressed_size;
    unsigned int uncompressed_size;
    unsigned int zip_crc32;

    QString file_md5;

    BinaryInfo binaryInfo;
};

class BinaryVerifier
{
public:
    BinaryVerifier();
    virtual ~BinaryVerifier();

    bool verify(const QByteArray& data);

    bool verify(const QString& filename);

    BinaryInfo info() const;

    QString errorString();

private:
    class Implementation;
    Implementation& p_;
};

#endif // BINARYVERIFIER_H
