#ifndef QGGRIFOBEAMUPTFTP_H
#define QGGRIFOBEAMUPTFTP_H

#include <QObject>

#include <QHostAddress>

class XlruTftp : public QObject
{
    Q_OBJECT
public:
    explicit XlruTftp(QObject *parent = 0);
    virtual ~XlruTftp();

    void bind(const QHostAddress&adr);

    void bindRemote(const QHostAddress&adr, unsigned int dst_port=0);

    bool sendFile(const QString& localFileName, const QString& remoteFileName);
    bool sendMemory(void* data, unsigned int size, const QString& remoteFileName);

    bool receiveMemory(void* data, unsigned int max_size, const QString& remoteFileName);

    QString errorString();
    int errorCode();

signals:
    void serverHello(unsigned intip, int port, const QString& msg);

    void transferError(int code, const QString& msg);
    void progressInfo(int percentage, const QString& msg);

    void sendBegin();
    void sendTerminated();

    void sendStart();
    void sendError();

    void sendProgress(int completition);

    void receiveTerminated(int ok);

public slots:
    void pingServer(int port);
    //void pingPartition(unsigned int address, int port);

private:
    class Implementation;
    Implementation& p_;
};

#endif // QGGRIFOBEAMUPTFTP_H
