ckftp2.h
来自「DES加密解密算法,西望大家共享.参考学习」· C头文件 代码 · 共 338 行
H
338 行
// CkFtp2.h: interface for the CkFtp2 class.
//
//////////////////////////////////////////////////////////////////////
#ifndef _CKFTP2_H
#define _CKFTP2_H
#pragma once
class CkByteData;
class CkCert;
#include "CkString.h"
#include "CkObject.h"
#pragma warning( disable : 4068 )
#pragma unmanaged
class CkCert;
class CkFtpProgress;
/*
IMPORTANT: Objects returned by methods as non-const pointers must be deleted
by the calling application.
*/
// CLASS: CkFtp2
class CkFtp2 : public CkObject
{
public:
CkFtp2();
virtual ~CkFtp2();
bool PutTree(const char *localDir, CkFtpProgress &progress);
bool AppendFile2(const char *localFilename, const char *remoteFilename, CkFtpProgress &progress);
bool AppendFileFromBinaryData2(const char *remoteFilename, const CkByteData &binaryData, CkFtpProgress &progress);
bool AppendFileFromTextData2(const char *remoteFilename, const char *textData, CkFtpProgress &progress);
// Return the number of files retrieved.
long MGetFiles2(const char *remotePattern, const char *localDir, CkFtpProgress &progress);
// Return the number of files uploaded.
long MPutFiles2(const char *pattern, CkFtpProgress &progress);
bool GetFile2(const char *remoteFilename, const char *localFilename, CkFtpProgress &progress);
bool PutFile2(const char *localFilename, const char *remoteFilename, CkFtpProgress &progress);
bool PutFileFromBinaryData2(const char *remoteFilename, const CkByteData &binaryData, CkFtpProgress &progress);
bool PutFileFromTextData2(const char *remoteFilename, const char *textData, CkFtpProgress &progress);
bool GetRemoteFileBinaryData2(const char *remoteFilename, CkByteData &data, CkFtpProgress &progress);
bool GetRemoteFileTextData2(const char *remoteFilename, CkString &str, CkFtpProgress &progress);
void SleepMs(int millisec) const;
CkFtpProgress *get_EventCallbackObject(void) const;
void put_EventCallbackObject(CkFtpProgress *progress);
// BEGIN PUBLIC INTERFACE
bool get_Utf8(void) const;
void put_Utf8(bool b);
bool UnlockComponent(const char *code);
bool IsUnlocked(void) const;
// Error log retrieval and saving (these methods are common to all Chilkat VC++ classes.)
bool SaveLastError(const char *filename);
void LastErrorXml(CkString &str);
void LastErrorHtml(CkString &str);
void LastErrorText(CkString &str);
bool get_IsConnected(void);
// Return the number of files deleted.
long DeleteMatching(const char *remotePattern);
// Return the number of files retrieved.
long MGetFiles(const char *remotePattern, const char *localDir);
// Return the number of files uploaded.
long MPutFiles(const char *pattern);
bool PutTree(const char *localDir);
bool GetFile(const char *remoteFilename, const char *localFilename);
bool PutFile(const char *localFilename, const char *remoteFilename);
bool PutFileFromBinaryData(const char *remoteFilename, const CkByteData &binaryData);
bool PutFileFromTextData(const char *remoteFilename, const char *textData);
bool GetRemoteFileBinaryData(const char *remoteFilename, CkByteData &data);
bool GetRemoteFileTextData(const char *remoteFilename, CkString &str);
bool GetRemoteFileTextC(const char *remoteFilename, const char *charset, CkString &str);
bool AppendFile(const char *localFilename, const char *remoteFilename);
bool AppendFileFromBinaryData(const char *remoteFilename, const CkByteData &binaryData);
bool AppendFileFromTextData(const char *remoteFilename, const char *textData);
void get_Version(CkString &str);
bool RenameRemoteFile(const char *existingFilename, const char *newFilename);
bool DeleteRemoteFile(const char *filename);
bool RemoveRemoteDir(const char *dir);
bool CreateRemoteDir(const char *dir);
bool Disconnect(void);
bool Connect(void);
bool GetCurrentRemoteDir(CkString &str);
bool ChangeRemoteDir(const char *relativeDirPath);
bool ClearControlChannel(void);
void get_DirListingCharset(CkString &str);
void put_DirListingCharset(const char *newVal);
void get_Account(CkString &str);
void put_Account(const char *newVal);
const char *account(void);
void get_ListPattern(CkString &strPattern);
void put_ListPattern(const char *pattern);
void get_Password(CkString &str);
void put_Password(const char *newVal);
void get_Username(CkString &str);
void put_Username(const char *newVal);
unsigned long get_AllocateSize(void);
void put_AllocateSize(unsigned long newVal);
long get_Port(void);
void put_Port(long newVal);
void get_Hostname(CkString &str);
void put_Hostname(const char *newVal);
void get_SessionLog(CkString &str);
bool get_Passive(void);
void put_Passive(bool newVal);
bool get_Ssl(void);
void put_Ssl(bool newVal);
bool get_AuthTls(void);
void put_AuthTls(bool newVal);
bool get_KeepSessionLog(void);
void put_KeepSessionLog(bool newVal);
bool get_PassiveUseHostAddr(void);
void put_PassiveUseHostAddr(bool newVal);
bool get_AutoFeat(void);
void put_AutoFeat(bool newVal);
bool get_AutoSyst(void);
void put_AutoSyst(bool newVal);
bool Feat(CkString &sOut);
const char *feat(void);
bool GetSizeStr(long index, CkString &str);
long GetSize(long index);
bool GetFilename(long index, CkString &str);
bool GetIsDirectory(long index);
bool GetIsSymbolicLink(long index);
long GetSizeByName(const char *filname);
bool GetCreateTime(long index, FILETIME &fTime);
bool GetLastAccessTime(long index, FILETIME &fTime);
bool GetLastModifiedTime(long index, FILETIME &fTime);
bool GetCreateTime(long index, SYSTEMTIME &sysTime);
bool GetLastAccessTime(long index, SYSTEMTIME &sysTime);
bool GetLastModifiedTime(long index, SYSTEMTIME &sysTime);
long get_NumFilesAndDirs(void);
void get_ProxyHostname(CkString &str);
void put_ProxyHostname(const char *newVal);
void get_ProxyUsername(CkString &str);
void put_ProxyUsername(const char *newVal);
void get_ProxyPassword(CkString &str);
void put_ProxyPassword(const char *newVal);
long get_ProxyMethod(void);
void put_ProxyMethod(long newVal);
void ClearSessionLog(void);
bool SetTypeBinary(void);
bool SetTypeAscii(void);
bool Quote(const char *cmd);
bool Site(const char *params);
bool Syst(CkString &sOut);
bool Stat(CkString &sOut);
// 0 = success
// 1-299 = underlying reasons
// Normal sockets:
// 1 = empty hostname
// 2 = DNS lookup failed
// 3 = DNS timeout
// 4 = Aborted by application.
// 5 = Internal failure.
// 6 = Connect Timed Out
// 7 = Connect Rejected (or failed for some other reason)
// SSL:
// 100 = Internal schannel error
// 101 = Failed to create credentials
// 102 = Failed to send initial message to proxy.
// 103 = Handshake failed.
// 104 = Failed to obtain remote certificate.
// Protocol/Component:
// 300 = asynch op in progress
// 301 = login failure.
long get_ConnectFailReason(void);
// Timeouts are in seconds
long get_ReadTimeout(void);
void put_ReadTimeout(long numSeconds);
// Timeouts are in seconds
long get_ConnectTimeout(void);
void put_ConnectTimeout(long numSeconds);
// These times are in milliseconds.
long get_HeartbeatMs(void);
void put_HeartbeatMs(long millisec);
long get_IdleTimeoutMs(void);
void put_IdleTimeoutMs(long millisec);
// CRLF mode for text (ASCII-mode) file downloads
// 0 = no conversion, 1 = CR+LF, 2 = LF Only, 3 = CR Only
long get_CrlfMode(void);
void put_CrlfMode(long newVal);
// These values are in bytes/second
long get_UploadRate(void);
long get_DownloadRate(void);
// Progress Monitoring size (in bytes) for FTP servers that do not
// respond with size information for GETs.
long get_ProgressMonSize(void);
void put_ProgressMonSize(long newVal);
bool GetXmlDirListing(const char *pattern, CkString &strXmlListing);
bool GetTextDirListing(const char *pattern, CkString &strRawListing);
// This method is experimental, do not use it yet...
bool DownloadTree(const char *localRoot);
bool DeleteTree(void);
// Asynchronous FTP
bool AsyncGetFileStart(const char *remoteFilename, const char *localFilename);
bool AsyncPutFileStart(const char *localFilename, const char *remoteFilename);
bool AsyncAppendFileStart(const char *localFilename, const char *remoteFilename);
void AsyncAbort(void); // Abort the async operation.
bool get_AsyncFinished(void); // True if finished, false if in progress.
void get_AsyncLog(CkString &strLog);
bool get_AsyncSuccess(void); // True if successful, false if aborted or failed.
// Can be called while the asynchronous upload or download is in progress to
// get the bytes sent/received so far..
unsigned long get_AsyncBytesReceived(void);
unsigned long get_AsyncBytesSent(void);
bool CreatePlan(const char *localDir, CkString &str);
//bool PutTree(const char *localDir);
bool PutPlan(const char *planUtf8, const char *planLogFilename);
bool get_SslServerCertVerified(void);
CkCert *GetSslServerCert(void);
bool get_RequireSslCertVerify(void);
void put_RequireSslCertVerify(bool newVal);
void SetSslCertRequirement(const char *name, const char *value);
bool get_AuthSsl(void);
void put_AuthSsl(bool newVal);
bool DetermineSettings(CkString &xmlReport);
const char *determineSettings(void);
CkString m_resultString;
const char *lastErrorText(void);
const char *lastErrorXml(void);
const char *lastErrorHtml(void);
const char *getFilename(long index);
const char *listPattern(void);
const char *password(void);
const char *username(void);
const char *hostname(void);
const char *sessionLog(void);
const char *getXmlDirListing(const char *pattern);
const char *getTextDirListing(const char *pattern);
const char *getRemoteFileTextData(const char *remoteFilename);
const char *getRemoteFileTextC(const char *remoteFilename, const char *charset);
const char *createPlan(const char *localDir);
const char *version(void);
const char *getCurrentRemoteDir(void);
const char *getSizeStr(long index);
const char *proxyHostname(void);
const char *proxyUsername(void);
const char *proxyPassword(void);
const char *syst(void);
const char *ck_stat(void);
const char *asyncLog(void);
const char *dirListingCharset(void);
// END PUBLIC INTERFACE
void TestDirListingParse(const char *textFilename);
// For internal use only.
private:
CkFtpProgress *m_callback;
void *m_impl;
bool m_utf8; // If true, all input "const char *" parameters are utf-8, otherwise they are ANSI strings.
// Don't allow assignment or copying these objects.
CkFtp2(const CkFtp2 &) { }
CkFtp2 &operator=(const CkFtp2 &) { return *this; }
CkFtp2(void *impl) : m_impl(impl), m_callback(0) { }
public:
void *getImpl(void) const { return m_impl; }
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?