446 |
andreas |
1 |
/*
|
475 |
andreas |
2 |
* Copyright (C) 2022 to 2024 by Andreas Theofilu <andreas@theosys.at>
|
446 |
andreas |
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>
|
|
|
24 |
#include <functional>
|
|
|
25 |
|
|
|
26 |
#include "../ftplib/ftplib.h"
|
|
|
27 |
|
|
|
28 |
#define _BUF_SIZE 1024
|
|
|
29 |
|
|
|
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);
|
|
|
43 |
bool unpack(const std::string&fname, const std::string& path);
|
475 |
andreas |
44 |
bool isTP5() { return tp5Type; }
|
446 |
andreas |
45 |
static void callbackLog(char *str, void* arg, bool out);
|
|
|
46 |
static void callbackError(char *msg, void *arg, int err);
|
|
|
47 |
static int callbackXfer(off64_t xfered, void *arg);
|
|
|
48 |
|
|
|
49 |
static void regCallbackProgress(std::function<int (off64_t xfered)> progress) { _progress = progress; }
|
|
|
50 |
|
|
|
51 |
private:
|
|
|
52 |
ftplib *mFtpLib{nullptr};
|
|
|
53 |
static std::function<int (off64_t xfered)> _progress;
|
|
|
54 |
void logging(int level, const std::string& msg);
|
475 |
andreas |
55 |
|
|
|
56 |
bool tp5Type{false};
|
446 |
andreas |
57 |
};
|
|
|
58 |
|
|
|
59 |
#endif
|