1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- #ifndef CURLFTP_H
- #define CURLFTP_H
- #include "curl/curl.h"
- #include <string>
- #include <vector>
- #include <mutex>
- #include "CurlFtpInfo.h"
- class CurlFtp
- {
- public:
- CurlFtp();
- ~CurlFtp();
-
-
-
-
-
-
-
-
- bool setFtpIPAndPort(const std::string& IP, const int port);
-
- bool setSftpIPAndPort(const std::string& IP, const int port);
-
- void setIgnoreSSLCert(bool isIgnore);
-
- void setCaCertFile(const std::string& caCertFile);
-
- bool setUsernameAndPassword(const std::string& username, const std::string& password);
-
- bool getFileList(std::string dir, std::vector<std::string>& fileList);
-
- bool getDirList(std::string dir, std::vector<std::string>& dirList);
-
- bool isDirExist(const std::string& dir);
-
- bool createDirectory(const std::string& ftpDir);
-
- bool createDirectories(const std::string& ftpDir);
-
- bool downloadFile(const std::string& remoteFile, const std::string& localFile);
-
- bool uploadFile(const std::string& localFile, const std::string& remoteFile);
- private:
-
- bool listAll(CURL* curl, std::string dir, std::vector<CF_FileInfo>& fileInfoList);
-
- std::string checkDirPath(const std::string& dir);
-
- std::string checkFilePath(const std::string& file);
-
- bool checkLocalDir(const std::string& localDir);
- private:
- std::mutex m_mutexCurl;
- std::string m_currentDir;
- std::string m_IP;
- int m_port = 21;
- std::string m_ftpUrl;
- std::string m_username;
- std::string m_password;
- bool m_isSftp = false;
- bool m_isIgnoreSSLCert = false;
- std::string m_caCertFile;
- };
- #endif
|