Subversion Repositories tpanel

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
112 andreas 1
/*
2
 * Copyright (C) 2022 by Andreas Theofilu <andreas@theosys.at>
3
 *
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software Foundation,
16
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
17
 */
18
 
19
#ifndef __TFSFREADER_H__
20
#define __TFSFREADER_H__
21
 
22
#include <string>
23
#include <vector>
120 andreas 24
#include <functional>
112 andreas 25
 
117 andreas 26
#include "ftplib/ftplib.h"
112 andreas 27
 
116 andreas 28
#define _BUF_SIZE   1024
29
 
112 andreas 30
class TFsfReader
31
{
32
    public:
33
        typedef struct FTP_CMDS_t
34
        {
35
            std::string cmd;
36
            int success;
37
        }FTP_CMDS_t;
38
 
39
        TFsfReader();
40
        ~TFsfReader();
41
 
42
        bool copyOverFTP(const std::string& fname, const std::string& target);
113 andreas 43
        bool unpack(const std::string&fname, const std::string& path);
117 andreas 44
        static void callbackLog(char *str, void* arg, bool out);
120 andreas 45
        static void callbackError(char *msg, void *arg, int err);
46
        static int callbackXfer(off64_t xfered, void *arg);
112 andreas 47
 
120 andreas 48
        static void regCallbackProgress(std::function<int (off64_t xfered)> progress) { _progress = progress; }
49
 
112 andreas 50
    private:
117 andreas 51
        ftplib *mFtpLib{nullptr};
120 andreas 52
        static std::function<int (off64_t xfered)> _progress;
137 andreas 53
        void logging(int level, const std::string& msg);
112 andreas 54
};
55
 
56
#endif